devenv
Research Date: 2026-02-26
Source URL: https://devenv.sh
GitHub Repository: https://github.com/cachix/devenv
Version at Research: v1.11.2
License: Apache-2.0
Overview
devenv is a declarative developer environment tool built on Nix that enables teams to define fast, reproducible, and composable development environments in a single devenv.nix configuration file. It provides 100,000+ prebuilt packages, built-in process management, task automation, and service orchestration that activate in under 100ms through Nix evaluation caching. The tool targets the "works on my machine" problem by encoding the entire toolchain — languages, services, git hooks, and environment variables — as version-pinned, reproducible declarations.
Problem Addressed
| Problem |
Solution |
| "Works on my machine" environment drift between developers |
Declarative Nix-based configuration pinned via devenv.lock, guaranteeing bit-for-bit reproducibility |
| Slow environment activation blocking developer workflow |
Nix evaluation caching delivers sub-100ms activation through direnv integration |
| Managing multiple language runtimes and toolchains per project |
50+ language modules with built-in version management for Python, Rust, Go, Ruby, PHP, Terraform |
| Running local services (databases, message brokers) without Docker overhead |
Native service modules for PostgreSQL, Redis, MySQL, Kafka, RabbitMQ, Elasticsearch with no container runtime |
| Inconsistent CI vs local development environments |
devenv test command runs the same environment definition in CI pipelines |
| Monorepo environment sprawl across frontend/backend components |
Composable imports in devenv.yaml merge local sub-environment configurations |
| Container configuration duplication |
devcontainer.enable = true auto-generates .devcontainer.json from the same devenv.nix |
Key Statistics
| Metric |
Value |
Date Gathered |
| GitHub Stars |
6,342 |
2026-02-26 |
| Forks |
467 |
2026-02-26 |
| Contributors |
246 |
2026-02-26 |
| Open Issues |
352 |
2026-02-26 |
| Latest Release |
v1.11.2 |
2025-11-27 |
| Repository Created |
2022-10-22 |
2026-02-26 |
| Primary Language |
Rust |
2026-02-26 |
SOURCE: GitHub API repos/cachix/devenv (accessed 2026-02-26)
Key Features
Declarative Environment Configuration
devenv.nix is the single source of truth for packages, languages, services, processes, tasks, git hooks, and environment variables
devenv.yaml defines input sources (nixpkgs revision, custom flake inputs) and composes imports from sub-directories
devenv.lock pins all inputs to exact revisions for reproducible builds
- Profile-based activation allows hostname/username-based environment variants within one configuration
Language Support (50+ languages)
- Per-language modules with version management: Python (via venv/conda/uv), Rust (toolchain pinning), Go, Ruby, PHP, Terraform, JavaScript/Node.js, Java, Haskell, and 40+ others
- LSP servers, formatters, linters, and compilers enabled declaratively per language
- Python example:
languages.python.enable = true; languages.python.version = "3.12.0";
Service Orchestration
- 30+ built-in service modules: PostgreSQL, Redis, MySQL, MongoDB, Kafka, RabbitMQ, Elasticsearch, Memcached, MinIO, and more
- Services run natively in the development environment without requiring Docker or container runtimes
- Each service module exposes typed configuration options (port, data directory, authentication settings)
Process Management
- Default built-in process manager supports supervision, socket activation, file watching, and dependency ordering
- Alternative process manager backends: process-compose (TUI), hivemind, honcho, overmind, mprocs — switchable via
process.manager.implementation
- Restart policies:
on_failure (default), always, never
- Ready probes: exec commands, HTTP endpoint polling, systemd-style
READY=1 notify probes
- Process dependencies declared with
after/before and temporal suffixes @started, @ready, @completed
Task Automation System
- Tasks defined in
devenv.nix with exec, status (skip-if-zero-exit), execIfModified (file hash tracking), and package attributes
- Parallel execution with automatic dependency resolution between named tasks
- Inter-task data flow via
$DEVENV_TASK_INPUT, $DEVENV_TASKS_OUTPUTS, $DEVENV_TASK_OUTPUT_FILE environment variables
- Processes become tasks automatically under the
devenv:processes: namespace
- Supports any language for task execution via the
package attribute
Git Hooks Integration
git-hooks.hooks module enables pre-commit, commit-msg, and other hook types
- Language-specific linters (black, isort, rustfmt, golangci-lint, eslint) activated per-project
- Uses the upstream
pre-commit framework's hook registry under the hood
Composability and Imports
devenv.yaml imports support local relative paths for monorepo subdirectory composition
- At the root, all imported configurations merge so
devenv up starts unified process set
- Per-subdirectory activation: entering
frontend/ activates only that component's environment
- Remote imports not yet supported in
devenv.yaml (as of v1.10)
Container and Codespace Support
devcontainer.enable = true generates .devcontainer.json from the same Nix configuration
- Generated devcontainer compatible with GitHub Codespaces and VS Code Dev Containers
- Container/OCI image building from development environment configuration
Secrets Management
- SecretSpec integration (
secretspec v0.4.1+ as of v1.11.2) for declarative secrets management
- Secrets injected into environment without hardcoding in version-controlled configuration files
Technical Architecture
devenv is implemented in Rust for the CLI binary, with the module system written in Nix. The evaluation pipeline works as follows:
Key architectural decisions:
- Nix module system: All configuration options are typed Nix modules — invalid configurations fail at evaluation time with descriptive errors rather than runtime
- Binary cache: Cachix (the same organization) provides a public binary cache (
cachix.cachix.org) so common packages download as pre-built binaries rather than compiling from source
- direnv integration:
.envrc generated by devenv init calls use devenv, enabling automatic shell activation when entering the project directory
- Flakes compatibility: devenv supports both classic Nix (via
nixpkgs.tarball) and Nix Flakes for teams already on flakes-based workflows
Installation & Usage
# Step 1: Install Nix (Linux/macOS daemon mode)
sh <(curl -L https://nixos.org/nix/install) --daemon
# Step 2: Install devenv via nixpkgs unstable
nix-env --install --attr devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstable
# Or via nix profile
nix profile install nixpkgs#devenv
# Step 3 (optional): Add GitHub token to avoid API rate limits
echo "access-tokens = github.com=<GITHUB_TOKEN>" >> ~/.config/nix/nix.conf
# Initialize a new project
devenv init
# Creates: .envrc, devenv.nix, devenv.yaml, .gitignore
# Activate environment (manual)
devenv shell
# Start all configured processes
devenv up
# Run tasks
devenv tasks run myapp:build
# Update pinned inputs
devenv update
# Run environment tests (for CI)
devenv test
# Build container image
devenv container build
# devenv.nix — example configuration
{ pkgs, lib, config, ... }:
{
# Packages available in the shell
packages = [ pkgs.git pkgs.jq ];
# Language runtimes
languages.python = {
enable = true;
version = "3.12.0";
venv.enable = true;
venv.requirements = ./requirements.txt;
};
languages.rust = {
enable = true;
channel = "stable";
};
# Local services (no Docker needed)
services.postgres = {
enable = true;
port = 5432;
initialDatabases = [{ name = "myapp"; }];
};
services.redis = {
enable = true;
port = 6379;
};
# Processes
processes = {
web.exec = "python manage.py runserver";
worker.exec = "celery -A myapp worker";
};
# Tasks
tasks = {
"myapp:migrate" = {
exec = "python manage.py migrate";
execIfModified = [ "migrations/**/*.py" ];
};
};
# Git hooks
git-hooks.hooks = {
black.enable = true;
ruff.enable = true;
rustfmt.enable = true;
};
# Environment variables
env.DATABASE_URL = "postgresql://localhost:5432/myapp";
# DevContainer support
devcontainer.enable = true;
}
# devenv.yaml — input composition
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
imports:
- ./frontend
- ./backend
Relevance to Claude Code Development
Applications
- Reproducible skill development environments: Each skill plugin that depends on specific Python versions, linting tools (prek, pre-commit), or CLI tools (gh, uv) could be declared in a
devenv.nix at the repository root, eliminating onboarding friction
- Consistent pre-commit hook enforcement: The git-hooks module directly replaces manual
.pre-commit-config.yaml management by declaring hooks as typed Nix options with automatic installation
- Local service mocking for tests: Skills that test against databases or message queues could use devenv's service modules to spin up local PostgreSQL/Redis instances without Docker, matching CI environments
- Task automation parity with CI: The task system with
execIfModified and status caching mirrors the conditional execution patterns needed for efficient CI/CD in skill validation pipelines
Patterns Worth Adopting
- Typed configuration with fail-fast validation: devenv's Nix module system rejects invalid option combinations at evaluation time rather than at runtime — a pattern applicable to skill frontmatter validation
execIfModified content-hash tracking: Skipping expensive operations when inputs have not changed (by hash, not just timestamp) is directly applicable to the validate_research.py freshness checks
- Namespace-prefixed task composition: The
namespace:taskname convention for task grouping provides a clear model for organizing the research curator's multi-step workflows
- Inter-task data flow via environment variables:
$DEVENV_TASK_INPUT / $DEVENV_TASK_OUTPUT_FILE provides a simple, shell-agnostic IPC pattern for agent pipelines
Integration Opportunities
- devenv.nix at repository root: Adding
devenv.nix to claude_skills would provide a single-command environment setup (devenv shell) with all required tools (uv, gh, prek, node) pinned to exact versions
- Replace manual pre-commit setup: Current
uv run prek install step in CLAUDE.md session start could be absorbed into devenv's git-hooks module, auto-installing hooks on devenv shell entry
- Process management for local agent testing: Multi-agent skill tests that require concurrent processes (orchestrator + worker agents) could be declared as devenv processes with proper dependency ordering
References
Freshness Tracking
| Field |
Value |
| Last Verified |
2026-02-26 |
| Version at Verification |
v1.11.2 |
| Next Review Recommended |
2026-05-26 |
1---2name: problem-addressed-313description: devenv is a declarative developer environment tool built on Nix that enables teams to define fast, reproducible, and composable development environments in a single devenv.nix configuration file.4---5# devenv67**Research Date**: 2026-02-268**Source URL**: <https://devenv.sh>9**GitHub Repository**: <https://github.com/cachix/devenv>10**Version at Research**: v1.11.211**License**: Apache-2.01213---1415## Overview1617devenv is a declarative developer environment tool built on Nix that enables teams to define fast, reproducible, and composable development environments in a single `devenv.nix` configuration file. It provides 100,000+ prebuilt packages, built-in process management, task automation, and service orchestration that activate in under 100ms through Nix evaluation caching. The tool targets the "works on my machine" problem by encoding the entire toolchain — languages, services, git hooks, and environment variables — as version-pinned, reproducible declarations.1819---2021## Problem Addressed2223| Problem | Solution |24|---------|----------|25| "Works on my machine" environment drift between developers | Declarative Nix-based configuration pinned via `devenv.lock`, guaranteeing bit-for-bit reproducibility |26| Slow environment activation blocking developer workflow | Nix evaluation caching delivers sub-100ms activation through direnv integration |27| Managing multiple language runtimes and toolchains per project | 50+ language modules with built-in version management for Python, Rust, Go, Ruby, PHP, Terraform |28| Running local services (databases, message brokers) without Docker overhead | Native service modules for PostgreSQL, Redis, MySQL, Kafka, RabbitMQ, Elasticsearch with no container runtime |29| Inconsistent CI vs local development environments | `devenv test` command runs the same environment definition in CI pipelines |30| Monorepo environment sprawl across frontend/backend components | Composable imports in `devenv.yaml` merge local sub-environment configurations |31| Container configuration duplication | `devcontainer.enable = true` auto-generates `.devcontainer.json` from the same `devenv.nix` |3233---3435## Key Statistics3637| Metric | Value | Date Gathered |38|--------|-------|---------------|39| GitHub Stars | 6,342 | 2026-02-26 |40| Forks | 467 | 2026-02-26 |41| Contributors | 246 | 2026-02-26 |42| Open Issues | 352 | 2026-02-26 |43| Latest Release | v1.11.2 | 2025-11-27 |44| Repository Created | 2022-10-22 | 2026-02-26 |45| Primary Language | Rust | 2026-02-26 |4647SOURCE: [GitHub API repos/cachix/devenv](https://api.github.com/repos/cachix/devenv) (accessed 2026-02-26)4849---5051## Key Features5253### Declarative Environment Configuration5455- `devenv.nix` is the single source of truth for packages, languages, services, processes, tasks, git hooks, and environment variables56- `devenv.yaml` defines input sources (nixpkgs revision, custom flake inputs) and composes imports from sub-directories57- `devenv.lock` pins all inputs to exact revisions for reproducible builds58- Profile-based activation allows hostname/username-based environment variants within one configuration5960### Language Support (50+ languages)6162- Per-language modules with version management: Python (via venv/conda/uv), Rust (toolchain pinning), Go, Ruby, PHP, Terraform, JavaScript/Node.js, Java, Haskell, and 40+ others63- LSP servers, formatters, linters, and compilers enabled declaratively per language64- Python example: `languages.python.enable = true; languages.python.version = "3.12.0";`6566### Service Orchestration6768- 30+ built-in service modules: PostgreSQL, Redis, MySQL, MongoDB, Kafka, RabbitMQ, Elasticsearch, Memcached, MinIO, and more69- Services run natively in the development environment without requiring Docker or container runtimes70- Each service module exposes typed configuration options (port, data directory, authentication settings)7172### Process Management7374- Default built-in process manager supports supervision, socket activation, file watching, and dependency ordering75- Alternative process manager backends: process-compose (TUI), hivemind, honcho, overmind, mprocs — switchable via `process.manager.implementation`76- Restart policies: `on_failure` (default), `always`, `never`77- Ready probes: exec commands, HTTP endpoint polling, systemd-style `READY=1` notify probes78- Process dependencies declared with `after`/`before` and temporal suffixes `@started`, `@ready`, `@completed`7980### Task Automation System8182- Tasks defined in `devenv.nix` with `exec`, `status` (skip-if-zero-exit), `execIfModified` (file hash tracking), and `package` attributes83- Parallel execution with automatic dependency resolution between named tasks84- Inter-task data flow via `$DEVENV_TASK_INPUT`, `$DEVENV_TASKS_OUTPUTS`, `$DEVENV_TASK_OUTPUT_FILE` environment variables85- Processes become tasks automatically under the `devenv:processes:` namespace86- Supports any language for task execution via the `package` attribute8788### Git Hooks Integration8990- `git-hooks.hooks` module enables pre-commit, commit-msg, and other hook types91- Language-specific linters (black, isort, rustfmt, golangci-lint, eslint) activated per-project92- Uses the upstream `pre-commit` framework's hook registry under the hood9394### Composability and Imports9596- `devenv.yaml` imports support local relative paths for monorepo subdirectory composition97- At the root, all imported configurations merge so `devenv up` starts unified process set98- Per-subdirectory activation: entering `frontend/` activates only that component's environment99- Remote imports not yet supported in `devenv.yaml` (as of v1.10)100101### Container and Codespace Support102103- `devcontainer.enable = true` generates `.devcontainer.json` from the same Nix configuration104- Generated devcontainer compatible with GitHub Codespaces and VS Code Dev Containers105- Container/OCI image building from development environment configuration106107### Secrets Management108109- SecretSpec integration (`secretspec` v0.4.1+ as of v1.11.2) for declarative secrets management110- Secrets injected into environment without hardcoding in version-controlled configuration files111112---113114## Technical Architecture115116devenv is implemented in Rust for the CLI binary, with the module system written in Nix. The evaluation pipeline works as follows:117118<eg>119devenv.yaml devenv.nix Nix module system120 | | |121 v v v122Input pins ------> User config ------> Merged module options123(devenv.lock) (languages, services,124 processes, tasks)125 |126 v127 Nix derivation graph128 |129 +---------+---------+130 | |131 v v132 Cachix binary Local build133 cache lookup (Nix store)134 | |135 v v136 /nix/store/... <--------+137 |138 v139 Shell environment140 (PATH, env vars, hooks)141 activated via direnv142</eg>143144Key architectural decisions:145146- **Nix module system**: All configuration options are typed Nix modules — invalid configurations fail at evaluation time with descriptive errors rather than runtime147- **Binary cache**: Cachix (the same organization) provides a public binary cache (`cachix.cachix.org`) so common packages download as pre-built binaries rather than compiling from source148- **direnv integration**: `.envrc` generated by `devenv init` calls `use devenv`, enabling automatic shell activation when entering the project directory149- **Flakes compatibility**: devenv supports both classic Nix (via `nixpkgs.tarball`) and Nix Flakes for teams already on flakes-based workflows150151---152153## Installation & Usage154155```bash156# Step 1: Install Nix (Linux/macOS daemon mode)157sh <(curl -L https://nixos.org/nix/install) --daemon158159# Step 2: Install devenv via nixpkgs unstable160nix-env --install --attr devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstable161162# Or via nix profile163nix profile install nixpkgs#devenv164165# Step 3 (optional): Add GitHub token to avoid API rate limits166echo "access-tokens = github.com=<GITHUB_TOKEN>" >> ~/.config/nix/nix.conf167```168169```bash170# Initialize a new project171devenv init172# Creates: .envrc, devenv.nix, devenv.yaml, .gitignore173174# Activate environment (manual)175devenv shell176177# Start all configured processes178devenv up179180# Run tasks181devenv tasks run myapp:build182183# Update pinned inputs184devenv update185186# Run environment tests (for CI)187devenv test188189# Build container image190devenv container build191```192193```nix194# devenv.nix — example configuration195{ pkgs, lib, config, ... }:196197{198 # Packages available in the shell199 packages = [ pkgs.git pkgs.jq ];200201 # Language runtimes202 languages.python = {203 enable = true;204 version = "3.12.0";205 venv.enable = true;206 venv.requirements = ./requirements.txt;207 };208209 languages.rust = {210 enable = true;211 channel = "stable";212 };213214 # Local services (no Docker needed)215 services.postgres = {216 enable = true;217 port = 5432;218 initialDatabases = [{ name = "myapp"; }];219 };220221 services.redis = {222 enable = true;223 port = 6379;224 };225226 # Processes227 processes = {228 web.exec = "python manage.py runserver";229 worker.exec = "celery -A myapp worker";230 };231232 # Tasks233 tasks = {234 "myapp:migrate" = {235 exec = "python manage.py migrate";236 execIfModified = [ "migrations/**/*.py" ];237 };238 };239240 # Git hooks241 git-hooks.hooks = {242 black.enable = true;243 ruff.enable = true;244 rustfmt.enable = true;245 };246247 # Environment variables248 env.DATABASE_URL = "postgresql://localhost:5432/myapp";249250 # DevContainer support251 devcontainer.enable = true;252}253```254255```yaml256# devenv.yaml — input composition257inputs:258 nixpkgs:259 url: github:NixOS/nixpkgs/nixpkgs-unstable260261imports:262 - ./frontend263 - ./backend264```265266---267268## Relevance to Claude Code Development269270### Applications271272- **Reproducible skill development environments**: Each skill plugin that depends on specific Python versions, linting tools (prek, pre-commit), or CLI tools (gh, uv) could be declared in a `devenv.nix` at the repository root, eliminating onboarding friction273- **Consistent pre-commit hook enforcement**: The git-hooks module directly replaces manual `.pre-commit-config.yaml` management by declaring hooks as typed Nix options with automatic installation274- **Local service mocking for tests**: Skills that test against databases or message queues could use devenv's service modules to spin up local PostgreSQL/Redis instances without Docker, matching CI environments275- **Task automation parity with CI**: The task system with `execIfModified` and status caching mirrors the conditional execution patterns needed for efficient CI/CD in skill validation pipelines276277### Patterns Worth Adopting278279- **Typed configuration with fail-fast validation**: devenv's Nix module system rejects invalid option combinations at evaluation time rather than at runtime — a pattern applicable to skill frontmatter validation280- **`execIfModified` content-hash tracking**: Skipping expensive operations when inputs have not changed (by hash, not just timestamp) is directly applicable to the `validate_research.py` freshness checks281- **Namespace-prefixed task composition**: The `namespace:taskname` convention for task grouping provides a clear model for organizing the research curator's multi-step workflows282- **Inter-task data flow via environment variables**: `$DEVENV_TASK_INPUT` / `$DEVENV_TASK_OUTPUT_FILE` provides a simple, shell-agnostic IPC pattern for agent pipelines283284### Integration Opportunities285286- **devenv.nix at repository root**: Adding `devenv.nix` to `claude_skills` would provide a single-command environment setup (`devenv shell`) with all required tools (uv, gh, prek, node) pinned to exact versions287- **Replace manual pre-commit setup**: Current `uv run prek install` step in CLAUDE.md session start could be absorbed into `devenv`'s `git-hooks` module, auto-installing hooks on `devenv shell` entry288- **Process management for local agent testing**: Multi-agent skill tests that require concurrent processes (orchestrator + worker agents) could be declared as devenv processes with proper dependency ordering289290---291292## References293294- [devenv official website](https://devenv.sh) (accessed 2026-02-26)295- [devenv Getting Started](https://devenv.sh/getting-started/) (accessed 2026-02-26)296- [devenv Processes documentation](https://devenv.sh/processes/) (accessed 2026-02-26)297- [devenv Tasks documentation](https://devenv.sh/tasks/) (accessed 2026-02-26)298- [devenv Composing using imports](https://devenv.sh/composing-using-imports/) (accessed 2026-02-26)299- [devenv Codespaces/DevContainer integration](https://devenv.sh/integrations/codespaces-devcontainer/) (accessed 2026-02-26)300- [GitHub repository cachix/devenv](https://github.com/cachix/devenv) (accessed 2026-02-26)301- [GitHub API release v1.11.2](https://github.com/cachix/devenv/releases/tag/v1.11.2) (accessed 2026-02-26)302303---304305## Freshness Tracking306307| Field | Value |308|-------|-------|309| Last Verified | 2026-02-26 |310| Version at Verification | v1.11.2 |311| Next Review Recommended | 2026-05-26 |