2006-08-21 18:05:11 +02:00
|
|
|
|
<chapter xmlns="http://docbook.org/ns/docbook"
|
2009-09-25 14:36:03 +02:00
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
|
xml:id="chap-quick-start">
|
2006-08-21 18:05:11 +02:00
|
|
|
|
|
|
|
|
|
<title>Quick Start</title>
|
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
|
|
|
|
|
<para>This chapter is for impatient people who don't like reading
|
|
|
|
|
documentation. For more in-depth information you are kindly referred
|
2004-10-14 13:55:12 +02:00
|
|
|
|
to the following chapters.</para>
|
2004-10-13 17:35:47 +02:00
|
|
|
|
|
|
|
|
|
<orderedlist>
|
|
|
|
|
|
2012-05-11 23:39:06 +02:00
|
|
|
|
<listitem><para>Download a source tarball or RPM or Debian/Ubuntu
|
|
|
|
|
package from <link xlink:href='http://nixos.org/'/>. Build source
|
|
|
|
|
distributions using the regular sequence:
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<screen>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
$ tar xvfj nix-<replaceable>version</replaceable>.tar.bz2
|
|
|
|
|
$ ./configure
|
|
|
|
|
$ make
|
|
|
|
|
$ make install <lineannotation>(as root)</lineannotation></screen>
|
|
|
|
|
|
2009-11-05 10:07:43 +01:00
|
|
|
|
This will install the Nix binaries in <filename>/usr/local</filename>
|
|
|
|
|
and keep the Nix store and other state in <filename>/nix</filename>.
|
|
|
|
|
You can change the former by specifying
|
|
|
|
|
<option>--prefix=<replaceable>path</replaceable></option>. The
|
|
|
|
|
location of the store can be changed using
|
|
|
|
|
<option>--with-store-dir=<replaceable>path</replaceable></option>.
|
|
|
|
|
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
|
|
|
|
|
<option>--localstatedir=<replaceable>path</replaceable>.</option></para></listitem>
|
|
|
|
|
|
|
|
|
|
<listitem><para>You should add
|
|
|
|
|
<filename><replaceable>prefix</replaceable>/etc/profile.d/nix.sh</filename>
|
|
|
|
|
to your <filename>~/.bashrc</filename> (or some other login
|
2004-10-13 17:35:47 +02:00
|
|
|
|
file).</para></listitem>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<listitem><para>Subscribe to the Nix Packages channel.
|
|
|
|
|
|
|
|
|
|
<screen>
|
2012-11-09 13:33:35 +01:00
|
|
|
|
$ nix-channel --add http://nixos.org/channels/nixpkgs-unstable</screen>
|
2004-10-13 17:35:47 +02:00
|
|
|
|
|
|
|
|
|
</para></listitem>
|
|
|
|
|
|
|
|
|
|
<listitem><para>Download the latest Nix expressions available in the channel.
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-channel --update</screen>
|
|
|
|
|
|
2007-12-04 12:42:58 +01:00
|
|
|
|
Note that this in itself doesn't download any packages, it just
|
2004-10-13 17:35:47 +02:00
|
|
|
|
downloads the Nix expressions that build them and stores them
|
|
|
|
|
somewhere (under <filename>~/.nix-defexpr</filename>, in case you're
|
|
|
|
|
curious). Also, it registers the fact that pre-built binaries are
|
|
|
|
|
available remotely.</para></listitem>
|
|
|
|
|
|
2007-12-04 12:42:58 +01:00
|
|
|
|
<listitem><para>See what installable packages are currently available
|
|
|
|
|
in the channel:
|
2004-10-13 17:35:47 +02:00
|
|
|
|
|
|
|
|
|
<screen>
|
2010-05-02 23:27:50 +02:00
|
|
|
|
$ nix-env -qa \*
|
2004-01-20 16:37:55 +01:00
|
|
|
|
docbook-xml-4.2
|
2004-10-13 17:35:47 +02:00
|
|
|
|
firefox-1.0pre-PR-0.10.1
|
|
|
|
|
hello-2.1.1
|
2004-01-20 16:37:55 +01:00
|
|
|
|
libxslt-1.1.0
|
|
|
|
|
<replaceable>...</replaceable></screen>
|
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
</para></listitem>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2007-12-04 12:42:58 +01:00
|
|
|
|
<listitem><para>Install some packages from the channel:
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<screen>
|
|
|
|
|
$ nix-env -i hello firefox <replaceable>...</replaceable> </screen>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2007-12-04 12:42:58 +01:00
|
|
|
|
This should download pre-built packages; it should not build them
|
|
|
|
|
locally (if it does, something went wrong).</para></listitem>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<listitem><para>Test that they work:
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<screen>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
$ which hello
|
2004-02-06 11:30:20 +01:00
|
|
|
|
/home/eelco/.nix-profile/bin/hello
|
2004-01-20 16:37:55 +01:00
|
|
|
|
$ hello
|
|
|
|
|
Hello, world!
|
2004-10-13 17:35:47 +02:00
|
|
|
|
$ firefox
|
2004-01-20 16:37:55 +01:00
|
|
|
|
<lineannotation>(read Slashdot or something)</lineannotation></screen>
|
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
</para></listitem>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<listitem><para>Uninstall a package:
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<screen>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
$ nix-env -e hello</screen>
|
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
</para></listitem>
|
|
|
|
|
|
|
|
|
|
<listitem><para>To keep up-to-date with the channel, do:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-channel --update
|
|
|
|
|
$ nix-env -u '*'</screen>
|
|
|
|
|
|
2007-12-04 12:42:58 +01:00
|
|
|
|
The latter command will upgrade each installed package for which there
|
|
|
|
|
is a “newer” version (as determined by comparing the version
|
2005-04-08 15:00:38 +02:00
|
|
|
|
numbers).</para></listitem>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2006-09-29 13:03:16 +02:00
|
|
|
|
<listitem><para>You can also install specific packages directly from
|
|
|
|
|
your web browser. For instance, you can go to <link
|
2012-05-11 23:39:06 +02:00
|
|
|
|
xlink:href="http://hydra.nixos.org/jobset/nixpkgs/trunk/channel/latest"
|
|
|
|
|
/> and click on any link for the individual packages for your
|
|
|
|
|
platform. Associate <literal>application/nix-package</literal> with
|
|
|
|
|
the program <command>nix-install-package</command>. A window should
|
2006-09-29 13:03:16 +02:00
|
|
|
|
appear asking you whether it’s okay to install the package. Say
|
|
|
|
|
<literal>Y</literal>. The package and all its dependencies will be
|
|
|
|
|
installed.</para></listitem>
|
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<listitem><para>If you're unhappy with the result of a
|
2007-12-04 12:42:58 +01:00
|
|
|
|
<command>nix-env</command> action (e.g., an upgraded package turned
|
2004-10-13 17:35:47 +02:00
|
|
|
|
out not to work properly), you can go back:
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<screen>
|
|
|
|
|
$ nix-env --rollback</screen>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
</para></listitem>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<listitem><para>You should periodically run the Nix garbage collector
|
|
|
|
|
to get rid of unused packages, since uninstalls or upgrades don't
|
2004-11-14 01:24:57 +01:00
|
|
|
|
actually delete them:
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
<screen>
|
2006-09-28 11:10:53 +02:00
|
|
|
|
$ nix-collect-garbage -d</screen>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2006-09-28 11:10:53 +02:00
|
|
|
|
<!--
|
2005-04-08 15:00:38 +02:00
|
|
|
|
The first command deletes old “generations” of your profile (making
|
2007-12-04 12:42:58 +01:00
|
|
|
|
rollbacks impossible, but also making the packages in those old
|
2005-04-08 15:00:38 +02:00
|
|
|
|
generations available for garbage collection), while the second
|
2006-09-28 11:10:53 +02:00
|
|
|
|
command actually deletes them.-->
|
|
|
|
|
|
|
|
|
|
</para></listitem>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-10-13 17:35:47 +02:00
|
|
|
|
</orderedlist>
|
2004-01-20 16:37:55 +01:00
|
|
|
|
|
2004-11-14 01:24:57 +01:00
|
|
|
|
</chapter>
|