Files
spacestation/abaduh/adguard.nix

57 lines
2.0 KiB
Nix
Raw Normal View History

2025-09-13 22:10:27 -03:00
{
config,
lib,
...
}:
with lib; let
cfg = config.services.adguardhome;
in {
2025-09-13 11:28:42 -03:00
enable = true;
openFirewall = true;
port = 8753;
settings = {
http = {address = "127.0.0.1:${toString port}";};
filtering = {
rewrites = mapAttrsToList (domain: answer: {inherit domain answer;}) {
"abaduh.local" = "100.86.139.22";
"*.abaduh.local" = "100.86.139.22";
};
};
2025-09-13 11:28:42 -03:00
filters =
2025-09-13 22:10:27 -03:00
imap (id: url: {
2025-09-13 11:28:42 -03:00
enabled = true;
2025-09-13 22:10:27 -03:00
inherit id url;
}) [
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/pro.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/hoster.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/doh-vpn-proxy-bypass.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/dyndns.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/gambling.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/native.lgwebos.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/hosts/native.tiktok.extended.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/native.winoffice.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/popupads.txt"
"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/tif.txt"
];
2025-09-13 11:28:42 -03:00
user_rules = [
2025-09-13 22:10:27 -03:00
"@@||neocities.org^$important"
2025-09-13 11:28:42 -03:00
"@@||tailscale.com^$important"
"@@||torproject.org^$important"
2025-09-13 22:10:27 -03:00
"@@||tumblr.com^$important"
"@@||wordpress.com^$important"
2025-09-13 11:28:42 -03:00
];
};
};
services.caddy.virtualHosts."adguard.abaduh.local" = {
extraConfig = ''
reverse_proxy http://localhost:${toString cfg.port}
tls internal
'';
};
2025-09-13 11:28:42 -03:00
# Ports needed to access the DNS resolver
networking.firewall.allowedTCPPorts = [53];
networking.firewall.allowedUDPPorts = [53 51820];
}