devenv manages several files in your project directory and exposes a set of built-in environment variables that let your scripts and processes refer to well-known paths. Understanding these files and variables is key to structuring a devenv project effectively.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cachix/devenv/llms.txt
Use this file to discover all available pages before exploring further.
Project files
devenv.nix
devenv.nix
The only required file for specifying the developer environment. Generated by
devenv init and thoroughly documented — see the basics to get started.devenv.local.nix
devenv.local.nix
Same as
devenv.nix, but not meant to be committed to the Git repository. Developers can use it to override settings for their local setup without affecting the shared environment.devenv.yaml
devenv.yaml
Configuration for inputs and imports, allowing you to specify dependencies and how to compose them.You can require a specific devenv version to make sure all developers use a compatible version:See the devenv.yaml reference for details.
devenv.yaml
devenv.local.yaml
devenv.local.yaml
New in devenv 1.10. Same as
devenv.yaml, but not meant to be committed to the Git repository. Useful for local overrides to inputs or imports.devenv.lock
devenv.lock
Pinned inputs that ensure your developer environment is reproducible. Updated automatically by devenv when inputs change.
.envrc
.envrc
direnv integration logic. See the direnv integration guide to set up your shell to automatically activate the developer environment when you
cd into the project directory.Environment variables
Setting variables in devenv.nix
Use theenv option to declare environment variables that are available in your shell and all processes:
devenv.nix
Built-in devenv variables
devenv injects these variables automatically whenever your environment is active:$DEVENV_ROOT
Points to the root of the project where
devenv.nix is located.$DEVENV_DOTFILE
Points to
$DEVENV_ROOT/.devenv.$DEVENV_STATE
Points to
$DEVENV_DOTFILE/state. Use this for service data directories and other state that should persist across shell sessions.$DEVENV_RUNTIME
Points to a temporary directory unique to each
$DEVENV_ROOT. Used for sockets and other runtime files. Defaults to $XDG_RUNTIME_DIR, falling back to $TMPDIR and finally /tmp.$DEVENV_PROFILE
Points to the Nix store path containing the final profile of packages and scripts provided by devenv. Useful for teaching other programs about
/bin, /etc, and /var folders.$DEVENV_HOME
Points to
~/.local/share/devenv (following the XDG data directory convention). Stores GC roots and other persistent per-user data.