Skip to main content

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.

As projects grow, keeping all environment configuration in a single devenv.nix file becomes unwieldy. Imports let you split your environment across multiple files — or pull in configuration from remote inputs — and have devenv merge them into one coherent environment.

How imports work

When devenv processes an imports list, it evaluates each referenced devenv.nix and merges the results into the top-level environment. Options like packages, processes, and services from every imported file are combined, so running devenv up at the top level starts processes defined in all of them.
Composing devenv.yaml files via local paths (relative and absolute) is supported as of devenv 1.10. Remote inputs are not yet supported for devenv.yaml imports.

Monorepo pattern: frontend + backend

Imagine a typical web application with separate frontend and backend components living in sub-directories. Your top-level devenv.yaml can import both:
devenv.yaml
inputs:
  nixpkgs:
    url: github:cachix/devenv-nixpkgs/rolling
  devenv:
    url: github:cachix/devenv
    flake: false
imports:
  - ./frontend
  - ./backend
  - devenv/examples/supported-languages
  - devenv/examples/scripts
Each sub-directory contains its own devenv.nix:
{ pkgs, ... }: {
  languages.javascript.enable = true;
  processes.dev-server.exec = "npm run dev";
}

How the environment resolves

1

Enter a sub-directory

When you cd into frontend/ and run devenv shell, the environment activates based solely on frontend/devenv.nix.
2

Work at the top level

When you run devenv shell from the project root, devenv merges devenv.nix, frontend/devenv.nix, and backend/devenv.nix into one environment.
3

Start all processes

Running devenv up at the top level starts every process defined across all imported files — both the frontend dev server and the backend API.

Importing from remote inputs

You can also import devenv.nix modules from remote inputs. Add the input to devenv.yaml, then reference it in the imports array by input name and path:
devenv.yaml
inputs:
  nixpkgs:
    url: github:cachix/devenv-nixpkgs/rolling
  devenv:
    url: github:cachix/devenv
    flake: false
imports:
  - devenv/examples/supported-languages
  - devenv/examples/scripts
Importing from remote inputs is a great way to share common environment configuration across multiple repositories — for example, a shared tools module that adds linters and formatters used by your whole organisation.

devenv.yaml imports reference

The imports key accepts a list of paths or input-scoped paths:
devenv.yaml
imports:
  - ./path/to/local/module   # relative path to a directory with devenv.nix
  - /absolute/path/to/module # absolute path to a directory with devenv.nix
  - my-input/subdir          # path inside a declared input
See the devenv.yaml reference for all supported import options.

Build docs developers (and LLMs) love