6 , libtasn1, openssl, fuse, glib, libseccomp, json-glib
8 , unixtools, expect, socat
17 stdenv.mkDerivation (finalAttrs: {
21 src = fetchFromGitHub {
22 owner = "stefanberger";
24 rev = "v${finalAttrs.version}";
25 hash = "sha256-48/BOzGPoKr/BGEXFo3FXWr6ZoPB+ixZIvv78g6L294=";
29 pkg-config unixtools.netstat expect socat
44 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
50 "--localstatedir=/var"
51 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
58 # Makefile tries to create the directory /var/lib/swtpm-localca, which fails
59 substituteInPlace samples/Makefile.am \
60 --replace 'install-data-local:' 'do-not-execute:'
62 # Use the correct path to the certtool binary
63 # instead of relying on it being in the environment
64 substituteInPlace src/swtpm_localca/swtpm_localca.c \
66 '# define CERTTOOL_NAME "gnutls-certtool"' \
67 '# define CERTTOOL_NAME "${gnutls}/bin/certtool"' \
69 '# define CERTTOOL_NAME "certtool"' \
70 '# define CERTTOOL_NAME "${gnutls}/bin/certtool"'
72 substituteInPlace tests/common --replace \
73 'CERTTOOL=gnutls-certtool;;' \
77 # stat: invalid option -- '%'
78 # This is caused by the stat program not being the BSD version,
79 # as is expected by the test
80 substituteInPlace tests/common --replace \
81 'if [[ "$(uname -s)" =~ (Linux|CYGWIN_NT-) ]]; then' \
82 'if [[ "$(uname -s)" =~ (Linux|Darwin|CYGWIN_NT-) ]]; then'
84 # Otherwise certtool seems to pick up the system language on macOS,
85 # which might cause a test to fail
86 substituteInPlace tests/test_swtpm_setup_create_cert --replace \
88 'LC_ALL=C.UTF-8 $CERTTOOL'
92 enableParallelBuilding = true;
94 outputs = [ "out" "man" ];
96 passthru.tests = { inherit (nixosTests) systemd-cryptenroll; };
99 description = "Libtpms-based TPM emulator";
100 homepage = "https://github.com/stefanberger/swtpm";
101 license = licenses.bsd3;
102 maintainers = [ maintainers.baloo ];
103 mainProgram = "swtpm";
104 platforms = platforms.all;