From 50e582b9f91e409ffd2e134017445d376659b32e Mon Sep 17 00:00:00 2001 From: 9p4 Date: Sat, 11 Nov 2023 19:13:38 -0500 Subject: [PATCH] swayidle: always restart systemd unit on failure Occasionally, swayidle crashes with a failure to connect to the Wayland session. Ideally, swayidle should automatically restart instead of leaving the system in a vulnerable state. --- modules/services/swayidle.nix | 1 + tests/modules/services/swayidle/basic-configuration.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/services/swayidle.nix b/modules/services/swayidle.nix index 5fdc95262..54bc5b41e 100644 --- a/modules/services/swayidle.nix +++ b/modules/services/swayidle.nix @@ -122,6 +122,7 @@ in { Service = { Type = "simple"; + Restart = "always"; # swayidle executes commands using "sh -c", so the PATH needs to contain a shell. Environment = [ "PATH=${makeBinPath [ pkgs.bash ]}" ]; ExecStart = diff --git a/tests/modules/services/swayidle/basic-configuration.nix b/tests/modules/services/swayidle/basic-configuration.nix index caa06ae16..96d983209 100644 --- a/tests/modules/services/swayidle/basic-configuration.nix +++ b/tests/modules/services/swayidle/basic-configuration.nix @@ -46,6 +46,7 @@ assertFileExists $serviceFile assertFileRegex $serviceFile 'ExecStart=.*/bin/swayidle ${expectedArgs}' + assertFileRegex $serviceFile 'Restart=always' assertFileRegex $serviceFile 'Environment=.*PATH=${ lib.makeBinPath [ pkgs.bash ] }'