nixos-config/quick-switch.sh

15 lines
337 B
Bash
Raw Normal View History

2023-06-16 23:32:12 +00:00
#!/usr/bin/env bash
2023-06-17 17:51:24 +00:00
set -euo pipefail
2023-06-16 23:32:12 +00:00
if [ -z "$(git status --porcelain)" ]
then
2023-06-16 23:56:23 +00:00
git push --force-with-lease
2023-06-17 17:51:24 +00:00
rev=$(git rev-parse HEAD)
2023-06-17 00:30:33 +00:00
sudo nixos-rebuild switch \
2023-06-17 17:51:24 +00:00
--flake "git+https://git.atauno.com/atau/nixos-config.git?ref=master&rev=$rev"
2023-06-16 23:32:12 +00:00
else
echo "Git working directory is unclean, please commit changes"
exit 1
fi