mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 01:18:30 +09:00
31 lines
526 B
Nix
31 lines
526 B
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.features.boot.storageCrypto;
|
|
in
|
|
{
|
|
options.my.features.boot.storageCrypto = {
|
|
enable = lib.mkEnableOption "LUKS decryption via TPM2";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
boot.initrd.systemd.enable = true;
|
|
|
|
boot.initrd.luks.devices.cryptroot = {
|
|
crypttabExtraOpts = [
|
|
"tpm2-device=auto"
|
|
];
|
|
};
|
|
|
|
security.tpm2.enable = true;
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
tpm2-tools # TPM2 management tools
|
|
];
|
|
};
|
|
}
|