From 41661ebd81e5b5c15c6e3e216e78489da94bbc64 Mon Sep 17 00:00:00 2001 From: ska Date: Mon, 22 Dec 2025 16:17:27 +0000 Subject: [PATCH] Update configuration.nix --- configuration.nix | 64 ----------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/configuration.nix b/configuration.nix index 3587307..d3aa218 100644 --- a/configuration.nix +++ b/configuration.nix @@ -207,70 +207,6 @@ }; }; - ############################################################ - # USB ROOT LOSS → SHUTDOWN (CORRECTED) - ############################################################ - - systemd.services.shutdown-on-root-usb-loss = { - description = "Shutdown if device backing / disappears"; - wantedBy = [ "multi-user.target" ]; - after = [ "local-fs.target" ]; - - serviceConfig = { - Type = "simple"; - Restart = "always"; - RestartSec = "1"; - - ExecStart = pkgs.writeShellScript "watch-root-device" '' - set -e - - FINDMNT=${pkgs.util-linux}/bin/findmnt - LSBLK=${pkgs.util-linux}/bin/lsblk - BASENAME=${pkgs.coreutils}/bin/basename - SLEEP=${pkgs.coreutils}/bin/sleep - SYSTEMCTL=${pkgs.systemd}/bin/systemctl - - # Wait until root is visible - while true; do - ROOT_SRC="$($FINDMNT -n -o SOURCE / 2>/dev/null || true)" - [ -n "$ROOT_SRC" ] && break - $SLEEP 1 - done - - # Resolve to top-level block device - PARENT="$($LSBLK -ndo PKNAME "$ROOT_SRC" 2>/dev/null || true)" - if [ -n "$PARENT" ]; then - ROOT_DEV="/dev/$PARENT" - else - ROOT_DEV="$ROOT_SRC" - fi - - DEV_NAME="$($BASENAME "$ROOT_DEV")" - - # Wait until sysfs entry exists - while [ ! -e "/sys/class/block/$DEV_NAME" ]; do - $SLEEP 1 - done - - # Watch until device disappears - while [ -e "/sys/class/block/$DEV_NAME" ]; do - $SLEEP 0.5 - done - - $SYSTEMCTL poweroff - ''; - }; - }; - - ############################################################ - # KERNEL FAILSAFE - ############################################################ - - boot.kernel.sysctl = { - "kernel.panic" = 5; - "kernel.panic_on_oops" = 1; - }; - ############################################################ # USB OPTIMIZATIONS ############################################################