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