Files
nix-config/modules/hardware/tpm.nix
Kopatz a7132f0326 tpm
2024-05-22 16:01:56 +02:00

22 lines
595 B
Nix

{ 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 ];
};
}