nixos/estuary: Generate DNS records for non-default interfaces
This commit is contained in:
parent
68f6942bda
commit
30c8913c08
@ -17,6 +17,8 @@
|
||||
};
|
||||
};
|
||||
vms = {
|
||||
name = "colony-vms";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.vms.v4}1";
|
||||
gateway = null;
|
||||
|
@ -20,6 +20,8 @@
|
||||
};
|
||||
};
|
||||
base = {
|
||||
name = "estuary-vm-base";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.base.v4}1";
|
||||
gateway = null;
|
||||
|
@ -2,7 +2,7 @@
|
||||
let
|
||||
inherit (builtins) attrNames stringLength genList filter;
|
||||
inherit (lib)
|
||||
concatStrings concatStringsSep concatMapStringsSep mapAttrsToList filterAttrs genAttrs optionalString;
|
||||
concatStrings concatStringsSep concatMapStringsSep mapAttrsToList filterAttrs genAttrs optionalString flatten;
|
||||
|
||||
ptrDots = 2;
|
||||
reverseZone = "100.10.in-addr.arpa";
|
||||
@ -62,28 +62,37 @@ in
|
||||
|
||||
bind.zones =
|
||||
let
|
||||
genRecords = f:
|
||||
genRecords = assignments: f:
|
||||
concatStringsSep
|
||||
"\n"
|
||||
(filter (s: s != "")
|
||||
(mapAttrsToList
|
||||
(_: as: f as.internal)
|
||||
(filterAttrs (_: as: as ? "internal" && as.internal.visible) allAssignments)));
|
||||
(filter
|
||||
(s: s != "")
|
||||
(flatten
|
||||
(map
|
||||
(assignment: (mapAttrsToList
|
||||
(_: as: f as."${assignment}")
|
||||
(filterAttrs
|
||||
(_: as: as ? "${assignment}" && as."${assignment}".visible)
|
||||
allAssignments)))
|
||||
assignments)));
|
||||
|
||||
genFor = [ "internal" "base" "vms" "ctrs" ];
|
||||
intRecords =
|
||||
genRecords (a: ''
|
||||
genRecords genFor (a: ''
|
||||
${a.name} IN A ${a.ipv4.address}
|
||||
${a.name} IN AAAA ${a.ipv6.address}
|
||||
${concatMapStringsSep "\n" (alt: "${alt} IN CNAME ${a.name}") a.altNames}
|
||||
'');
|
||||
intPtrRecords =
|
||||
genRecords
|
||||
genFor
|
||||
(a:
|
||||
optionalString
|
||||
a.ipv4.genPTR
|
||||
''@@PTR:${a.ipv4.address}:${toString ptrDots}@@ IN PTR ${a.name}.${config.networking.domain}.'');
|
||||
intPtr6Records =
|
||||
genRecords
|
||||
genFor
|
||||
(a:
|
||||
optionalString
|
||||
a.ipv4.genPTR
|
||||
|
@ -17,6 +17,8 @@
|
||||
};
|
||||
};
|
||||
ctrs = {
|
||||
name = "shill-vm-ctrs";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.ctrs.v4}1";
|
||||
gateway = null;
|
||||
|
Loading…
Reference in New Issue
Block a user