ctucx.git: dns.nix

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

commit f3ee0fb98002c5ded25b38dae57a7cfe730a376e
parent b74d9292a5d9f953a018d4800893978e6ba586a3
Author: Kirill Elagin <kirelagin@gmail.com>
Date: Mon, 31 Aug 2020 14:36:28 -0400

Add support for pseudo-records

This small tweak allows one to define a custom record type at the Nix
level, but write it out as another type (specified in its `rtype`).
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dns/types/zone.nix b/dns/types/zone.nix
@@ -45,9 +45,9 @@ let
 
   writeSubzone = name: zone:
     let
-      groupToString = subt:
-        concatMapStringsSep "\n" (writeRecord name subt) (zone."${subt.rtype}");
-      groups = map groupToString (attrValues rsubtypes');
+      groupToString = pseudo: subt:
+        concatMapStringsSep "\n" (writeRecord name subt) (zone."${pseudo}");
+      groups = mapAttrsToList groupToString rsubtypes';
       groups' = filter (s: s != "") groups;
 
       writeSubzone' = subname: writeSubzone "${subname}.${name}";