1
Fork 0
satellite/dns/implementation/nixos-module.nix

77 lines
2 KiB
Nix
Raw Normal View History

2024-10-11 14:11:52 +02:00
{
config,
pkgs,
lib,
...
}:
2024-07-08 03:06:27 +02:00
let
format = pkgs.formats.yaml { };
cfg = config.satellite.dns;
in
{
options.satellite.dns = {
domain = lib.mkOption {
description = "Default zone to include records in";
type = lib.types.str;
};
records = lib.mkOption {
description = "List of records to create";
default = [ ];
2024-10-11 14:11:52 +02:00
type = lib.types.listOf (
lib.types.submodule (
{ config, ... }:
{
options = {
at = lib.mkOption {
description = "Subdomain to use for entry";
type = lib.types.nullOr lib.types.str;
};
zone = lib.mkOption {
description = "Zone this record is a part of";
type = lib.types.str;
default = cfg.domain;
};
type = lib.mkOption {
type = lib.types.enum [
"A"
"AAAA"
"TXT"
"CNAME"
"MX"
];
description = "The type of the DNS record";
};
to = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Shorthand for CNMAE-ing to a subdomain of the given zone";
default = null;
};
value = lib.mkOption {
type = format.type;
description = "The value assigned to the record, in octodns format";
};
ttl = lib.mkOption {
type = lib.types.int;
description = "The TTL assigned to the record";
default = 300;
};
enableCloudflareProxy = lib.mkEnableOption "proxying using cloudflare";
};
config.value = lib.mkIf (
config.type == "CNAME" && config.to != null
) "${config.to}.${config.zone}.";
}
)
);
2024-07-08 03:06:27 +02:00
};
};
}