aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/selfhost/adguard.nix
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-01-08 09:44:54 -0600
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-01-08 09:44:54 -0600
commit2702decc9470cf0f553eb957145bdcda9e95e0bc (patch)
tree5e49fadf94dfd39a766135efc9013851ef3e04f2 /modules/services/nixos/selfhost/adguard.nix
parent5474e411f4898b00014c1599bec4d26eb2741ad1 (diff)
clean up networking and selfhosted apps configuration
Diffstat (limited to 'modules/services/nixos/selfhost/adguard.nix')
-rw-r--r--modules/services/nixos/selfhost/adguard.nix80
1 files changed, 36 insertions, 44 deletions
diff --git a/modules/services/nixos/selfhost/adguard.nix b/modules/services/nixos/selfhost/adguard.nix
index eb77cf6..c5e93ee 100644
--- a/modules/services/nixos/selfhost/adguard.nix
+++ b/modules/services/nixos/selfhost/adguard.nix
@@ -4,52 +4,44 @@
...
}: let
cfg = config.collinux.services.selfhost.adguard;
-
- # tailscale constants (should be configured elsewhere)
- tailscaleIP = "100.69.180.89";
in
- lib.mkIf cfg.enable (lib.mkMerge [
- {
- services.adguardhome = {
- enable = true;
- port = 8001;
- mutableSettings = true;
- settings = {
- http = {
- pprof.enabled = false;
- address = "localhost:${toString config.services.adguardhome.port}";
- };
- users = []; # disable auth (only accessable over tailscale anyway)
- dns = {
- bind_hosts =
- [
- "127.0.0.1"
- ]
- ++ lib.optional config.collinux.services.networking.tailscale.enable tailscaleIP;
- upstream_dns = [
- "https://dns.quad9.net/dns-query"
- ];
- enable_dnssec = true;
- };
- tls.enabled = false;
- dhcp.enabled = false;
+ lib.mkIf cfg.enable {
+ services.adguardhome = {
+ enable = true;
+ port = cfg.port;
+ mutableSettings = true;
+ settings = {
+ http = {
+ pprof.enabled = false;
+ address = "localhost:${toString cfg.port}";
+ };
+ users = []; # disable auth (only accessable over tailscale anyway)
+ dns = {
+ bind_hosts = ["127.0.0.1" cfg.bind_host];
+ upstream_dns = ["https://dns.quad9.net/dns-query"];
+ enable_dnssec = true;
};
+ tls.enabled = false;
+ dhcp.enabled = false;
};
+ };
+
+ # disable systemd-resolved (https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#bindinuse)
+ services.resolved.extraConfig = lib.mkIf config.services.resolved.enable ''
+ DNS=127.0.0.1
+ DNSStubListener=no
+ '';
- # tailscale stuff
- # disable systemd-resolved (https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#bindinuse)
- services.resolved.extraConfig = lib.mkIf config.services.resolved.enable ''
- DNS=127.0.0.1
- DNSStubListener=no
+ services.caddy = lib.mkIf config.collinux.services.selfhost.caddy.enable {
+ virtualHosts.${cfg.root_url}.extraConfig = ''
+ ${
+ if config.collinux.services.networking.tailscale.enable
+ then "bind tailscale/adguard"
+ else ""
+ }
+ reverse_proxy localhost:${toString cfg.port}
'';
- }
- (lib.mkIf config.collinux.services.networking.tailscale.enable {
- services.tailscale.extraSetFlags = ["--accept-dns=false"]; # would create an infinite loop of dns lookups
- services.caddy = lib.mkIf config.collinux.services.selfhost.caddy.enable {
- virtualHosts."https://adguard.tail7cca06.ts.net".extraConfig = ''
- bind tailscale/adguard
- reverse_proxy ${config.services.adguardhome.settings.http.address}
- '';
- };
- })
- ])
+ };
+
+ services.tailscale.extraSetFlags = lib.optional config.collinux.services.networking.tailscale.enable "--accept-dns=false"; # would create an infinite loop of dns lookups
+ }