Add disko as a flake input (following nixpkgs) and wire its NixOS module into the host-builder, so any Host can declare a disk layout while the layout itself stays a per-Host concern. neogaia's layout (hosts/neogaia/disk.nix): one GPT NVMe disk with a systemd-boot EFI system partition and a LUKS container holding btrfs with @root/@home/@nix subvolumes. The initrd prompts for the passphrase on a normal boot. Swap is RAM-backed zram, so there is no on-disk swap partition; zramSwap is enabled directly for now (task 0003 lifts it into a toggle Module). The task-0001 placeholder fileSystems are removed since disko now derives them.
3.1 KiB
3.1 KiB
spec, blocked-by
| spec | blocked-by |
|---|---|
| laptop-mvi | 0001-skeleton-and-building-host |
What to build
Declare the neogaia laptop's disk with disko and make it unlock and boot on real hardware: a LUKS-encrypted btrfs volume with subvolumes plus zram swap, on an EFI system partition using systemd-boot, with the LUKS passphrase prompted at boot via the initrd.
The layout must build from the same tree as the Host toplevel (so the whole-Host build exercises it), and must be expressed as a per-Host disk concern so other machines can declare their own layouts later.
Acceptance criteria
neogaiadeclares adiskolayout: LUKS-encrypted btrfs with subvolumes plus zram swap on an EFI system partition.- systemd-boot is the bootloader; the initrd prompts for the LUKS passphrase so a normal boot unlocks the encrypted disk.
- The
diskolayout builds as part of theneogaiatoplevel build (no separate invocation needed to catch layout errors). - The disk layout is a per-
Hostconcern, expressible differently for futureHosts without restructuring theSkeleton.
Implementation Notes
- Layout. One GPT disk at
/dev/nvme0n1: a 512M EF00 ESP (vfat,umask=0077) mounted at/boot, and a 100%-fill LUKS partition (cryptroot,allowDiscards) holding a btrfs filesystem with three subvolumes —@root→/,@home→/home,@nix→/nix— each mountedcompress=zstd,noatime. There is deliberately no on-disk swap partition; swap is RAM-backed zram. - Skeleton vs. per-Host split. The disko module (
inputs.disko.nixosModules.disko) is wired into the host-builder inlib/default.nix, so everyHostcan interpret adisko.devicesdeclaration; the layout itself lives inhosts/neogaia/disk.nix. A futureHostdeclares a different layout, or none at all (an undeclareddisko.devicesis a no-op), so servers that preserve an existing pool by import need noSkeletonchange. - disko input follows nixpkgs. Unlike chaotic (which must not), disko follows our
nixpkgsso it builds against the same base. - Boot unlock. disko's
type = "luks"(no key file) generatesboot.initrd.luks.devices.cryptroot, so the classic initrd prompts for the passphrase on a normal boot; thenvmeinitrd module was already present inhardware-configuration.nix. - zram enabled directly, not yet a Module. Criterion 1 requires "plus zram swap," so
zramSwap.enable = trueis set on theHostnow. Task 0003 owns the reusable zram toggleModuleand will lift this line into it; the placeholderfileSystems/bootloader stubs from task 0001 are removed here since disko now derivesfileSystems. - Verification.
nix flake check(thechecks.x86_64-linux.neogaiatoplevel) builds green. Confirmed vianix eval: disko-derivedfileSystems=/,/home,/nixon btrfs/dev/mapper/cryptroot+/booton the ESP;boot.initrd.luks.devices=["cryptroot"];systemd-boot.enableandzramSwap.enableboth true;swapDevicesempty. The genuine end-to-end confirmation is the manualdisko-installreimage, which is irreversible by nature and not automated.