5 nullConf = { services.adguardhome.enable = true; };
8 services.adguardhome = {
15 schemaVersionBefore23 = {
16 services.adguardhome = {
19 settings.schema_version = 20;
24 services.adguardhome = {
27 mutableSettings = false;
28 settings.dns.bootstrap_dns = [ "127.0.0.1" ];
33 services.adguardhome = {
36 mutableSettings = true;
37 settings.dns.bootstrap_dns = [ "127.0.0.1" ];
41 dhcpConf = { lib, ... }: {
42 virtualisation.vlans = [ 1 ];
45 # Configure static IP for DHCP server
47 interfaces."eth1" = lib.mkForce {
51 address = "10.0.10.1";
56 address = "10.0.10.0";
63 firewall.allowedUDPPorts = [ 67 68 ];
66 services.adguardhome = {
69 mutableSettings = false;
71 dns.bootstrap_dns = [ "127.0.0.1" ];
73 # This implicitly enables CAP_NET_RAW
75 interface_name = "eth1";
76 local_domain_name = "lan";
78 gateway_ip = "10.0.10.1";
79 range_start = "10.0.10.100";
80 range_end = "10.0.10.101";
81 subnet_mask = "255.255.255.0";
88 client = { lib, ... }: {
89 virtualisation.vlans = [ 1 ];
93 ipv4.addresses = lib.mkForce [ ];
100 with subtest("Minimal (settings = null) config test"):
101 nullConf.wait_for_unit("adguardhome.service")
102 nullConf.wait_for_open_port(3000)
104 with subtest("Default config test"):
105 emptyConf.wait_for_unit("adguardhome.service")
106 emptyConf.wait_for_open_port(3000)
108 with subtest("Default schema_version 23 config test"):
109 schemaVersionBefore23.wait_for_unit("adguardhome.service")
110 schemaVersionBefore23.wait_for_open_port(3000)
112 with subtest("Declarative config test, DNS will be reachable"):
113 declarativeConf.wait_for_unit("adguardhome.service")
114 declarativeConf.wait_for_open_port(53)
115 declarativeConf.wait_for_open_port(3000)
117 with subtest("Mixed config test, check whether merging works"):
118 mixedConf.wait_for_unit("adguardhome.service")
119 mixedConf.wait_for_open_port(53)
120 mixedConf.wait_for_open_port(3000)
121 # Test whether merging works properly, even if nothing is changed
122 mixedConf.systemctl("restart adguardhome.service")
123 mixedConf.wait_for_unit("adguardhome.service")
124 mixedConf.wait_for_open_port(3000)
126 with subtest("Testing successful DHCP start"):
127 dhcpConf.wait_for_unit("adguardhome.service")
128 client.systemctl("start network-online.target")
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")