feat: standardise dns to using `services.skynet."${name}";` format

This commit is contained in:
silver 2024-05-30 13:25:52 +01:00
parent 75f0a17fcb
commit 023b491d89
Signed by: silver
GPG key ID: 54E2C71918E93B74
32 changed files with 76 additions and 77 deletions

View file

@ -39,7 +39,7 @@ in {
domain domain
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = domain_sub; record = domain_sub;
r_type = "CNAME"; r_type = "CNAME";

View file

@ -5,7 +5,8 @@
nodes, nodes,
... ...
}: let }: let
cfg = config.skynet_dns; name = "dns";
cfg = config.services.skynet."${name}";
# reads that date to a string (will need to be fixed in 2038) # reads that date to a string (will need to be fixed in 2038)
current_date = lib.readFile "${pkgs.runCommand "timestamp" {} "echo -n `date +%s` > $out"}"; current_date = lib.readFile "${pkgs.runCommand "timestamp" {} "echo -n `date +%s` > $out"}";
@ -245,10 +246,10 @@
++ builtins.concatLists ( ++ builtins.concatLists (
lib.attrsets.mapAttrsToList ( lib.attrsets.mapAttrsToList (
key: value: let key: value: let
details_server = value.config.skynet_dns.server; details_server = value.config.services.skynet."${name}".server;
details_records = value.config.skynet_dns.records; details_records = value.config.services.skynet."${name}".records;
in in
if builtins.hasAttr "skynet_dns" value.config if builtins.hasAttr "dns" value.config.services.skynet
then then
( (
# got to handle habing a dns record for the dns serves themselves. # got to handle habing a dns record for the dns serves themselves.
@ -294,8 +295,7 @@ in {
../config/dns.nix ../config/dns.nix
]; ];
options = { options.services.skynet."${name}" = {
skynet_dns = {
server = { server = {
enable = lib.mkEnableOption { enable = lib.mkEnableOption {
default = false; default = false;
@ -340,7 +340,6 @@ in {
}); });
}; };
}; };
};
config = lib.mkIf cfg.server.enable { config = lib.mkIf cfg.server.enable {
# services.skynet_backup.normal.backups = ["/etc/skynet/dns"]; # services.skynet_backup.normal.backups = ["/etc/skynet/dns"];

View file

@ -285,7 +285,7 @@ in {
}; };
# set up dns record for it # set up dns record for it
skynet_dns.records = [ services.skynet.dns.records = [
# basic one # basic one
{ {
record = "mail"; record = "mail";

View file

@ -46,7 +46,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
skynet_dns.records = [ services.skynet.dns.records = [
# need a base domain # need a base domain
{ {
record = cfg.domain.sub; record = cfg.domain.sub;

View file

@ -62,7 +62,7 @@ in {
"*.${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}" "*.${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
# the minecraft (web) config server # the minecraft (web) config server
{ {
record = "config.${cfg.domain.sub}"; record = "config.${cfg.domain.sub}";

View file

@ -106,7 +106,7 @@ in {
]; ];
# using https://nixos.org/manual/nixos/stable/index.html#module-services-gitlab as a guide # using https://nixos.org/manual/nixos/stable/index.html#module-services-gitlab as a guide
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = cfg.domain.sub; record = cfg.domain.sub;
r_type = "A"; r_type = "A";

View file

@ -37,7 +37,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = "${name}"; record = "${name}";
r_type = "CNAME"; r_type = "CNAME";

View file

@ -60,7 +60,7 @@ in {
"${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}" "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = cfg.domain.sub; record = cfg.domain.sub;
r_type = "CNAME"; r_type = "CNAME";

View file

@ -83,7 +83,7 @@ in {
domain domain
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = cfg.domain.sub; record = cfg.domain.sub;
r_type = "CNAME"; r_type = "CNAME";

View file

@ -59,7 +59,7 @@ in {
"onlyoffice.${domain}" "onlyoffice.${domain}"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = cfg.domain.sub; record = cfg.domain.sub;
r_type = "CNAME"; r_type = "CNAME";

View file

@ -44,7 +44,7 @@ in {
"${name}.skynet.ie" "${name}.skynet.ie"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = "${name}"; record = "${name}";
r_type = "CNAME"; r_type = "CNAME";

View file

@ -33,7 +33,7 @@ in {
"${name}.skynet.ie" "${name}.skynet.ie"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = "${name}"; record = "${name}";
r_type = "CNAME"; r_type = "CNAME";

View file

@ -35,7 +35,7 @@ in {
"${name}.skynet.ie" "${name}.skynet.ie"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = "${name}"; record = "${name}";
r_type = "CNAME"; r_type = "CNAME";

View file

@ -33,7 +33,7 @@ in {
"renew.skynet.ie" "renew.skynet.ie"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
# means root domain, so skynet.ie # means root domain, so skynet.ie
{ {
record = "@"; record = "@";

View file

@ -43,7 +43,7 @@ in {
"*.users.skynet.ie" "*.users.skynet.ie"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = "users"; record = "users";
r_type = "CNAME"; r_type = "CNAME";

View file

@ -57,7 +57,7 @@ in {
"${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}" "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
]; ];
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = cfg.domain.sub; record = cfg.domain.sub;
r_type = "CNAME"; r_type = "CNAME";

View file

@ -31,7 +31,7 @@ in {
tags = ["active-firewall"]; tags = ["active-firewall"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -31,7 +31,7 @@ in {
tags = ["active"]; tags = ["active"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -39,7 +39,7 @@ in {
}; };
# it has two network devices so two # it has two network devices so two
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -32,7 +32,7 @@ in {
}; };
# it has two network devices so two # it has two network devices so two
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -32,7 +32,7 @@ in {
tags = ["active"]; tags = ["active"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -33,7 +33,7 @@ in {
}; };
# add this server to dns # add this server to dns
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -32,7 +32,7 @@ in {
tags = ["active-gitlab"]; tags = ["active-gitlab"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -39,7 +39,7 @@ in {
}; };
# add this server to dns # add this server to dns
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -49,7 +49,7 @@ in {
sudo_groups = groups; sudo_groups = groups;
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -44,7 +44,7 @@ in {
tags = ["active-core"]; tags = ["active-core"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -32,7 +32,7 @@ in {
tags = ["active"]; tags = ["active"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -39,7 +39,7 @@ in {
"ip daddr ${ip_pub} udp dport 51820 counter packets 0 bytes 0 accept" "ip daddr ${ip_pub} udp dport 51820 counter packets 0 bytes 0 accept"
]; ];
skynet_dns.records = { services.skynet.dns.records = {
external = [ external = [
"${name} A ${ip_pub}" "${name} A ${ip_pub}"
]; ];

View file

@ -35,7 +35,7 @@ in {
tags = ["active-ext"]; tags = ["active-ext"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";

View file

@ -52,7 +52,7 @@ in {
}; };
}; };
skynet_dns = { services.skynet.dns = {
server = { server = {
enable = true; enable = true;
# primary dns server (ns1) # primary dns server (ns1)

View file

@ -36,7 +36,7 @@ in {
}; };
}; };
skynet_dns = { services.skynet.dns = {
server = { server = {
enable = true; enable = true;
# secondary dns server (ns2) # secondary dns server (ns2)

View file

@ -31,7 +31,7 @@ in {
tags = ["active-gitlab"]; tags = ["active-gitlab"];
}; };
skynet_dns.records = [ services.skynet.dns.records = [
{ {
record = name; record = name;
r_type = "A"; r_type = "A";