Update configuration.nix

This commit is contained in:
ska
2025-12-22 16:02:15 +00:00
parent 70a55816ce
commit 5692709ea6

View File

@@ -208,7 +208,7 @@
}; };
############################################################ ############################################################
# USB ROOT LOSS → SHUTDOWN (FIXED) # USB ROOT LOSS → SHUTDOWN (CORRECTED)
############################################################ ############################################################
systemd.services.shutdown-on-root-usb-loss = { systemd.services.shutdown-on-root-usb-loss = {
@@ -227,11 +227,9 @@
SLEEP=${pkgs.coreutils}/bin/sleep SLEEP=${pkgs.coreutils}/bin/sleep
SYSTEMCTL=${pkgs.systemd}/bin/systemctl SYSTEMCTL=${pkgs.systemd}/bin/systemctl
# Resolve root source
ROOT_SRC="$($FINDMNT -n -o SOURCE / || true)" ROOT_SRC="$($FINDMNT -n -o SOURCE / || true)"
[ -z "$ROOT_SRC" ] && exit 0 [ -z "$ROOT_SRC" ] && exit 0
# Walk up to the top-level block device
DEV="$ROOT_SRC" DEV="$ROOT_SRC"
while PARENT="$($LSBLK -no PKNAME "$DEV" 2>/dev/null)"; [ -n "$PARENT" ]; do while PARENT="$($LSBLK -no PKNAME "$DEV" 2>/dev/null)"; [ -n "$PARENT" ]; do
DEV="/dev/$PARENT" DEV="/dev/$PARENT"
@@ -239,7 +237,6 @@
DEV_NAME="$($BASENAME "$DEV")" DEV_NAME="$($BASENAME "$DEV")"
# Watch until the block device disappears
while [ -e "/sys/class/block/$DEV_NAME" ]; do while [ -e "/sys/class/block/$DEV_NAME" ]; do
$SLEEP 0.5 $SLEEP 0.5
done done