fix: move dns configuration into module

This commit is contained in:
2025-11-17 10:32:57 -08:00
parent 9af0abc9f9
commit 1083ad8d40
4 changed files with 40 additions and 25 deletions

39
nix/modules/dns.nix Normal file
View File

@@ -0,0 +1,39 @@
{
lib,
config,
...
}:
{
options.dns = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "enable dns";
};
};
config = lib.mkIf config.dns.enable {
networking.networkmanager = {
enable = true;
dns = "systemd-resolved";
};
services.resolved = {
enable = true;
fallbackDns = [
"1.1.1.1"
"1.0.0.1"
];
domains = [
"consul"
"service.consul"
"node.consul"
];
extraConfig = ''
[Resolve]
DNS=192.168.20.5:8600
'';
};
};
}