feat: add interfacesByType option to network module for type-based interface access
This commit is contained in:
parent
2d4bdd0cfd
commit
894bc74667
@ -46,11 +46,18 @@ in
|
||||
default = { };
|
||||
description = "An attribute set of networks with their configurations.";
|
||||
};
|
||||
|
||||
interfacesByType = mkOption {
|
||||
type = types.attrsOf (types.attrsOf types.anything);
|
||||
default = {};
|
||||
description = "Interfaces grouped by type (lan, wan, vpn) for easy access.";
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# Create lists of interfaces by type for easy access elsewhere
|
||||
cfg.interfacesByType = {
|
||||
pepe.core.network.interfacesByType = {
|
||||
lan = lib.filterAttrs (_: iface: iface.type == "lan") cfg.interfaces;
|
||||
wan = lib.filterAttrs (_: iface: iface.type == "wan") cfg.interfaces;
|
||||
vpn = lib.filterAttrs (_: iface: iface.type == "vpn") cfg.interfaces;
|
||||
|
Loading…
x
Reference in New Issue
Block a user