Skip to content

Support for directory-based auto-activation (direnv shell hook equivalent) #2488

@schickling

Description

@schickling

Problem

A key feature of direnv is its shell hook (eval "$(direnv hook fish)" etc.) which automatically activates/deactivates environments when cd-ing into/out of project directories. This is essential for seamless developer experience — the environment just works without manually running any command.

As devenv moves toward replacing direnv (#2061), an equivalent mechanism is needed: automatic environment activation/deactivation triggered by directory changes.

Expected behavior

Devenv should provide a shell hook (for bash, zsh, and fish) that:

  1. Detects when the user enters a directory with a devenv.nix / devenv.yaml
  2. Automatically activates the devenv environment (ideally with background evaluation, as noted in Replace direnv with Rust #2061)
  3. Deactivates/restores the previous environment when leaving the directory
  4. Works with nested projects (inner project takes precedence)

This is the main remaining blocker for fully replacing direnv with devenv.

Related


This issue was created on behalf of @schickling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions