refactor(adguard): update service configuration

Restructure AdGuard Home settings by nesting DNS-related options under a `dns` key.
Add `mutableSettings = false` for better NixOS management.
Update upstream and bootstrap DNS servers to Cloudflare and Quad9.
Adjust system nameservers for testing.
This commit is contained in:
2026-09-12 18:51:25 -04:00
parent d302102e32
commit 0f68834e25
+29 -52
View File
@@ -1,69 +1,46 @@
{ config, pkgs, ... }:
{
## ===== AdGuard Home =====
config,
pkgs,
...
}: {
services.adguardhome = {
enable = true;
# écoute uniquement en local (safe)
host = "127.0.0.1";
port = 3000;
# DNS local
mutableSettings = false; # régénère le YAML et nettoie les clés parasites
settings = {
host = "127.0.0.1";
port = 53;
# upstream DNS (rapide et clean)
upstream_dns = [
# "https://1.1.1.1/dns-query"
# "https://9.9.9.9/dns-query"
"127.0.0.1:53"
];
bootstrap_dns = [
"1.1.1.1"
"9.9.9.9"
];
## ===== PERF =====
cache_size = 4194304; # 4 MB
ratelimit = 0; # disable rate limit
blocked_response_ttl = 60;
## ===== LOGS (OFF) =====
querylog_enabled = false;
statistics_enabled = true;
statistics_interval = 24;
## ===== FILTRAGE =====
filtering_enabled = true;
dns = {
bind_hosts = ["127.0.0.1"];
port = 53;
upstream_dns = [
"https://dns.cloudflare.com/dns-query"
"https://dns.quad9.net/dns-query"
];
bootstrap_dns = ["1.1.1.1" "9.9.9.9"];
cache_size = 4194304;
ratelimit = 0;
blocked_response_ttl = 60;
protection_enabled = true;
filtering_enabled = true;
safe_search.enabled = false;
};
querylog.enabled = false;
statistics = {
enabled = true;
interval = "24h";
};
filters = [
{
enabled = true;
url = "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt";
name = "AdGuard DNS filter";
id = 1;
name = "AdGuard DNS filter";
url = "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt";
}
];
## ===== SAFE =====
protection_enabled = true;
safe_search = {
enabled = false;
};
};
};
## ===== DNS SYSTEME =====
networking.nameservers = [ "127.0.0.1" ];
## évite que resolvconf écrase le DNS
networking.nameservers = ["1.1.1.1"]; # bascule sur 127.0.0.1 après test
networking.networkmanager.dns = "none";
## firewall (DNS local uniquement)
networking.firewall.allowedTCPPorts = [ 3000 ];
networking.firewall.allowedUDPPorts = [ 53 ];
networking.firewall.allowedTCPPorts = [3000];
}