diff --git a/modules/core/network.nix b/modules/core/network.nix index 2a2246f..f44cfa7 100644 --- a/modules/core/network.nix +++ b/modules/core/network.nix @@ -34,6 +34,11 @@ in description = "The network interface name."; }; + type = mkOption { + type = types.enum [ "lan" "wan" "tailscale" ]; + description = "The type of interface (lan, wan, or vpn/tailscale)."; + }; + net = mkOption { type = types.str; description = "The network address in CIDR format."; @@ -62,4 +67,13 @@ in description = "An attribute set of networks with their configurations."; }; }; + + config = { + # Create lists of interfaces by type for easy access elsewhere + pepe.core.network.interfacesByType = { + lan = lib.filterAttrs (_: iface: iface.type == cfg.interfaceTypes.lan) cfg.interfaces; + wan = lib.filterAttrs (_: iface: iface.type == cfg.interfaceTypes.wan) cfg.interfaces; + vpn = lib.filterAttrs (_: iface: iface.type == cfg.interfaceTypes.vpn) cfg.interfaces; + }; + }; }