[O] Import nix.sh only if it's nixos
This commit is contained in:
+28
-26
@@ -1,32 +1,34 @@
|
|||||||
alias rebuild="nixos-rebuild switch"
|
if command -v nixos-rebuild &> /dev/null; then
|
||||||
alias gc="nix-collect-garbage -d"
|
alias rebuild="nixos-rebuild switch"
|
||||||
alias rebuild-gc="rebuild; gc"
|
alias gc="nix-collect-garbage -d"
|
||||||
|
alias rebuild-gc="rebuild; gc"
|
||||||
|
|
||||||
# Update git
|
# Update git
|
||||||
nix-git-update() {
|
nix-git-update() {
|
||||||
pushd /etc/nixos
|
pushd /etc/nixos
|
||||||
|
|
||||||
# Make sure there aren't any other changes
|
# Make sure there aren't any other changes
|
||||||
if git diff-index --quiet HEAD --; then
|
if git diff-index --quiet HEAD --; then
|
||||||
# No changes
|
# No changes
|
||||||
update-nix-fetchgit *.nix
|
update-nix-fetchgit *.nix
|
||||||
|
|
||||||
# If there are changes after updating
|
# If there are changes after updating
|
||||||
if ! git diff-index --quiet HEAD --; then
|
if ! git diff-index --quiet HEAD --; then
|
||||||
# Has changes
|
# Has changes
|
||||||
rebuild-gc
|
rebuild-gc
|
||||||
git add *.nix
|
git add *.nix
|
||||||
git commit -m "[U] Update fetchgit refs"
|
git commit -m "[U] Update fetchgit refs"
|
||||||
git push
|
git push
|
||||||
echo "Successfully updated fetchgit refs"
|
echo "Successfully updated fetchgit refs"
|
||||||
|
else
|
||||||
|
echo "There aren't any updates"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "There aren't any updates"
|
# Changes
|
||||||
|
echo "Error: There are uncommitted changes"
|
||||||
|
git status
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
# Changes
|
|
||||||
echo "Error: There are uncommitted changes"
|
|
||||||
git status
|
|
||||||
fi
|
|
||||||
|
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user