lib/dns: add extraRecords

This commit is contained in:
Astro 2021-11-10 20:12:45 +01:00
parent f14c6ff200
commit 01f37cec9f
3 changed files with 24 additions and 5 deletions

View File

@ -159,7 +159,24 @@ let
domainName = mkOption {
description = "Domain name option";
type = types.str;
default = "${name}.zentralwerk.dn42";
default = "${name}.zentralwerk.org";
};
extraRecords = mkOption {
type = with types; listOf (submodule {
options = {
name = mkOption {
type = str;
};
type = mkOption {
type = enum [ "A" "AAAA" "MX" "SRV" "CNAME" "TXT" ];
};
data = mkOption {
type = str;
};
};
});
default = [];
description = "Extraneous DNS records";
};
dynamicDomain = mkOption {
type = types.bool;

View File

@ -174,19 +174,21 @@ rec {
} ];
} ] ++ builtins.concatLists (
builtins.attrValues (
builtins.mapAttrs (net: { dynamicDomain, hosts4, hosts6, ... }: [
builtins.mapAttrs (net: { dynamicDomain, hosts4, hosts6, extraRecords, ... }: [
{
name = "${net}.zentralwerk.dn42";
ns = internalNS;
records =
lib.optionals (hosts6 ? dn42) (hosts6Records hosts6.dn42);
lib.optionals (hosts6 ? dn42) (hosts6Records hosts6.dn42) ++
extraRecords;
}
{
name = "${net}.zentralwerk.org";
ns = publicNS;
records =
hosts4Records hosts4 ++
lib.optionals (hosts6 ? up4) (hosts6Records hosts6.up4);
lib.optionals (hosts6 ? up4) (hosts6Records hosts6.up4) ++
extraRecords;
dynamic = dynamicDomain;
}
]) namedNets

View File

@ -39,7 +39,7 @@ in
type = types.str;
};
type = mkOption {
type = types.enum [ "A" "AAAA" "PTR" ];
type = types.enum [ "A" "AAAA" "MX" "SRV" "CNAME" "TXT" "PTR" ];
};
data = mkOption {
type = types.str;