feat: standardise dns to using `services.skynet."${name}";
` format
This commit is contained in:
parent
75f0a17fcb
commit
023b491d89
32 changed files with 76 additions and 77 deletions
|
@ -39,7 +39,7 @@ in {
|
|||
domain
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = domain_sub;
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
nodes,
|
||||
...
|
||||
}: 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)
|
||||
current_date = lib.readFile "${pkgs.runCommand "timestamp" {} "echo -n `date +%s` > $out"}";
|
||||
|
@ -245,10 +246,10 @@
|
|||
++ builtins.concatLists (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
key: value: let
|
||||
details_server = value.config.skynet_dns.server;
|
||||
details_records = value.config.skynet_dns.records;
|
||||
details_server = value.config.services.skynet."${name}".server;
|
||||
details_records = value.config.services.skynet."${name}".records;
|
||||
in
|
||||
if builtins.hasAttr "skynet_dns" value.config
|
||||
if builtins.hasAttr "dns" value.config.services.skynet
|
||||
then
|
||||
(
|
||||
# got to handle habing a dns record for the dns serves themselves.
|
||||
|
@ -294,51 +295,49 @@ in {
|
|||
../config/dns.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
skynet_dns = {
|
||||
server = {
|
||||
enable = lib.mkEnableOption {
|
||||
default = false;
|
||||
description = "Skynet DNS server";
|
||||
type = lib.types.bool;
|
||||
};
|
||||
|
||||
primary = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
ip = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
ip of this server
|
||||
'';
|
||||
};
|
||||
options.services.skynet."${name}" = {
|
||||
server = {
|
||||
enable = lib.mkEnableOption {
|
||||
default = false;
|
||||
description = "Skynet DNS server";
|
||||
type = lib.types.bool;
|
||||
};
|
||||
|
||||
# mirrorred in ../config/dns.nix
|
||||
records = lib.mkOption {
|
||||
description = "Records, sorted based on therir type";
|
||||
type = with lib.types;
|
||||
listOf (submodule {
|
||||
options = {
|
||||
record = lib.mkOption {
|
||||
type = str;
|
||||
};
|
||||
r_type = lib.mkOption {
|
||||
type = enum ["A" "CNAME" "TXT" "PTR" "SRV" "MX"];
|
||||
};
|
||||
value = lib.mkOption {
|
||||
type = str;
|
||||
};
|
||||
server = lib.mkOption {
|
||||
description = "Core record for a server";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
primary = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
ip = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
ip of this server
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# mirrorred in ../config/dns.nix
|
||||
records = lib.mkOption {
|
||||
description = "Records, sorted based on therir type";
|
||||
type = with lib.types;
|
||||
listOf (submodule {
|
||||
options = {
|
||||
record = lib.mkOption {
|
||||
type = str;
|
||||
};
|
||||
});
|
||||
};
|
||||
r_type = lib.mkOption {
|
||||
type = enum ["A" "CNAME" "TXT" "PTR" "SRV" "MX"];
|
||||
};
|
||||
value = lib.mkOption {
|
||||
type = str;
|
||||
};
|
||||
server = lib.mkOption {
|
||||
description = "Core record for a server";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ in {
|
|||
};
|
||||
|
||||
# set up dns record for it
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
# basic one
|
||||
{
|
||||
record = "mail";
|
||||
|
|
|
@ -46,7 +46,7 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
# need a base domain
|
||||
{
|
||||
record = cfg.domain.sub;
|
||||
|
|
|
@ -62,7 +62,7 @@ in {
|
|||
"*.${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
# the minecraft (web) config server
|
||||
{
|
||||
record = "config.${cfg.domain.sub}";
|
||||
|
|
|
@ -106,7 +106,7 @@ in {
|
|||
];
|
||||
|
||||
# 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;
|
||||
r_type = "A";
|
||||
|
|
|
@ -37,7 +37,7 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = "${name}";
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -60,7 +60,7 @@ in {
|
|||
"${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = cfg.domain.sub;
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -83,7 +83,7 @@ in {
|
|||
domain
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = cfg.domain.sub;
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -59,7 +59,7 @@ in {
|
|||
"onlyoffice.${domain}"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = cfg.domain.sub;
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -44,7 +44,7 @@ in {
|
|||
"${name}.skynet.ie"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = "${name}";
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -33,7 +33,7 @@ in {
|
|||
"${name}.skynet.ie"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = "${name}";
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -35,7 +35,7 @@ in {
|
|||
"${name}.skynet.ie"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = "${name}";
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -33,7 +33,7 @@ in {
|
|||
"renew.skynet.ie"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
# means root domain, so skynet.ie
|
||||
{
|
||||
record = "@";
|
||||
|
|
|
@ -43,7 +43,7 @@ in {
|
|||
"*.users.skynet.ie"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = "users";
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -57,7 +57,7 @@ in {
|
|||
"${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = cfg.domain.sub;
|
||||
r_type = "CNAME";
|
||||
|
|
|
@ -31,7 +31,7 @@ in {
|
|||
tags = ["active-firewall"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -31,7 +31,7 @@ in {
|
|||
tags = ["active"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -39,7 +39,7 @@ in {
|
|||
};
|
||||
|
||||
# it has two network devices so two
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -32,7 +32,7 @@ in {
|
|||
};
|
||||
|
||||
# it has two network devices so two
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -32,7 +32,7 @@ in {
|
|||
tags = ["active"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -33,7 +33,7 @@ in {
|
|||
};
|
||||
|
||||
# add this server to dns
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -32,7 +32,7 @@ in {
|
|||
tags = ["active-gitlab"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -39,7 +39,7 @@ in {
|
|||
};
|
||||
|
||||
# add this server to dns
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -49,7 +49,7 @@ in {
|
|||
sudo_groups = groups;
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -44,7 +44,7 @@ in {
|
|||
tags = ["active-core"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -32,7 +32,7 @@ in {
|
|||
tags = ["active"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -39,7 +39,7 @@ in {
|
|||
"ip daddr ${ip_pub} udp dport 51820 counter packets 0 bytes 0 accept"
|
||||
];
|
||||
|
||||
skynet_dns.records = {
|
||||
services.skynet.dns.records = {
|
||||
external = [
|
||||
"${name} A ${ip_pub}"
|
||||
];
|
||||
|
|
|
@ -35,7 +35,7 @@ in {
|
|||
tags = ["active-ext"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
|
@ -52,7 +52,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
skynet_dns = {
|
||||
services.skynet.dns = {
|
||||
server = {
|
||||
enable = true;
|
||||
# primary dns server (ns1)
|
||||
|
|
|
@ -36,7 +36,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
skynet_dns = {
|
||||
services.skynet.dns = {
|
||||
server = {
|
||||
enable = true;
|
||||
# secondary dns server (ns2)
|
||||
|
|
|
@ -31,7 +31,7 @@ in {
|
|||
tags = ["active-gitlab"];
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
services.skynet.dns.records = [
|
||||
{
|
||||
record = name;
|
||||
r_type = "A";
|
||||
|
|
Loading…
Reference in a new issue