LinuxmacOS

Where Does Devenv Store Config and State?

Devenv keeps devenv.nix and devenv.lock in your project root, with mutable state in .devenv. Commit the first two, ignore the third.

Last updated

Devenv stores intent and state apart. The project root holds devenv.nix with your declared tools and services. A lock file pins what those declarations resolved to. The .devenv folder holds everything generated.

That split decides your gitignore. Version the declarations and the lock. Exclude the state folder. Deleting .devenv is the standard fix for weird shells, exactly because nothing precious lives there.

Where Devenv stores this, by platform

Linux
<project>/devenv.nix + devenv.lock

Project definition and lock. Both belong in version control. Imports and overlays sit beside them in the repo.

Linux
<project>/.devenv

Generated state: builds, processes, caches. Regenerates on next shell. Same layout on macOS.

macOS
<project>/devenv.nix + devenv.lock

Same project files as Linux. Commit these, ignore .devenv.

macOS
<project>/.devenv

Same generated state folder as Linux. Delete to reset a broken shell.

Frequently asked questions

What Devenv files belong in git?

Commit devenv.nix (or devenv.yaml), devenv.lock, and any imported files. Add .devenv to gitignore. That folder holds build outputs and process state that regenerates.

How do I reset a broken Devenv shell?

Delete .devenv and run devenv shell again. It rebuilds state from the lock file. Your definitions are safe since they live outside that folder.

devenv.nix versus devenv.lock: what differs?

devenv.nix holds inputs like languages and services. devenv.lock pins exact versions. One is intent, the other is the reproducible result.

Notice an outdated path? Let us know.