summary refs log tree commit diff stats
path: root/system
diff options
context:
space:
mode:
authorAlan Pearce2023-04-18 20:47:43 +0200
committerAlan Pearce2023-04-19 15:57:43 +0200
commit7510f22640aaf52b859d0eb04a3ee867cf406919 (patch)
tree06925c0aa788b8c76ffbaac46d6a75fb638af943 /system
parentf39f143812c161941546d39889dab9f3d2ef20cb (diff)
downloadnixfiles-7510f22640aaf52b859d0eb04a3ee867cf406919.tar.lz
nixfiles-7510f22640aaf52b859d0eb04a3ee867cf406919.tar.zst
nixfiles-7510f22640aaf52b859d0eb04a3ee867cf406919.zip
Configure ddclient to update AAAA record for prefect
Diffstat (limited to 'system')
-rw-r--r--system/prefect.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/system/prefect.nix b/system/prefect.nix
index 829621ef..ec481e22 100644
--- a/system/prefect.nix
+++ b/system/prefect.nix
@@ -136,5 +136,40 @@
     hostName = "prefect";
   };
 
+  services.ddclient = {
+    enable = true;
+    package = (pkgs.ddclient.overrideAttrs
+      (old: {
+        patches = (old.patches or [ ]) ++ [
+          ../patches/ddclient-noipv4.patch
+        ];
+      }));
+    use = "no";
+    protocol = "nsupdate";
+    verbose = true;
+    zone = "alanpearce.eu";
+    server = "pappel.alanpearce.eu";
+    passwordFile = "/etc/secrets/ddns.key";
+    domains = [ "prefect.home.alanpearce.eu" ];
+    extraConfig = ''
+      usev4=disabled
+      usev6=cmdv6
+      cmdv6=${pkgs.writeScript "getipv6" ''
+        #!/bin/sh
+        set -eo pipefail
+        ip --oneline address show dev enp7s0 to 2000::/3 primary \
+          | awk '{ print $4 }' \
+          | cut -d/ -f1
+      ''}
+      ttl=3600
+    '';
+  };
+  systemd.services.ddclient.path = with pkgs;
+    [
+      iproute2
+      coreutils
+      gawk
+    ];
+
   system.stateVersion = "23.05";
 }