Files
dotconfs/.zshrc
T
thomas.koppandClaude Opus 5 003ba4b390 feat(mobile): the Mac role, and role-dependent plugins
Looking at the actual machine turned up something the shared plugin list could
not express. The Mac loads macos, brew and dotbare; beastix and shron load
archlinux. One list filtered by availability - which is what the stub did -
would have dropped four plugins on the Mac without a word. Assembly moves into
05-pre-omz.zsh, which knows the role, and the availability filter stays on top
of it so a plugin that is not installed still cannot produce a warning at every
login.

.zprofile is added, and that is the whole point of the mobile role. The Mac
sets its PATH in .zshrc, so /opt/homebrew/bin exists for interactive shells and
for nothing else: "ssh mac brew --version" comes back empty, which during the
design phase was read as Homebrew not being installed. It is installed, with
178 formulae. Homebrew's shellenv belongs in .zprofile and now lives there; the
loop is inert on Linux, where neither prefix exists.

Carried over from the Mac: the Homebrew auto-update settings and bench(), which
runs bench inside the ERPNext compose stack.

PYTHONPATH pointed at /usr/lib/python3.9/site-packages there too - a Linux path
on macOS, so doubly wrong. All three machines had a variant of that line and
none of them is kept.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 14:11:58 +02:00

49 lines
2.1 KiB
Bash

# Stub only. Everything of substance lives in ~/.config/zsh/rc.d/.
#
# Load order, and why it is this one:
#
# 1. p10k instant prompt must be the first thing that runs
# 2. role needed before plugins, see below
# 3. plugins must be set before oh-my-zsh reads them
# 4. oh-my-zsh
# 5. rc.d/[1-4]*.zsh shared by every machine
# 6. rc.d/50-<role>.zsh exactly one of desktop/server/mobile
# 7. rc.d/90-local.zsh machine-local, never in the repository
#
# Step 3 is the reason the role is resolved so early: oh-my-zsh consumes the
# plugins array while sourcing, so nothing loaded afterwards can influence it.
# Must stay at the top: this block may print, and anything above it that also
# prints breaks the instant prompt. Absent on machines without powerlevel10k,
# where the test simply fails and nothing happens.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export ZSH="$HOME/.oh-my-zsh"
# Defaults to desktop so a machine without the file still gets a working shell.
# Servers must have it in place before the first login, or shron comes up on
# the desktop profile - blue prompt on a production mail server.
ROLE=$(cat "$HOME/.config/dotconfs/role" 2>/dev/null || echo desktop)
export ROLE
# Theme and oh-my-zsh's own settings, which it reads while being sourced.
# Anything of that kind placed in a role file - which comes afterwards - is
# silently ignored, so it lives here instead.
[[ -r "$HOME/.config/zsh/rc.d/05-pre-omz.zsh" ]] && source "$HOME/.config/zsh/rc.d/05-pre-omz.zsh"
source "$ZSH/oh-my-zsh.sh"
# (N) makes an empty directory a no-op instead of an error.
for _f in "$HOME"/.config/zsh/rc.d/[1-4]*.zsh(N); do
source "$_f"
done
unset _f
[[ -r "$HOME/.config/zsh/rc.d/50-$ROLE.zsh" ]] && source "$HOME/.config/zsh/rc.d/50-$ROLE.zsh"
# Last on purpose: this one can override anything above without the repository
# needing to know about it.
[[ -r "$HOME/.config/zsh/rc.d/90-local.zsh" ]] && source "$HOME/.config/zsh/rc.d/90-local.zsh"