fix: modify network interface type handling to resolve Nix type error

This commit is contained in:
Giulio De Pasquale (aider) 2025-04-26 17:14:17 +01:00
parent a5232f522b
commit 738b0e9577

View File

@ -48,7 +48,7 @@ in
}; };
interfacesByType = mkOption { interfacesByType = mkOption {
type = types.attrsOf (types.attrsOf types.anything); type = types.attrsOf (types.listOf types.str);
default = {}; default = {};
description = "Interfaces grouped by type (lan, wan, vpn) for easy access."; description = "Interfaces grouped by type (lan, wan, vpn) for easy access.";
internal = true; internal = true;
@ -69,9 +69,9 @@ in
config = { config = {
# Create lists of interfaces by type for easy access elsewhere # Create lists of interfaces by type for easy access elsewhere
pepe.core.network.interfacesByType = { pepe.core.network.interfacesByType = {
lan = lib.filterAttrs (_: iface: iface.type == "lan") cfg.interfaces; lan = lib.attrNames (lib.filterAttrs (_: iface: iface.type == "lan") cfg.interfaces);
wan = lib.filterAttrs (_: iface: iface.type == "wan") cfg.interfaces; wan = lib.attrNames (lib.filterAttrs (_: iface: iface.type == "wan") cfg.interfaces);
vpn = lib.filterAttrs (_: iface: iface.type == "vpn") cfg.interfaces; vpn = lib.attrNames (lib.filterAttrs (_: iface: iface.type == "vpn") cfg.interfaces);
}; };
# We don't need the groups anymore as we're using interfacesByType directly # We don't need the groups anymore as we're using interfacesByType directly