feat(guests): place networked guests on tagged VLANs (task 0004)

A guest sets `vlan` to attach to its host's `br-vlan<id>` bridge, `mac`
to reuse an existing address (else a stable one is derived from its
namespace path and read back via `nix eval`), and `address` for a static
IP (else DHCP). The MAC and address are pinned inside the guest by its
own networkd, the only stable MAC pin for a nested container. A guest
naming a VLAN its host has not declared fails the build with an
actionable message.

The `br-vlan<id>` naming moves into a shared `bridgeName` in the lib, so
the bridge a guest attaches to and the bridge the host emits have one
source.
This commit was merged in pull request #30.
This commit is contained in:
2026-07-25 16:45:26 -04:00
parent 83106239d4
commit e6ea8a0060
3 changed files with 125 additions and 2 deletions

View File

@@ -1,14 +1,16 @@
{
config,
lib,
my,
...
}:
# The host networking foundation: per-VLAN bridges over a tagged trunk.
let
cfg = config.modules.network;
# Each tagged VLAN materializes as a bridge named for its id.
bridgeName = id: "br-vlan${toString id}";
# Each tagged VLAN materializes as a bridge named for its id, by the shared
# convention.
inherit (my) bridgeName;
# The tagged sub-interface stacked on the trunk that feeds one bridge.
vlanName = id: "${cfg.trunk}.${toString id}";