From 6817b784ea2d0ead3cb19cf44465e77b557b7b7b Mon Sep 17 00:00:00 2001 From: ska Date: Mon, 22 Dec 2025 15:14:43 +0000 Subject: [PATCH] Update configuration.nix --- configuration.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/configuration.nix b/configuration.nix index 9f57a4d..10938ad 100644 --- a/configuration.nix +++ b/configuration.nix @@ -218,23 +218,23 @@ ############################################################ systemd.services.usb-root-monitor = { - description = "Monitor USB root device and shut down if removed"; + description = "Monitor USB LUKS container and shut down if removed"; script = '' + LUksDevice="/dev/disk/by-partlabel/nixos-crypt" while true; do - if ! test -e /dev/disk/by-label/nixos-root; then - /run/current-system/sw/bin/logger -t usb-root-monitor "Root device missing – shutting down" - /run/current-system/sw/bin/systemctl poweroff + if ! test -e "$LUksDevice"; then + /run/current-system/sw/bin/logger -t usb-root-monitor "LUKS container missing – shutting down immediately" + /run/current-system/sw/bin/systemctl --force poweroff exit 0 fi - sleep 5 + sleep 3 done ''; serviceConfig = { Type = "simple"; Restart = "always"; - RestartSec = 10; + RestartSec = 5; User = "root"; - ExecStop = "/run/current-system/sw/bin/kill $MAINPID"; }; wantedBy = [ "multi-user.target" ]; };