1{ lib
2, stdenv
3, bcrypt
4, buildPythonPackage
5, cryptography
6, fetchPypi
7, fido2
8, gssapi
9, libnacl
10, libsodium
11, nettle
12, openssh
13, openssl
14, pyopenssl
15, pytestCheckHook
16, python-pkcs11
17, pythonOlder
18, typing-extensions
19}:
20
21buildPythonPackage rec {
22 pname = "asyncssh";
23 version = "2.14.1";
24 format = "setuptools";
25
26 disabled = pythonOlder "3.6";
27
28 src = fetchPypi {
29 inherit pname version;
30 hash = "sha256-GsMcMzoNg8iIMVIyRVAMqoFFA0I3QbDkZTOe9tpbXik=";
31 };
32
33 propagatedBuildInputs = [
34 cryptography
35 libsodium
36 nettle
37 typing-extensions
38 ];
39
40 passthru.optional-dependencies = {
41 bcrypt = [
42 bcrypt
43 ];
44 fido2 = [
45 fido2
46 ];
47 gssapi = [
48 gssapi
49 ];
50 libnacl = [
51 libnacl
52 ];
53 pkcs11 = [
54 python-pkcs11
55 ];
56 pyOpenSSL = [
57 pyopenssl
58 ];
59 };
60
61 __darwinAllowLocalNetworking = true;
62
63 nativeCheckInputs = [
64 openssh
65 openssl
66 pytestCheckHook
67 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
68
69 patches = [
70 # Reverts https://github.com/ronf/asyncssh/commit/4b3dec994b3aa821dba4db507030b569c3a32730
71 #
72 # This changed the test to avoid setting the sticky bit
73 # because that's not allowed for plain files in FreeBSD.
74 # However that broke the test on NixOS, failing with
75 # "Operation not permitted"
76 ./fix-sftp-chmod-test-nixos.patch
77 ];
78
79 disabledTestPaths = [
80 # Disables windows specific test (specifically the GSSAPI wrapper for Windows)
81 "tests/sspi_stub.py"
82 ];
83
84 disabledTests = [
85 # No PIN set
86 "TestSKAuthCTAP2"
87 # Requires network access
88 "test_connect_timeout_exceeded"
89 # Fails in the sandbox
90 "test_forward_remote"
91 ];
92
93 pythonImportsCheck = [
94 "asyncssh"
95 ];
96
97 meta = with lib; {
98 description = "Asynchronous SSHv2 Python client and server library";
99 homepage = "https://asyncssh.readthedocs.io/";
100 changelog = "https://github.com/ronf/asyncssh/blob/v${version}/docs/changes.rst";
101 license = licenses.epl20;
102 maintainers = with maintainers; [ ];
103 };
104}