architect: switch to nextdns

This commit is contained in:
Giulio De Pasquale 2023-05-28 06:22:56 +02:00
parent 84df2e348d
commit 229e92222e

View File

@ -1,18 +1,40 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
adguard_webui_port = 3031; adguard_dns_port = 5300;
adguard_dns_port = "5300"; domain = "adguard.architect.devs.giugl.io";
dnscrypt_listen_port = "5353";
utilities = import ./utilities.nix { inherit lib config; };
inherit (utilities) architectInterfaceAddress;
in in
{ {
architect.firewall.openUDPVPN = [ 53 ]; architect.firewall.openUDPVPN = [ 53 ];
networking.extraHosts = ''
${architectInterfaceAddress "lan"} ${domain}
${architectInterfaceAddress "wireguard"} ${domain}
${architectInterfaceAddress "tailscale"} ${domain}
'';
services = { services = {
nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
extraConfig = ''
allow ${config.architect.networks.lan.net};
allow ${config.architect.networks.tailscale.net};
deny all;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.adguardhome.port}";
};
};
dnsmasq = { dnsmasq = {
enable = true; enable = true;
# adguard port # adguard port
servers = [ "127.0.0.1#${adguard_dns_port}" ]; servers = [ "127.0.0.1#${toString adguard_dns_port}" ];
extraConfig = '' extraConfig = ''
localise-queries localise-queries
min-cache-ttl=120 min-cache-ttl=120
@ -27,28 +49,7 @@ in
adguardhome = { adguardhome = {
enable = true; enable = true;
port = adguard_webui_port; port = 5353;
};
dnscrypt-proxy2 = {
enable = true;
settings = {
listen_addresses = [ "127.0.0.1:${dnscrypt_listen_port}" ];
ipv4_servers = true;
ipv6_servers = false;
block_ipv6 = true;
dnscrypt_servers = true;
doh_servers = true;
require_nolog = true;
require_nofilter = true;
timeout = 350;
lb_strategy = "p4";
lb_estimator = true;
ignore_system_dns = true;
fallback_resolvers = [ "1.1.1.1:53" "9.9.9.9:53" ];
cache_min_ttl = 450;
cache_max_ttl = 2400;
};
}; };
}; };
} }