1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 installShellFiles, 6 libnitrokey, 7 flit-core, 8 certifi, 9 cffi, 10 click, 11 cryptography, 12 ecdsa, 13 fido2, 14 intelhex, 15 nkdfu, 16 python-dateutil, 17 pyusb, 18 requests, 19 tqdm, 20 tlv8, 21 typing-extensions, 22 click-aliases, 23 semver, 24 nethsm, 25 importlib-metadata, 26 nitrokey, 27 pyscard, 28 asn1crypto, 29}: 30 31let 32 pname = "pynitrokey"; 33 version = "0.8.1"; 34 mainProgram = "nitropy"; 35in 36 37buildPythonPackage { 38 inherit pname version; 39 pyproject = true; 40 41 src = fetchPypi { 42 inherit pname version; 43 hash = "sha256-HLqT4r0ljRU5TYRJuBJvt9tF0igxaerUEPobyzWLCO8="; 44 }; 45 46 nativeBuildInputs = [ installShellFiles ]; 47 48 build-system = [ flit-core ]; 49 50 dependencies = [ 51 certifi 52 cffi 53 click 54 cryptography 55 ecdsa 56 fido2 57 intelhex 58 nkdfu 59 python-dateutil 60 pyusb 61 requests 62 tqdm 63 tlv8 64 typing-extensions 65 click-aliases 66 semver 67 nethsm 68 importlib-metadata 69 nitrokey 70 pyscard 71 asn1crypto 72 ]; 73 74 pythonRelaxDeps = true; 75 76 # pythonRelaxDepsHook runs in postBuild so cannot be used 77 pypaBuildFlags = [ "--skip-dependency-check" ]; 78 79 # libnitrokey is not propagated to users of the pynitrokey Python package. 80 # It is only usable from the wrapped bin/nitropy 81 makeWrapperArgs = [ "--set LIBNK_PATH ${lib.makeLibraryPath [ libnitrokey ]}" ]; 82 83 # no tests 84 doCheck = false; 85 86 pythonImportsCheck = [ "pynitrokey" ]; 87 88 postInstall = '' 89 installShellCompletion --cmd ${mainProgram} \ 90 --bash <(_NITROPY_COMPLETE=bash_source $out/bin/${mainProgram}) \ 91 --zsh <(_NITROPY_COMPLETE=zsh_source $out/bin/${mainProgram}) \ 92 --fish <(_NITROPY_COMPLETE=fish_source $out/bin/${mainProgram}) 93 ''; 94 95 meta = with lib; { 96 description = "Python client for Nitrokey devices"; 97 homepage = "https://github.com/Nitrokey/pynitrokey"; 98 changelog = "https://github.com/Nitrokey/pynitrokey/releases/tag/v${version}"; 99 license = with licenses; [ 100 asl20 101 mit 102 ]; 103 maintainers = with maintainers; [ 104 frogamic 105 raitobezarius 106 ]; 107 inherit mainProgram; 108 }; 109}