fix(zshrc): set ~/.local/bin on PATH before mise activate#24
Merged
Conversation
Order bug: `command -v mise > /dev/null && eval "$(mise activate zsh)"` ran ahead of `export PATH="$PATH:$HOME/.local/bin"`. On Linux where mise is curl-pipe-installed to ~/.local/bin/mise, the `command -v mise` check fails because ~/.local/bin isn't on PATH yet at that point — mise activate silently skipped, no tools on PATH, fzf/zoxide integrations don't fire either (both depend on mise activate having run). Manifests on jetson (Ubuntu 22.04 aarch64): SSH'd into zsh login shell, `which delta` → not found, despite `mise where aqua:dandavison/delta` returning a valid install path. `eval "$(mise activate zsh)"` manually fixes the session but the next session breaks the same way. Works fine on Mac because brew's `.zprofile` shellenv adds `/opt/homebrew/bin` (where brew-installed mise lives) to PATH before .zshrc fires — `command -v mise` succeeds, activate runs. Linux has no equivalent pre-zshrc PATH setup for ~/.local/bin (Ubuntu's ~/.profile adds it but only for bash, not zsh; zsh would need ~/.zprofile which we don't deploy). Fix: move the PATH extension block above the mise activate line. Order is now PATH → mise activate → fzf → zoxide, matching dependency direction. Mac unaffected — appends are idempotent and mise activate already saw mise on PATH there. Verified by `chezmoi apply` on workstation Mac (no behavioural change), and matches the manual `eval "$(mise activate zsh)"` reproduction on jetson.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
command -v mise && eval "$(mise activate zsh)"ran ahead ofexport PATH="$PATH:$HOME/.local/bin". On Linux where mise is curl-pipe-installed to~/.local/bin/mise, thecommand -v misecheck fails because~/.local/binisn't on PATH at that point → mise activate silently skipped → tools not on PATH → fzf/zoxide integrations (which depend on mise activate) also don't fire.Reproduction
Jetson (Ubuntu 22.04 aarch64, zsh login shell):
So mise is installed, paths exist, but activate never ran in zshrc. Manual
evalfixes the session; next session breaks same way.Why Mac was fine
Brew's
.zprofileshellenv adds/opt/homebrew/bin(where brew-installed mise lives) to PATH before.zshrcfires →command -v misesucceeds → activate runs. Linux has no equivalent pre-zshrc PATH setup for~/.local/bin(Ubuntu's~/.profileadds it but only for bash; zsh would need~/.zprofilewhich we don't deploy).Downstream effect noticed first
chezmoi diffon jetson kept showing~/.gitconfigwanting to remove the delta block —{{ if lookPath "delta" }}was evaluating false because chezmoi's rendering process inherited the unactivated shell's PATH. Looked like a chezmoi convergence issue at first; root cause is zshrc ordering.Fix
Move the PATH extension block above the mise activate line:
Matches dependency direction. Mac unaffected (idempotent appends; activate already saw mise on PATH).
Test plan
chezmoi applyon Mac workstation — no behavioural change, rtk init still wires correctlygrep -nE 'PATH|mise activate' dot_zshrcchezmoi update && chezmoi apply && exec zsh && which delta→ mise install path;chezmoi diff→ empty for gitconfig