mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 08:43:06 +00:00
960ae854b5
Before, the state directory was set to a path in the Nix store, which isn't writable and so makes for a terrible directory for storing state. See https://github.com/NixOS/nixpkgs/issues/141224 for a more detailed explanation. Also, swtpm-localca tried to use certtool from the environment. Change the path so it refers directly to certtool in the Nix store.
71 lines
1.6 KiB
Nix
71 lines
1.6 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub, fetchpatch
|
|
, autoreconfHook
|
|
, pkg-config
|
|
, libtasn1, openssl, fuse, glib, libseccomp, json-glib
|
|
, libtpms
|
|
, unixtools, expect, socat
|
|
, gnutls
|
|
, perl
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "swtpm";
|
|
version = "0.6.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "stefanberger";
|
|
repo = "swtpm";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-7YzdwGAGECj7PhaCOf/dLSILPXqtbylCkN79vuFBw5Y=";
|
|
};
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
url = "https://patch-diff.githubusercontent.com/raw/stefanberger/swtpm/pull/527.patch";
|
|
sha256 = "sha256-cpKHP15a27ifmmswSgHoNzGPO6TY/ZuJIfM5xLOlqlU=";
|
|
})
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config unixtools.netstat expect socat
|
|
perl # for pod2man
|
|
autoreconfHook
|
|
];
|
|
buildInputs = [
|
|
libtpms
|
|
openssl libtasn1 libseccomp
|
|
fuse glib json-glib
|
|
gnutls
|
|
];
|
|
|
|
configureFlags = [
|
|
"--with-cuse"
|
|
"--localstatedir=/var"
|
|
];
|
|
|
|
prePatch = ''
|
|
# Makefile tries to create the directory /var/lib/swtpm-localcafor, which fails
|
|
substituteInPlace samples/Makefile.am \
|
|
--replace 'install-data-local:' 'do-not-execute:'
|
|
|
|
# Use the correct path to the certtool binary
|
|
# instead of relying on it being in the environment
|
|
substituteInPlace samples/swtpm_localca.c --replace \
|
|
'# define CERTTOOL_NAME "certtool"' \
|
|
'# define CERTTOOL_NAME "${gnutls}/bin/certtool"'
|
|
'';
|
|
|
|
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 ];
|
|
};
|
|
}
|