{
  stdenv,
  pkgs,
  fetchurl,
  lib,
  pandoc,
  pkg-config,
  curl,
  openssl,
  patosPkgs,
  libuuid,
}:

stdenv.mkDerivation {
  pname = "tpm2-tools";
  version = pkgs.tpm2-tools.version;

  src = pkgs.tpm2-tools.src;

  nativeBuildInputs = [
    pandoc
    pkg-config
  ];

  buildInputs = [
    curl
    openssl
    patosPkgs.tpm2-tss
    libuuid
  ];

  # Unit tests disabled, as they rely on a dbus session
  configureFlags = [ "--prefix=/" ];
  preInstall = ''
    mkdir -p $out
    export DESTDIR=$out
  '';
  doCheck = false;

  meta = with lib; {
    description = "Command line tools that provide access to a TPM 2.0 compatible device";
    homepage = "https://github.com/tpm2-software/tpm2-tools";
    license = licenses.bsd3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ tomfitzhenry ];
  };
}