From 995485f86eb7070cf504f320d148581e46bead21 Mon Sep 17 00:00:00 2001 From: George Vaintrub Date: Sun, 31 May 2026 13:48:17 +0100 Subject: [PATCH] fix(install): auto-rerun mise install when tool list changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit run_onchange_after_50 only re-fired on its own content change — packages.yaml edits re-fire it (rendered into DOTFILES_* vars), but the mise config is read by mise directly, so adding/removing a mise tool didn't trigger `mise install` (hit on the jetson: direnv declared but not installed after chezmoi update). Embed the mise config's hash in the script (chezmoi's documented run_onchange dependency idiom: `include | sha256sum`). Now a tool add/remove changes the script → re-fires → mise install runs on apply. Demonstrated: dummy tool flips the hash. Docs updated (README + config header): 'chezmoi apply' now suffices. --- .../run_onchange_after_50-install-packages.sh.tmpl | 6 ++++++ README.md | 2 +- dot_config/mise/config.toml.tmpl | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.chezmoiscripts/run_onchange_after_50-install-packages.sh.tmpl b/.chezmoiscripts/run_onchange_after_50-install-packages.sh.tmpl index e67e6ef..e29f7b1 100644 --- a/.chezmoiscripts/run_onchange_after_50-install-packages.sh.tmpl +++ b/.chezmoiscripts/run_onchange_after_50-install-packages.sh.tmpl @@ -31,6 +31,12 @@ export DOTFILES_GUI_MAC_CASKS={{ (.packages.gui.mac_casks | default (list)) | so export DOTFILES_GUI_LINUX_APT={{ (.packages.gui.linux_apt | default (list)) | sortAlpha | uniq | join " " | quote }} export DOTFILES_GUI_LINUX_DNF={{ (.packages.gui.linux_dnf | default (list)) | sortAlpha | uniq | join " " | quote }} +# Re-fire when the mise tool list changes. packages.yaml is already rendered +# into the DOTFILES_* vars above (edits there change this script); the mise +# config is read by mise directly, so embed its hash to trigger `mise install` +# on tool add/remove (chezmoi's documented run_onchange dependency idiom). +# mise-config-hash: {{ include "dot_config/mise/config.toml.tmpl" | sha256sum }} + # GITHUB_TOKEN for mise's GitHub-backed installs: pre-exported env wins. # Otherwise mise authenticates itself via `github.credential_command = # "gh auth token"` (rendered into ~/.config/mise/config.toml when gh is on diff --git a/README.md b/README.md index 98e9526..9f844e6 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Prompted on init (the detected env is shown as a hint; you pick). Cached in `~/. | `dev` | core + full CLI toolchain: 4 languages (Go/Python/Node/Rust) + ~30 mise binaries (kubectl/helm/jq/gh/delta/… + `op` + `rtk` + `claude-code` + `codex`) + a few OS-native brews/apts. ~1.9 GB first apply. | Headless dev box | | `workstation` | dev + GUI apps. macOS casks: iterm2, docker-desktop, visual-studio-code, ngrok, 1password, fonts. | Primary GUI machine | -Exact tool lists are the source of truth in `dot_config/mise/config.toml.tmpl` (mise) and `.chezmoidata/packages.yaml` (brew/apt/dnf). Add a mise tool: `mise registry | grep -i ` → add the slug to the config (inside the `$isDev` block unless every tier needs it) → `chezmoi apply`. +Exact tool lists are the source of truth in `dot_config/mise/config.toml.tmpl` (mise) and `.chezmoidata/packages.yaml` (brew/apt/dnf). Add a mise tool: `mise registry | grep -i ` → add the slug to the config (inside the `$isDev` block unless every tier needs it) → `chezmoi apply` (the install script embeds the mise-config hash, so apply auto-reruns `mise install` — no manual step). Docker is intentionally not in `dev` (the `docker.io` vs `docker-ce` apt conflict breaks installs) — install it per-machine, or use the macOS Docker Desktop cask in `workstation`. diff --git a/dot_config/mise/config.toml.tmpl b/dot_config/mise/config.toml.tmpl index ea3b57e..7291b5a 100644 --- a/dot_config/mise/config.toml.tmpl +++ b/dot_config/mise/config.toml.tmpl @@ -1,7 +1,8 @@ {{- /* Profile-aware mise config. core: fzf+zoxide only. dev/workstation: full toolchain. Per-machine opt-out: ~/.config/mise/config.local.toml (auto-merged, untracked). - Adding a tool: `mise registry | grep -i ` → use the slug shown. + Adding a tool: `mise registry | grep -i ` → add the slug → `chezmoi apply` + (run_onchange_after_50 embeds this file's hash, so apply auto-runs `mise install`). */ -}} {{- $profile := .profile | default "core" -}} {{- $isDev := or (eq $profile "dev") (eq $profile "workstation") -}}