diff --git a/nixie b/nixie index 4230556..58b45c5 100755 --- a/nixie +++ b/nixie @@ -12,6 +12,11 @@ QUIT () { exit } +QUIT1 () { + popd > /dev/null + exit 1 +} + CHOOSE_CASE () { echo -e -n "${IPurple}Build changes? ${Purple}Yes/Preview/Edit/Restore/Quit. (y/p/e/r/q):${NC} " @@ -33,12 +38,12 @@ BUILD () { case $CHOICE in [nN]* ) echo -e -n "[ ${Red}cancelled${NC} ] " && CHOOSE_CASE ;; *) - git add . + sudo git add . echo -e "${IPurple}Rebuilding NixOS...${NC}" sudo nixos-rebuild switch if [ $? -ne 0 ]; then - echo -e "[ ${Bred}error${NC} ] ${Red}Rebuilding NixOS failed.${NC}" - QUIT + echo -e "[ ${Red}error${NC} ] ${Red}Rebuilding NixOS failed.${NC}" + QUIT1 fi echo -e "${IPurple}Committing the changes...${NC}" sudo git commit --no-status -am "$(sudo nixos-rebuild list-generations | grep current | sed 's/ .*//')"