2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
2024-01-02 11:29:13 +00:00
|
|
|
, buildPythonPackage
|
2023-07-15 17:15:38 +00:00
|
|
|
, fetchPypi
|
2024-01-02 11:29:13 +00:00
|
|
|
, pythonRelaxDepsHook
|
|
|
|
, installShellFiles
|
2023-07-15 17:15:38 +00:00
|
|
|
, libnitrokey
|
2024-01-02 11:29:13 +00:00
|
|
|
, flit-core
|
|
|
|
, certifi
|
|
|
|
, cffi
|
|
|
|
, click
|
|
|
|
, cryptography
|
|
|
|
, ecdsa
|
|
|
|
, fido2
|
|
|
|
, intelhex
|
|
|
|
, nkdfu
|
|
|
|
, python-dateutil
|
|
|
|
, pyusb
|
|
|
|
, requests
|
|
|
|
, spsdk
|
|
|
|
, tqdm
|
|
|
|
, tlv8
|
|
|
|
, typing-extensions
|
|
|
|
, pyserial
|
|
|
|
, protobuf
|
|
|
|
, click-aliases
|
|
|
|
, semver
|
|
|
|
, nethsm
|
|
|
|
, importlib-metadata
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
2022-01-27 00:19:43 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
let
|
2022-01-27 00:19:43 +00:00
|
|
|
pname = "pynitrokey";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "0.4.45";
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "nitropy";
|
|
|
|
in
|
|
|
|
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version;
|
|
|
|
pyproject = true;
|
2022-01-27 00:19:43 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-iY4ThrmXP7pEjTYYU4lePVAbuJGTdHX3iKswXzuf7W8=";
|
2022-01-27 00:19:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2023-03-30 22:05:00 +00:00
|
|
|
certifi
|
|
|
|
cffi
|
2022-01-27 00:19:43 +00:00
|
|
|
click
|
|
|
|
cryptography
|
|
|
|
ecdsa
|
|
|
|
fido2
|
|
|
|
intelhex
|
2023-03-30 22:05:00 +00:00
|
|
|
nkdfu
|
|
|
|
python-dateutil
|
2022-01-27 00:19:43 +00:00
|
|
|
pyusb
|
|
|
|
requests
|
2022-08-21 13:32:41 +00:00
|
|
|
spsdk
|
2023-03-30 22:05:00 +00:00
|
|
|
tqdm
|
2023-03-24 00:07:29 +00:00
|
|
|
tlv8
|
2023-03-30 22:05:00 +00:00
|
|
|
typing-extensions
|
2024-01-02 11:29:13 +00:00
|
|
|
pyserial
|
|
|
|
protobuf
|
|
|
|
click-aliases
|
|
|
|
semver
|
|
|
|
nethsm
|
2023-10-09 19:29:22 +00:00
|
|
|
importlib-metadata
|
2023-03-24 00:07:29 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-10-09 19:29:22 +00:00
|
|
|
flit-core
|
2024-01-02 11:29:13 +00:00
|
|
|
installShellFiles
|
2023-03-24 00:07:29 +00:00
|
|
|
pythonRelaxDepsHook
|
2022-01-27 00:19:43 +00:00
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
pythonRelaxDeps = true;
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
# pythonRelaxDepsHook runs in postBuild so cannot be used
|
|
|
|
pypaBuildFlags = [ "--skip-dependency-check" ];
|
2023-03-30 22:05:00 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# libnitrokey is not propagated to users of the pynitrokey Python package.
|
2023-03-30 22:05:00 +00:00
|
|
|
# It is only usable from the wrapped bin/nitropy
|
|
|
|
makeWrapperArgs = [
|
|
|
|
"--set LIBNK_PATH ${lib.makeLibraryPath [ libnitrokey ]}"
|
2023-03-24 00:07:29 +00:00
|
|
|
];
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2022-01-27 00:19:43 +00:00
|
|
|
# no tests
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "pynitrokey" ];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
postInstall = ''
|
|
|
|
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})
|
|
|
|
'';
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2022-01-27 00:19:43 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Python client for Nitrokey devices";
|
|
|
|
homepage = "https://github.com/Nitrokey/pynitrokey";
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/Nitrokey/pynitrokey/releases/tag/v${version}";
|
2022-01-27 00:19:43 +00:00
|
|
|
license = with licenses; [ asl20 mit ];
|
|
|
|
maintainers = with maintainers; [ frogamic ];
|
2024-01-02 11:29:13 +00:00
|
|
|
inherit mainProgram;
|
2022-01-27 00:19:43 +00:00
|
|
|
};
|
|
|
|
}
|