refactor: remove interfaceTypes and simplify network interface type filtering
This commit is contained in:
parent
d3e8f402a9
commit
9f0a119c8e
@ -6,26 +6,6 @@ let
|
||||
in
|
||||
{
|
||||
options.pepe.core.network = {
|
||||
interfaceTypes = {
|
||||
lan = mkOption {
|
||||
type = types.str;
|
||||
default = "lan";
|
||||
description = "Key for LAN interface";
|
||||
};
|
||||
|
||||
wan = mkOption {
|
||||
type = types.str;
|
||||
default = "wan";
|
||||
description = "Key for WAN interface";
|
||||
};
|
||||
|
||||
vpn = mkOption {
|
||||
type = types.str;
|
||||
default = "tailscale";
|
||||
description = "Key for VPN interface";
|
||||
};
|
||||
};
|
||||
|
||||
interfaces = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
@ -71,9 +51,9 @@ in
|
||||
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;
|
||||
lan = lib.filterAttrs (_: iface: iface.type == "lan") cfg.interfaces;
|
||||
wan = lib.filterAttrs (_: iface: iface.type == "wan") cfg.interfaces;
|
||||
vpn = lib.filterAttrs (_: iface: iface.type == "tailscale") cfg.interfaces;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user