Kaynağa Gözat

feat(odin): added adguard home

Zander Hawke 9 ay önce
ebeveyn
işleme
7acdf57c4b

+ 77 - 0
hosts/odin/services/adguard.nix

@@ -0,0 +1,77 @@
+{ config, ... }:
+let
+  cfg = config.services.adguardhome;
+in
+{
+  services.adguardhome = {
+    enable = true;
+    settings = {
+      dns.cache_enabled = true;
+      dns.upstream_mode = "parallel";
+      dns.upstream_dns = [
+        "tls://security.cloudflare-dns.com"
+        "tls://one.one.one.one"
+        "tls://dns.google"
+        "tls://dns.quad9.net"
+        "tls://dns.digitale-gesellschaft.ch"
+        "tls://child-noads.joindns4.eu"
+      ];
+
+      filters = [
+        {
+          url = "https://github.com/AdguardTeam/FiltersRegistry/raw/refs/heads/master/filters/filter_2_Base/filter.txt";
+          name = "AdGuard Base";
+          enabled = true;
+        }
+        {
+          url = "https://github.com/AdguardTeam/FiltersRegistry/raw/refs/heads/master/filters/filter_3_Spyware/filter.txt";
+          name = "AdGuard Spyware";
+          enabled = true;
+        }
+        {
+          url = "https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_17_TrackParam/filter.txt";
+          name = "AdGuard URL Tracking";
+          enabled = true;
+        }
+        {
+          url = "https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/refs/heads/master/filters/filter_4_Social/filter.txt";
+          name = "AdGuard Social";
+          enabled = true;
+        }
+        {
+          url = "https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_14_Annoyances/filter.txt";
+          name = "AdGuard Annoyances";
+          enabled = true;
+        }
+        {
+          url = "https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_11_Mobile/filter.txt";
+          name = "AdGuard Mobile";
+          enabled = true;
+        }
+        {
+          url = "https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_6_German/filter.txt";
+          name = "AdGuard German";
+          enabled = true;
+        }
+        {
+          url = "https://easylist.to/easylist/easyprivacy.txt";
+          name = "EasyPrivacy";
+          enabled = true;
+        }
+        {
+          url = "https://raw.githubusercontent.com/uBlockOrigin/uAssets/refs/heads/master/filters/filters.txt";
+          name = "uBlockOrigin";
+          enabled = true;
+        }
+      ];
+    };
+  };
+
+  services.caddy.virtualHosts.adguard = {
+    hostName = "adguard.{$DOMAIN}";
+    extraConfig = ''
+      encode gzip zstd
+      reverse_proxy ${cfg.host}:${toString cfg.port}
+    '';
+  };
+}

+ 2 - 2
hosts/odin/services/caddy.nix

@@ -2,13 +2,13 @@
 {
   services.caddy = {
     enable = true;
+
     package = pkgs.caddy.withPlugins {
       plugins = [ "github.com/caddy-dns/[email protected]" ];
       hash = "sha256-p9AIi6MSWm0umUB83HPQoU8SyPkX5pMx989zAi8d/74=";
     };
+
     environmentFile = config.age.secrets."odin/services/caddy".path;
-    # TODO: set to null for production
-    acmeCA = "https://acme-staging-v02.api.letsencrypt.org/directory";
     globalConfig = ''
       acme_dns cloudflare {env.CF_API_TOKEN}
     '';

+ 1 - 0
hosts/odin/services/default.nix

@@ -2,6 +2,7 @@
 
 {
   imports = [
+    ./adguard.nix
     ./caddy.nix
     ./snapraid.nix
     ./tailscale.nix