diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2024-09-30 06:13:06 +0200 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2024-09-30 06:13:06 +0200 |
commit | 117e2a672807ab747af98add7a5d32b4864876cc (patch) | |
tree | d6a6b511487693fdba9a9290357760af18932009 | |
parent | d1f5e8eaaf93c86999fb2d4c11b31a5af98919bb (diff) | |
download | dots-117e2a672807ab747af98add7a5d32b4864876cc.tar.gz dots-117e2a672807ab747af98add7a5d32b4864876cc.zip |
t14: 39 current 2024-09-30 06:12:59 24.05.20240928.fbca5e7 6.6.52 *
-rwxr-xr-x | rebuild.sh | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rebuild.sh b/rebuild.sh index 2e2dfdd..97f4926 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -10,7 +10,9 @@ # As I hope was clear from the video, I am new to nixos, and there may be other, better, options, in which case I'd love to know them! (I'll update the gist if so) DIR=$HOME/nixos +OPT=$1 +FORCE=[ $1 = "-f" ] # A rebuild script that commits on a successful build set -e pipefail @@ -20,9 +22,11 @@ pushd $DIR # Early return if no changes were detected (thanks @singiamtel!) if git diff --quiet '*'; then - echo "No changes detected, exiting." - popd - exit 0 + if ! $FORCE; then + echo "No changes detected, exiting." + popd + exit 0 + fi fi # Autoformat your nix files @@ -42,7 +46,9 @@ cat nixos-switch.log | grep --color error && exit 1 current=$(nixos-rebuild list-generations | grep current) # Commit all changes witih the generation metadata -git commit -am "$(hostname): $current" +if ! $FORCE; then + git commit -am "$(hostname): $current" +fi # Back to where you were popd |