summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/asyncssh/default.nix
blob: 1547c0f7d5d1e96e2704ec86b1e4ee7b5f5c7801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
  lib,
  bcrypt,
  buildPythonPackage,
  cryptography,
  fetchPypi,
  fido2,
  gssapi,
  libnacl,
  libsodium,
  nettle,
  openssh,
  openssl,
  pyopenssl,
  pytestCheckHook,
  python-pkcs11,
  setuptools,
  typing-extensions,
}:

buildPythonPackage rec {
  pname = "asyncssh";
  version = "2.21.1";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-mUOAKVXiExU2wrHnGqzGj1aXOjmZN+0LclCG10YcmQw=";
  };

  build-system = [ setuptools ];

  dependencies = [
    cryptography
    nettle
    typing-extensions
  ];

  buildInputs = [ libsodium ];

  optional-dependencies = {
    bcrypt = [ bcrypt ];
    fido2 = [ fido2 ];
    gssapi = [ gssapi ];
    libnacl = [ libnacl ];
    pkcs11 = [ python-pkcs11 ];
    pyOpenSSL = [ pyopenssl ];
  };

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    openssh
    openssl
    pytestCheckHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  patches = [
    # Reverts https://github.com/ronf/asyncssh/commit/4b3dec994b3aa821dba4db507030b569c3a32730
    #
    # This changed the test to avoid setting the sticky bit
    # because that's not allowed for plain files in FreeBSD.
    # However that broke the test on NixOS, failing with
    # "Operation not permitted"
    ./fix-sftp-chmod-test-nixos.patch
  ];

  disabledTestPaths = [
    # Disables windows specific test (specifically the GSSAPI wrapper for Windows)
    "tests/sspi_stub.py"
  ];

  disabledTests = [
    # No PIN set
    "TestSKAuthCTAP2"
    # Requires network access
    "test_connect_timeout_exceeded"
    # Fails in the sandbox
    "test_forward_remote"
    # (2.21.0) SFTP copy ends up with an empty file
    "test_copy_max_requests"
  ];

  pythonImportsCheck = [ "asyncssh" ];

  meta = {
    description = "Asynchronous SSHv2 Python client and server library";
    homepage = "https://asyncssh.readthedocs.io/";
    changelog = "https://github.com/ronf/asyncssh/blob/v${version}/docs/changes.rst";
    license = with lib.licenses; [
      epl20 # or
      gpl2Plus
    ];
    maintainers = [ ];
  };
}