2022-06-09 17:43:22 +02:00
|
|
|
{
|
2022-01-17 01:39:27 +01:00
|
|
|
name = "adguardhome";
|
|
|
|
|
|
|
|
nodes = {
|
2022-10-30 18:34:01 +01:00
|
|
|
nullConf = { ... }: { services.adguardhome = { enable = true; }; };
|
|
|
|
|
|
|
|
emptyConf = { lib, ... }: {
|
|
|
|
services.adguardhome = {
|
|
|
|
enable = true;
|
|
|
|
settings = {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-01-17 01:39:27 +01:00
|
|
|
declarativeConf = { ... }: {
|
|
|
|
services.adguardhome = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
mutableSettings = false;
|
|
|
|
settings = {
|
2022-06-07 13:35:22 +02:00
|
|
|
schema_version = 0;
|
2022-01-17 01:39:27 +01:00
|
|
|
dns = {
|
|
|
|
bind_host = "0.0.0.0";
|
|
|
|
bootstrap_dns = "127.0.0.1";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
mixedConf = { ... }: {
|
|
|
|
services.adguardhome = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
mutableSettings = true;
|
|
|
|
settings = {
|
2022-06-07 13:35:22 +02:00
|
|
|
schema_version = 0;
|
2022-01-17 01:39:27 +01:00
|
|
|
dns = {
|
|
|
|
bind_host = "0.0.0.0";
|
|
|
|
bootstrap_dns = "127.0.0.1";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2022-10-30 18:34:01 +01:00
|
|
|
with subtest("Minimal (settings = null) config test"):
|
|
|
|
nullConf.wait_for_unit("adguardhome.service")
|
|
|
|
|
|
|
|
with subtest("Default config test"):
|
|
|
|
emptyConf.wait_for_unit("adguardhome.service")
|
|
|
|
emptyConf.wait_for_open_port(3000)
|
|
|
|
|
2022-01-17 01:39:27 +01:00
|
|
|
with subtest("Declarative config test, DNS will be reachable"):
|
|
|
|
declarativeConf.wait_for_unit("adguardhome.service")
|
|
|
|
declarativeConf.wait_for_open_port(53)
|
|
|
|
declarativeConf.wait_for_open_port(3000)
|
|
|
|
|
|
|
|
with subtest("Mixed config test, check whether merging works"):
|
|
|
|
mixedConf.wait_for_unit("adguardhome.service")
|
|
|
|
mixedConf.wait_for_open_port(53)
|
|
|
|
mixedConf.wait_for_open_port(3000)
|
|
|
|
# Test whether merging works properly, even if nothing is changed
|
|
|
|
mixedConf.systemctl("restart adguardhome.service")
|
|
|
|
mixedConf.wait_for_unit("adguardhome.service")
|
|
|
|
mixedConf.wait_for_open_port(3000)
|
|
|
|
'';
|
|
|
|
}
|