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 listOf
submodule submodule
nonEmptyStr nonEmptyStr
str
; ;
cfg = config.modules.server.navidrome; cfg = config.modules.server.navidrome;
in in
@ -45,6 +46,14 @@ in
}; };
}; };
settings = options.services.navidrome.settings; 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 { config = mkIf cfg.enable {
@ -54,6 +63,10 @@ in
options = cfg.library.source.options; options = cfg.library.source.options;
}; };
systemd.tmpfiles.rules = mkIf (cfg.library.type == "nfs") [
"d ${cfg.library.path} - ${config.services.navidrome.group} - -"
];
services.navidrome = { services.navidrome = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
@ -63,6 +76,7 @@ in
}; };
systemd.services.navidrome.serviceConfig = { systemd.services.navidrome.serviceConfig = {
Restart = cfg.restartPolicy;
EnvironmentFile = config.age.secrets.navidrome.path; EnvironmentFile = config.age.secrets.navidrome.path;
}; };
}; };