direnv
| Repo | box/github.com/opencharly/layer-direnv:v2026.287.2155 |
direnv — automatic per-directory environment loading from .envrc files
direnv installs the direnv binary (one package name across
fedora/arch/debian) AND declaratively wires the per-shell hook that
makes .envrc autoload work. The shell: schema below emits that hook
VENUE-SHAPED: at charly box build it bakes drop-ins into the image —
/etc/profile.d/charly-direnv-eval "$(direnv hook <shell>)" with ${SHELL_NAME} substituted) and
the fish-specific hook into /etc/fish/conf.d/charly-direnv.fish
(direnv hook fish | source) — while a target: local / target: vm
deploy instead appends managed blocks to ~/.bashrc / ~/.zshrc and
writes the per-user ~/.config/fish/conf.d/charly-direnv.fish.
sh is intentionally opted OUT (sh: {}): upstream direnv hook
supports bash/zsh/fish/tcsh but NOT sh, so direnv hook sh errors
on every shell that sources it. The scenarios assert the
installed/runnable binary in every venue, the baked drop-ins at
context: [build], and the deploy venue’s OWN wiring at
context: [runtime] — so a missing package, a missing shell wiring on
EITHER venue, or a shipped sh hook fails.
Packages
Section titled “Packages”Installed on every distro:
direnv
Acceptance plan
Section titled “Acceptance plan”This candy’s plan: — the runnable spec charly check executes against a live deployment. check: steps are idempotent probes; run: steps change state.
| Intent | Step |
|---|---|
check |
the direnv binary is installed at /usr/bin/direnv for the .envrc/.secrets autoload workflow |
check |
direnv reports its version without error |
check |
the bash shell-init drop-in EVALs the direnv hook, guarded to bash only (the guard stops bash from running the zsh drop-in, which /etc/profile also sources) |
check |
the zsh shell-init drop-in EVALs the direnv zsh hook, guarded to zsh only |
check |
NO sh drop-in is baked — direnv hook sh is not a valid target, so the sh:{} opt-out must suppress /etc/profile.d/charly-direnv-sh.sh (a file here means the invalid hook ships and errors on every sh) |
check |
the zsh drop-in is guarded to zsh — sourcing it under bash must produce zero errors (the zsh body uses zsh-only syntax, so an unguarded drop-in errors under bash; this is the observable cross-shell regression) |
check |
the fish shell-init drop-in is baked into its conf.d and sources the direnv fish hook |
check |
the direnv hook is wired at the DEPLOY venue — an image venue carries the baked drop-ins, a host/VM venue carries the managed ~/.bashrc + ~/.zshrc blocks and the per-user fish conf.d drop-in, and the sh:{} opt-out holds at both. The venue marker picks the branch, so a venue with NO wiring fails either way. |
check |
package=direnv |
check |
command=/usr/bin/direnv version |

