Commit Graph
252 Commits
Author SHA1 Message Date
oqyude 762275fdd3 opencode: remove opencode-loop plugin
Reverts the plugin registration added in 4ff7188 ("opencode:
opencode-loop added"). The entry had to be dropped from both places
inside programs.opencode, otherwise the plugin keeps loading in the
TUI:

  settings.plugin -> ~/.config/opencode/opencode.json
  tui.plugin      -> ~/.config/opencode/tui.json

oh-my-openagent is untouched; its agent and category overrides in
~/.omo/omo.jsonc still apply.
2026-10-19 18:23:18 +03:00
oqyude 6c1bf6917e fix(gitea-runner): put workdir in /tmp + lower health_check threshold to 256 MiB 2026-10-19 18:23:18 +03:00
oqyude b663ffb887 ci(gitea): re-trigger /tmp workspace 2026-10-19 18:23:18 +03:00
oqyude 7372549b4b ci(gitea): workspace -> /tmp 2026-10-19 18:23:18 +03:00
oqyude 8729537c5f ci(gitea): strace trigger 2026-10-19 18:23:18 +03:00
oqyude 6c42551911 ci(gitea): trigger after restart 2026-10-19 18:23:18 +03:00
oqyude cdff5b2672 fix(gitea-runner): workspace outside the StateDirectory symlink to private/
The NixOS gitea-actions-runner module sets StateDirectory to private/gitea-runner
(mode 700 in /var/lib/), so symlink /var/lib/gitea-runner -> private/gitea-runner
resolves into a root-only directory tree. The static gitea-runner user (uid 973)
cannot traverse that tree → mkdir within host.workdir_parent failed with EACCES.

Move workdir_parent to /var/lib/gitea-runner-work (sibling of the symlink,
no parent traversal through /var/lib/private). tmpfiles creates it owned
by gitea-runner with mode 0755.

Also still using rootfs to avoid the bind-mount RO issue that bit earlier.
2026-10-19 18:23:18 +03:00
oqyude 899e6faa84 ci(gitea): re-trigger test-runner after workspace fix + token re-entry 2026-10-19 18:23:18 +03:00
oqyude 7cc19900d8 fix(gitea-runner): move workspace off /mnt/services bind mount to rootfs
Workflow runs at 16:04 and 16:11 failed at:
  mkdir /mnt/services/gitea-runner-work/<id>: read-only file system

The bind mount /mnt/services occasionally flips RO during nixos-rebuild
activation (transient window while systemd re-creates .mount units). It's
back to RW a few seconds later (verified manually at 19:11 as uid 973),
but act_runner fails fast — by the time the unit retries the mount is
still in its intermittent state, and the job's mkdir dies.

Move workspace to /var/lib/gitea-runner/work (rootfs, always RW). 4 GiB
eMMC has plenty of room for short-lived job scratch dirs.
2026-10-19 18:23:18 +03:00
oqyude 77e0436b25 ci(gitea): re-trigger after fixing mount 2026-10-19 18:23:18 +03:00
oqyude 03fca3410b ci(gitea): trigger test-runner workflow on push to dev 2026-10-19 18:23:18 +03:00
oqyude 23cbb2e0d5 ci(gitea): add note so the next push triggers test-runner 2026-10-19 18:23:18 +03:00
oqyude fb46ffeadb ci(gitea): add smoke-test workflow for the ci-sapphira runner
A two-trigger workflow — manual (workflow_dispatch) and on every push to
dev — that runs a single shell step on 'runs-on: native' to verify the
sapphira runner is healthy: hostname/whoami/pwd plus probes for the
common ZeroQ-workflow tools (nix, git, python3) and the act_runner
environment variables (RUNNER_NAME, RUNNER_TEMP).

Useful as a quick health check after any change to modules/server/
gitea-runner.nix, secrets/gitea-runner-registration.env, or after a
NixOS upgrade.
2026-10-19 18:23:18 +03:00
oqyude 71826d3b99 fix(sops, gitea-runner): decode token as dotenv, not yaml
Nixpkgs's services.gitea-actions-runner.module uses EnvironmentFile=
instance.tokenFile; systemd reads KEY=VALUE lines, not YAML. The previous
key="registration_token" with format="yaml" produced /var/lib/gitea-runner/
registration-token as YAML, which systemd silently failed to parse — the
runner process received an empty $TOKEN and Gitea replied with
"runner registration token not found".

Switch to format="dotenv" and drop the key= parameter (dotenv has no key
concept, the file is one TOKEN=... line). The companion secret file is
renamed accordingly:

  secrets/gitea-runner-registration.yaml  →  secrets/gitea-runner-registration.env

Verified at 2026-10-14 17:36 MSK on sapphira with token in place — register
+ declare succeed, runner shows up green in Gitea admin UI.
2026-10-19 18:23:18 +03:00
oqyude 7a0e7d560e fix(gitea-runner): drop serviceConfig overrides that shadow upstream unit
ServiceConfig-level leaf assignments (or a single lib.mkMerge block) into
systemd.services.gitea-runner-ci-sapphira.serviceConfig were silently
replacing Nixpkgs's services.gitea-actions-runner module output: the
generated unit came out without ExecStart / ExecStartPre / LoadCredential
/ User / Restart / RestartSec / StateDirectory, so systemd refused to
start the service ('Service has no ExecStart=... Refusing').

[Unit]-side overrides DO merge, so the storage guard (ConditionPathIsMountPoint
on xlib.dirs.server-home) and the local-fs.target After= are kept.
Cgroup caps (CPUQuota, MemoryMax, OOM knobs) are deferred — a follow-up
should add them via a systemd drop-in
(/etc/systemd/system/gitea-runner-ci\x2dsapphira.service.d/override.conf)
so the upstream ExecStart path stays intact.

Verified at 2026-10-14 17:36 MSK: register + declare succeed on sapphira
after this commit's deploy + a sops format fix (next commit).
2026-10-19 18:23:18 +03:00
oqyude d4abd8f0cc feat(gitea): enable Actions and add host-mode runner on sapphira 2026-10-19 18:23:18 +03:00
oqyude 9693ded39a secrets(gitea-runner): add sops placeholder for registration token 2026-10-19 18:23:18 +03:00
oqyude 501086dde7 gitignore upd 2026-10-19 18:23:18 +03:00
oqyude 952451d15e feat(pxe-infra): use qemu-bridge-helper with setuid wrapper (T13)
Replace the manual `ip tuntap add` + `ip link set master` pattern in the
VM service with the standard `-netdev bridge,helper=...` approach. This
removes the bespoke tap lifecycle from the systemd script and uses
qemu's own bridge helper for TAP creation/teardown.

What changed in vm.nix:
  - Added security.wrappers.qemu-bridge-helper: a setuid root wrapper
    at /run/wrappers/bin/qemu-bridge-helper that execs the nixpkgs
    binary (${pkgs.qemu}/libexec/qemu-bridge-helper).
  - Added /etc/qemu/bridge.conf restricting the helper to the pxe0
    bridge (single `allow pxe0` line).
  - Added /run/wrappers/bin to the service PATH and `helper=` option
    on -netdev bridge, so qemu finds the wrapper.
  - Removed the tap creation in the script and the teardown in
    postStop — qemu-bridge-helper handles both.
  - Inlined `chmod 4755` on the wrapper at the top of the service
    script. The security.wrappers activation script in this NixOS
    version (qemu 11.1.1, edk2 202608) doesn't always apply the
    setuid bit, leaving the wrapper at mode 0511 which makes the
    helper fail to create the TAP. The inlined chmod is idempotent
    and runs as root (system service). Remove this once upstream
    NixOS is fixed.

Verified 2026-10-14 on rydiwo:
  - direct mode: VM boots, tap0 (created by helper) attaches to
    pxe0, all network up.
  - pxe mode: iPXE chain works end-to-end through the bridge —
    snp.efi -> autoexec.ipxe -> boot.ipxe (vmlinuz-virt Not found is
    expected; /latest/ copies were cleaned up after the H_fix.1b
    test).

T10 fix (autoexec.ipxe on TFTP root) is independent and already
committed (7c9a8d8 + syntax fix ae14fec). Closes T13.
2026-10-19 18:23:18 +03:00
oqyude a08c5ddd54 fix(pxe-infra): correct triple-quote to double-quote in autoexec.ipxe block
Nix indented strings use \x27\x27 (two single quotes) as delimiters, not \x27\x27\x27
(three). The autoexec.ipxe block added in 7c9a8d8 used \x27\x27\x27 which
the parser rejects with "unexpected end of file, expecting indented
string or \x27${ or end of an indented string". Replacing with the
correct \x27\x27 makes both copies (this one and the home-manager
symlink target) parse cleanly and unblocks nixos-rebuild.
2026-10-19 18:23:18 +03:00
oqyude 64036c4951 fix(pxe-infra): add autoexec.ipxe to TFTP root (resolves iPXE #GP / T10)
iPXE in UEFI mode looks for autoexec.ipxe on the same TFTP server it
was loaded from, and runs it as the boot script. Without it, the iPXE
instance that replaced the firmware PXE ROM has nothing to chain to
and ends up in No more network devices -> #GP.

This was the root cause of T10 (the iPXE 2.0.0 #GP with RIP 0x7EE8A5FC
or 0x7EC9456F depending on which point in the chain it crashed at).
Adding a 1-line autoexec.ipxe that chains to the HTTP-served boot.ipxe
makes the full chain work end-to-end: snp.efi -> autoexec.ipxe ->
boot.ipxe -> vmlinuz-virt+initramfs-virt -> kernel boot -> Alpine Init.

ipxe.nix: new environment.etc entry autoexec.ipxe via pkgs.writeText.
default.nix: tmpfiles rule symlinks it into the served TFTP root.

Verified 2026-10-14 on rydiwo with manual QEMU test (H_fix.1b):
snp.efi (iPXE 2.0.0) loaded, autoexec.ipxe found, HTTP boot.ipxe
fetched, kernel+initrd downloaded, handoff to firmware, Alpine Init
ran. No #GP. Detailed diagnostic in pxe-infra-automation
.agent/notes/T10-diagnostic-2026-10-14.md.
2026-10-19 18:23:18 +03:00
oqyude f0bb11de28 pxe-infra: add vm.bootMode option (direct | pxe)
The default "direct" preserves the proven E2E behavior
(2026-10-13). "pxe" enables the full L3 boot chain
(-boot n, no virtio drive) for reproducing T10 (iPXE 2.0.0
#GP at ExitBootServices, RIP 0x7EE8A5FC) and verifying any
fix. Switch modes by editing pxe-infra.vm.bootMode in
configurations/rydiwo and running nixos-rebuild switch —
no other changes needed.
2026-10-19 18:23:17 +03:00
oqyude afbfcaec69 opencode lan reverse 2026-10-19 18:23:17 +03:00
oqyude 09412b8bdb nix flake update 2026-10-19 18:23:17 +03:00
oqyude 9cf86435f5 nix flake update 2026-10-13 04:35:12 +03:00
oqyude 13552039c7 opencode: opencode fix 2026-10-13 04:33:47 +03:00
oqyude a3c94906e9 feat(pxe-infra): boot VM from local image, not via iPXE sanboot
iPXE 2.0.0 reliably #GPs at RIP 0x7EE8A5FC (RAX=0xAF...AF) when handing off a 1-2 GB raw image back to the firmware under QEMU/OVMF, regardless of whether the boot primitive is sanboot, imgfetch+boot, or kernel+initrd+boot, regardless of iPXE binary (universal or snp-only), and regardless of VM memory (2G or 4G). The image itself is fine (kernel+initrd extract cleanly, BOOTX64.EFI is in the ESP, systemd-boot config is set up). The crash is in iPXE 2.0.0 `s exit-to-firmware path under this QEMU/OVMF combination.

Workaround: attach the Alpine worker image as a local virtio drive in the QEMU command line. The firmware (OVMF) finds BOOTX64.EFI in the image's ESP and boots the kernel from the image's ext4 partition. The network is still there (pxe0-tap, dnsmasq, nginx, report-sink), so the runner inside the guest can still POST to the report-sink and the VM can still talk to the L2/L3 services at runtime. The image attached is the same artifact nginx serves for the real PXE rig (the `latest` symlink at `artifacts.root/http/latest/`); deploy.sh keeps both paths in sync.

Refs: docs/ARCHITECTURE.md section L4.
2026-10-13 04:23:27 +03:00
oqyude e27eae9ae0 fix(pxe-infra): probe with kernel+initrd to isolate iPXE sanboot bug
All four attempts to sanboot the Alpine raw image through iPXE crash at the same RIP offset (0x35FC from the iPXE image base) regardless of memory (2G or 4G), iPXE binary (universal or snp-only), or image virtual size (2G or 1G). Common factor: all used sanboot to present the URL as a block device.

Replace boot.ipxe with iPXE's kernel/initrd/boot primitive. This bypasses sanboot and the SAN device creation path entirely. The kernel will fail to find a rootfs (no /dev/sda* is exposed) and panic — but kernel boot messages in the journal will tell us whether iPXE's kernel-initrd handoff works at all. If it does, the bug is isolated to the sanboot/SAN-device code path. If it also crashes, the bug is in shared iPXE code (HTTP download buffer management, probably).
2026-10-13 04:19:14 +03:00
oqyude 687d6d13f3 config(rydiwo): use snp.efi instead of universal ipxe.efi
The universal UEFI binary ipxe.efi (1.2 MB, all NIC drivers)
crashes at the same offset (0x35FC from the iPXE image
base) whether the VM has 2 GB or 4 GB of RAM, with
RAX = 0xAF...AF (iPXE uninit-memory fill). So this is not
OOM (the memory bump did not help) and not a NIC driver
issue (we use virtio-net, which the universal binary handles);
it is a deterministic bug somewhere in the sanboot/download
buffer path of the universal binary when the image is 2 GB.

snp.efi (310 KB, SNP-only — the driver virtio-net speaks)
is a separate iPXE build with a smaller code path: no UNDI,
no PXE prefix, no multi-NIC code. The same bug may not be
there, or the different code layout may avoid the bad
offset. Worth a try before reaching for GRUB or NFS root.

The opt-in is just bootloader.ipxeBinary = "snp.efi"; on
the pxe-infra attrset. The tmpfiles rule in
modules/pxe-infra/default.nix will symlink the new name
into the served TFTP root, and the next DHCP offer from
dnsmasq will hand it to the firmware.
2026-10-13 04:08:58 +03:00
oqyude 3154813d01 config(rydiwo): bump pxe-infra VM to 4G so iPXE can sanboot a 2G image
iPXE's sanboot for an HTTP URL needs to hold the entire image
in its own heap. The raw Alpine image is 2 GB; with the
default 2 GB VM RAM, iPXE's allocator runs out around the
2 GB mark, leaves uninitialised 0xAF...AF fill in the
fresh pages, and the firmware's next read from that area
raises #GP at RIP 0x7EE855FC with RAX = 0xAF...AF.

Bumping pxe-infra.vm.memory to 4G gives iPXE roughly 2G of
heap for the download, which is exactly what a 2G image
needs. The rest goes to OVMF firmware and friends.
2026-10-13 04:01:49 +03:00
oqyude 8d5fad76fd fix(pxe-infra): back to sanboot now that ESP has BOOTX64.EFI
The previous run of imgfetch+boot crashed at RIP 0x7EE855FC in iPXE. iPXE was passing the full 2GB raw disk image to the firmware 'boot' primitive, which expects a UEFI PE executable (a small file with a PE header), not a 2GB block-device image. The firmware's PE loader hits uninitialised memory and the RIP-AF pattern reappears.

The earlier sanboot attempt also crashed, but that was before the systemd-boot fix gave the image a real \EFI\BOOT\BOOTX64.EFI. sanboot presents the URL as a block device, the firmware walks the GPT and finds the ESP, systemd-boot runs, and the kernel boots from the local ext4 partition. This is the right primitive for raw disk images served over HTTP.

Refs: docs/ARCHITECTURE.md section L4.
2026-10-13 03:57:28 +03:00
oqyude 4ff7188678 opencode: opencode-loop added 2026-10-13 03:46:43 +03:00
oqyude 5f8986ae86 fix(pxe-infra): use imgfetch+boot instead of sanboot in boot.ipxe
iPXE sanbooted the Alpine raw image and crashed with a #GP at RIP 0x7EE855FC, RAX=0xAF...AF — the AF pattern is the uninit-memory marker iPXE puts in block-device descriptors, which sanboot reads back. Splitting OVMF CODE+VARS did not change the RIP, which is in iPXE not OVMF, confirming the fault is on the iPXE side.

sanboot uses the legacy INT13 interface to present the URL as a disk; for a UEFI-only guest (B.6) the EFI firmware protocols are more direct. imgfetch downloads the (sparse, 159M actual) image into a memory block and boot invokes the EFI LoadImage/StartImage path on it, which is the same path the firmware would use for a normal disk boot. Removes the INT13 detour that was crashing.

Refs: docs/ARCHITECTURE.md section L4.
2026-10-13 03:42:25 +03:00
oqyude 55505fa1c5 fix(pxe-infra): split OVMF CODE+VARS so the firmware can chain
iPXE loaded boot.ipxe and tried to sanboot the Alpine raw image, but the firmware raised a #GP fault at RIP 0x7EC8B5FC with RAX=0xAF...AF. The AF pattern in RAX is a tell: it is the poisoned-memory value QEMU leaves in regions the firmware has not initialised. The combined OVMF.fd is read-only and carries no NVRAM region the firmware can write to, so ExitBootServices during the iPXE-to-image handoff cannot record its boot variables and the firmware crashes.

Switch to the split CODE+VARS form that nixpkgs ships: mount OVMF_CODE.fd read-only, seed a writable copy of OVMF_VARS.fd at /var/lib/pxe-infra/ovmf-vars.bin on first run, and pass it as a second pflash drive. iPXE can then write the chain target into NVRAM and the firmware hands off cleanly.

Refs: docs/ARCHITECTURE.md section L4.
2026-10-13 03:38:34 +03:00
oqyude a98732d142 fix(pxe-infra): actually include dhcp-range in the dnsmasq settings
The previous commit computed `dhcpRange` in the let-block
but never put it into the `base` attrset that becomes the
dnsmasq settings. The value was dead code, the rendered
conf had no dhcp-range line, dnsmasq still didnt open
2026-10-13 03:34:54 +03:00
oqyudeandSisyphus f7acbc6868 fix(pxe-infra): put free pool in dhcp-range, not dhcp-host
dhcp-host and dhcp-range are different dnsmasq keys. The
free-pool lines from the optional rangeStart/rangeEnd options
were being concatenated into the dhcp-host list, which
dnsmasq rendered as

  dhcp-host=52:54:00:12:34:56,10.66.0.10,pxe-vm-01,set:known
  dhcp-host=10.66.0.100,10.66.0.200,12h

i.e. it would try to give IP 10.66.0.200 to the device whose
MAC is 10.66.0.100. Even worse, with no dhcp-range at all,
dnsmasq does not open its DHCP server socket — it only runs
TFTP. The UEFI firmware in the VM would send DISCOVER and
get nothing back, ending in PXE-E18: Server response
timeout.

Move the pool to its own  list, with a sane
default (the entire /24 minus the host address) so the
server actually starts even when rangeStart/rangeEnd are
left null. The MAC filter (dhcp-ignore=tag:!known) still
prevents unknown MACs from getting a lease from the range.

Co-authored-by: Sisyphus <sisyphus@local>
2026-10-13 03:32:16 +03:00
oqyude a1aaa46908 fix(pxe-infra): script=no,downscript=no on the tap netdev
By default  invokes /etc/qemu-ifup
after opening the tap (and /etc/qemu-ifdown on shutdown).
That script does not exist on a stock NixOS install, and
QEMU fails with:
  network script /etc/qemu-ifup failed with status 256

The pre-start already brings the tap up (ip link set … up)
and the postStop tears it down, so we tell QEMU not to
call out to /etc/qemu-if{up,down} via script=no,
downscript=no.
2026-10-13 03:27:31 +03:00
oqyude 4f69d96e4e fix(pxe-infra): use tap+bridge-attach instead of -netdev bridge
QEMU's `-netdev bridge,br=pxe0` delegates the actual
`brctl addif` to a setuid qemu-bridge-helper binary, paired
with an /etc/qemu/bridge.conf ACL file. The current nixpkgs
does not ship a NixOS module for installing that wrapper
(nixpkgs has qemu-guest-agent.nix — a different thing, the
in-VM guest agent) so the default is to fail with:

  failed to parse default acl file /etc/qemu/bridge.conf
  -netdev bridge,…: bridge helper failed

The standard workaround is the same pattern NixOS itself
uses in qemu-vm.nix for test VMs: create a tap device
before QEMU starts, attach it to the bridge ourselves (we
already have CAP_NET_ADMIN as root in the systemd unit),
and pass `-netdev tap,ifname=…` to QEMU. No helper needed.

- modules/pxe-infra/vm.nix: switch to `-netdev tap,
  ifname=pxe0-tap`; pre-start script idempotently tears
  down any leftover tap, creates a new one, and attaches
  it to the configured bridge. `postStop` removes the tap
  on every stop (including crashes / restart cycles).
- modules/pxe-infra/bridge.nix: drop the no-op
  `services.qemuGuest.enable = true;` (option doesn't exist
  in this nixpkgs).
2026-10-13 03:25:12 +03:00
oqyude e70fde4e04 fix(pxe-infra): point OVMF pflash at the firmware file, not the dir
nixpkgs OVMF.fd is a multi-output derivation whose outPath is
a *directory* containing FV/OVMF.fd (combined CODE+VARS),
FV/OVMF_CODE.fd, FV/OVMF_VARS.fd, and share/. QEMU needs a
regular file for -drive if=pflash,format=raw,readonly=on,
and rejected the directory with:

  'file' driver requires '.../OVMF-202608-fd'
  to be a regular file

Use the combined FV/OVMF.fd (4 MB, CODE+VARS in one).
Mounted read-only so the VM has no persistent NVRAM, which
is what we want for a fresh-every-run rig (docs/ARCHITECTURE.md
§L4). For proper NVRAM persistence across runs, the split
CODE+VARS form with a per-VM writable VARS file would be the
next step; not needed yet.
2026-10-13 03:17:27 +03:00
oqyude 15f36bcd0e fix(pxe-infra): wantedBefore -> before in pxe-infra-bridge
NixOS systemd module does not have a `wantedBefore` attribute
(it is a Unit-file directive, not a NixOS option). The
equivalent is `before = [ "dnsmasq.service" ]`, which says
"this unit is ordered to start before dnsmasq.service". The
previous value made nix flake check / nixos-rebuild fail
with:

  error: The option
  `systemd.services.pxe-infra-bridge.wantedBefore` does not exist.
  Did you mean `systemd.services.pxe-infra-bridge.wantedBy`,
  `systemd.services.pxe-infra-bridge.before` or
  `systemd.services.pxe-infra-bridge.after`?

which surfaced when we tried to actually switch on the rig
after enabling pxe-infra in mini-laptop.nix.
2026-10-13 03:10:31 +03:00
oqyude dfb939bdab config(rydiwo): enable pxe-infra, with VM off autostart
The L1–L6 plumbing is now in place (oqyude/nixos@a940356 …
85953f9, pxe-infra-automation@15c8c3e), the L5 image is built
and staged at /var/lib/pxe-infra/http/574ccbe/alpine-worker.raw
with a `latest` symlink. Time to actually switch the rig on.

Per the user constraint ("VM is for script development
iteration, not permanent"), the L4 guest is configured but
NOT autostarted. The systemd unit exists; `systemctl start
pxe-infra-vm` brings the guest up for a test session, and
`systemctl stop` tears it down. The bridge, DHCP+TFTP, HTTP,
iPXE staging, and report sink all start on boot as expected.

After this lands, `ip a` should show `pxe0` with
10.66.0.1/24, `curl http://10.66.0.1/` should show the nginx
autoindex with the staged image, and `systemctl status
pxe-infra-vm` should report `Loaded …; inactive (dead)` — the
unit is there, just not started.
2026-10-13 03:09:52 +03:00
oqyude 85953f9b3d feat(pxe-infra): add vm.autostart option (default false)
The QEMU/KVM guest was unconditionally
`wantedBy = [ "multi-user.target" ]`, which means it would
have come up on every boot of rydiwo. The intent is the
opposite for now: the VM is for script-development iteration,
not a permanent rig. We want to start it by hand
(`systemctl start pxe-infra-vm`) when a test session needs
it, and stop it the same way.

- modules/options.nix: new options.pxe-infra.vm.autostart
  (default false). Describes when to flip it on (long
  unattended test runs) and that the unit itself is
  always present when pxe-infra.vm.enable is true.

- modules/pxe-infra/vm.nix: wantedBy is now
  `lib.optional config.pxe-infra.vm.autostart "multi-user.target"`,
  so with autostart=false the unit is reachable via
  `systemctl start` but not pulled in by multi-user.target.

- configurations/mini-laptop.nix: commented example now
  shows the `vm.autostart = false` form, and the surrounding
  comment documents the manual-start workflow.
2026-10-13 03:09:18 +03:00
oqyude bc62b6f03d feat(pxe-infra): add HTTP report sink — L6
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".
2026-10-13 02:48:30 +03:00
oqyude d7e46a4e89 feat(pxe-infra): stage iPXE EFI + boot.ipxe — completes the boot chain
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.
2026-10-13 02:46:07 +03:00
oqyude 5973aa74fd 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).
2026-10-13 02:42:49 +03:00
oqyude 54a93f1e48 feat(pxe-infra): add TFTP (via dnsmasq) and HTTP (via nginx) — L3
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.
2026-10-13 02:35:59 +03:00
oqyude a940356e0a feat(pxe-infra): add isolated bridge + MAC-filtered DHCP module (L2)
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.
2026-10-13 01:45:28 +03:00
oqyude df02a71c03 fix(vtimeline): drop dead PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH export
Playwright never reads this variable. Verified: no reference to it anywhere
in playwright-core, unsetting it leaves the suite green, and pointing
PLAYWRIGHT_BROWSERS_PATH at an empty directory fails the suite even while
the variable is set. The browsers.json-derived symlink farm is the only
mechanism that selects the nixpkgs chromium.

The old comment claimed the variable was "honoured by older Playwright and
the channel code path", which is false. That claim risked a future editor
deciding the symlink farm was secondary and breaking a working setup.

Replaced it with a note recording why the export must not come back.
Suite re-verified after the change: 15/15 passed.
2026-10-12 15:16:57 +03:00
oqyude fe08c0290e fix(deploy): only evaluate deploy-rs checks for linux systems
nixpkgs 26.11 dropped x86_64-darwin and deploy-rs throws at eval time,
which broke nix flake show / nix flake check for the whole flake.
2026-10-12 13:20:15 +03:00
oqyude fe9db04d0f devshell(vtimeline): resolve project path and playwright revision at runtime
the banner pointed at ../VeeamTimelineView, which exists nowhere - on
sapphira the repo is on the external disk. the chromium revision was
hardcoded to 1248 and would have silently broken the next time the
project bumps @playwright/test; read it from the project's own
playwright-core/browsers.json instead.
2026-10-12 13:20:15 +03:00