aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home
diff options
context:
space:
mode:
authorSimen A. W. Olsen <hello@simenandre.no>2026-09-26 22:12:36 +0200
committerSimen A. W. Olsen <hello@simenandre.no>2026-09-26 22:12:36 +0200
commit7c3e313cfec6c67b8ea15afe92d18896393eec59 (patch)
tree4d6d972b067edf57d83cb4027a77e6d9c15b8df2 /modules/home
parent9c68e811a0f96f83e610f39f527fbcd64336a8a5 (diff)
downloaddotfiles-7c3e313cfec6c67b8ea15afe92d18896393eec59.tar.gz
dotfiles-7c3e313cfec6c67b8ea15afe92d18896393eec59.zip
feat(home): commit and push flake.lock from update
Diffstat (limited to 'modules/home')
-rw-r--r--modules/home/zsh.nix11
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 "") + ''