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