From 9347751df7e8e3d3a0288306b4393539d3d5c3f0 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 21 Dec 2024 20:57:16 +0100 Subject: [PATCH] feat: dns for vlans --- config/services/adguardhome.nix | 15 +++++++++------ hosts/nucnix/kea.nix | 23 ++++++----------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/config/services/adguardhome.nix b/config/services/adguardhome.nix index 8dba90a..d5ad8bd 100644 --- a/config/services/adguardhome.nix +++ b/config/services/adguardhome.nix @@ -1,4 +1,9 @@ -{ config, ... }: +{ + config, + lib, + globals, + ... +}: { wireguard.services = { client.via = "nucnix"; @@ -30,11 +35,9 @@ ]; }; user_rules = [ - # "||adguardhome.${config.secrets.secrets.global.domains.web}^$dnsrewrite=${lib.net.cidr.host config.secrets.secrets.global.net.ips.elisabeth config.secrets.secrets.global.net.privateSubnetv4}" - # "||nc.${config.secrets.secrets.global.domains.web}^$dnsrewrite=${lib.net.cidr.host config.secrets.secrets.global.net.ips.elisabeth config.secrets.secrets.global.net.privateSubnetv4}" - # "||immich.${config.secrets.secrets.global.domains.web}^$dnsrewrite=${lib.net.cidr.host config.secrets.secrets.global.net.ips.elisabeth config.secrets.secrets.global.net.privateSubnetv4}" - # "||smb.${config.secrets.secrets.global.domains.web}^$dnsrewrite=${lib.net.cidr.host config.secrets.secrets.global.net.ips.elisabeth-samba config.secrets.secrets.global.net.privateSubnetv4}" - # "||fritz.box^$dnsrewrite=${lib.net.cidr.host 1 config.secrets.secrets.global.net.privateSubnetv4}" + "||${globals.domains.web}^$dnsrewrite=${lib.net.cidr.host globals.services.nginx.ip globals.net.vlans.home.cidrv4}" + "||${globals.services.samba.domain}^$dnsrewrite=${lib.net.cidr.host globals.services.samba.ip globals.net.vlans.home.cidrv4}" + "||fritz.box^$dnsrewrite=${lib.net.cidr.host 1 "10.99.2.0/24"}" ]; dhcp.enabled = false; ratelimit = 60; diff --git a/hosts/nucnix/kea.nix b/hosts/nucnix/kea.nix index 03938e7..4a7a19a 100644 --- a/hosts/nucnix/kea.nix +++ b/hosts/nucnix/kea.nix @@ -1,7 +1,9 @@ { lib, utils, + globals, ... + }: let inherit (lib) @@ -55,30 +57,17 @@ in } { name = "domain-name-servers"; - data = "${net.cidr.host 10 subnet}"; + data = "${net.cidr.host globals.services.adguardhome.ip subnet}"; } ]; reservations = [ - #FIXME - # { - # hw-address = nodes.ward-adguardhome.config.lib.microvm.mac; - # ip-address = globals.net.home-lan.hosts.ward-adguardhome.ipv4; - # } - # { - # hw-address = nodes.ward-web-proxy.config.lib.microvm.mac; - # ip-address = globals.net.home-lan.hosts.ward-web-proxy.ipv4; - # } - # { - # hw-address = nodes.sire-samba.config.lib.microvm.mac; - # ip-address = globals.net.home-lan.hosts.sire-samba.ipv4; - # } ]; } ); }; }; - systemd.services.kea-dhcp4-server.after = [ - "sys-subsystem-net-devices-${utils.escapeSystemdPath "lan-self"}.device" - ]; + systemd.services.kea-dhcp4-server.after = flip mapAttrsToList vlans ( + name: _: "sys-subsystem-net-devices-${utils.escapeSystemdPath "lan-${name}"}.device" + ); }