[O] Fix nix-git-update

This commit is contained in:
Hykilpikonna
2021-08-24 15:19:17 -04:00
committed by GitHub
parent 9035b8dea1
commit 14a6e98dcb
+15 -6
View File
@@ -4,19 +4,28 @@ alias rebuild-gc="rebuild; gc"
# Update git
nix-git-update() {
pushd /etc/nixos
# Make sure there aren't any other changes
if git diff-index --quiet HEAD --; then
# No changes
pushd /etc/nixos
update-nix-fetchgit *.nix
rebuild-gc
git add *.nix
git commit -m "[U] Update fetchgit refs"
git push
popd
# If there are changes after updating
if git diff-index --quiet HEAD --; then
rebuild-gc
git add *.nix
git commit -m "[U] Update fetchgit refs"
git push
echo "Successfully updated fetchgit refs"
else
echo "There aren't any updates"
fi
else
# Changes
echo "Error: There are uncommitted changes"
git status
fi
popd
}