nixpkgs/pkgs/development/python-modules/pynitrokey/default.nix
R. Ryantm 5bffbbd391 python3Packages.pynitrokey: 0.12.2 -> 0.12.3
(cherry picked from commit 12af2cd2d8)
2026-06-19 21:19:40 +00:00

97 lines
1.8 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
installShellFiles,
libnitrokey,
poetry-core,
cffi,
click,
cryptography,
fido2,
hidapi,
intelhex,
nkdfu,
pyusb,
requests,
tqdm,
tlv8,
semver,
nethsm,
nitrokey,
pyscard,
}:
let
pname = "pynitrokey";
version = "0.12.3";
mainProgram = "nitropy";
in
buildPythonPackage {
inherit pname version;
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-gVHa95vQH9mCxeU+hX6tXDM2WUc0vw+8iTcPs1msjbQ=";
};
nativeBuildInputs = [ installShellFiles ];
build-system = [ poetry-core ];
dependencies = [
cffi
click
cryptography
fido2
hidapi
intelhex
nkdfu
nitrokey
pyusb
requests
tqdm
tlv8
semver
nethsm
];
optional-dependencies = {
pcsc = [
pyscard
];
};
pythonRelaxDeps = true;
# libnitrokey is not propagated to users of the pynitrokey Python package.
# It is only usable from the wrapped bin/nitropy
makeWrapperArgs = [ "--set LIBNK_PATH ${lib.makeLibraryPath [ libnitrokey ]}" ];
pythonImportsCheck = [ "pynitrokey" ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd ${mainProgram} \
--bash <(_NITROPY_COMPLETE=bash_source $out/bin/${mainProgram}) \
--zsh <(_NITROPY_COMPLETE=zsh_source $out/bin/${mainProgram}) \
--fish <(_NITROPY_COMPLETE=fish_source $out/bin/${mainProgram})
'';
meta = {
description = "Python client for Nitrokey devices";
homepage = "https://github.com/Nitrokey/pynitrokey";
changelog = "https://github.com/Nitrokey/pynitrokey/releases/tag/v${version}";
license = with lib.licenses; [
asl20
mit
];
maintainers = with lib.maintainers; [
frogamic
panicgh
];
inherit mainProgram;
};
}