about summary refs log tree commit diff
path: root/modules/wireguard.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2024-12-02 01:13:53 +0300
committerazahi <azat@bahawi.net>2024-12-02 01:13:53 +0300
commit0df7936405dd7cfa1ed518441a154b03f1aa57bc (patch)
treede5a0042316f821475e829885c3120aaa6725926 /modules/wireguard.nix
parent2024-11-30 (diff)
2024-12-02
Diffstat (limited to '')
-rw-r--r--modules/wireguard.nix29
1 files changed, 11 insertions, 18 deletions
diff --git a/modules/wireguard.nix b/modules/wireguard.nix
index dcd7858..5138946 100644
--- a/modules/wireguard.nix
+++ b/modules/wireguard.nix
@@ -20,6 +20,14 @@ let
       ${resolvectl} dnssec ${cfg.interface} no
       ${resolvectl} dnsovertls ${cfg.interface} no
     '';
+
+  extraOptions = {
+    jc = 228;
+    jmin = 42;
+    jmax = 420;
+    s1 = 69;
+    s2 = 96;
+  };
 in
 {
   disabledModules = [
@@ -149,13 +157,7 @@ in
               "${ipv4.address}/16"
               "${ipv6.address}/16"
             ];
-            extraInterfaceConfig = ''
-              jc = 228
-              jmin = 42
-              jmax = 420
-              s1 = 69
-              s2 = 96
-            '';
+            inherit extraOptions;
           })
           (with cfg.server; {
             peers = [
@@ -221,17 +223,8 @@ in
                 "${ipv4.address}/16"
               ];
               listenPort = port;
-              inherit peers;
-              postSetup =
-                DNSSetup
-                + ''
-                  awg set ${cfg.interface} \
-                    jc 228 \
-                    jmin 42 \
-                    jmax 420 \
-                    s1 69 \
-                    s2 96
-                '';
+              inherit peers extraOptions;
+              postSetup = DNSSetup;
               allowedIPsAsRoutes = false;
             };
           };

Consider giving Nix/NixOS a try! <3