mob next [ci-skip] [ci skip] [skip ci]

lastFile:clan.nix
This commit is contained in:
2026-08-07 14:50:25 +07:00
parent 73a2f737c3
commit b10343c194
2 changed files with 24 additions and 3 deletions
+3
View File
@@ -137,9 +137,12 @@ in
}; };
}; };
trunkPorts = [ "enp2s0" ]; trunkPorts = [ "enp2s0" ];
accessPorts = { accessPorts = {
enp4s0.vlanId = 10; enp4s0.vlanId = 10;
}; };
uplinkPorts = [ "enp3s0" ];
}; };
}; };
}; };
+21 -3
View File
@@ -77,7 +77,7 @@
description = "Static DHCP leases; the attribute name becomes the client's hostname."; description = "Static DHCP leases; the attribute name becomes the client's hostname.";
}; };
}; };
allowWAN = lib.mkOption { allowedWAN = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
description = "Whether clients on this VLAN may reach the internet."; description = "Whether clients on this VLAN may reach the internet.";
@@ -142,7 +142,10 @@
''; '';
}; };
secondaryUpLink = lib.mkOption { }; upLinkPorts = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "DHCP-client uplink into the existing router LAN so this machine has internet";
};
}; };
}; };
@@ -212,6 +215,7 @@
}; };
}; };
} }
// lib.optionalAttrs (settings.wan.vlanId != null) { // lib.optionalAttrs (settings.wan.vlanId != null) {
"15-wan-lan" = { "15-wan-lan" = {
matchConfig.Name = "wan-vlan"; matchConfig.Name = "wan-vlan";
@@ -219,6 +223,7 @@
linkConfig.RequiredForOnline = "no"; linkConfig.RequiredForOnline = "no";
}; };
} }
// { // {
"20-br0" = { "20-br0" = {
matchConfig.Name = "br0"; matchConfig.Name = "br0";
@@ -228,6 +233,7 @@
linkConfig.RequiredForOnline = "no"; linkConfig.RequiredForOnline = "no";
}; };
} }
// lib.listToAttrs ( // lib.listToAttrs (
map (port: { map (port: {
name = "25-trunk-${port}"; name = "25-trunk-${port}";
@@ -239,6 +245,7 @@
}; };
}) settings.trunkPorts }) settings.trunkPorts
) )
// lib.mapAttrs' ( // lib.mapAttrs' (
iface: port: iface: port:
lib.nameValuePair "25-access-${iface}" { lib.nameValuePair "25-access-${iface}" {
@@ -254,6 +261,7 @@
linkConfig.RequiredForOnline = "no"; linkConfig.RequiredForOnline = "no";
} }
) settings.accessPorts ) settings.accessPorts
// lib.mapAttrs' ( // lib.mapAttrs' (
name: vlan: name: vlan:
lib.nameValuePair "40-${vlanIf name}" { lib.nameValuePair "40-${vlanIf name}" {
@@ -267,7 +275,17 @@
dhcpPrefixDelegationConfig.SubnetId = "auto"; dhcpPrefixDelegationConfig.SubnetId = "auto";
linkConfig.RequiredForOnline = "no"; linkConfig.RequiredForOnline = "no";
} }
) settings.vlans; ) settings.vlans
// lib.listToAttrs (
map (port: {
name = "5-uplink-${port}";
value = {
matchConfig.Name = "${port}";
networkConfig.DHCP = "ipv4";
};
}) settings.upLinkPorts
);
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
tcpdump tcpdump