mirror of
https://github.com/Cian-H/My_NixOS_Config.git
synced 2026-05-03 20:21:42 +01:00
Fixed issue with git pulls on flake.lock
This commit is contained in:
@@ -10,11 +10,20 @@ default:
|
||||
|
||||
_git-sync:
|
||||
@if [ -n "$(git status --porcelain)" ]; then \
|
||||
echo ">> Stashing local changes..."; \
|
||||
git stash; \
|
||||
git pull --ff-only --recurse-submodules; \
|
||||
git submodule update --remote --recursive; \
|
||||
git stash pop; \
|
||||
if git status --porcelain | grep -q "flake.lock"; then \
|
||||
echo ">> flake.lock is dirty. Resetting to avoid pull conflicts..."; \
|
||||
git checkout flake.lock; \
|
||||
fi; \
|
||||
if [ -n "$(git status --porcelain)" ]; then \
|
||||
echo ">> Stashing remaining local changes..."; \
|
||||
git stash; \
|
||||
git pull --ff-only --recurse-submodules; \
|
||||
git submodule update --remote --recursive; \
|
||||
git stash pop; \
|
||||
else \
|
||||
git pull --ff-only --recurse-submodules; \
|
||||
git submodule update --remote --recursive; \
|
||||
fi; \
|
||||
else \
|
||||
git pull --ff-only --recurse-submodules; \
|
||||
git submodule update --remote --recursive; \
|
||||
@@ -23,6 +32,11 @@ _git-sync:
|
||||
_flake-update:
|
||||
nix flake update
|
||||
|
||||
# Safely commit the lockfile changes
|
||||
commit-lock:
|
||||
git add flake.lock
|
||||
git commit -m "chore: update flake.lock" || echo "No changes to commit"
|
||||
|
||||
# Sync git and update flake inputs (override with git=false or flake=false)
|
||||
prebuild:
|
||||
@if [ "{{git}}" == "true" ]; then \
|
||||
|
||||
Reference in New Issue
Block a user