ScriptsMay 5, 2026·3 min read

Devenv — Fast Reproducible Developer Environments with Nix

A developer environment tool built on Nix that lets you define languages, services, and processes in a single file, producing instant, reproducible environments without containers.

Introduction

Devenv uses Nix under the hood to create fully reproducible developer environments that start in seconds. Unlike containers, it runs natively on your host, providing all the tooling your project needs without Dockerfiles or virtual machines.

What Devenv Does

  • Defines project toolchains, environment variables, and services in a single devenv.nix file
  • Provisions language runtimes (Node, Python, Go, Rust, etc.) at pinned versions instantly
  • Starts background services (PostgreSQL, Redis, Elasticsearch) as managed processes
  • Produces identical environments on Linux, macOS, and WSL without containers
  • Integrates with direnv to activate automatically when entering a project directory

Architecture Overview

Devenv evaluates a devenv.nix configuration to produce a Nix derivation that includes all declared packages, shell hooks, and process definitions. Nix ensures bit-for-bit reproducibility by pinning every dependency to a content-addressed store. The devenv up command uses a process manager to start declared services. A lockfile (devenv.lock) pins the Nixpkgs revision and any flake inputs.

Self-Hosting & Configuration

  • Install with the official one-line installer or via Nix (nix profile install github:cachix/devenv)
  • Requires Nix with flakes enabled (the installer handles this)
  • Define your environment in devenv.nix at the project root
  • Pin package versions by updating devenv.lock with devenv update
  • Use Cachix binary caches to avoid building packages from source

Key Features

  • Seconds-to-activate environments versus minutes for container builds
  • Native performance with no virtualization layer
  • Support for 80,000+ packages from Nixpkgs across all languages
  • Built-in process management for databases, queues, and custom daemons
  • Pre-commit hook integration for automatic code formatting and linting

Comparison with Similar Tools

  • Docker / Dev Containers — containerized isolation; Devenv runs natively with no overhead
  • Nix flakes (raw) — powerful but verbose; Devenv provides a friendlier, opinionated API
  • Devbox (Jetify) — similar Nix wrapper; Devenv adds service management and richer Nix integration
  • asdf / mise — version managers for runtimes only; Devenv also manages services and env vars
  • Vagrant — full VM provisioning; Devenv is lighter and faster for development tooling

FAQ

Q: Do I need to learn Nix to use Devenv? A: Basic usage requires minimal Nix knowledge. The devenv.nix schema is well-documented with examples for each language.

Q: Can I use Devenv in CI? A: Yes. Run devenv shell -- make test in CI to get the exact same environment as local development.

Q: Does it work on macOS with Apple Silicon? A: Yes. Nix supports aarch64-darwin natively, and most packages have prebuilt binaries via Cachix.

Q: How do I add a custom background service? A: Define a process in the processes attribute of devenv.nix with a command and optional readiness check.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets