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.

Outputs allow you to define Nix derivations using the module system, exposing Nix packages or sets of packages to be consumed by other tools for installation and distribution. devenv provides a unified interface for packaging applications across all supported languages, automatically using each language’s best packaging tools.
Outputs were introduced in devenv v1.1.

Language integration

Each language provides an import function that wraps the best packaging tool for that ecosystem. You reference it through config.languages.<lang>.import:
devenv.nix
{ config, ... }: {
  languages.rust.enable = true;
  languages.python.enable = true;

  outputs = {
    rust-app = config.languages.rust.import ./rust-app {};
    python-app = config.languages.python.import ./python-app {};
  };
}
The language import functions automatically pick the right build backend:

Rust

Uses crate2nix for optimal Cargo.toml and Cargo.lock handling.

Python

Uses uv2nix for modern Python packaging with pyproject.toml support.
Other languages each use the most appropriate packaging tool for their ecosystem.

Building outputs

To build all defined outputs, run devenv build:
$ devenv build
{
  "outputs.rust-app": "/nix/store/abc123def456ghi789jkl012mno345pq-rust-app-1.0",
  "outputs.python-app": "/nix/store/xyz987wvu654tsr321qpo987mnl654ki-python-app-1.0"
}
To build a specific output, pass its name explicitly:
$ devenv build outputs.rust-app
{
  "outputs.rust-app": "/nix/store/abc123def456ghi789jkl012mno345pq-rust-app-1.0",
}
The command prints the Nix store paths of the built derivations, making it easy to hand off results to installers or deployment pipelines.

Defining outputs as custom module options

For more flexibility, you can define outputs using the module system’s options API. This integrates them with the rest of your configuration and allows other modules to reference them:
devenv.nix
{ pkgs, lib, config, ... }: {
  options = {
    myapp.package = pkgs.lib.mkOption {
      type = config.lib.types.outputOf lib.types.package;
      description = "The package for myapp";
      default = import ./myapp { inherit pkgs; };
      defaultText = "myapp";
    };
  };

  config = {
    outputs.git = pkgs.git;
  };
}
When building, devenv automatically includes every output defined via the outputs attribute as well as any options typed with config.lib.types.outputOf.
If you don’t need to expose an option’s output type, use config.lib.types.output instead of config.lib.types.outputOf lib.types.package.

Build docs developers (and LLMs) love