Skip to content

direnv integration for automatic environment activation #39

Open

Description

@alanbem

Summary

Include direnv in the dclaude image as a developer QoL enabler.

direnv automatically loads/unloads environment variables based on .envrc files when you cd into directories.

Use Cases

Project-specific environment variables:

# .envrc
export DATABASE_URL="postgres://localhost/myapp_dev"
export AWS_PROFILE="mycompany"

Nix environment auto-activation (complements #37):

# .envrc
use flake
# or: use nix

Tool version managers:

# .envrc
layout node
layout python

User Experience

$ dclaude exec bash
claude@container:~$ cd /path/to/project
direnv: loading .envrc
direnv: export +DATABASE_URL +AWS_PROFILE

claude@container:/path/to/project$ cd ..
direnv: unloading

Works identically on host (macOS/Linux) and in dclaude - same .envrc file.

Implementation

  1. Install direnv in Dockerfile
  2. Add direnv hook to .bashrc / .zshrc
  3. Users create .envrc files in their projects

Relationship to Nix (#37)

direnv complements Nix integration:

Setup Claude session Interactive shell (dclaude exec bash)
flake.nix only dclaude wraps with nix develop ✓ manual nix develop needed
flake.nix + .envrc dclaude wraps with nix develop ✓ direnv auto-activates ✓

Part of

#38 - Vision: dclaude as orchestrator, not tool provider

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions