nixos/adguardhome: Fix openFirewall
When not setting `settings` and setting `openFirewall = true` evaluation would fail because it tries to access `settings.bind_port` while `settings == null`
This commit is contained in:
parent
364ab12942
commit
20acd199f4
2 changed files with 3 additions and 3 deletions
|
@ -17,6 +17,7 @@ let
|
||||||
text = builtins.toJSON cfg.settings;
|
text = builtins.toJSON cfg.settings;
|
||||||
checkPhase = "${pkgs.adguardhome}/bin/adguardhome -c $out --check-config";
|
checkPhase = "${pkgs.adguardhome}/bin/adguardhome -c $out --check-config";
|
||||||
};
|
};
|
||||||
|
defaultBindPort = 3000;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -86,7 +87,7 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
bind_port = mkOption {
|
bind_port = mkOption {
|
||||||
default = 3000;
|
default = defaultBindPort;
|
||||||
type = port;
|
type = port;
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Port to serve HTTP pages on.
|
Port to serve HTTP pages on.
|
||||||
|
@ -169,6 +170,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.settings.bind_port ];
|
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.settings.bind_port or defaultBindPort ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
emptyConf = { lib, ... }: {
|
emptyConf = { lib, ... }: {
|
||||||
services.adguardhome = {
|
services.adguardhome = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue