feat(pxe-infra): add QEMU/KVM guest module — L4
Wires the L4 guest VM from docs/ARCHITECTURE.md into the homelab
flake. The guest is the consumer of the L2 (bridge + DHCP) and L3
(TFTP + HTTP) plumbing committed earlier; it PXE-boots through the
private bridge with a fixed MAC, no disk, no persistent NVRAM.
- modules/options.nix: new options.pxe-infra.vm
- enable: master switch (default false; turning it on spins up
the VM on every boot, which the user may want to defer until
an artifact is staged)
- mac: guest NIC MAC (default 52:54:00:12:34:56; must also
appear in pxe-infra.dhcp.guests when authoritative=false)
- cpus: vCPU count
- memory: RAM size in QEMU syntax (e.g. "2G")
- modules/pxe-infra/vm.nix: new file. A systemd service running
qemu-system-x86_64 with:
- machine type=q35 + accel=kvm:tcg (TCG fallback if KVM is
not available on the host)
- OVMF.fd as a read-only pflash drive (UEFI only — B.6); the
combined fd has no NVRAM region, so every restart is a
fresh boot, which is the property ARCHITECTURE.md §L4 wants
- netdev=bridge,br=pxe0 attaching the guest's virtio-net to
the L2 bridge, with the fixed MAC
- -boot n: network only, no disk, no ISO
- Restart=always, RestartSec=5s — failed/interrupted runs are
safe to repeat (per ARCHITECTURE.md "Run lifecycle")
- modules/pxe-infra/default.nix: imports the new vm.nix.
Refs: docs/ARCHITECTURE.md §L4, docs/OPEN-QUESTIONS.md
"Resolved (2026-10-13)" B.6 (UEFI only).
This commit is contained in:
1 parent
54a93f1e48
commit
5973aa74fd
3 files changed
+121
No files matched your search
@@ -286,5 +286,53 @@
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# VM: a single QEMU/KVM guest that PXE-boots through the
|
||||
# bridge. Layer L4 of docs/ARCHITECTURE.md. The guest is
|
||||
# intentionally disposable — no persistent disk, no NVRAM
|
||||
# persistence, restart on crash — so every run starts from
|
||||
# the same state, which is the rig's whole reason to exist.
|
||||
vm = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to run a QEMU/KVM guest that PXE-boots through
|
||||
the bridge. Disabled by default: enabling it spins up
|
||||
the VM on boot, which the user may want to defer until
|
||||
the artifact is staged.
|
||||
'';
|
||||
};
|
||||
mac = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "52:54:00:12:34:56";
|
||||
example = "52:54:00:12:34:56";
|
||||
description = ''
|
||||
MAC address of the guest's NIC. Choose from the
|
||||
52:54:00:XX:XX:XX QEMU/OUI range. The same MAC must
|
||||
appear in `dhcp.guests` when `dhcp.authoritative` is
|
||||
false, otherwise the VM gets no lease.
|
||||
'';
|
||||
};
|
||||
cpus = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 2;
|
||||
example = 4;
|
||||
description = ''
|
||||
Number of virtual CPUs. Memory and CPU together cap
|
||||
which tests can run on the rig (Phase 5 in
|
||||
RUNNER-DESIGN.md).
|
||||
'';
|
||||
};
|
||||
memory = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "2G";
|
||||
example = "4G";
|
||||
description = ''
|
||||
RAM size in QEMU syntax (e.g. `2G`, `512M`). Caps the
|
||||
testable memory in Phase 3 (RAM burnin).
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user