refactor(network-config): update configuration references to use pepe.core.network.interfaces

- Refactored config references from `config.architect.networks` to `config.pepe.core.network.interfaces` across multiple files
- Updated `fail2ban.nix`, `firewall.nix`, `tailscale.nix`, and `utilities.nix` to align with new configuration structure
- Centralized network interface configuration under `pepe.core` for better maintainability
- Maintained existing functionality while modernizing configuration hierarchy
This commit is contained in:
Giulio De Pasquale 2025-05-06 12:57:02 +01:00
parent 9277af4088
commit 7053b64156
4 changed files with 17 additions and 14 deletions

View File

@ -7,8 +7,8 @@
packageFirewall = pkgs.nftables;
bantime-increment.enable = true;
ignoreIP = [
config.architect.networks.lan.net
config.architect.networks.tailscale.net
config.pepe.core.network.interfaces.tailscale.net
config.pepe.core.network.interfaces.lan.net
];
};
}

View File

@ -1,13 +1,13 @@
{ config, lib, ... }:
let
openTCP = lib.concatMapStringsSep "," (x: toString x) config.architect.firewall.openTCP;
openUDP = lib.concatMapStringsSep "," (x: toString x) config.architect.firewall.openUDP;
openTCPVPN = lib.concatMapStringsSep "," (x: toString x) config.architect.firewall.openTCPVPN;
openUDPVPN = lib.concatMapStringsSep "," (x: toString x) config.architect.firewall.openUDPVPN;
firewallRules = config.pepe.core.firewall;
openTCP = lib.concatMapStringsSep "," (x: toString x) firewallRules.openTCP;
openUDP = lib.concatMapStringsSep "," (x: toString x) firewallRules.openUDP;
ifaces = config.pepe.core.network.interfaces;
deviceAddress = interface: device:
config.architect.networks.${interface}.devices.${device}.address;
ifaces.${interface}.devices.${device}.address;
gdevices = [
(deviceAddress "tailscale" "architect")
@ -25,7 +25,7 @@ in
nftables = {
enable = true;
ruleset = with config.architect.networks; ''
ruleset = with config.pepe.core.network.interfaces; ''
table ip raw {
chain PREROUTING {
type filter hook prerouting priority raw; policy accept;

View File

@ -35,5 +35,5 @@ in
};
};
networking.extraHosts = generateDeviceStrings config.architect.networks.tailscale.devices;
networking.extraHosts = generateDeviceStrings config.pepe.core.network.interfaces.tailscale.devices;
}

View File

@ -1,13 +1,16 @@
{ config, lib, ... }:
let
ifaces = config.pepe.core.network.interfaces;
in
{
# device.address device.hostname
generateDeviceStrings = devices: lib.concatStringsSep "\n"
(lib.mapAttrsToList (name: device: "${device.address} ${device.hostname}") devices);
getDeviceAddress = interface: device:
config.architect.networks.${interface}.devices.${device}.address;
ifaces.${interface}.devices.${device}.address;
architectInterfaceAddress = interface:
config.architect.networks.${interface}.devices.architect.address;
ifaces.${interface}.devices.architect.address;
}