The last layer of the boot-and-report pipeline. Per
docs/ARCHITECTURE.md §L6, the report sink must survive the VM
disappearing — anything inside the guest is gone the moment the
VM tears down. This module provides that place: a minimal HTTP
service bound to the bridge IP that accepts run reports and
writes them to disk atomically.
- modules/options.nix: new options.pxe-infra.reportSink
- enable: master switch (default true)
- port: TCP port (default 8080; unprivileged so DynamicUser
can run the daemon without CAP_NET_BIND_SERVICE)
- modules/pxe-infra/report-sink.py: new file, the actual
service. Python stdlib only (no third-party deps, no version
drift, no extra security surface). Endpoints:
POST /report — body is JSON with at least `run_id`; the
file is written atomically (temp + rename)
to /var/lib/pxe-infra/reports/<run_id>.json
GET /health — returns "ok" for liveness checks
A 1 MB body cap is plenty for any structured run report
per RUNNER-DESIGN.md. Path-traversal hardening: run_id must
match [A-Za-z0-9_-]+.
- modules/pxe-infra/report-sink.nix: new file, the Nix module
that wraps report-sink.py. systemd service with:
- DynamicUser + StateDirectory="pxe-infra/reports": no
persistent system-user state, the daemon writes into
/var/lib/pxe-infra/reports/ as a throwaway UID
- NoNewPrivileges, ProtectSystem=strict, ProtectHome,
PrivateTmp, RestrictAddressFamilies=AF_INET{,6}: only
needs to bind a TCP socket and write one file
- Environment sets REPORTS_BIND to the bridge IP, so the
daemon never accidentally listens on 0.0.0.0
- modules/pxe-infra/default.nix: imports the new module.
Refs: docs/ARCHITECTURE.md §L6, docs/RUNNER-DESIGN.md
"Result object".
Wires the missing piece between the L3 services and the L4 VM:
the firmware does DHCP+TFTP-fetch of an iPXE binary, then iPXE
fetches a static boot.ipxe script over HTTP, which sanboots the
alpine-worker raw image. Without this, the VM has a DHCP lease
but no filename to TFTP-fetch, so the chain stops at the
firmware.
- modules/options.nix: new options.pxe-infra.bootloader
- enable: master switch (default true)
- ipxeBinary: filename under tftpboot/ (default "ipxe.efi",
the universal UEFI binary from pkgs.ipxe; "snp.efi" is a
smaller virtio-net-only alternative)
- modules/pxe-infra/ipxe.nix: new file.
- environment.etc drops pkgs.ipxe's binary under
/etc/static/pxe-infra/tftpboot/<ipxeBinary>, plus a static
boot.ipxe script under /etc/static/pxe-infra/http/.
- The script uses iPXE's own ${boot-url} variable substitution
(escaped with Nix's ''${...}'' so it survives into the
output verbatim) to sanboot http://<bridge.address>/latest/
alpine-worker.raw, with a 5s retry on failure.
- modules/pxe-infra/dhcp.nix: when both pxe-infra.tftp.enable
and pxe-infra.bootloader.enable are on, dnsmasq settings now
include `dhcp-boot=<ipxeBinary>`. The MAC filter (tag:!known)
still drops requests from unknown MACs before they can use the
filename.
- modules/pxe-infra/default.nix: imports ipxe.nix and adds two
`L+` tmpfiles rules that symlink the iPXE binary and the
boot.ipxe script from /etc/static/pxe-infra/... into the
served TFTP/HTTP roots. `L+` (instead of plain `L`) means
systemd-tmpfiles will update the symlink target on every
boot, so pkgs.ipxe upgrades via nixos-rebuild take effect
without redeploying anything.
Refs: docs/ARCHITECTURE.md §L3, §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).
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.
Adds the L2 layer of the PXE pipeline test bed (docs/ARCHITECTURE.md
§L2) to rydiwo only — isolated private subnet, never touches LAN.
- modules/options.nix: options.pxe-infra.{enable, bridge, dhcp.*,
guests[]} — fully typed, default master toggle is off so the
existing rydiwo build is unchanged
- modules/pxe-infra/default.nix: umbrella that imports the two
sub-modules; inert when the master toggle is off
- modules/pxe-infra/bridge.nix: idempotent systemd oneshot that
creates the Linux bridge, assigns the lab host a private IPv4,
and is explicitly NetworkManager.unmanaged so NM does not
reconfigure it
- modules/pxe-infra/dhcp.nix: dnsmasq as DHCP-only on the bridge
only (bind-interfaces + interface=, port=0 disables DNS, no-resolv,
no-poll, cache-size=0); MAC-filtered via dhcp-host=…,set:known and
dhcp-ignore=tag:!known when authoritative=false
- configurations/mini-laptop.nix: adds modules/pxe-infra to
imports, plus a commented example showing how to enable for a
real guest
Sidesteps docs/OPEN-QUESTIONS.md Q21 (LAN-permission) by design:
a fully isolated bridge satisfies L2 without the lab node answering
DHCP on the real LAN. nix flake check passes for all six hosts.
Refs: docs/ARCHITECTURE.md §L2, docs/OPEN-QUESTIONS.md F20/F21/F23.
Owner: 'reality443Forwarding точно ли стоило удалять? xray по прежнему
не работает, несмотря на то, что ssh и pubray1.zeroq.su работают.'
T10/C5 decision (б) was WRONG. modules/vds/nginx.nix was never touched
and still routes:
pubray1.zeroq.su → 127.0.0.1:2049 (panel)
pubrayx1.zeroq.su → 127.0.0.1:15380 (Xray REALITY)
default → 127.0.0.1:15380 (fallback)
Removing the container mapping 127.0.0.1:15380:443/tcp made the nginx
stream forward TLS to a dead port → Xray REALITY unreachable. SSH and
pubray1.zeroq.su kept working because they do NOT depend on 15380.
Restored (exact pre-T10 code from 61b3724):
- modules/options.nix: reality443Forwarding option
- modules/vds/default.nix: reality443Forwarding = true
- modules/containers/3x-ui.nix: realityPorts binding + ports = basePorts ++ realityPorts
- manifest.json T10 → status 'pending' (reopened with corrected notes)
Verified: nix eval .#nixosConfigurations.otreca...3xui_app.ports =
[..., '127.0.0.1:15380:443/tcp']
Review of dev vs 16644fc found 1 BLOCKING + 3 IMPORTANT + 2 MINOR.
All addressed in this commit:
B1 (R1.4 stale files in project-rules.md + AGENTS.md):
Replaced 'vds/nginx.nix' (removed in ef38dc4) with 'home/termux.nix'
(added in 958247b). R1.4 now correctly lists the 4 files that use
100.64.0.0: home/termux.nix:256, modules/server/nextcloud.nix:73,
modules/server/nginx.nix:109,253, modules/vds/systemd.nix:10.
I1 (count drift in '15 modules' docs):
- AGENTS.md:84 + project-rules.md:97: '15 → 14' (with note that
stirling-pdf was deleted in 5dd7a58)
- manifest.json (T16): rewritten acceptance to '15 archived
(13 from server/default.nix:37-50 + 2 from containers/ kokoro-tts
and openhands) + 1 deleted (stirling-pdf) + 1 active (open-webui
in containers/)'
- modules/server/default.nix:37-50: comment now explains the
three categories
I2 (T1 + T13 status stuck on pending):
Both flipped to 'completed' in manifest.json. T1 import fix
verified by nix eval (epral stateVersion = '24.05'). T13 done in
61b3724 (nginx firewall rule removed). I3 (.ci/checks.sh committed)
satisfied.
M1 (R1.3 stale nginx.nix:225 line number):
Removed line number from both project-rules.md and AGENTS.md.
Replaced with 'nginx.nix (networking.firewall)'.
M2 (R1.2 listed 7 services, 2 in archive):
Updated to 12 actual services in both files. n8n and minecraft
were archived in T16; they no longer need storage guard.
T10 (reality443Forwarding погашен):
Removed option from options.nix:66-74, realityPorts from
3x-ui.nix:33-35, and 'reality443Forwarding = true' from
vds/default.nix:19. ADR-note comments left in place.
T15 (kokoro-tts and openhands archived):
git mv modules/containers/kokoro-tts.nix → archive/containers/
git mv modules/containers/openhands.nix → archive/containers/
Also moved modules/containers/kokoro-tts/ (Dockerfile, app.py, etc.)
to archive/containers/kokoro-tts/ for completeness.
any.nix (nix flake check support):
Added stub fileSystems + boot.loader.grub to configurations/any.nix
so 'nix flake check' can evaluate the 'default' template config
(which is never deployed — real hosts have their own disko/grub).
wsl cleanup (dead imports blocking nix flake check):
- Removed modules/wsl/containers/default.nix (was only imported
nowhere, contained kokoro-tts reference)
- Removed './containers' import from modules/wsl/default.nix
(resolved to the now-removed default.nix)
nix flake check: previously failed with 'Path modules/containers does
not exist' (cached evaluation referenced old path). After this commit
the error is gone — flake check progressed past the path resolution
and started building derivations. Full build output not captured
(5-min timeout for download from cache.nixos.org), but path errors
are resolved.
T5 risk acknowledgment:
.agent/decisions/0002-backups-external.md updated with explicit
risk table for 'if no backups' scenario + ADR/R1.9 guidance.
T1, T2, T6, T7, T8, T9, T10, T12, T13, T15, T16, T17: all → completed
in manifest.json. T3, T4, T5, T11, T14: previously completed.
Remaining DEFERRED: T3 (otrecа SSH recovery), T5 (5.6 answer).
The 3x-ui container config was hardcoded for vds: it mounted the LE
cert for pubray1.zeroq.su and published host:15380→container:443 for
Xray REALITY. The server imports the same module but for x.zeroq.su
(no REALITY inbound, no cert needed by 3x-ui itself yet).
Add two options so each device picks what it needs:
- xlib.services.3x-ui.certDomain: domain whose LE cert is mounted
at /root/cert/{fullchain,key}.pem. null means no cert mount.
- xlib.services.3x-ui.reality443Forwarding: when true, also publish
host:15380→container:443 for nginx stream SNI-routed REALITY.
vds sets both. Server sets only certDomain (kept harmless; nginx
still terminates TLS for x.zeroq.su, so the mounted cert is unused
until/unless 3x-ui is reconfigured to terminate TLS itself).