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 <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-08-14 08:59:00 +02:00
parent 7ae88ec0f3
commit dba4f38d34
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951
2 changed files with 2 additions and 4 deletions

View File

@ -100,12 +100,10 @@ in
] ++ cfg.runtimePackages; ] ++ cfg.runtimePackages;
serviceConfig = { serviceConfig = {
Type = "oneshot";
User = "renovate"; User = "renovate";
Group = "renovate"; Group = "renovate";
DynamicUser = true; DynamicUser = true;
LoadCredential = lib.mapAttrsToList (name: value: "SECRET-${name}:${value}") cfg.credentials; LoadCredential = lib.mapAttrsToList (name: value: "SECRET-${name}:${value}") cfg.credentials;
RemainAfterExit = false;
Restart = "on-failure"; Restart = "on-failure";
CacheDirectory = "renovate"; CacheDirectory = "renovate";
StateDirectory = "renovate"; StateDirectory = "renovate";

View File

@ -58,12 +58,12 @@ import ./make-test-python.nix (
machine.succeed("git -C /tmp/kitty push origin") machine.succeed("git -C /tmp/kitty push origin")
machine.succeed(f"echo '{accessToken}' > /etc/renovate-token") 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 list --repo meow/kitty | grep 'Configure Renovate'")
machine.succeed("tea pulls merge --repo meow/kitty 1") machine.succeed("tea pulls merge --repo meow/kitty 1")
machine.systemctl("start renovate.service") machine.systemctl("start --wait renovate.service")
''; '';
} }
) )