27 lines
509 B
Bash
27 lines
509 B
Bash
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
|
|
pushd ~/nixos/
|
|
|
|
alejandra . &>/dev/null \
|
|
|| (alejandra . ; echo "formatting failed!" && exit 1)
|
|
|
|
echo "Rebuilding"
|
|
sudo nixos-rebuild switch --upgrade --flake .
|
|
|
|
current=$(nixos-rebuild list-generations | grep current)
|
|
|
|
if git diff --quiet '*.nix'; then
|
|
popd
|
|
notify-send -e "Nixos updated with no config changes" --icon=software-update-avaiable
|
|
fi
|
|
|
|
git commit -am "$current"
|
|
git push
|
|
|
|
popd
|
|
|
|
notify-send -e "Nixos updated and pushed to git" --icon=software-update-avaiable
|
|
|