make it ask
This commit is contained in:
parent
b39b82463b
commit
0daf6f612a
1 changed files with 9 additions and 1 deletions
10
nswitch
10
nswitch
|
@ -7,7 +7,15 @@ cd ~/Projects/NixOS/
|
||||||
nvim
|
nvim
|
||||||
nix fmt . &>/dev/null
|
nix fmt . &>/dev/null
|
||||||
git diff -U0 *.nix
|
git diff -U0 *.nix
|
||||||
echo "NixOS Rebuilding..."
|
|
||||||
|
echo "Do you want to rebuild NixOS? [y/N]"
|
||||||
|
read -r YESNO
|
||||||
|
if ! [[ "${YESNO,,}" == "y" ]]; then
|
||||||
|
echo "Exiting ..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Rebuilding NixOS"
|
||||||
sudo nixos-rebuild switch &>nixos-switch.log || (
|
sudo nixos-rebuild switch &>nixos-switch.log || (
|
||||||
cat nixos-switch.log | grep --color error && false)
|
cat nixos-switch.log | grep --color error && false)
|
||||||
gen=$(nixos-rebuild list-generations | grep current)
|
gen=$(nixos-rebuild list-generations | grep current)
|
||||||
|
|
Loading…
Add table
Reference in a new issue