Files
Nomarchy/pkgs/nomarchy-install/disko-config.nix
Bernardo Magri f3707357a6 feat: nomarchy-install — guided live-ISO installer (disko + mkFlake)
Ported from the previous iteration's installer (3bdfc35), adapted to the
mkFlake world. gum TUI: disk pick, optional LUKS2, user/hostname/timezone,
DMI → nixos-hardware autodetection (hardware-db.sh). disko partitions
GPT + 1 GiB ESP + BTRFS subvolumes; the generated machine flake lands at
~user/.nomarchy (one mkFlake call, /etc/nixos symlinks to it) and
nixos-install makes it bootable (UEFI/systemd-boot, v1 single disk).

Offline by construction: the target flake.lock is composed from the rev
the ISO was built from (compose-lock.py), `nix flake archive` seeds the
target store, and the ISO pre-builds the template system + desktop.
First boot lands themed: the HM generation is pre-activated in chroot.

mkFlake grows two things for this: hardwareProfile now also takes a list
(autodetection emits several common-* modules), and installed systems get
the standalone home-manager CLI from the pinned input. Unattended mode
(NOMARCHY_UNATTENDED=1 + env) documented in docs/TESTING.md §4.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 16:05:29 +01:00

71 lines
1.9 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 \
# 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
, ...
}:
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; };
};
};
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;
};
};
};
};
}