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:
Florian Engel 2023-09-09 08:19:22 +02:00
parent 364ab12942
commit 20acd199f4
No known key found for this signature in database
GPG Key ID: 76762421D45837DE
2 changed files with 3 additions and 3 deletions

View File

@ -17,6 +17,7 @@ let
text = builtins.toJSON cfg.settings;
checkPhase = "${pkgs.adguardhome}/bin/adguardhome -c $out --check-config";
};
defaultBindPort = 3000;
in
{
@ -86,7 +87,7 @@ in
'';
};
bind_port = mkOption {
default = 3000;
default = defaultBindPort;
type = port;
description = lib.mdDoc ''
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 ];
};
}

View File

@ -7,7 +7,6 @@
emptyConf = { lib, ... }: {
services.adguardhome = {
enable = true;
settings = {};
};
};