1{ lib, buildPythonPackage, fetchPypi, pythonOlder
2, pkg-config, swig
3, tpm2-tss
4, cryptography, ibm-sw-tpm2
5}:
6
7buildPythonPackage rec {
8 pname = "tpm2-pytss";
9
10 # Last version on github is 0.2.4, but it looks
11 # like a mistake (it's missing commits from 0.1.9)
12 version = "0.1.9";
13 disabled = pythonOlder "3.5";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "sha256-v5Xth0A3tFnLFg54nvWYL2TD201e/GWv+2y5Qc60CmU=";
18 };
19 postPatch = ''
20 substituteInPlace tpm2_pytss/config.py --replace \
21 'SYSCONFDIR = CONFIG.get("sysconfdir", "/etc")' \
22 'SYSCONFDIR = "${tpm2-tss}/etc"'
23 '';
24
25 nativeBuildInputs = [ pkg-config swig ];
26 # The TCTI is dynamically loaded from tpm2-tss, we have to provide the library to the end-user
27 propagatedBuildInputs = [ tpm2-tss ];
28
29 checkInputs = [
30 cryptography
31 # provide tpm_server used as simulator for the tests
32 ibm-sw-tpm2
33 ];
34
35 meta = with lib; {
36 homepage = "https://github.com/tpm2-software/tpm2-pytss";
37 description = "TPM2 TSS Python bindings for Enhanced System API (ESYS)";
38 license = licenses.bsd2;
39 maintainers = with maintainers; [ baloo ];
40 };
41}