From 0d991812f22e18aa9c7d4f138110bcca522c5645 Mon Sep 17 00:00:00 2001 From: Sean Kovacs Date: Sat, 21 Feb 2026 09:48:03 -0500 Subject: [PATCH] make systemd services more robust --- home/services/systemd.nix | 55 +++------------------------------------ home/tiling/wallpaper.nix | 5 ++-- 2 files changed, 7 insertions(+), 53 deletions(-) diff --git a/home/services/systemd.nix b/home/services/systemd.nix index 5dd3a94..5e1d681 100644 --- a/home/services/systemd.nix +++ b/home/services/systemd.nix @@ -28,16 +28,14 @@ Description = "Mount Synology NAS with Rclone and Home Manager."; After = [ "tailscaled.service" ]; Wants = [ "tailscaled.service" ]; + StartLimitBurst = 5; + StartLimitIntervalSec = "1m"; }; Service = { Type = "simple"; - # ExecStartPre = "${pkgs.writeShellScript "synology-prep" '' - # if mountpoint -q %h/Synology; then - # /run/wrappers/bin/fusermount -uz %h/Synology - # fi - # ${pkgs.coreutils}/bin/mkdir -p %h/Synology - # ''}"; + Restart = "on-failure"; + RestartSec = "1m"; ExecStart = "${pkgs.writeShellScript "synology-mount" '' #!/usr/bin/env bash set -euo pipefail @@ -65,49 +63,4 @@ WantedBy = [ "default.target" ]; }; }; - - # systemd.user.services.synology-prefill = { - # Unit = { - # Description = "Prefill Synology NAS rclone cache"; - # After = [ "synology-mount.service" ]; - # Wants = [ "synology-mount.service" ]; - # }; - - # Service = { - # Type = "simple"; - # ExecStart = "${pkgs.writeShellScript "synology-prefill" '' - # #!/usr/bin/env bash - # set -euo pipefail - # ${pkgs.rclone}/bin/rclone rc vfs/refresh -v --fast-list recursive=true >/dev/null - # ''}"; - # StandardOutput = "journal"; - # StandardError = "journal"; - # Restart = "on-failure"; - # }; - - # Install = { - # WantedBy = [ "default.target" ]; - # }; - # }; - - # systemd.user.services.input-leap = { - # Unit = { - # Description = "Autostart Input Leap"; - # After = [ "graphical-session.target" ]; - # }; - - # Service = { - # Type = "oneshot"; - # RemainAfterExit = true; - # PassEnvironment = "DISPLAY"; - # ExecStart = "${pkgs.writeShellScript "input-leap-start" '' - # sleep 5 - # ${pkgs.input-leap}/bin/input-leap - # ''}"; - # }; - - # Install = { - # WantedBy = [ "graphical-session.target" ]; - # }; - # }; } diff --git a/home/tiling/wallpaper.nix b/home/tiling/wallpaper.nix index 9482de3..095c163 100644 --- a/home/tiling/wallpaper.nix +++ b/home/tiling/wallpaper.nix @@ -26,10 +26,10 @@ systemd.user.services.bing-wallpaper = { Unit.Description = "Download and set Bing wallpaper of the day"; - Unit.StartLimitBurst = 5; + Unit.StartLimitBurst = 6; Unit.StartLimitIntervalSec = "10m"; Service.Restart = "on-failure"; - Service.RestartSec = "1m"; + Service.RestartSec = "10s"; Service.Type = "oneshot"; Service.ExecStart = pkgs.lib.getExe ( pkgs.writeShellApplication { @@ -68,6 +68,7 @@ } ); Service.ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart awww-setter.service"; + Install.WantedBy = [ "graphical-session.target" ]; }; systemd.user.timers.bing-wallpaper = {