feat: reduced some complexity
This commit is contained in:
parent
4c8ebb455e
commit
1287160cdf
1 changed files with 14 additions and 38 deletions
|
@ -230,46 +230,14 @@
|
||||||
|
|
||||||
records =
|
records =
|
||||||
config.skynet.records
|
config.skynet.records
|
||||||
|
/*
|
||||||
|
Need to "manually" grab it from each server.
|
||||||
|
Nix is laxy evalusted so if it does not need to open a file it wont.
|
||||||
|
This is to iterate through each server (node) and evaluate the dns records for that server.
|
||||||
|
*/
|
||||||
++ builtins.concatLists (
|
++ builtins.concatLists (
|
||||||
lib.attrsets.mapAttrsToList (
|
lib.attrsets.mapAttrsToList (
|
||||||
key: value: let
|
key: value: value.config.services.skynet."${name}".records
|
||||||
details_server = value.config.services.skynet."${name}".server;
|
|
||||||
details_records = value.config.services.skynet."${name}".records;
|
|
||||||
in
|
|
||||||
if builtins.hasAttr "dns" value.config.services.skynet
|
|
||||||
then
|
|
||||||
(
|
|
||||||
# got to handle habing a dns record for the dns serves themselves.
|
|
||||||
if details_server.enable
|
|
||||||
then
|
|
||||||
(
|
|
||||||
if details_server.primary
|
|
||||||
then
|
|
||||||
details_records
|
|
||||||
++ [
|
|
||||||
{
|
|
||||||
domain = "skynet.ie";
|
|
||||||
record = "ns1";
|
|
||||||
r_type = "A";
|
|
||||||
value = details_server.ip;
|
|
||||||
server = false;
|
|
||||||
}
|
|
||||||
]
|
|
||||||
else
|
|
||||||
details_records
|
|
||||||
++ [
|
|
||||||
{
|
|
||||||
domain = "skynet.ie";
|
|
||||||
record = "ns2";
|
|
||||||
r_type = "A";
|
|
||||||
value = details_server.ip;
|
|
||||||
server = false;
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
else details_records
|
|
||||||
)
|
|
||||||
else []
|
|
||||||
)
|
)
|
||||||
nodes
|
nodes
|
||||||
);
|
);
|
||||||
|
@ -327,6 +295,14 @@ in {
|
||||||
"ip daddr ${cfg.server.ip} udp dport 53 counter packets 0 bytes 0 accept"
|
"ip daddr ${cfg.server.ip} udp dport 53 counter packets 0 bytes 0 accept"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.skynet.dns.records = [
|
||||||
|
{
|
||||||
|
record = nameserver;
|
||||||
|
r_type = "A";
|
||||||
|
value = config.services.skynet.host.ip;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
services.bind.zones = lib.attrsets.mergeAttrsList (
|
services.bind.zones = lib.attrsets.mergeAttrsList (
|
||||||
# uses teh domains lsited in teh records
|
# uses teh domains lsited in teh records
|
||||||
(lib.lists.forEach domains (domain: (create_entry_zone domain)))
|
(lib.lists.forEach domains (domain: (create_entry_zone domain)))
|
||||||
|
|
Loading…
Reference in a new issue