nixos/modules/luks.nix
2025-04-19 05:07:57 +00:00

26 lines
682 B
Nix

{ config, ... }:
{
boot.initrd.kernelModules = [ "usb_storage" ];
boot.initrd.luks.devices = {
"${config.networking.hostName}-luks0" = {
device = "/dev/disk/by-partlabel/${config.networking.hostName}-luks0";
allowDiscards = true;
keyFileSize = 32;
keyFile = "/dev/zero";
#keyFile = "/etc/luks-zero.key";
};
};
#boot.initrd.systemd.contents = {
# "/etc/luks-zero.key".source = ./luks-zero.key;
#};
fileSystems."/" = {
device = "/dev/disk/by-label/${config.networking.hostName}-root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
}