about summary refs log tree commit diff
path: root/pkgs/development/python-modules/tpm2-pytss/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/tpm2-pytss/default.nix')
-rw-r--r--pkgs/development/python-modules/tpm2-pytss/default.nix90
1 files changed, 46 insertions, 44 deletions
diff --git a/pkgs/development/python-modules/tpm2-pytss/default.nix b/pkgs/development/python-modules/tpm2-pytss/default.nix
index 7b5fd56b0a109..48e02d477885c 100644
--- a/pkgs/development/python-modules/tpm2-pytss/default.nix
+++ b/pkgs/development/python-modules/tpm2-pytss/default.nix
@@ -1,22 +1,24 @@
-{ lib
-, stdenv
-, substituteAll
-, buildPythonPackage
-, fetchPypi
-, pythonOlder
-, asn1crypto
-, cffi
-, cryptography
-, pkgconfig # see nativeBuildInputs
-, pkg-config # see nativeBuildInputs
-, pycparser
-, pytestCheckHook
-, python
-, pyyaml
-, setuptools-scm
-, tpm2-tss
-, tpm2-tools
-, swtpm
+{
+  lib,
+  stdenv,
+  fetchurl,
+  substituteAll,
+  buildPythonPackage,
+  fetchPypi,
+  pythonOlder,
+  asn1crypto,
+  cffi,
+  cryptography,
+  pkgconfig, # see nativeBuildInputs
+  pkg-config, # see nativeBuildInputs
+  pycparser,
+  pytestCheckHook,
+  python,
+  pyyaml,
+  setuptools-scm,
+  tpm2-tss,
+  tpm2-tools,
+  swtpm,
 }:
 
 let
@@ -34,22 +36,28 @@ buildPythonPackage rec {
     hash = "sha256-uPFUc0IvN39ZxyF9zRR5FlzOYt+jOTTsl2oni68unv4=";
   };
 
-  patches = [
-    # Fix hardcoded `fapi-config.json` configuration path
-    ./fapi-config.patch
-  ] ++ lib.optionals isCross [
-    # pytss will regenerate files from headers of tpm2-tss.
-    # Those headers are fed through a compiler via pycparser. pycparser expects `cpp`
-    # to be in the path.
-    # This is put in the path via stdenv when not cross-compiling, but this is absent
-    # when cross-compiling is turned on.
-    # This patch changes the call to pycparser.preprocess_file to provide the name
-    # of the cross-compiling cpp
-    (substituteAll {
-      src = ./cross.patch;
-      crossPrefix = stdenv.hostPlatform.config;
-    })
-  ];
+  patches =
+    [
+      # Fix hardcoded `fapi-config.json` configuration path
+      ./fapi-config.patch
+      (fetchurl {
+        url = "https://github.com/tpm2-software/tpm2-pytss/pull/571/commits/b02fdc8e259fe977c1065389c042be69e2985bdf.patch";
+        hash = "sha256-+jZFv+s9p52JxtUcNeJx7ayzKDVtPoQSSGgyZqPDuEc=";
+      })
+    ]
+    ++ lib.optionals isCross [
+      # pytss will regenerate files from headers of tpm2-tss.
+      # Those headers are fed through a compiler via pycparser. pycparser expects `cpp`
+      # to be in the path.
+      # This is put in the path via stdenv when not cross-compiling, but this is absent
+      # when cross-compiling is turned on.
+      # This patch changes the call to pycparser.preprocess_file to provide the name
+      # of the cross-compiling cpp
+      (substituteAll {
+        src = ./cross.patch;
+        crossPrefix = stdenv.hostPlatform.config;
+      })
+    ];
 
   postPatch = ''
     sed -i "s#@TPM2_TSS@#${tpm2-tss.out}#" src/tpm2_pytss/FAPI.py
@@ -59,9 +67,7 @@ buildPythonPackage rec {
   # due to pycparsing handling it poorly.
   # See https://github.com/NixOS/nixpkgs/issues/252023
   # for more details.
-  hardeningDisable = [
-    "fortify"
-  ];
+  hardeningDisable = [ "fortify" ];
 
   nativeBuildInputs = [
     cffi
@@ -70,9 +76,7 @@ buildPythonPackage rec {
     setuptools-scm
   ];
 
-  buildInputs = [
-    tpm2-tss
-  ];
+  buildInputs = [ tpm2-tss ];
 
   propagatedBuildInputs = [
     cffi
@@ -89,9 +93,7 @@ buildPythonPackage rec {
     swtpm
   ];
 
-  pythonImportsCheck = [
-    "tpm2_pytss"
-  ];
+  pythonImportsCheck = [ "tpm2_pytss" ];
 
   meta = with lib; {
     homepage = "https://github.com/tpm2-software/tpm2-pytss";