diff --git a/pkgs/development/python-modules/pyspx/default.nix b/pkgs/development/python-modules/pyspx/default.nix new file mode 100644 index 000000000000..b8e3cb49df6f --- /dev/null +++ b/pkgs/development/python-modules/pyspx/default.nix @@ -0,0 +1,47 @@ +{ lib +, buildPythonPackage +, cffi +, fetchFromGitHub +, pytestCheckHook +, pythonOlder +, setuptools +, wheel +}: + +buildPythonPackage rec { + pname = "pyspx"; + version = "0.5.2"; + pyproject = true; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "sphincs"; + repo = "pyspx"; + rev = "refs/tags/v${version}"; + hash = "sha256-hMZ7JZoo5RdUwQYpGjtZznH/O6rBUXv+svfOAI0cjqs="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + cffi + setuptools + wheel + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "pyspx" + ]; + + meta = with lib; { + description = "Python bindings for SPHINCS"; + homepage = "https://github.com/sphincs/pyspx"; + changelog = "https://github.com/sphincs/pyspx/releases/tag/v${version}"; + license = licenses.cc0; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/securesystemslib/default.nix b/pkgs/development/python-modules/securesystemslib/default.nix new file mode 100644 index 000000000000..4a0ce694866b --- /dev/null +++ b/pkgs/development/python-modules/securesystemslib/default.nix @@ -0,0 +1,96 @@ +{ lib +, asn1crypto +, azure-identity +, azure-keyvault-keys +, boto3 +, botocore +, buildPythonPackage +, cryptography +, ed25519 +, fetchFromGitHub +, google-cloud-kms +, hatchling +, pynacl +, pyspx +, pytestCheckHook +, pythonOlder +}: + +buildPythonPackage rec { + pname = "securesystemslib"; + version = "0.30.0"; + pyproject = true; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "secure-systems-lab"; + repo = "securesystemslib"; + rev = "refs/tags/v${version}"; + hash = "sha256-Jqw65VTMLA/X7VQGxN0BlTzF/lxBYirDKBf+xI9cfhg="; + }; + + nativeBuildInputs = [ + hatchling + ]; + + passthru.optional-dependencies = { + PySPX = [ + pyspx + ]; + awskms = [ + boto3 + botocore + cryptography + ]; + azurekms = [ + azure-identity + azure-keyvault-keys + cryptography + ]; + crypto = [ + cryptography + ]; + gcpkms = [ + cryptography + google-cloud-kms + ]; + hsm = [ + asn1crypto + cryptography + # pykcs11 + ]; + pynacl = [ + pynacl + ]; + # Circular dependency + # sigstore = [ + # sigstore + # ]; + }; + + nativeCheckInputs = [ + ed25519 + pytestCheckHook + ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); + + pythonImportsCheck = [ + "securesystemslib" + ]; + + disabledTestPaths = [ + # pykcs11 is not available + "tests/test_hsm_signer.py" + # Ignore vendorized tests + "securesystemslib/_vendor/" + ]; + + meta = with lib; { + description = "Cryptographic and general-purpose routines"; + homepage = "https://github.com/secure-systems-lab/securesystemslib"; + changelog = "https://github.com/secure-systems-lab/securesystemslib/blob/${version}/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ fab ]; + }; +} + diff --git a/pkgs/development/python-modules/tuf/default.nix b/pkgs/development/python-modules/tuf/default.nix new file mode 100644 index 000000000000..b6965a7f42e2 --- /dev/null +++ b/pkgs/development/python-modules/tuf/default.nix @@ -0,0 +1,61 @@ +{ lib +, buildPythonPackage +, ed25519 +, fetchFromGitHub +, hatchling +, pytestCheckHook +, pythonOlder +, requests +, securesystemslib +}: + +buildPythonPackage rec { + pname = "tuf"; + version = "3.1.0"; + pyproject = true; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "theupdateframework"; + repo = "python-tuf"; + rev = "refs/tags/v${version}"; + hash = "sha256-IGF/8RdX7Oxl6gdqPGN1w/6q4zaei+MnYXBZepB4KUA="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace "hatchling==" "hatchling>=" + ''; + + nativeBuildInputs = [ + hatchling + ]; + + propagatedBuildInputs = [ + requests + securesystemslib + ] ++ securesystemslib.optional-dependencies.pynacl + ++ securesystemslib.optional-dependencies.crypto; + + nativeCheckInputs = [ + ed25519 + pytestCheckHook + ]; + + pythonImportsCheck = [ + "tuf" + ]; + + preCheck = '' + cd tests + ''; + + meta = with lib; { + description = "Python reference implementation of The Update Framework (TUF)"; + homepage = "https://github.com/theupdateframework/python-tuf"; + changelog = "https://github.com/theupdateframework/python-tuf/blob/v${version}/docs/CHANGELOG.md"; + license = with licenses; [ asl20 mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ff9578aaf486..be9abf636e02 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11102,6 +11102,8 @@ self: super: with self; { pysptk = callPackage ../development/python-modules/pysptk { }; + pyspx = callPackage ../development/python-modules/pyspx { }; + pysqlcipher3 = callPackage ../development/python-modules/pysqlcipher3 { inherit (pkgs) sqlcipher; }; @@ -12753,6 +12755,8 @@ self: super: with self; { secure = callPackage ../development/python-modules/secure { }; + securesystemslib = callPackage ../development/python-modules/securesystemslib { }; + securetar = callPackage ../development/python-modules/securetar { }; sectools = callPackage ../development/python-modules/sectools { }; @@ -14345,6 +14349,8 @@ self: super: with self; { tubes = callPackage ../development/python-modules/tubes { }; + tuf = callPackage ../development/python-modules/tuf { }; + tunigo = callPackage ../development/python-modules/tunigo { }; tubeup = callPackage ../development/python-modules/tubeup { };