feat: unify the record options
This commit is contained in:
parent
9fb45cba7e
commit
b1bd6ca40a
3 changed files with 29 additions and 42 deletions
|
@ -316,28 +316,11 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# mirrorred in ../config/dns.nix
|
|
||||||
records = lib.mkOption {
|
records = lib.mkOption {
|
||||||
description = "Records, sorted based on therir type";
|
description = "Records, sorted based on therir type";
|
||||||
type = with lib.types;
|
type = lib.types.listOf (lib.types.submodule (import ./dns/options-records.nix {
|
||||||
listOf (submodule {
|
inherit lib;
|
||||||
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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
23
applications/dns/options-records.nix
Normal file
23
applications/dns/options-records.nix
Normal file
|
@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,31 +1,12 @@
|
||||||
{lib, ...}: {
|
{lib, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
# Paths to other modules.
|
|
||||||
# Compose this module out of smaller ones.
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# this needs to mirror ../applications/dns.nix
|
|
||||||
options.skynet.records = lib.mkOption {
|
options.skynet.records = lib.mkOption {
|
||||||
description = "Records, sorted based on therir type";
|
description = "Records, sorted based on therir type";
|
||||||
type = with lib.types;
|
type = lib.types.listOf (lib.types.submodule (import ../applications/dns/options-records.nix {
|
||||||
listOf (submodule {
|
inherit lib;
|
||||||
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 = {
|
config = {
|
||||||
|
|
Loading…
Reference in a new issue