feat: figured out how to share types across files
This commit is contained in:
parent
106485a754
commit
ed43da872c
3 changed files with 29 additions and 41 deletions
19
_types/dns_object.nix
Normal file
19
_types/dns_object.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{lib, ...}:
|
||||
with lib; {
|
||||
options = {
|
||||
record = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
r_type = mkOption {
|
||||
type = types.enum ["A" "CNAME" "TXT" "PTR" "SRV" "MX"];
|
||||
};
|
||||
value = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
server = mkOption {
|
||||
description = "Core record for a server";
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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 ../_types/dns_object.nix {
|
||||
inherit lib;
|
||||
}));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -5,27 +5,13 @@
|
|||
];
|
||||
|
||||
# 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;
|
||||
};
|
||||
};
|
||||
});
|
||||
options.skynet = {
|
||||
records = lib.mkOption {
|
||||
description = "Records, sorted based on therir type";
|
||||
type = lib.types.listOf (lib.types.submodule (import ../_types/dns_object.nix {
|
||||
inherit lib;
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
|
|
Loading…
Reference in a new issue