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.