Files
dotconfs/.zshrc
T
thomas.koppandClaude Opus 5 4b38b80875 feat(server): carry shron's own configuration into the role file
Task 7 as planned would have checked out over shron and reviewed what was lost
afterwards. That is the wrong order for a machine whose .zshrc holds working
operational tooling: ipt-block, a CrowdSec whitelist helper, reboot_required,
the German locale and dircolors would all have been gone between the checkout
and the review.

Also found: shron runs ZSH_THEME="ys" and has no powerlevel10k. The theme
selection would have fallen through to oh-my-zsh's default, which is a
regression nobody asked for, so 05-pre-omz.zsh keeps ys where p10k is absent.
The red role colour is still set, but it is honest to say it does nothing there
until p10k is installed - the safeguard the role split was built around does
not currently apply to the one machine it was meant for.

05-prompt.zsh becomes 05-pre-omz.zsh: the theme was never the only thing that
has to precede oh-my-zsh. DISABLE_AUTO_UPDATE belongs there too - a server
should not go fetching updates on its own while somebody is logged in fixing
something - and the stub no longer sets the update mode itself.

update-blacklist is carried over with a note rather than silently: openbl.org
answers 301 and the curl call has no -L, so it has been reporting "Blacklist
download failed" for some time. CrowdSec covers that ground now, but the
iptables chain it created may still exist and is worth removing deliberately.

PYTHONPATH pointed at python3.4 on shron and at 3.9 on beastix. Neither
directory exists; neither is carried over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 16:59:56 +02:00

62 lines
2.6 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
# One list for every machine, filtered by what is actually installed. A plugin
# named but not present makes oh-my-zsh complain on every single shell start,
# and the alternative - a separate list per role - means editing three files to
# add one plugin.
_want_plugins=(git archlinux colored-man-pages colorize zsh-interactive-cd fzf)
plugins=()
for _p in $_want_plugins; do
if [[ -d "$ZSH/plugins/$_p" || -d "${ZSH_CUSTOM:-$ZSH/custom}/plugins/$_p" ]]; then
plugins+=("$_p")
fi
done
unset _p _want_plugins
# 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"