make it look nicer
This commit is contained in:
parent
40c7c325e7
commit
692845b707
1 changed files with 12 additions and 8 deletions
20
nswitch
20
nswitch
|
@ -7,18 +7,22 @@ export LC_ALL=C.UTF8
|
||||||
|
|
||||||
cd ~/Projects/NixOS/
|
cd ~/Projects/NixOS/
|
||||||
nvim
|
nvim
|
||||||
nix fmt . &>/dev/null
|
|
||||||
git diff -U0 *.nix
|
|
||||||
|
|
||||||
echo "Do you want to rebuild NixOS? [y/N]"
|
printf ">>> auto formating ..."
|
||||||
read -r YESNO
|
nix fmt . &> /dev/null
|
||||||
|
printf " DONE!\n"
|
||||||
|
|
||||||
|
git diff -U0 # "*.nix"
|
||||||
|
|
||||||
|
printf ">>> Do you want to rebuild NixOS? [y/N]\n"
|
||||||
|
printf "<<< " && read -r YESNO
|
||||||
if ! [[ "${YESNO,,}" == "y" ]]; then
|
if ! [[ "${YESNO,,}" == "y" ]]; then
|
||||||
echo "Exiting ..."
|
printf ">>> Exiting ...\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Rebuilding NixOS"
|
printf ">>> Rebuilding NixOS\n"
|
||||||
sudo nixos-rebuild switch &>nixos-switch.log || (
|
sudo nixos-rebuild switch | tee nixos-switch.log || (
|
||||||
cat nixos-switch.log | grep --color error && false)
|
grep --color error nixos-switch.log && false)
|
||||||
gen=$(nixos-rebuild list-generations | grep current)
|
gen=$(nixos-rebuild list-generations | grep current)
|
||||||
git commit -am "$gen"
|
git commit -am "$gen"
|
||||||
|
|
Loading…
Add table
Reference in a new issue