1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, pkg-config
, libtasn1, openssl, fuse, glib, libseccomp
, libtpms
, unixtools, expect, socat
, gnutls
, perl
, python3, python3Packages
}:
stdenv.mkDerivation rec {
pname = "swtpm";
version = "0.5.2";
src = fetchFromGitHub {
owner = "stefanberger";
repo = "swtpm";
rev = "v${version}";
sha256 = "sha256-KY5V4z/8I15ePjorgZueNahlD/xvFa3tDarA0tuRxFk=";
};
pythonPath = with python3Packages; requiredPythonModules [
setuptools
cryptography
];
patches = [
# upstream looks for /usr directory in $prefix to check
# whether or not to proceed with installation of python
# tools (swtpm_setup utility).
./python-installation.patch
];
prePatch = ''
patchShebangs src/swtpm_setup/setup.py
patchShebangs samples/setup.py
'';
nativeBuildInputs = [
pkg-config unixtools.netstat expect socat
perl # for pod2man
autoreconfHook
python3
];
buildInputs = [
libtpms
openssl libtasn1 libseccomp
fuse glib
gnutls
python3.pkgs.wrapPython
];
propagatedBuildInputs = pythonPath;
configureFlags = [
"--with-cuse"
];
postInstall = ''
wrapPythonProgramsIn $out/bin "$out $pythonPath"
wrapPythonProgramsIn $out/share/swtpm "$out $pythonPath"
'';
enableParallelBuilding = true;
outputs = [ "out" "man" ];
meta = with lib; {
description = "Libtpms-based TPM emulator";
homepage = "https://github.com/stefanberger/swtpm";
license = licenses.bsd3;
maintainers = [ maintainers.baloo ];
};
}
|