diff --git a/nixos/boxes/colony/default.nix b/nixos/boxes/colony/default.nix index 7dfdd7f..70da818 100644 --- a/nixos/boxes/colony/default.nix +++ b/nixos/boxes/colony/default.nix @@ -17,6 +17,8 @@ }; }; vms = { + name = "colony-vms"; + domain = lib.my.colony.domain; ipv4 = { address = "${lib.my.colony.start.vms.v4}1"; gateway = null; diff --git a/nixos/boxes/colony/vms/estuary/default.nix b/nixos/boxes/colony/vms/estuary/default.nix index ccfc9ea..c9f9033 100644 --- a/nixos/boxes/colony/vms/estuary/default.nix +++ b/nixos/boxes/colony/vms/estuary/default.nix @@ -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; diff --git a/nixos/boxes/colony/vms/estuary/dns.nix b/nixos/boxes/colony/vms/estuary/dns.nix index 2479486..9c65687 100644 --- a/nixos/boxes/colony/vms/estuary/dns.nix +++ b/nixos/boxes/colony/vms/estuary/dns.nix @@ -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 diff --git a/nixos/boxes/colony/vms/shill/default.nix b/nixos/boxes/colony/vms/shill/default.nix index 8f432ea..a41cf0c 100644 --- a/nixos/boxes/colony/vms/shill/default.nix +++ b/nixos/boxes/colony/vms/shill/default.nix @@ -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;