This SDK provides direnv inside a workshop. It installs
the upstream binary and wires the bash shell hook system-wide. On project
setup it auto-allows /project/.envrc, so the project's environment loads
on every new shell. The direnv configuration and allowlist directories are
persisted between workshop updates, so approvals survive refreshes.
A minimal workshop:
# workshop.yaml
name: my-project
base: [email protected]
sdks:
- name: direnv
channel: latest/stableThe workshop user gets direnv on the PATH and an active hook in every
interactive bash shell. Place an .envrc in your project directory and its
exports load automatically on workshop shell.
-
No prerequisite SDKs are required.
-
Add an
.envrcfile at/project/.envrcwith the exports you want active in every shell:# /project/.envrc export DATABASE_URL=postgres://localhost/dev export NODE_ENV=development PATH_add ./bin
-
On launch, the SDK adds direnv to
PATH, injects the bash hook into/etc/bash.bashrc, and (when/project/.envrcexists) callsdirenv allow /projectso the hook is trusted without manual approval.
Once the workshop is ready:
workshop shellThe hook fires on shell start; your .envrc exports are active immediately.
direnv prints a one-line summary of the variables it loaded on every
directory change. Edit the .envrc and direnv re-reads it on the next prompt.
If you edit .envrc and direnv complains the file is no longer allowed (it
hashes the file on allow and re-prompts on changes), run:
direnv allowNon-interactive workshop exec and workshop run don't draw a prompt, so
the bash hook never fires. Use direnv exec /project -- <cmd> to load the
.envrc and run the command in that environment.
direnv is a convenient place to set environment variables consumed by other
workshop SDKs, for example API tokens for agentic SDKs like
claude-code,
codex,
copilot, or
opencode. Put the relevant
variable in /project/.envrc and it will be in scope wherever those SDKs
look for it:
# /project/.envrc
export ANTHROPIC_API_KEY=...
export OPENAI_API_KEY=...- Interface:
mount - Workshop target:
/home/workshop/.config/direnv - Purpose: Preserves direnv's user configuration between workshop updates.
This is where direnv looks for user extensions to the direnv stdlib and
direnv.toml.
- Interface:
mount - Workshop target:
/home/workshop/.local/share/direnv - Purpose: Preserves direnv's allowlist between workshop updates. direnv
stores the per-
.envrcapproval hashes underallow/here; without this mount, every refresh would force the user to re-approve their.envrcfiles.
This SDK doesn't define any slots.
- direnv project: direnv on GitHub
- Workshop forum: Discourse
- Please review our Code of Conduct before participating.
All contributions, including code, documentation updates, and issue reports, are welcome!
- See
CONTRIBUTING.mdfor guidelines. - Open issues or pull requests on the official repository.
Copyright 2026 Canonical Ltd.
This SDK packaging is licensed under the MIT License.
direnv itself is licensed under the MIT License.