- LUKS2 is the installer default; in exchange the generated config sets
the new nomarchy.system.greeter.autoLogin (greetd initial_session) —
the disk passphrase already gates the machine.
- @snapshots subvolume + nomarchy.system.snapper.enable: hourly/daily
timeline snapshots of / and the nixos-rebuild-snap helper, ported from
the previous iteration (3bdfc35), guarded to no-op on non-BTRFS roots.
- @swap subvolume with a swapfile sized to RAM by default (disko
mkswapfile handles NOCOW); the installer computes the resume offset
and wires boot.resumeDevice + resume_offset for hibernation.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
82 lines
2.5 KiB
Nix
82 lines
2.5 KiB
Nix
# Nomarchy installer disk layout — single disk, GPT, 1 GiB ESP, BTRFS
|
|
# root with subvolumes, optionally under LUKS2. Invoked by
|
|
# nomarchy-install via:
|
|
#
|
|
# disko --mode destroy,format,mount \
|
|
# --argstr mainDrive /dev/nvme0n1 \
|
|
# --arg withLuks true \
|
|
# --argstr swapSize 16G \
|
|
# disko-config.nix
|
|
#
|
|
# Ported from the previous iteration's golden-path config (multi-disk
|
|
# RAID and the impermanence snapshot dropped for v1 — see git history
|
|
# of installer/disko-config.nix at 3bdfc35 when adding them back).
|
|
# Function arguments, not sed-templating: escaping shell into Nix
|
|
# proved fragile twice before.
|
|
{ mainDrive
|
|
, withLuks ? true
|
|
, swapSize ? "0" # "0" = no swap; otherwise e.g. "16G" (sized for hibernation)
|
|
, ...
|
|
}:
|
|
|
|
let
|
|
btrfsMountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
rootBtrfs = {
|
|
type = "btrfs";
|
|
extraArgs = [ "-f" ];
|
|
subvolumes = {
|
|
"@" = { mountpoint = "/"; mountOptions = btrfsMountOptions; };
|
|
"@home" = { mountpoint = "/home"; mountOptions = btrfsMountOptions; };
|
|
"@nix" = { mountpoint = "/nix"; mountOptions = btrfsMountOptions; };
|
|
"@log" = { mountpoint = "/var/log"; mountOptions = btrfsMountOptions; };
|
|
# snapper timeline snapshots (nomarchy.system.snapper.enable)
|
|
"@snapshots" = { mountpoint = "/.snapshots"; mountOptions = btrfsMountOptions; };
|
|
} // (if swapSize == "0" then { } else {
|
|
# Hibernation-ready swapfile on its own subvolume; disko's
|
|
# mkswapfile handles the BTRFS NOCOW requirements.
|
|
"@swap" = {
|
|
mountpoint = "/swap";
|
|
swap.swapfile.size = swapSize;
|
|
};
|
|
});
|
|
};
|
|
in
|
|
{
|
|
disko.devices.disk.main = {
|
|
type = "disk";
|
|
device = mainDrive;
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
# 1 GiB ESP — fits several kernel generations + initrd.
|
|
ESP = {
|
|
priority = 1;
|
|
name = "ESP";
|
|
start = "1M";
|
|
end = "1G";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
mountOptions = [ "umask=0077" ];
|
|
};
|
|
};
|
|
root = {
|
|
size = "100%";
|
|
content =
|
|
if withLuks then {
|
|
type = "luks";
|
|
name = "crypted";
|
|
passwordFile = "/tmp/nomarchy-luks.key";
|
|
settings.allowDiscards = true;
|
|
content = rootBtrfs;
|
|
} else
|
|
rootBtrfs;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|