feat(shell): bake zsh + starship into PHP-FPM image#358
Open
geodro wants to merge 1 commit into
Open
Conversation
`lerd shell` and the TUI shell action previously dropped into bare `sh`, which made the in-container experience feel like a different planet from the host. The PHP-FPM image now ships zsh with a self-contained config (starship prompt, `compinit -u`, persistent history under `~/.local/share/lerd/shell-state/php-<ver>/zsh/`) and a handful of modern CLI tools (eza, bat, fzf, zoxide). The quadlet sets `HostName=` to the host's hostname so the prompt reads `root@your-machine` instead of an opaque container id, and the renderer mounts the per-version zsh history dir read-write so commands survive container rebuilds. `InteractiveShellScript()` picks zsh in the FPM image and falls back through bash to sh for other containers. The shell environment is deliberately isolated from the host's `~/.zshrc` and `~/.config/fish`. An earlier draft mounted those (first read-only, then with podman's overlay flag for fish_variables writes), but every customised host config introduced its own cascade of "no such file or directory" errors as it tried to source distro-specific paths the alpine container had never heard of. The container shell is its own world now, consistent across every machine and contributor.
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.
Summary
The lerd PHP-FPM image now drops into zsh with starship instead of bare sh when you run
lerd shell(or hit the TUI shell action). Container ships its own self-contained config so the experience is predictable across machines.What's in the image: zsh, starship, eza, bat, fzf, zoxide. The lerd-shipped
/etc/zsh/zshrcwires up persistent history (per PHP version, under~/.local/share/lerd/shell-state/php-<ver>/zsh/), enables completion withcompinit -u, and inits starship. The FPM quadlet pinsHostName=to the host's hostname so the prompt readsroot@your-machine, not an opaque container id.Host shell config is intentionally not mounted. An earlier round of this branch tried to bind-mount
~/.config/fishand~/.zshrcfor an OrbStack-like inherit-your-prompt experience, but every customised host config has its own pile of distro-specific source paths and binaries that simply don't exist inside alpine, so the container shell would fire off a cascade of "no such file or directory" errors on every login. Cleaner to ship one good environment than to play whack-a-mole.After upgrading, existing users need to rebuild their PHP images (
lerd php:rebuild <ver>) and recreate the FPM container (systemctl --user daemon-reload && podman rm -f lerd-php<short>-fpm && systemctl --user start lerd-php<short>-fpm) to pick up the new layer and the regenerated quadlet.