blob: 4d7db1b9a251bcd6fe7fbeca8ed0954b1993505c [file] [log] [blame]
#!/usr/bin/env bash
cd /home/minion/Nix
git add .
if [[ $(git diff --stat HEAD) != '' ]]; then
read -e -p "What did you change?: " changes
/usr/bin/env git commit -am "$changes"
fi
echo "Rebuilding..."
nix build .#homeConfigurations.${USER}.activationPackage $1 || exit 1
echo "Removing old profiles..."
nix profile list \
| { grep 'home-manager-path$' || test $? = 1; } \
| awk -F ' ' '{ print $4 }' \
| cut -d ' ' -f 4 \
| xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG
# ^ Remove old profiles; from https://github.com/nix-community/home-manager/blob/8d38ca886880265d523a66fe3da4d42e92ab0748/modules/home-environment.nix#L582
echo "Activating..."
result/activate
unlink result