nixos/whisparr: add settings option

This commit is contained in:
Felix Buehler
2025-02-24 18:50:08 +01:00
parent 7045b5061f
commit 22b311429f
+10 -1
View File
@@ -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 = {