1{
2 stdenv,
3 fetchurl,
4 lib,
5 pandoc,
6 pkg-config,
7 makeWrapper,
8 curl,
9 openssl,
10 tpm2-tss,
11 libuuid,
12 abrmdSupport ? true,
13 tpm2-abrmd ? null,
14}:
15
16stdenv.mkDerivation rec {
17 pname = "tpm2-tools";
18 version = "5.7";
19
20 src = fetchurl {
21 url = "https://github.com/tpm2-software/${pname}/releases/download/${version}/${pname}-${version}.tar.gz";
22 sha256 = "sha256-OBDTa1B5JW9PL3zlUuIiE9Q7EDHBMVON+KLbw8VwmDo=";
23 };
24
25 nativeBuildInputs = [
26 pandoc
27 pkg-config
28 makeWrapper
29 ];
30 buildInputs = [
31 curl
32 openssl
33 tpm2-tss
34 libuuid
35 ];
36
37 preFixup =
38 let
39 ldLibraryPath = lib.makeLibraryPath (
40 [
41 tpm2-tss
42 ]
43 ++ (lib.optional abrmdSupport tpm2-abrmd)
44 );
45 in
46 ''
47 wrapProgram $out/bin/tpm2 --suffix LD_LIBRARY_PATH : "${ldLibraryPath}"
48 wrapProgram $out/bin/tss2 --suffix LD_LIBRARY_PATH : "${ldLibraryPath}"
49 '';
50
51 # Unit tests disabled, as they rely on a dbus session
52 #configureFlags = [ "--enable-unit" ];
53 doCheck = false;
54
55 meta = with lib; {
56 description = "Command line tools that provide access to a TPM 2.0 compatible device";
57 homepage = "https://github.com/tpm2-software/tpm2-tools";
58 license = licenses.bsd3;
59 platforms = platforms.linux;
60 maintainers = [ ];
61 };
62}