just: parameterize update recipe (system/home/both)
`just update system` re-locks + rebuilds the NixOS system flake, `just update home` re-locks + switches the Home Manager flake, and `just update` with no arg does both (system first). Previously update only touched the system flake, leaving the Home Manager side stale. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
be7ecfc0ea
commit
86b5c2422e
1 changed files with 23 additions and 3 deletions
|
|
@ -26,9 +26,29 @@ let
|
|||
nix-collect-garbage -d
|
||||
|
||||
[no-cd]
|
||||
update:
|
||||
update target="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
update_system() {
|
||||
sudo nix flake update --flake "''${NIXOS_FLAKE:-/etc/nixos}"
|
||||
just rebuild
|
||||
}
|
||||
|
||||
update_home() {
|
||||
nix flake update --flake "''${XDG_CONFIG_HOME:-$HOME/.config}/home-manager"
|
||||
just switch
|
||||
}
|
||||
|
||||
case "{{target}}" in
|
||||
system) update_system ;;
|
||||
home) update_home ;;
|
||||
"") update_system; update_home ;;
|
||||
*)
|
||||
echo "usage: just update [system|home] (empty = both)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
[no-cd]
|
||||
init-home:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue