5 nullConf = { ... }: { services.adguardhome = { enable = true; }; };
7 emptyConf = { lib, ... }: {
8 services.adguardhome = {
13 declarativeConf = { ... }: {
14 services.adguardhome = {
17 mutableSettings = false;
21 bind_host = "0.0.0.0";
22 bootstrap_dns = "127.0.0.1";
28 mixedConf = { ... }: {
29 services.adguardhome = {
32 mutableSettings = true;
36 bind_host = "0.0.0.0";
37 bootstrap_dns = "127.0.0.1";
43 dhcpConf = { lib, ... }: {
44 virtualisation.vlans = [ 1 ];
47 # Configure static IP for DHCP server
49 interfaces."eth1" = lib.mkForce {
53 address = "10.0.10.1";
58 address = "10.0.10.0";
65 firewall.allowedUDPPorts = [ 67 68 ];
68 services.adguardhome = {
71 mutableSettings = false;
75 bind_host = "0.0.0.0";
76 bootstrap_dns = "127.0.0.1";
79 # This implicitly enables CAP_NET_RAW
81 interface_name = "eth1";
82 local_domain_name = "lan";
84 gateway_ip = "10.0.10.1";
85 range_start = "10.0.10.100";
86 range_end = "10.0.10.101";
87 subnet_mask = "255.255.255.0";
94 client = { lib, ... }: {
95 virtualisation.vlans = [ 1 ];
99 ipv4.addresses = lib.mkForce [ ];
106 with subtest("Minimal (settings = null) config test"):
107 nullConf.wait_for_unit("adguardhome.service")
109 with subtest("Default config test"):
110 emptyConf.wait_for_unit("adguardhome.service")
111 emptyConf.wait_for_open_port(3000)
113 with subtest("Declarative config test, DNS will be reachable"):
114 declarativeConf.wait_for_unit("adguardhome.service")
115 declarativeConf.wait_for_open_port(53)
116 declarativeConf.wait_for_open_port(3000)
118 with subtest("Mixed config test, check whether merging works"):
119 mixedConf.wait_for_unit("adguardhome.service")
120 mixedConf.wait_for_open_port(53)
121 mixedConf.wait_for_open_port(3000)
122 # Test whether merging works properly, even if nothing is changed
123 mixedConf.systemctl("restart adguardhome.service")
124 mixedConf.wait_for_unit("adguardhome.service")
125 mixedConf.wait_for_open_port(3000)
127 with subtest("Testing successful DHCP start"):
128 dhcpConf.wait_for_unit("adguardhome.service")
129 client.wait_for_unit("network-online.target")
130 # Test IP assignment via DHCP
131 dhcpConf.wait_until_succeeds("ping -c 5 10.0.10.100")
132 # Test hostname resolution over DHCP-provided DNS
133 dhcpConf.wait_until_succeeds("ping -c 5 client.lan")