From f28f26fdfa1b497ebc41653e5386271f5b69e26f Mon Sep 17 00:00:00 2001 From: Dominic Shelton Date: Mon, 6 Nov 2023 17:34:52 +1100 Subject: [PATCH 1/2] python311Packages.nethsm: init at 1.0.0 --- .../python-modules/nethsm/default.nix | 51 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 53 insertions(+) create mode 100644 pkgs/development/python-modules/nethsm/default.nix diff --git a/pkgs/development/python-modules/nethsm/default.nix b/pkgs/development/python-modules/nethsm/default.nix new file mode 100644 index 000000000000..902fa62e3387 --- /dev/null +++ b/pkgs/development/python-modules/nethsm/default.nix @@ -0,0 +1,51 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pythonRelaxDepsHook +, flit-core +, certifi +, cryptography +, python-dateutil +, typing-extensions +, urllib3 +}: + +let + pname = "nethsm"; + version = "1.0.0"; +in + +buildPythonPackage { + inherit pname version; + pyproject = true; + + src = fetchPypi { + inherit pname version; + hash = "sha256-sENuSdA4pYt8v2w2RvDkcQLYCP9V0vZOdWOlkNBi3/o="; + }; + + propagatedBuildInputs = [ + certifi + cryptography + python-dateutil + typing-extensions + urllib3 + ]; + + nativeBuildInputs = [ + flit-core + pythonRelaxDepsHook + ]; + + pythonRelaxDeps = true; + + pythonImportsCheck = [ "nethsm" ]; + + meta = with lib; { + description = "Client-side Python SDK for NetHSM"; + homepage = "https://github.com/Nitrokey/nethsm-sdk-py"; + changelog = "https://github.com/Nitrokey/nethsm-sdk-py/releases/tag/v${version}"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ frogamic ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7c561d1e6fd0..af31871622ab 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8088,6 +8088,8 @@ self: super: with self; { netdisco = callPackage ../development/python-modules/netdisco { }; + nethsm = callPackage ../development/python-modules/nethsm { }; + netifaces = callPackage ../development/python-modules/netifaces { }; netmiko = callPackage ../development/python-modules/netmiko { }; From a3c12b75e5437e0537714e309c2f29dee3bcaa12 Mon Sep 17 00:00:00 2001 From: Dominic Shelton Date: Fri, 3 Nov 2023 21:20:20 +0000 Subject: [PATCH 2/2] pynitrokey: 0.4.40 -> 0.4.42 --- pkgs/tools/security/pynitrokey/default.nix | 77 ++++++++++++++-------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/pkgs/tools/security/pynitrokey/default.nix b/pkgs/tools/security/pynitrokey/default.nix index 690d566c476d..f6171b35c701 100644 --- a/pkgs/tools/security/pynitrokey/default.nix +++ b/pkgs/tools/security/pynitrokey/default.nix @@ -1,63 +1,82 @@ { lib -, python3Packages +, buildPythonApplication , fetchPypi -, nrfutil +, pythonRelaxDepsHook +, installShellFiles , libnitrokey -, nix-update-script +, 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 }: -with python3Packages; - -buildPythonApplication rec { +let pname = "pynitrokey"; - version = "0.4.40"; - format = "pyproject"; + version = "0.4.42"; + mainProgram = "nitropy"; +in + +buildPythonApplication { + inherit pname version; + pyproject = true; src = fetchPypi { inherit pname version; - hash = "sha256-Hu+8UooDzv4GhkWt0sCckQQyHjWn4V/zt2ADlVCoHmk="; + hash = "sha256-KLUuMTGiPqm2C3+TWS7nBNZAq+rGxAL/mMaT94SkYWY="; }; propagatedBuildInputs = [ certifi cffi click - click-aliases cryptography ecdsa - frozendict fido2 intelhex nkdfu - nrfutil python-dateutil pyusb requests - semver spsdk tqdm - urllib3 tlv8 typing-extensions + pyserial + protobuf + click-aliases + semver + nethsm importlib-metadata ]; nativeBuildInputs = [ flit-core + installShellFiles pythonRelaxDepsHook ]; - # FIXME: does pythonRelaxDepsHook not work for pypaBuildHook + flit-core? - pypaBuildFlags = [ "--skip-dependency-check" ]; + pythonRelaxDeps = true; - pythonRelaxDeps = [ - "click" - "cryptography" - "protobuf" - "python-dateutil" - "spsdk" - "typing_extensions" - ]; + # pythonRelaxDepsHook runs in postBuild so cannot be used + pypaBuildFlags = [ "--skip-dependency-check" ]; # libnitrokey is not propagated to users of the pynitrokey Python package. # It is only usable from the wrapped bin/nitropy @@ -70,13 +89,19 @@ buildPythonApplication rec { pythonImportsCheck = [ "pynitrokey" ]; - passthru.updateScript = nix-update-script { }; + 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}) + ''; meta = with lib; { description = "Python client for Nitrokey devices"; homepage = "https://github.com/Nitrokey/pynitrokey"; + changelog = "https://github.com/Nitrokey/pynitrokey/releases/tag/v${version}"; license = with licenses; [ asl20 mit ]; maintainers = with maintainers; [ frogamic ]; - mainProgram = "nitropy"; + inherit mainProgram; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d00c6eec6ddc..19cf8026ead3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -41726,7 +41726,7 @@ with pkgs; xrq = callPackage ../applications/misc/xrq { }; - pynitrokey = callPackage ../tools/security/pynitrokey { }; + pynitrokey = python3Packages.callPackage ../tools/security/pynitrokey { }; nitrokey-app = libsForQt5.callPackage ../tools/security/nitrokey-app { };