From dba4f38d34c801052143c71fe772cde4e17b2330 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Wed, 14 Aug 2024 08:59:00 +0200 Subject: [PATCH] nixos/renovate: set service type to simple By setting `Type=oneshot` for longer running services like Renovate, the unit remains in the `activating` state during the whole lifetime of the main process. This is probably desirable for short scripts/programs that run setup tasks for other services, like setting up network interfaces. In those cases one can also make use of `RemainAfterExit` to treat the service as `active` once the main process exits. In the case of Renovate we do not make use of `RemainAfterExit` and we have a longer running task, so `Type=simple` works better here. Signed-off-by: Sefa Eyeoglu --- nixos/modules/services/misc/renovate.nix | 2 -- nixos/tests/renovate.nix | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/misc/renovate.nix b/nixos/modules/services/misc/renovate.nix index 9062b7424b68..9fbd8ec9e1ac 100644 --- a/nixos/modules/services/misc/renovate.nix +++ b/nixos/modules/services/misc/renovate.nix @@ -100,12 +100,10 @@ in ] ++ cfg.runtimePackages; serviceConfig = { - Type = "oneshot"; User = "renovate"; Group = "renovate"; DynamicUser = true; LoadCredential = lib.mapAttrsToList (name: value: "SECRET-${name}:${value}") cfg.credentials; - RemainAfterExit = false; Restart = "on-failure"; CacheDirectory = "renovate"; StateDirectory = "renovate"; diff --git a/nixos/tests/renovate.nix b/nixos/tests/renovate.nix index a30b5b3d60b9..deaac4faa5ce 100644 --- a/nixos/tests/renovate.nix +++ b/nixos/tests/renovate.nix @@ -58,12 +58,12 @@ import ./make-test-python.nix ( machine.succeed("git -C /tmp/kitty push origin") machine.succeed(f"echo '{accessToken}' > /etc/renovate-token") - machine.systemctl("start renovate.service") + machine.systemctl("start --wait renovate.service") machine.succeed("tea pulls list --repo meow/kitty | grep 'Configure Renovate'") machine.succeed("tea pulls merge --repo meow/kitty 1") - machine.systemctl("start renovate.service") + machine.systemctl("start --wait renovate.service") ''; } )