summaryrefslogtreecommitdiff
path: root/os/kay/modules/dns/ddns.nix
blob: 4a8fe5d4589c4fc90261734b22d06af0792708a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ pkgs, ... }:
{
  services.pppd.script."02-ddns-ipv6" = {
    type = "ipv6-up";
    runtimeInputs = with pkgs; [
      coreutils
      knot-dns
      iproute2
      gnugrep
    ];

    text = ''
      while ! ipv6="$(ip -6 addr show dev "$1" scope global | grep -o '[0-9a-f:]*::1')"; do
         sleep 0.2
      done

      cat <<- EOF | knsupdate
              server  2001:470:ee65::1
              zone    sinanmohd.com.

              update  delete  sinanmohd.com.  AAAA
              update  add     sinanmohd.com.  180     AAAA    $ipv6

              send
      EOF
    '';
  };
}