dns: better function for the etc files (basically using a nice wrapper)

This commit is contained in:
silver 2023-05-21 21:30:14 +01:00
parent c6b766bd65
commit f8f2f6fa15

View file

@ -125,10 +125,10 @@ let
# small function to tidy up the spam of the cache networks, would use teh subnet except all external traffic has the ip of teh router
create_cache_networks = (map (x: "193.1.99.${toString x}/32" ) (lib.lists.range 71 126) );
# standard function to create the etc file, pass in the text and domain and it makes it
create_entry_etc = domain: text: {
# Creates /etc/skynet/dns/domain
# standard function to create the etc file, pass in the text and domain and it makes it
create_entry_etc_sub = domain: text: {
# Creates /etc/skynet/dns/domain
"skynet/dns/${domain}" = {
user = "named";
group = "named";
@ -139,6 +139,15 @@ let
text = text;
};
};
# (text.owned "csn.ul.ie")
# standard function to create the etc file, pass in the text and domain and it makes it
create_entry_etc = domain: type:
if type == "owned" then
create_entry_etc_sub domain (text.owned domain)
else
{};
create_entry_zone = (domain: extraConfig: {
"${domain}" = {
@ -396,8 +405,8 @@ in {
environment.etc =
(create_entry_etc "csn.ul.ie" (text.owned "csn.ul.ie")) //
(create_entry_etc "skynet.ie" (text.owned "skynet.ie")) //
(create_entry_etc "csn.ul.ie" "owned") //
(create_entry_etc "skynet.ie" "owned") //
{
"dns_custom/dns_zone_99.1.193.in-addr.arpa" = {