diff options
| author | Simen A. W. Olsen <hello@simenandre.no> | 2026-09-26 22:12:36 +0200 |
|---|---|---|
| committer | Simen A. W. Olsen <hello@simenandre.no> | 2026-09-26 22:12:36 +0200 |
| commit | 7c3e313cfec6c67b8ea15afe92d18896393eec59 (patch) | |
| tree | 4d6d972b067edf57d83cb4027a77e6d9c15b8df2 | |
| parent | 9c68e811a0f96f83e610f39f527fbcd64336a8a5 (diff) | |
| download | dotfiles-7c3e313cfec6c67b8ea15afe92d18896393eec59.tar.gz dotfiles-7c3e313cfec6c67b8ea15afe92d18896393eec59.zip | |
feat(home): commit and push flake.lock from update
| -rw-r--r-- | modules/home/zsh.nix | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix index 73e4b93..3cef29d 100644 --- a/modules/home/zsh.nix +++ b/modules/home/zsh.nix @@ -119,7 +119,16 @@ in '' + (if pkgs.stdenv.isDarwin then '' alias tailscale='/Applications/Tailscale.app/Contents/MacOS/Tailscale' alias rebuild='sudo darwin-rebuild switch --flake ~/ghq/simenandre.no/dotfiles#${flakeAttr}' - alias update='nix flake update --flake ~/ghq/simenandre.no/dotfiles && sudo darwin-rebuild switch --flake ~/ghq/simenandre.no/dotfiles#${flakeAttr}' + function update() { + local flake=~/ghq/simenandre.no/dotfiles + nix flake update --flake "$flake" || return + sudo darwin-rebuild switch --flake "$flake#${flakeAttr}" || return + # Commit only after a switch succeeds, and only flake.lock, so unrelated + # work in the tree stays uncommitted. + git -C "$flake" diff --quiet HEAD -- flake.lock && return 0 + git -C "$flake" commit -m 'chore(flake): update inputs' -- flake.lock || return + git -C "$flake" push || echo 'update: lock committed but push failed' + } alias nix-gc='sudo nix-collect-garbage --delete-older-than 14d && nix-collect-garbage --delete-older-than 14d && nix store gc' '' else "") + '' |
