nixos/home: De-share Virgin Media modem specifics from routing-common

The modem management subnet is stream-specific (it shares stream's `wan`
interface), so it no longer belongs in the shared routing-common. Drop the
`modem` network assignment and configure the address directly on stream's
`wan` (modemV4). The firewall reject and DNS wan-A-record skipBroadcasts that
existed only because of the modem move to per-box options
`my.homeRouter.{firewall.untrustedRejectV4,dns.wanSkipBroadcasts}`, set solely
by stream. river needs neither: its ONT sits on a separate interface already
blocked by the interface-based forward rules.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 01:35:08 +01:00
parent 832d0b5542
commit 49de78d47f
3 changed files with 55 additions and 32 deletions
+19 -9
View File
@@ -11,12 +11,6 @@ in
{
nixos.systems."${name}" = {
assignments = {
modem = {
ipv4 = {
address = net.cidr.host (254 - index) prefixes.modem.v4;
gateway = null;
};
};
core = {
name = "${name}-core";
inherit domain;
@@ -100,9 +94,11 @@ in
configuration = { lib, pkgs, config, assignments, allAssignments, ... }:
let
inherit (lib) mkIf mkMerge mkForce;
inherit (lib.my) networkdAssignment;
inherit (lib) mkIf mkMerge mkForce optionalString concatStringsSep;
inherit (lib.my) mkOpt' networkdAssignment;
inherit (lib.my.c) networkd;
cfg = config.my.homeRouter;
in
{
imports = map (m: import m index) [
@@ -112,6 +108,20 @@ in
./kea.nix
];
# Per-box WAN-management specifics: the Virgin Media modem on stream lives on the `wan`
# interface itself, whereas river's ONT sits on its own interface. Declared as options the
# box sets so routing-common itself carries no modem/ONT knowledge.
options.my.homeRouter = with lib.types; {
dns.wanSkipBroadcasts = mkOpt' (listOf str) [ ] ''
Broadcast addresses to exclude when auto-selecting the router's own `wan` A record,
for extra static subnets that share the `wan` interface.
'';
firewall.untrustedRejectV4 = mkOpt' (listOf str) [ ] ''
IPv4 prefixes untrusted clients must be explicitly rejected from reaching. Only needed
for subnets sharing the `wan` interface, since `wan` egress is otherwise accepted.
'';
};
config = {
environment = {
systemPackages = with pkgs; [
@@ -338,7 +348,7 @@ in
return
}
chain filter-untrusted {
ip daddr ${prefixes.modem.v4} reject
${optionalString (cfg.firewall.untrustedRejectV4 != [ ]) "ip daddr { ${concatStringsSep ", " cfg.firewall.untrustedRejectV4} } reject"}
oifname wan accept
return
}
+1 -1
View File
@@ -206,7 +206,7 @@ in
${name} IN LUA ${lib.my.dns.ifaceA {
inherit pkgs;
iface = "wan";
skipBroadcasts = [ (lib.my.netBroadcast prefixes.modem.v4) ];
skipBroadcasts = config.my.homeRouter.dns.wanSkipBroadcasts;
}}
${otherName} IN LUA ${lib.my.dns.lookupIP {
inherit pkgs;