diff --git a/scripts/bashrc-nix.sh b/scripts/bashrc-nix.sh index c117934..1cb3f35 100644 --- a/scripts/bashrc-nix.sh +++ b/scripts/bashrc-nix.sh @@ -1,3 +1,22 @@ alias rebuild="nixos-rebuild switch" alias gc="nix-collect-garbage -d" alias rebuild-gc="rebuild; gc" + +# Update git +nix-git-update() { + # 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 + else + # Changes + echo "Error: There are uncommitted changes" + git status + fi +}