about summary refs log tree commit diff
path: root/modules/wireguard.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/wireguard.nix')
-rw-r--r--modules/wireguard.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/wireguard.nix b/modules/wireguard.nix
index 8547f70..8ea360b 100644
--- a/modules/wireguard.nix
+++ b/modules/wireguard.nix
@@ -9,6 +9,15 @@
 with lib;
 let
   cfg = config.nixfiles.modules.wireguard;
+
+  DNSSetup =
+    let
+      resolvectl = "${config.systemd.package}/bin/resolvectl";
+    in
+    ''
+      ${resolvectl} dns ${cfg.interface} ${cfg.server.ipv6.address} ${cfg.server.ipv4.address}
+      ${resolvectl} domain ${cfg.interface} ${my.domain.shire}
+    '';
 in
 {
   disabledModules = [
@@ -166,14 +175,7 @@ in
               ipv6.address
               ipv4.address
             ];
-            postUp =
-              let
-                resolvectl = "${config.systemd.package}/bin/resolvectl";
-              in
-              ''
-                ${resolvectl} dns ${cfg.interface} ${ipv6.address} ${ipv4.address}
-                ${resolvectl} domain ${cfg.interface} ${concatStringsSep " " (mapAttrsToList (_: v: v) my.domain)}
-              '';
+            postUp = DNSSetup;
           })
         ];
 
@@ -216,6 +218,7 @@ in
               ];
               listenPort = port;
               inherit peers;
+              postSetup = DNSSetup;
               allowedIPsAsRoutes = false;
             };
           };

Consider giving Nix/NixOS a try! <3