Quick StartThis chapter is for impatient people who don't like reading
documentation. For more in-depth information you are kindly referred
to the following chapters.Download a source tarball or RPM or Debian/Ubuntu
package from . Build source
distributions using the regular sequence:
$ tar xvfj nix-version.tar.bz2
$ ./configure
$ make
$ make install (as root)
This will install the Nix binaries in /usr/local
and keep the Nix store and other state in /nix.
You can change the former by specifying
. The
location of the store can be changed using
.
However, you shouldn't change the store location, if at all possible,
since that will make it impossible to use pre-built binaries from the
Nixpkgs channel and other channels. The location of the state can be
changed using
You should add
prefix/etc/profile.d/nix.sh
to your ~/.bashrc (or some other login
file).Subscribe to the Nix Packages channel.
$ nix-channel --add http://nixos.org/channels/nixpkgs-unstableDownload the latest Nix expressions available in the channel.
$ nix-channel --update
Note that this in itself doesn't download any packages, it just
downloads the Nix expressions that build them and stores them
somewhere (under ~/.nix-defexpr, in case you're
curious). Also, it registers the fact that pre-built binaries are
available remotely.See what installable packages are currently available
in the channel:
$ nix-env -qa \*
docbook-xml-4.2
firefox-1.0pre-PR-0.10.1
hello-2.1.1
libxslt-1.1.0
...Install some packages from the channel:
$ nix-env -i hello firefox ...
This should download pre-built packages; it should not build them
locally (if it does, something went wrong).Test that they work:
$ which hello
/home/eelco/.nix-profile/bin/hello
$ hello
Hello, world!
$ firefox
(read Slashdot or something)Uninstall a package:
$ nix-env -e helloTo keep up-to-date with the channel, do:
$ nix-channel --update
$ nix-env -u '*'
The latter command will upgrade each installed package for which there
is a “newer” version (as determined by comparing the version
numbers).You can also install specific packages directly from
your web browser. For instance, you can go to and click on any link for the individual packages for your
platform. Associate application/nix-package with
the program nix-install-package. A window should
appear asking you whether it’s okay to install the package. Say
Y. The package and all its dependencies will be
installed.If you're unhappy with the result of a
nix-env action (e.g., an upgraded package turned
out not to work properly), you can go back:
$ nix-env --rollbackYou should periodically run the Nix garbage collector
to get rid of unused packages, since uninstalls or upgrades don't
actually delete them:
$ nix-collect-garbage -d