1
0
Fork 0

Add /opt/rocm/bin to PATH in zshrc when it exists

ROCm installs to /opt/rocm (not /opt/rocm-X.Y versioning). The
upstream /etc/profile.d/rocm.sh tries to add /opt/rocm/bin to PATH
but uses 'append_path' which is a fish-shell function, not a bash/zsh
built-in — so on a zsh login the export is a no-op and the rocm
tools (amd-smi, rocm-smi, rocminfo, hipcc, etc.) are unreachable
without explicit PATH setup.

Add /opt/rocm/bin to the top of the path array in dot_zshrc.tmpl
when the directory exists on the host. Use stat() with the
not-(not-...) bool coercion (pitfall #35 in the chezmoi-bootstrap-
runbook skill) to avoid rendering the stat map's string repr.

Conditional on the directory existing so Pis (no ROCm) don't get a
dead PATH entry. Verified on miche:
  PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin/site_perl:    /usr/bin/vendor_perl:/usr/bin/core_perl:/opt/rocm/bin
  /opt/rocm/bin/amd-smi
  /opt/rocm/bin/rocm-smi
  /opt/rocm/bin/rocminfo

amd-smi version: AMDSMI Tool: 26.4.0+3309c6114a | ROCm version: 7.13.0
This commit is contained in:
Rain 2026-06-22 19:16:31 -04:00
parent 3d329073fb
commit 1b596bd894

View file

@ -90,6 +90,9 @@ export TMUX_PLUGIN_MANAGER_PATH=~/.tmux/plugins/tpm
# ---------------------------------------------------------------------------
typeset -U path
path=(
{{- if not (not (stat "/opt/rocm/bin")) }}
/opt/rocm/bin # ROCm tools first (rocminfo, rocm-smi, amd-smi, hipcc, etc.)
{{- end }}
$HOME/.local/bin
$HOME/.bin
$path