who needs temporary files and tee and whatever when you can have BASH SCRIPTS :3

This commit is contained in:
uku 2025-03-05 09:34:03 +01:00
parent 87c2e38720
commit 361dd6dc67
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
4 changed files with 22 additions and 31 deletions

20
switch.sh Normal file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
script_path=$(readlink -f "${BASH_SOURCE[0]}")
flake=$(dirname "$script_path")
configuration=$(sudo nixos-rebuild dry-activate --flake "$flake" --keep-going "$@")
echo "$configuration"
nix run --inputs-from "$flake" nixpkgs#nvd -- diff /run/current-system "$configuration"
read -n1 -rp "Activate new configuration? [y/N] " answer
echo
if [[ $answer =~ ^[Yy]$ ]]; then
sudo "$configuration/bin/switch-to-configuration" switch
else
echo "Not activating :("
exit 1
fi