# 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. ## Install Save as a script file and run: # Devenv — Fast Reproducible Developer Environments with Nix ## Quick Use ```bash # Install devenv sh <(curl -L https://devenv.sh/install.sh) # Initialize in a project devenv init devenv shell # enter the environment ``` ## 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 - https://github.com/cachix/devenv - https://devenv.sh/getting-started/ --- Source: https://tokrepo.com/en/workflows/asset-3396a520 Author: Script Depot