From 2a7a774d4ee2b8823d0e460bb1c897e6c1f53130 Mon Sep 17 00:00:00 2001 From: Nydragon Date: Mon, 7 Oct 2024 18:38:39 +0200 Subject: [PATCH] feat(navidrome): add restart policy --- options/server/navidrome.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/options/server/navidrome.nix b/options/server/navidrome.nix index 6225fcf..424f8d3 100644 --- a/options/server/navidrome.nix +++ b/options/server/navidrome.nix @@ -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; }; };