▸ Agent Skills
3 min read

Packages

Packages allow you to add executables and libraries/headers to your environment.

To declare packages, refer to the pkgs input and specify packages as a list: Add packages to the packages list

{ pkgs, ... }:
{  packages = [    # Executables    pkgs.git    pkgs.jq    # Libraries    pkgs.libffi    pkgs.zlib  ];}

devenv.nix

Packages are added to the PATH when you activate the shell:

$ jqjq: command not found
$ devenv shellBuilding shell ...Entering shell ...
(devenv) $ jq --versionjq-1.6

Terminal window

Package outputs

Nixpkgs splits many packages into several outputs, such as bin, dev, lib, man or doc. Adding a package to packages gives the shell its dev output (or out when there is none) together with the bin, lib and include outputs it propagates, so headers, pkg-config files and libraries are available to compilers and linkers. Outputs like doc, debug and static are left out.

To get exactly one output, select it explicitly:

{ pkgs, ... }:
{  packages = [    # Only the shared libraries, without the `openssl` command line tool.    pkgs.openssl.out  ];}

devenv.nix

Installing a specific version

Add the nixpkgs-multiverse input once:

devenv inputs add nixpkgs-multiverse github:fzakaria/nixpkgs-multiverse

Terminal window

Packages are then available by their Nixpkgs attribute and version:

{ pkgs, multiverse, ... }:
{  packages = [    pkgs.git    multiverse.cmake."3.16.5"    multiverse.bun."0.7.0"  ];}

devenv.nix

The nixpkgs-multiverse input is pinned in devenv.lock. Historical Nixpkgs revisions are fetched lazily, so only revisions providing packages you use are downloaded. The unmodified input remains available as inputs."nixpkgs-multiverse" for advanced use. See Pinning an individual package version for the reproducibility and update workflow.

Pinning several packages

A multiverse costs one fetch and one evaluation per Nixpkgs revision it touches, not per package. Each version above resolves to the newest revision that shipped it, so two pins from different years mean two Nixpkgs trees.

multiverse.pins takes the whole set at once, resolves it through the fewest revisions that can serve it, and returns the packages:

{ multiverse, ... }:
{  packages = multiverse.pins {    cmake = "3.26.4";    bun = "0.7.0";  };}

devenv.nix

Both packages come back at exactly the versions you asked for. What minimizing decides is which revision serves each, so a pin can land on an older build of the same version.

The mvs solve command spells out the plan behind the answer from a terminal, and the raw input exposes it to Nix as data. See the fewest nixpkgs for how the plan is computed and why it is minimal.

Multiverse indexes top-level package attributes from published Nixpkgs releases and nixos-unstable channel revisions. If a package or version is not indexed, you can still fetch it from another nixpkgs input.

Searching

To search for available packages, use devenv search <NAME>:

$ devenv search ncduname         version  description----         -------  -----------pkgs.ncdu    2.2.1    Disk usage analyzer with an ncurses interfacepkgs.ncdu_1  1.17     Disk usage analyzer with an ncurses interfacepkgs.ncdu_2  2.2.1    Disk usage analyzer with an ncurses interface

No options found for 'ncdu'.
Found 3 packages and 0 options for 'ncdu'.

Terminal window

This will search available packages for the exact pinned version of Nixpkgs input in your devenv.lock.

Searching for a file

If you’d like to see what package includes a specific file, for example libquadmath.so:

$ nix run github:nix-community/nix-index-database libquadmath.so(rPackages.RcppEigen.out)                       302,984 x /nix/store/24r9jkqyf2nd5dlg1jyihfl82sa9nwwb-gfortran-12.3.0-lib/lib/libquadmath.so.0.0.0(zsnes2.out)                                    693,200 x /nix/store/z23qmfjaj5p50n3iki7zkjjgjzia16v1-gcc-12.3.0-lib/lib/libquadmath.so.0.0.0(zulip.out)                                           0 s /nix/store/xnlcrrg3b9fgwry6qh3fxk3hnb0whs5z-zulip-5.10.2-usr-target/lib/libquadmath.so.0.0.0(zulip.out)                                           0 s /nix/store/xnlcrrg3b9fgwry6qh3fxk3hnb0whs5z-zulip-5.10.2-usr-target/lib64/libquadmath.so.0.0.0(zulip.out)                                           0 s /nix/store/48dnfgadck1mzncy002cs1a9hpddmdmz-zulip-5.10.2-fhs/usr/lib/libquadmath.so.0.0.0(zettlr-beta.out)                                     0 s /nix/store/nlq9rpakv852kkm7lwhzgb8iap1izpdm-zettlr-beta-3.0.0-beta.7-fhs/usr/lib/libquadmath.so.0.0.0(zettlr-beta.out)                                     0 s /nix/store/8ypzmv66kvi6qrdlga9yg60gl396n7ny-zettlr-beta-3.0.0-beta.7-usr-target/lib/libquadmath.so.0.0.0(zettlr-beta.out)                                     0 s /nix/store/8ypzmv66kvi6qrdlga9yg60gl396n7ny-zettlr-beta-3.0.0-beta.7-usr-target/lib64/libquadmath.so.0.0.0(zettlr.out)                                          0 s /nix/store/5xq9qch1fnknn3z97wcdvcf5vgjfm2ip-zettlr-2.3.0-fhs/usr/lib/libquadmath.so.0.0.0(zecwallet-lite.out)                                  0 s /nix/store/rllm8zagppnjf4kh14drwwg93gsxwaja-zecwallet-lite-1.8.8-fhs/usr/lib/libquadmath.so.0.0.0...

Terminal window


Last updated Oct 08, 2026