Skip to content

direnv / flake.nix environment is not propagated to agent sessions #523

@sgiath

Description

@sgiath

I’m using direnv together with flake.nix to provide project-local dependencies automatically when entering a directory.

This setup works as expected in:

  • terminal-based agents
  • Cursor
  • Zed

But when I run t3code, the agent behaves as if those dependencies are not available in the project environment.

For example, tools/binaries made available through direnv are visible in my shell, but the T3 Code agent reports that they are missing:

Image

Expected behavior

  • T3 Code should use the environment for the target project/worktree directory
  • if a project relies on direnv + flake.nix, the agent should see the same dependencies that are available in a normal shell inside that directory

Actual behavior

  • T3 Code appears to inherit only the parent process environment
  • workspace-local environment activation does not seem to happen for the agent session

Notes

  • My guess is that this may also affect other environment managers with similar behavior, such as asdf, mise, nix develop, etc.
  • I suspect the issue is that changing cwd alone is not enough; tools like direnv require explicit environment activation for that directory

Example project

Here is one of my projects that uses this setup: https://github.com/sgiath/nostr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions