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 = { };
|
default = { };
|
||||||
description = "An attribute set of networks with their configurations.";
|
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 = {
|
config = {
|
||||||
# Create lists of interfaces by type for easy access elsewhere
|
# 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;
|
lan = lib.filterAttrs (_: iface: iface.type == "lan") cfg.interfaces;
|
||||||
wan = lib.filterAttrs (_: iface: iface.type == "wan") cfg.interfaces;
|
wan = lib.filterAttrs (_: iface: iface.type == "wan") cfg.interfaces;
|
||||||
vpn = lib.filterAttrs (_: iface: iface.type == "vpn") cfg.interfaces;
|
vpn = lib.filterAttrs (_: iface: iface.type == "vpn") cfg.interfaces;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user