Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>devenvNew to Visual Studio Code? Get it now.
devenv

devenv

Preview

Asko Soukka

|
553 installs
| (0) | Free
Declarative developer environments for Visual Studio Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

devenv

⚠️ Notice: This extension is forked from direnv/direnv-vscode and has been rewritten for devenv using an LLM coding agent. Use with appropriate caution and review the source before deploying in production environments.

devenv is a tool for creating fast, declarative, reproducible, and composable developer environments using Nix.

This extension adds devenv support to Visual Studio Code by loading environment variables from devenv.nix for the workspace root.

Features

Custom Environment

This extension automatically loads the custom environment devenv provides for the workspace by running devenv print-dev-env. When devenv.nix, devenv.yaml, devenv.lock, or local override files are modified, the extension automatically reloads the environment.

The custom environment is available in integrated terminals, in custom tasks of type shell, and in environment variable substitutions (${env:VAR}).

Commands

  • "devenv: Open devenv.nix file" opens an editor with the devenv.nix file for the workspace root.

  • "devenv: Reload environment" reloads the custom environment for the workspace.

  • "devenv: Reset and reload environment" resets the custom environment for the workspace, then reloads it.

Status Item

The extension displays a status icon that indicates whether it is currently working or has succeeded or failed.

Clicking the status item will also reload the custom environment.

Requirements

This extension requires devenv to be installed. See the devenv installation guide for details.

Settings

Setting Default Description
devenv.path.executable devenv Path to the devenv executable. Set this to an absolute path if devenv is not on the PATH that VS Code sees.
devenv.path.nixBinPaths [] Extra directories to prepend to PATH when running devenv. The extension already adds the standard Nix profile directories and common system paths; use this only for non-standard install locations.
devenv.extraEnv {} Environment variables to set before running devenv.
devenv.watchForChanges true Automatically reload the environment when devenv.nix, devenv.yaml, devenv.lock, or local override files change.
devenv.status.showChangesCount true Show the count of added/changed/removed variables in the status bar.
devenv.restart.automatic false Automatically restart the extension host after the environment changes (instead of prompting).

Known Issues

Custom tasks with type process don't pick up on the modified environment. Several task provider extensions provide these kinds of tasks.

When devenv unsets an environment variable that already existed before devenv loaded, then in the terminal it will be set to empty (what POSIX calls null) rather than truly unset. VSCode does not provide API to unset environment variables for the terminal. Variables that were not present before devenv loaded are handled correctly and will remain absent in the terminal. The difference between null and unset variables is mostly academic but some programs insist on treating them distinctly.

devenv evaluates Nix expressions so this extension requires trusted workspaces.

Virtual Environments and Background Tasks

This extension determines your environment by running devenv print-dev-env --json in the background. This command is fast and purely evaluates your Nix derivations without executing heavy shell tasks.

Because of this, if your devenv.nix contains configurations that require a shell task to physically build (such as languages.python.venv.enable = true in devenv 2.x), the extension will not automatically build the .venv directory for you in the background when you edit the file. Doing so could cause unexpected CPU spikes, network downloads, and hide installation errors from you.

To build or update your virtual environment:

  1. Open a terminal and run devenv shell (or use direnv). This will execute the required tasks and build your virtual environment.
  2. The extension will automatically detect that the .devenv/state/venv folder now exists, and it will safely inject the VIRTUAL_ENV variable and prepend .venv/bin into your VS Code PATH.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft