LinuxCommandLibrary

nix-env

TLDR

Install package

$ nix-env -iA nixpkgs.[package]
copy
Uninstall package
$ nix-env -e [package]
copy
List installed packages
$ nix-env -q
copy
Search packages
$ nix-env -qaP [pattern]
copy
Upgrade all packages
$ nix-env -u
copy
Rollback to previous generation
$ nix-env --rollback
copy
List generations
$ nix-env --list-generations
copy

SYNOPSIS

nix-env [options] operation

DESCRIPTION

nix-env manages Nix user environments. It installs, upgrades, and removes packages in user profiles, with the ability to rollback to previous states.
Each operation creates a new generation, preserving previous states.

PARAMETERS

-i, --install

Install packages.
-e, --uninstall
Remove packages.
-u, --upgrade
Upgrade packages.
-q, --query
Query packages.
-A, --attr
Install by attribute.
--rollback
Rollback generation.
-p profile
Use profile.

PROFILES

$ ~/.nix-profile        - Default profile
/nix/var/nix/profiles - System profiles
copy

CAVEATS

Consider using declarative config (home-manager) instead. Generations use disk space. -A for attribute paths is faster.

HISTORY

nix-env is part of Nix, a purely functional package manager created by Eelco Dolstra in his 2006 PhD thesis at Utrecht University.

SEE ALSO

Copied to clipboard