diff --git a/applications/dns.nix b/applications/dns.nix index deec46d..9bb7d48 100644 --- a/applications/dns.nix +++ b/applications/dns.nix @@ -316,28 +316,11 @@ in { }; }; - # 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; - }; - }; - }); + type = lib.types.listOf (lib.types.submodule (import ./dns/options-records.nix { + inherit lib; + })); }; }; diff --git a/applications/dns/options-records.nix b/applications/dns/options-records.nix new file mode 100644 index 0000000..1795099 --- /dev/null +++ b/applications/dns/options-records.nix @@ -0,0 +1,23 @@ +/* +Define the options for dns records here. +They are imported into anything that needs to use them +*/ +{lib, ...}: +with lib; { + options = { + record = lib.mkOption { + type = lib.types.str; + }; + r_type = lib.mkOption { + type = lib.types.enum ["A" "CNAME" "TXT" "PTR" "SRV" "MX"]; + }; + value = lib.mkOption { + type = lib.types.str; + }; + server = lib.mkOption { + description = "Core record for a server"; + type = lib.types.bool; + default = false; + }; + }; +} diff --git a/config/dns.nix b/config/dns.nix index ef07285..931a176 100644 --- a/config/dns.nix +++ b/config/dns.nix @@ -1,31 +1,12 @@ {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; - }; - }; - }); + type = lib.types.listOf (lib.types.submodule (import ../applications/dns/options-records.nix { + inherit lib; + })); }; config = {