Skip to content

Installing packages on profiles

As shown in the previous section, you can produce a list of Nix installables by using the --installable option.

Not only can you feed that list into nix shell but also to any other nix CLI like nix profile install. Allowing you to install a set of tools into a directory of your choice along with all its dependencies in just one command.

The following example will install cargo and glibc. Notice that for packages providing many outputs (like glibc static and dev headers) you can specify output selectors.

Terminal window
mkdir tmp
nix profile install --profile $PWD/tmp/my-tools $(nix-versions -i cargo@latest glibc^static,dev@latest)
export PATH=$PWD/tmp/my-tools/bin:$PATH
which cargo
/home/foo/tmp/my-tools/bin/cargo
Contribute Community Sponsor