From cba32a256a2c5a47a5939ec848583b22ba2408ad Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 16 Aug 2026 13:50:03 -0400 Subject: [PATCH] feat: serve hoenn DNS on pastoria --- .../nixos/profiles/wireguard-hoenn.nix | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/nix/modules/nixos/profiles/wireguard-hoenn.nix b/nix/modules/nixos/profiles/wireguard-hoenn.nix index d8dcaff8..7cceef92 100644 --- a/nix/modules/nixos/profiles/wireguard-hoenn.nix +++ b/nix/modules/nixos/profiles/wireguard-hoenn.nix @@ -1,4 +1,14 @@ -_: { +{lib, ...}: let + nodes = { + pastoria = "10.254.1.1"; + mauville = "10.254.1.2"; + rustboro = "10.254.1.3"; + sootopolis = "10.254.1.4"; + fortree = "10.254.1.5"; + fallarbor = "10.254.1.6"; + }; + coreDnsHosts = lib.concatStringsSep "\n" (lib.mapAttrsToList (name: address: " ${address} ${name}.hoenn") nodes); +in { flake.nixosModules.wireguardHoenn = { config, self, @@ -13,15 +23,6 @@ _: { }; networking = { - hosts = { - "10.254.1.1" = ["pastoria.hoenn"]; - "10.254.1.2" = ["mauville.hoenn"]; - "10.254.1.3" = ["rustboro.hoenn"]; - "10.254.1.4" = ["sootopolis.hoenn"]; - "10.254.1.5" = ["fortree.hoenn"]; - "10.254.1.6" = ["fallarbor.hoenn"]; - }; - firewall = { allowedUDPPorts = [51821]; trustedInterfaces = ["wg-hoenn"]; @@ -56,5 +57,22 @@ _: { ]; }; }; + + services.coredns = { + enable = true; + config = lib.concatStringsSep "\n" [ + "hoenn:53 {" + " bind ${nodes.pastoria}" + " hosts {" + coreDnsHosts + " }" + "}" + ]; + }; + + systemd.services.coredns = { + after = ["wireguard-wg-hoenn.service"]; + requires = ["wireguard-wg-hoenn.service"]; + }; }; } -- 2.51.2