diff --git a/configuration.nix b/configuration.nix index d3aa218..698dc10 100644 --- a/configuration.nix +++ b/configuration.nix @@ -164,7 +164,7 @@ export NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" LOCAL_PATH="/var/lib/nixos-config" - REPO_URL="https://git.skarockoi.de/ska/nixos-production.git" + REPO_URL="https://git.skarockoi.de/ska/nixos-production.git " if [ ! -d "$LOCAL_PATH/.git" ]; then mkdir -p "$LOCAL_PATH" @@ -200,7 +200,7 @@ }; systemd.timers.nixos-git-update = { - description = "Check for config updates hourly"; + description = "Check for config updates at startup"; wantedBy = [ "timers.target" ]; timerConfig = { OnBootSec = "60s"; @@ -213,6 +213,18 @@ zramSwap.enable = true; + ############################################################ + # USB ROOT DEVICE MONITOR (SHUTDOWN ON DISCONNECT) + ############################################################ + + # Monitor root device removal and shut down + services.udev.extraRules = '' + # Match the root filesystem device by label (or use PARTLABEL/UUID if preferred) + KERNEL=="sd*", ENV{ID_FS_LABEL}=="nixos-root", SYMLINK+="nixos-root-device" + # Trigger when the root device is removed + ACTION=="remove", KERNEL=="sd*", ENV{ID_FS_LABEL}=="nixos-root", RUN+="/run/current-system/sw/bin/systemctl poweroff" + ''; + ############################################################ # NIXOS VERSION ############################################################