From e986e2bb94e959b87bb3f020514aebfce233db07 Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Tue, 21 Jan 2025 16:58:08 -0500 Subject: [PATCH] flake.nix: Restart forever, with backoff timer (#14) RestartSteps and RestartMaxDelaySec were introduced in systemd 254: https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#RestartSteps= --- flake.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 013ed41..d73ae44 100644 --- a/flake.nix +++ b/flake.nix @@ -111,9 +111,16 @@ after = ["tailscaled.service"]; wants = ["tailscaled.service"]; wantedBy = ["multi-user.target"]; + # Never give up on trying to restart + startLimitIntervalSec = 0; serviceConfig = { Type = "exec"; - Restart = "on-failure"; + Restart = "always"; + # Restart at increasing intervals to avoid things like EC2 + # metadata service rate limits + RestartSec = 1; + RestartSteps = 30; + RestartMaxDelaySec = 60; ExecStart = lib.escapeShellArgs ( [ "${cfg.package}/bin/tailscale-manager" configFile "--tailscale=${config.services.tailscale.package}/bin/tailscale"