nvim $HOME/.config/home-manager/home.nix home-manager switch &>home-switch.log || ( cat home-switch.log | grep --color error && false) gen=$(home-manager generations | head -n1 | sed 's/->.*//') sudo cp -r $HOME/.config/home-manager . git add . git commit -m "$gen" if grep -q "error" home-switch.log; then echo "There was an error in your Home Manager Config, please fix it before you push to git" else git push fi