feat(navidrome): add restart policy

This commit is contained in:
Nydragon 2024-10-07 18:38:39 +02:00
parent db93d95ea4
commit 2a7a774d4e
Signed by: nydragon
SSH key fingerprint: SHA256:iQnIC12spf4QjWSbarmkD2No1cLMlu6TWoV7K6cYF5g

View file

@ -11,6 +11,7 @@ let
listOf
submodule
nonEmptyStr
str
;
cfg = config.modules.server.navidrome;
in
@ -45,6 +46,14 @@ in
};
};
settings = options.services.navidrome.settings;
restartPolicy = mkOption {
type = str;
default = "on-failure";
defaultText = ''
Refer to https://www.mankier.com/5/systemd.service#Options-Restart for possible values,
defines the restart behaviour in case the program ends.
'';
};
};
config = mkIf cfg.enable {
@ -54,6 +63,10 @@ in
options = cfg.library.source.options;
};
systemd.tmpfiles.rules = mkIf (cfg.library.type == "nfs") [
"d ${cfg.library.path} - ${config.services.navidrome.group} - -"
];
services.navidrome = {
enable = true;
openFirewall = true;
@ -63,6 +76,7 @@ in
};
systemd.services.navidrome.serviceConfig = {
Restart = cfg.restartPolicy;
EnvironmentFile = config.age.secrets.navidrome.path;
};
};