23 stdenv.mkDerivation rec {
24 pname = "tpm2-pkcs11";
27 src = fetchFromGitHub {
28 owner = "tpm2-software";
31 sha256 = "sha256-SoHtgZRIYNJg4/w1MIocZAM26mkrM+UOQ+RKCh6nwCk=";
36 ./graceful-fapi-fail.patch
39 # The preConfigure phase doesn't seem to be working here
40 # ./bootstrap MUST be executed as the first step, before all
41 # of the autoreconfHook stuff
43 echo ${version} > VERSION
47 configureFlags = lib.optionals (!fapiSupport) [
48 # Note: this will be renamed to with-fapi in next release.
66 (python3.withPackages (
86 # To be able to use the userspace resource manager, the RUNPATH must
87 # explicitly include the tpm2-abrmd shared libraries.
90 rpath = lib.makeLibraryPath (
91 (lib.optional abrmdSupport tpm2-abrmd)
103 --set-rpath ${rpath} \
104 ${lib.optionalString abrmdSupport "--add-needed ${lib.makeLibraryPath [ tpm2-abrmd ]}/libtss2-tcti-tabrmd.so"} \
105 --add-needed ${lib.makeLibraryPath [ tpm2-tss ]}/libtss2-tcti-device.so \
106 $out/lib/libtpm2_pkcs11.so.0.0.0
110 mkdir -p $bin/bin/ $bin/share/tpm2_pkcs11/
111 mv ./tools/* $bin/share/tpm2_pkcs11/
112 makeWrapper $bin/share/tpm2_pkcs11/tpm2_ptool.py $bin/bin/tpm2_ptool \
113 --prefix PATH : ${lib.makeBinPath [ tpm2-tools ]}
117 description = "PKCS#11 interface for TPM2 hardware";
118 homepage = "https://github.com/tpm2-software/tpm2-pkcs11";
119 license = licenses.bsd2;
120 platforms = platforms.linux;
122 mainProgram = "tpm2_ptool";