7 , libtasn1, openssl, fuse, glib, libseccomp, json-glib
9 , unixtools, expect, socat
18 stdenv.mkDerivation (finalAttrs: {
22 src = fetchFromGitHub {
23 owner = "stefanberger";
25 rev = "v${finalAttrs.version}";
26 hash = "sha256-48/BOzGPoKr/BGEXFo3FXWr6ZoPB+ixZIvv78g6L294=";
30 # Enable 64-bit file API on 32-bit systems:
31 # https://github.com/stefanberger/swtpm/pull/941
33 name = "64-bit-file-api.patch";
34 url = "https://github.com/stefanberger/swtpm/commit/599e2436d4f603ef7c83fad11d76b5546efabefc.patch";
35 hash = "sha256-cS/BByOJeNNevQ1B3Ij1kykJwixVwGoikowx7j9gRmA=";
40 pkg-config unixtools.netstat expect socat
55 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
61 "--localstatedir=/var"
62 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
69 # Makefile tries to create the directory /var/lib/swtpm-localca, which fails
70 substituteInPlace samples/Makefile.am \
71 --replace 'install-data-local:' 'do-not-execute:'
73 # Use the correct path to the certtool binary
74 # instead of relying on it being in the environment
75 substituteInPlace src/swtpm_localca/swtpm_localca.c \
77 '# define CERTTOOL_NAME "gnutls-certtool"' \
78 '# define CERTTOOL_NAME "${gnutls}/bin/certtool"' \
80 '# define CERTTOOL_NAME "certtool"' \
81 '# define CERTTOOL_NAME "${gnutls}/bin/certtool"'
83 substituteInPlace tests/common --replace \
84 'CERTTOOL=gnutls-certtool;;' \
88 # stat: invalid option -- '%'
89 # This is caused by the stat program not being the BSD version,
90 # as is expected by the test
91 substituteInPlace tests/common --replace \
92 'if [[ "$(uname -s)" =~ (Linux|CYGWIN_NT-) ]]; then' \
93 'if [[ "$(uname -s)" =~ (Linux|Darwin|CYGWIN_NT-) ]]; then'
95 # Otherwise certtool seems to pick up the system language on macOS,
96 # which might cause a test to fail
97 substituteInPlace tests/test_swtpm_setup_create_cert --replace \
99 'LC_ALL=C.UTF-8 $CERTTOOL'
103 enableParallelBuilding = true;
105 outputs = [ "out" "man" ];
107 passthru.tests = { inherit (nixosTests) systemd-cryptenroll; };
110 description = "Libtpms-based TPM emulator";
111 homepage = "https://github.com/stefanberger/swtpm";
112 license = licenses.bsd3;
113 maintainers = [ maintainers.baloo ];
114 mainProgram = "swtpm";
115 platforms = platforms.all;