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