From 0af96c20c64e955c337dd124a89bac35556f79e6 Mon Sep 17 00:00:00 2001 From: sajenim Date: Tue, 23 Jan 2024 09:44:06 +0800 Subject: [PATCH] migrate adguardhome to container --- nixos/viridian/containers/adguardhome.nix | 21 +++++++++++++++ nixos/viridian/services/adguardhome.nix | 31 ----------------------- 2 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 nixos/viridian/containers/adguardhome.nix delete mode 100644 nixos/viridian/services/adguardhome.nix diff --git a/nixos/viridian/containers/adguardhome.nix b/nixos/viridian/containers/adguardhome.nix new file mode 100644 index 0000000..264465a --- /dev/null +++ b/nixos/viridian/containers/adguardhome.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + virtualisation.oci-containers.containers = { + adguardhome = { + autoStart = true; + image = "adguard/adguardhome"; + ports = [ + "53:53" # Plain DNS + "3000:3000" # WEBGUI + ]; + volumes = [ + "/srv/containers/adguardhome/work:/opt/adguardhome/work" + "/srv/containers/adguardhome/conf:/opt/adguardhome/conf" + ]; + extraOptions = [ + "--network=host" + ]; + }; + }; +} diff --git a/nixos/viridian/services/adguardhome.nix b/nixos/viridian/services/adguardhome.nix deleted file mode 100644 index 41c7c3b..0000000 --- a/nixos/viridian/services/adguardhome.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ ... }: - -{ - # Privacy protection center - services.adguardhome = { - enable = true; - openFirewall = true; - settings = { - # Web interface IP address to listen on. - bind_port = 3000; - # Web interface IP port to listen on. - bind_host = "0.0.0.0"; - # Custom DNS responses - dns.rewrites = [ - { # LAN self-host domain - domain = "kanto.dev"; - answer = "192.168.1.102"; - } - { # Wildcard subdomains - domain = "*.kanto.dev"; - answer = "kanto.dev"; - } - ]; - }; - mutableSettings = true; - }; - environment.persistence."/persist" = { - directories = [ "/var/lib/AdGuardHome" ]; - }; -} -