clanService/headscale: adjust magic dns settings

This commit is contained in:
2026-09-03 17:17:36 +07:00
parent 37ff958560
commit 9403ddbf08
2 changed files with 76 additions and 23 deletions
+21 -6
View File
@@ -320,13 +320,28 @@
};
roles.server.machines."alasia".settings = {
public_url = "tailvpn.public.newedge.house";
base_domain = "tailnet.newedge.house";
advertise_routes = [ "10.0.10.0/24" ];
nameservers = [
"10.0.10.82"
"1.1.1.1"
"8.8.8.8"
];
dns = {
magic_dns = true;
base_domain = "tailvpn.newedge.house";
nameservers = [
"10.0.10.82"
"1.1.1.1"
"8.8.8.8"
];
extra_records = [
{
name = "poyerp.newedge.house";
type = "A";
value = "10.0.10.1";
}
{
name = "glomerp.newedge.house";
type = "A";
value = "10.0.10.1";
}
];
};
};
};
+55 -17
View File
@@ -19,12 +19,6 @@
description = "Public URL for accessing the instance";
};
base_domain = lib.mkOption {
type = with lib.types; str;
default = "";
description = "Defines the base domain to create the hostnames for MagicDNS in Headscale. `base_domain` must be a FQDN, without the trailing dot. The FQDN of the hosts will be `hostname.base_domain (e.g. myhost.tailnet.example.com)";
};
advertise_routes = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
@@ -32,14 +26,57 @@
example = [ "192.168.1.0/24" ];
};
nameservers = lib.mkOption {
type = with lib.types; listOf str;
default = [
"1.1.1.1"
"8.8.8.8"
];
description = "List of nameservers to pass to Tailscale clients";
example = [ "10.0.10.1" ];
dns = {
base_domain = lib.mkOption {
type = with lib.types; str;
default = "";
description = "Defines the base domain to create the hostnames for MagicDNS in Headscale. `base_domain` must be a FQDN, without the trailing dot. The FQDN of the hosts will be `hostname.base_domain (e.g. myhost.tailnet.example.com)";
};
nameservers = lib.mkOption {
type = with lib.types; listOf str;
default = [
"1.1.1.1"
"8.8.8.8"
];
description = "List of nameservers to pass to Tailscale clients";
example = [ "10.0.10.1" ];
};
magic_dns = lib.mkOption {
type = with lib.types; bool;
default = true;
description = "Whether to enable MagicDNS";
};
extra_records = lib.mkOption {
type =
with lib.types;
nullOr (
listOf (submodule {
options = {
name = lib.mkOption {
type = lib.types.str;
description = "DNS record name.";
example = "grafana.tailnet.example.com";
};
type = lib.mkOption {
type = lib.types.enum [
"A"
"AAAA"
];
description = "DNS record type.";
example = "A";
};
value = lib.mkOption {
type = lib.types.str;
description = "DNS record value (IP address).";
example = "100.64.0.3";
};
};
})
);
};
};
};
};
@@ -170,10 +207,11 @@
settings.server_url = "https://${settings.public_url}";
settings.dns = {
base_domain = settings.base_domain;
base_domain = settings.dns.base_domain;
override_local_dns = true;
nameservers.global = settings.nameservers;
magic_dns = false;
nameservers.global = settings.dns.nameservers;
magic_dns = settings.dns.magic_dns;
extra_records = settings.dns.extra_records;
};
};