who needs temporary files and tee and whatever when you can have BASH SCRIPTS :3
This commit is contained in:
parent
87c2e38720
commit
361dd6dc67
4 changed files with 22 additions and 31 deletions
20
switch.sh
Normal file
20
switch.sh
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue