Files
nixos-router/modules/installer/layout.nix
T
nilsandClaude Sonnet 5.5 b5429ad876 Add local DNS records, DHCP reservations and an installer ISO
DNS and DHCP (needed to replace a dnsmasq-based router):
- router.dns.domain/hosts/overrides/forwardZones: authoritative local
  domain, split-horizon host records with reverse entries, wildcard
  overrides and per-zone forwarders (private zones skip DNSSEC).
- lans.<n>.dhcp.reservations: Kea host reservations, published in DNS.
- Tunnels with dns = true admit what their peers route, so a
  site-to-site peer without a transfer address can use the resolver.

Installer:
- router-install wipes a disk, creates an ESP and an ext4 root and
  installs a prebuilt system with its secrets; nothing is built on the
  box. installed-layout is the shared disk layout contract.
- lib.mkInstaller builds an ISO for a given nixosSystem;
  packages.installer-example is the example's ISO.

Covered by the dns and installer VM tests (the latter installs onto an
empty disk and boots it under UEFI), wireguard DNS and assertion cases.
PLAN.md records the remaining gaps for replacing the hand-written router.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 12:31:44 +01:00

35 lines
1.0 KiB
Nix

# The disk layout `router-install` creates, as a NixOS module: an ESP labelled
# `boot` and an ext4 root labelled `nixos`. Target configurations import this so
# the installed system finds its disks on any hardware.
{ lib, ... }:
{
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
options = [ "umask=0077" ];
};
boot.loader.systemd-boot.enable = true;
# The installer may run anywhere (even a BIOS-booted stick) and the firmware
# may be reset: boot through the removable fallback path, not NVRAM entries.
boot.loader.efi.canTouchEfiVariables = lib.mkDefault false;
# Storage and USB controllers of common hardware, so the root is found on
# an arbitrary box (and in VMs).
boot.initrd.availableKernelModules = [
"ahci"
"nvme"
"sd_mod"
"sdhci_pci"
"usb_storage"
"xhci_pci"
"virtio_blk"
"virtio_pci"
];
hardware.enableRedistributableFirmware = lib.mkDefault true;
}