Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at r-updates 96 lines 1.8 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 installShellFiles, 6 libnitrokey, 7 poetry-core, 8 cffi, 9 click, 10 cryptography, 11 fido2, 12 hidapi, 13 intelhex, 14 nkdfu, 15 pyusb, 16 requests, 17 tqdm, 18 tlv8, 19 semver, 20 nethsm, 21 nitrokey, 22 pyscard, 23}: 24 25let 26 pname = "pynitrokey"; 27 version = "0.10.0"; 28 mainProgram = "nitropy"; 29in 30 31buildPythonPackage { 32 inherit pname version; 33 pyproject = true; 34 35 src = fetchPypi { 36 inherit pname version; 37 hash = "sha256-Kr6VtBADLvXUva7csbsHujGzBfRG1atJLF7qbIWmToM="; 38 }; 39 40 nativeBuildInputs = [ installShellFiles ]; 41 42 build-system = [ poetry-core ]; 43 44 dependencies = [ 45 cffi 46 click 47 cryptography 48 fido2 49 hidapi 50 intelhex 51 nkdfu 52 nitrokey 53 pyusb 54 requests 55 tqdm 56 tlv8 57 semver 58 nethsm 59 ]; 60 61 optional-dependencies = { 62 pcsc = [ 63 pyscard 64 ]; 65 }; 66 67 pythonRelaxDeps = true; 68 69 # libnitrokey is not propagated to users of the pynitrokey Python package. 70 # It is only usable from the wrapped bin/nitropy 71 makeWrapperArgs = [ "--set LIBNK_PATH ${lib.makeLibraryPath [ libnitrokey ]}" ]; 72 73 pythonImportsCheck = [ "pynitrokey" ]; 74 75 postInstall = '' 76 installShellCompletion --cmd ${mainProgram} \ 77 --bash <(_NITROPY_COMPLETE=bash_source $out/bin/${mainProgram}) \ 78 --zsh <(_NITROPY_COMPLETE=zsh_source $out/bin/${mainProgram}) \ 79 --fish <(_NITROPY_COMPLETE=fish_source $out/bin/${mainProgram}) 80 ''; 81 82 meta = with lib; { 83 description = "Python client for Nitrokey devices"; 84 homepage = "https://github.com/Nitrokey/pynitrokey"; 85 changelog = "https://github.com/Nitrokey/pynitrokey/releases/tag/v${version}"; 86 license = with licenses; [ 87 asl20 88 mit 89 ]; 90 maintainers = with maintainers; [ 91 frogamic 92 raitobezarius 93 ]; 94 inherit mainProgram; 95 }; 96}