ctucx.git: dns.nix

fork of https://github.com/kirelagin/dns.nix

commit f81a7f0a1363b6957e753c677606c1d5a67612d0
parent 04cce39f89a3132c15a125f69b5d14e22e62be30
Author: Kirill Elagin <kirelagin@gmail.com>
Date: Sun, 10 Mar 2019 02:23:10 +0100

records: Add AAAA
5 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -33,6 +33,10 @@ with dns.combinators; {
     (ttl (60 * 60) (a "203.0.113.4"))  # Equivalent to the second one
   ];
 
+  AAAA = [
+    (aaaa "4321:0:1:2:3:4:567:89ab")
+  ];
+
   CAA = letsEncrypt "admin@example.com";  # Common template combinators included
 
   subdomains = {
diff --git a/dns/combinators.nix b/dns/combinators.nix
@@ -18,6 +18,7 @@ rec {
 #
 
 a = address: { inherit address; };
+aaaa = address: { inherit address; };
 cname = cname: { inherit cname; };
 ns = nsdname: { inherit nsdname; };
 txt = data: { inherit data; };
diff --git a/dns/types/records/AAAA.nix b/dns/types/records/AAAA.nix
@@ -0,0 +1,24 @@
+#
+# © 2019 Kirill Elagin <kirelagin@gmail.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+{ pkgs }:
+
+let
+  inherit (pkgs.lib) mkOption types;
+
+in
+
+{
+  rtype = "AAAAA";
+  options = {
+    address = mkOption {
+      type = types.str;
+      example = "4321:0:1:2:3:4:567:89ab";
+      description = "IPv6 address of the host";
+    };
+  };
+  dataToString = {address, ...}: address;
+}
diff --git a/dns/types/records/default.nix b/dns/types/records/default.nix
@@ -11,6 +11,7 @@ let
 
   types = [
     "A"
+    "AAAA"
     "CAA"
     "CNAME"
     "NS"
diff --git a/example.nix b/example.nix
@@ -25,6 +25,10 @@ let
       (ttl (60 * 60) (a "203.0.113.3"))
     ];
 
+    AAAA = [
+      (aaaa "4321:0:1:2:3:4:567:89ab")
+    ];
+
     CAA = letsEncrypt "admin@example.com";
 
     subdomains = {