I’m exploring NixOS for the first time and confused about the installation process. The manual says:
The LUKS volume should be automatically picked up by
nixos-generate-config
but I’m not seeing that happen. I’ve tried this in NixOS 21.05:
parted /dev/disk/by-id/ata-VBOX_HARDDISK_VB9fd13ce8-0e7b0319 -- mklabel gpt
parted /dev/disk/by-id/ata-VBOX_HARDDISK_VB9fd13ce8-0e7b0319 -- mkpart pv-enc 0% 100%
cryptsetup luksFormat /dev/disk/by-partlabel/pv-enc
cryptsetup luksOpen /dev/disk/by-partlabel/pv-enc pv
pvcreate /dev/mapper/pv
vgcreate vg /dev/mapper/pv
lvcreate --name root --extents '100%FREE' vg
mkfs.ext4 -L root /dev/vg/root
mount /dev/disk/by-label/root /mnt
nixos-generate-config --root /mnt
The resulting configuration in hardware-configuration.nix
is:
imports = [ ];
boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/8be4a162-081d-4605-9dd3-f1b8a2008f07";
fsType = "ext4";
};
swapDevices = [ ];
virtualisation.virtualbox.guest.enable = true;
I know I could manually add boot.initrd.luks
but I’d like to understand why the automatic detection isn’t working as I expect.