From 22b311429ffb62adce41826d084e6bccae007209 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Fri, 21 Feb 2025 22:42:51 +0100 Subject: [PATCH] nixos/whisparr: add settings option --- nixos/modules/services/misc/whisparr.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/whisparr.nix b/nixos/modules/services/misc/whisparr.nix index bf15ee70fde4..02db788fc3ae 100644 --- a/nixos/modules/services/misc/whisparr.nix +++ b/nixos/modules/services/misc/whisparr.nix @@ -7,6 +7,7 @@ let cfg = config.services.whisparr; + servarr = import ./servarr/settings-options.nix { inherit lib pkgs; }; in { options = { @@ -27,6 +28,10 @@ in description = "Open ports in the firewall for the Whisparr web interface."; }; + settings = servarr.mkServarrSettingsOptions "whisparr" 6969; + + environmentFiles = servarr.mkServarrEnvironmentFiles "whisparr"; + user = lib.mkOption { type = lib.types.str; default = "whisparr"; @@ -48,17 +53,21 @@ in description = "Whisparr"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; + environment = servarr.mkServarrSettingsEnvVars "WHISPARR" cfg.settings; serviceConfig = { Type = "simple"; User = cfg.user; Group = cfg.group; + EnvironmentFile = cfg.environmentFiles; ExecStart = "${lib.getExe cfg.package} -nobrowser -data='${cfg.dataDir}'"; Restart = "on-failure"; }; }; - networking.firewall = lib.mkIf cfg.openFirewall { allowedTCPPorts = [ 6969 ]; }; + networking.firewall = lib.mkIf cfg.openFirewall { + allowedTCPPorts = [ cfg.settings.server.port ]; + }; users.users = lib.mkIf (cfg.user == "whisparr") { whisparr = {