Skip to content

feat: restore direnv (env+secrets) alongside mise (tools)#33

Merged
vaintrub merged 2 commits into
masterfrom
feat/restore-direnv
May 31, 2026
Merged

feat: restore direnv (env+secrets) alongside mise (tools)#33
vaintrub merged 2 commits into
masterfrom
feat/restore-direnv

Conversation

@vaintrub

Copy link
Copy Markdown
Owner

Reverses #32. Real-world study of vaintrub/infra (the IaC repo) showed direnv is genuinely needed, and our exclusion broke it.

Finding

infra/.envrc (committed, SHA-pinned) uses direnv-1password from_op to inject CLOUDFLARE_API_TOKEN/HCLOUD_TOKEN/DIGITALOCEAN_TOKEN/GH_TOKEN from op://Infrastructure/..., plus OP_SERVICE_ACCOUNT_TOKEN (headless-safe) + AWS_PROFILE (SSO). Tools come from .tool-versions (mise).

Why mise/plugins can't replace it

  • mise: no native op://; mise [hooks] enter leak (no cleanup on cd-out) — unsafe for secrets.
  • 1Password shell plugins: auth CLI binaries, don't inject terraform-provider env; AWS plugin is static-keys-only (you use SSO → redundant).

Why it's safe

mise docs: env-only direnv is fine; conflict is only when both manage the same tool. Division: mise = tool versions, direnv = env + secrets; never direnv layout/PATH_add.

Change

Verified: zsh -n clean, mise renders valid TOML, aqua:direnv/direnv resolves (2.37.1).

vaintrub added 2 commits May 31, 2026 13:29
Reverses PR #32's direnv exclusion. Studying the real infra repo
(vaintrub/infra) showed a deliberate committed .envrc using
direnv-1password (from_op) to inject Cloudflare/Hetzner/DO/GitHub provider
tokens + OP_SERVICE_ACCOUNT_TOKEN + AWS SSO profile — which mise cannot
replace (no native op://; mise hooks don't unload on cd-out) and 1Password
shell plugins don't cover (they auth CLI binaries, not terraform-provider
env). Removing direnv broke that repo.

mise's 'don't use both' applies only when both manage the same tool; an
env/secrets-only direnv is officially safe. Division: mise = tool versions,
direnv = per-project env + secrets; never direnv layout/PATH_add for tools.

Adds aqua:direnv/direnv to mise + direnv hook at end of dot_zshrc (after
prompt + ~/.zshrc_local, per direnv docs).
direnv prints 'direnv: loading …/.envrc' on shell start in an .envrc dir
(tmux panes, SSH into a project). With instant prompt 'verbose' that benign
output triggers a console-output warning every time. 'quiet' keeps instant
prompt on without the false warning. Completes the direnv coexistence.
@vaintrub vaintrub merged commit 08d25c6 into master May 31, 2026
3 checks passed
@vaintrub vaintrub deleted the feat/restore-direnv branch May 31, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant