feat: add interface type and categorize interfaces by type in network module
This commit is contained in:
parent
87511fc1b8
commit
d3e8f402a9
@ -34,6 +34,11 @@ in
|
|||||||
description = "The network interface name.";
|
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 {
|
net = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The network address in CIDR format.";
|
description = "The network address in CIDR format.";
|
||||||
@ -62,4 +67,13 @@ in
|
|||||||
description = "An attribute set of networks with their configurations.";
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user