This commit is contained in:
Kopatz
2024-05-22 16:01:47 +02:00
parent 8000a1db32
commit a7132f0326
4 changed files with 25 additions and 1 deletions

View File

@@ -7,5 +7,6 @@
./ssd.nix
./vfio.nix
./wooting.nix
./tpm.nix
];
}

21
modules/hardware/tpm.nix Normal file
View File

@@ -0,0 +1,21 @@
{ config, pkgs, lib, ... }:
with lib;
let cfg = config.custom.hardware.tpm;
in {
options.custom.hardware.tpm = { enable = mkEnableOption "Enables tpm"; };
config = mkIf cfg.enable {
security.tpm2 = {
enable = true;
# expose /run/current-system/sw/lib/libtpm2_pkcs11.so
pkcs11.enable = true;
# TPM2TOOLS_TCTI and TPM2_PKCS11_TCTI env variables
tctiEnvironment.enable = true;
};
#tss group has access to TPM devices
users.users.${config.mainUser.name}.extraGroups = [ "tss" ];
environment.systemPackages = with pkgs; [ tpm2-tools ];
};
}