diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9d6ad4..4d7684a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -78,6 +78,7 @@ sync_repos: - secrets/**/* - flake.* - .gitlab-ci.yml + - config/**/* # deploy items only run on main .deploy_template: &deployment @@ -92,6 +93,7 @@ sync_repos: - applications/**/* - machines/**/* - secrets/**/* + - config/**/* linter: <<: *builder @@ -152,4 +154,4 @@ deploy_gitlab: stage: deploy_gitlab script: - colmena apply -v --on @active-gitlab - when: manual \ No newline at end of file + when: manual diff --git a/applications/dns.nix b/applications/dns.nix index 973b956..b912991 100644 --- a/applications/dns.nix +++ b/applications/dns.nix @@ -240,47 +240,49 @@ old = ""; }; - records = builtins.concatLists ( - lib.attrsets.mapAttrsToList ( - key: value: let - details_server = value.config.skynet_dns.server; - details_records = value.config.skynet_dns.records; - in - if builtins.hasAttr "skynet_dns" value.config - 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 - ++ [ - { - record = "ns1"; - r_type = "A"; - value = details_server.ip; - server = false; - } - ] - else - details_records - ++ [ - { - record = "ns2"; - r_type = "A"; - value = details_server.ip; - server = false; - } - ] - ) - else details_records - ) - else [] - ) - nodes - ); + records = + config.skynet.records + ++ builtins.concatLists ( + lib.attrsets.mapAttrsToList ( + key: value: let + details_server = value.config.skynet_dns.server; + details_records = value.config.skynet_dns.records; + in + if builtins.hasAttr "skynet_dns" value.config + 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 + ++ [ + { + record = "ns1"; + r_type = "A"; + value = details_server.ip; + server = false; + } + ] + else + details_records + ++ [ + { + record = "ns2"; + r_type = "A"; + value = details_server.ip; + server = false; + } + ] + ) + else details_records + ) + else [] + ) + nodes + ); nameserver = if cfg.server.primary @@ -288,7 +290,8 @@ else "ns2"; in { imports = [ - ../applications/firewall.nix + ./firewall.nix + ../config/dns.nix ]; options = { @@ -313,6 +316,7 @@ in { }; }; + # mirrorred in ../config/dns.nix records = lib.mkOption { description = "Records, sorted based on therir type"; type = with lib.types; diff --git a/config/dns.nix b/config/dns.nix new file mode 100644 index 0000000..b64c2c3 --- /dev/null +++ b/config/dns.nix @@ -0,0 +1,57 @@ +{lib, ...}: { + imports = [ + # Paths to other modules. + # Compose this module out of smaller ones. + ]; + + # this needs to mirror ../applications/dns.nix + options.skynet.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; + }; + }; + }); + }; + + config = { + skynet.records = [ + { + record = "optimus-reborn"; + r_type = "A"; + value = "193.1.99.90"; + server = true; + } + { + record = "panel.games"; + r_type = "CNAME"; + value = "optimus-reborn"; + } + #{ + # record = "bumblebee"; + # r_type = "A"; + # value = "193.1.99.91"; + # server = true; + #} + #{ + # record = "testing"; + # r_type = "CNAME"; + # value = "bumblebee"; + #} + ]; + }; +}