Wires the L3 PXE services from docs/ARCHITECTURE.md into the
homelab flake. The DHCP module already running on the bridge gets
TFTP bolted on (same dnsmasq daemon, same interface binding); a
new nginx vhost serves kernel, initramfs, and rootfs over HTTP
from the same private bridge.
- modules/options.nix: new options.pxe-infra.{artifacts, http, tftp}
- artifacts.root defaults to /var/lib/pxe-infra; both servers
read from subdirs of that path
- http.{enable, port}: nginx listener (default port 80, bound
to the bridge IP only)
- tftp.enable: opt-out for the dnsmasq TFTP module
- modules/pxe-infra/dhcp.nix: when pxe-infra.tftp.enable, the
dnsmasq settings now include `enable-tftp` and `tftp-root=`.
No new daemon; the same bind-interfaces + interface= already
restricts the DHCP server to the bridge, and that carries
through to the TFTP server.
- modules/pxe-infra/http.nix: new file. services.nginx.enable
and a single vhost listening on the bridge IP, root at
artifacts.root/http, autoindex on. No default-server catch-all,
so requests on any other interface are refused at the listen
layer, not silently answered.
- modules/pxe-infra/default.nix: imports the new http.nix and
adds systemd-tmpfiles rules that create artifacts.root plus
its http/ and tftpboot/ subdirs at boot. The module does not
populate them — that is L5 (image build)'s job.
nginx does not speak TFTP (UDP/69, RFC 1350); TFTP stays with
dnsmasq where it shares the daemon with DHCP. ARCHITECTURE.md
L3 calls out TFTP+HTTP conflation as the mistake; DHCP+TFTP
sharing a daemon is a natural fit and avoids a second service
on the Chuwi MiniBook.
Refs: docs/ARCHITECTURE.md §L3, docs/OPEN-QUESTIONS.md
"Resolved (2026-10-13)" B.9/B.10.
34 lines
1.1 KiB
Nix
34 lines
1.1 KiB
Nix
# pxe-infra — isolated private network for PXE VM guests (L2/L3 of
|
|
# docs/ARCHITECTURE.md). Provides a Linux bridge, a MAC-filtered
|
|
# DHCP server, a TFTP server (iPXE bootloader), and an HTTP server
|
|
# (kernel/initramfs/rootfs), so a fresh VM can netboot from this
|
|
# host without touching the real LAN.
|
|
#
|
|
# Master toggle: `pxe-infra.enable`. Submodules guard their own
|
|
# config with `lib.mkIf config.pxe-infra.enable`, so importing
|
|
# this umbrella alone has no effect on a host that opts out.
|
|
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
imports = [
|
|
./bridge.nix
|
|
./dhcp.nix
|
|
./http.nix
|
|
];
|
|
|
|
config = lib.mkIf config.pxe-infra.enable {
|
|
# Create the artifact directory tree at boot. TFTP and HTTP
|
|
# both serve from here; the actual artifacts land in this tree
|
|
# by whatever means (manual copy, deploy step, mkosi output
|
|
# directory — see docs/OPEN-QUESTIONS.md B.9/B.10).
|
|
systemd.tmpfiles.rules = [
|
|
"d ${config.pxe-infra.artifacts.root} 0755 root root - -"
|
|
"d ${config.pxe-infra.artifacts.root}/http 0755 root root - -"
|
|
"d ${config.pxe-infra.artifacts.root}/tftpboot 0755 root root - -"
|
|
];
|
|
};
|
|
}
|