2006-08-21 19:05:11 +03:00
|
|
|
<chapter xmlns="http://docbook.org/ns/docbook"
|
2014-08-27 19:41:09 +03:00
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
|
|
version="5.0"
|
2014-11-24 15:53:50 +02:00
|
|
|
xml:id="chap-quick-start">
|
2006-08-21 19:05:11 +03:00
|
|
|
|
2014-11-24 15:53:50 +02:00
|
|
|
<title>Quick Start</title>
|
|
|
|
|
|
|
|
<para>This chapter is for impatient people who don't like reading
|
|
|
|
documentation. For more in-depth information you are kindly referred
|
|
|
|
to subsequent chapters.</para>
|
2006-08-21 19:05:11 +03:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<procedure>
|
2004-10-13 18:35:47 +03:00
|
|
|
|
2014-09-24 12:14:12 +03:00
|
|
|
<step><para>Install single-user Nix by running the following:
|
2013-04-09 18:57:48 +03:00
|
|
|
|
2004-10-13 18:35:47 +03:00
|
|
|
<screen>
|
2020-06-18 11:29:24 +03:00
|
|
|
$ bash <(curl -L https://nixos.org/nix/install)
|
2014-04-08 17:28:39 +03:00
|
|
|
</screen>
|
2004-10-13 18:35:47 +03:00
|
|
|
|
2014-04-08 17:28:39 +03:00
|
|
|
This will install Nix in <filename>/nix</filename>. The install script
|
|
|
|
will create <filename>/nix</filename> using <command>sudo</command>,
|
|
|
|
so make sure you have sufficient rights. (For other installation
|
2014-08-27 19:41:09 +03:00
|
|
|
methods, see <xref linkend="chap-installation"/>.)</para></step>
|
2004-10-13 18:35:47 +03:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<step><para>See what installable packages are currently available
|
2007-12-04 13:42:58 +02:00
|
|
|
in the channel:
|
2004-10-13 18:35:47 +03:00
|
|
|
|
|
|
|
<screen>
|
2014-04-08 17:28:39 +03:00
|
|
|
$ nix-env -qa
|
2014-11-24 16:14:07 +02:00
|
|
|
docbook-xml-4.3
|
|
|
|
docbook-xml-4.5
|
|
|
|
firefox-33.0.2
|
|
|
|
hello-2.9
|
|
|
|
libxslt-1.1.28
|
2020-07-23 15:28:05 +03:00
|
|
|
<emphasis>...</emphasis></screen>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
</para></step>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<step><para>Install some packages from the channel:
|
2013-04-09 18:57:48 +03:00
|
|
|
|
2004-10-13 18:35:47 +03:00
|
|
|
<screen>
|
2017-04-21 03:07:23 +03:00
|
|
|
$ nix-env -i hello</screen>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2007-12-04 13:42:58 +02:00
|
|
|
This should download pre-built packages; it should not build them
|
2014-08-27 19:41:09 +03:00
|
|
|
locally (if it does, something went wrong).</para></step>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<step><para>Test that they work:
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2004-10-13 18:35:47 +03:00
|
|
|
<screen>
|
2004-01-20 17:37:55 +02:00
|
|
|
$ which hello
|
2004-02-06 12:30:20 +02:00
|
|
|
/home/eelco/.nix-profile/bin/hello
|
2004-01-20 17:37:55 +02:00
|
|
|
$ hello
|
|
|
|
Hello, world!
|
2014-04-08 17:28:39 +03:00
|
|
|
</screen>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
</para></step>
|
2013-04-09 18:57:48 +03:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<step><para>Uninstall a package:
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2004-10-13 18:35:47 +03:00
|
|
|
<screen>
|
2004-01-20 17:37:55 +02:00
|
|
|
$ nix-env -e hello</screen>
|
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
</para></step>
|
2004-10-13 18:35:47 +03:00
|
|
|
|
2014-11-24 16:14:07 +02:00
|
|
|
<step><para>You can also test a package without installing it:
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
$ nix-shell -p hello
|
|
|
|
</screen>
|
|
|
|
|
|
|
|
This builds or downloads GNU Hello and its dependencies, then drops
|
|
|
|
you into a Bash shell where the <command>hello</command> command is
|
|
|
|
present, all without affecting your normal environment:
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
[nix-shell:~]$ hello
|
|
|
|
Hello, world!
|
|
|
|
|
|
|
|
[nix-shell:~]$ exit
|
|
|
|
|
|
|
|
$ hello
|
|
|
|
hello: command not found
|
|
|
|
</screen>
|
|
|
|
|
|
|
|
</para></step>
|
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<step><para>To keep up-to-date with the channel, do:
|
2004-10-13 18:35:47 +03:00
|
|
|
|
|
|
|
<screen>
|
2014-04-08 17:28:39 +03:00
|
|
|
$ nix-channel --update nixpkgs
|
2004-10-13 18:35:47 +03:00
|
|
|
$ nix-env -u '*'</screen>
|
|
|
|
|
2007-12-04 13:42:58 +02:00
|
|
|
The latter command will upgrade each installed package for which there
|
|
|
|
is a “newer” version (as determined by comparing the version
|
2014-08-27 19:41:09 +03:00
|
|
|
numbers).</para></step>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<step><para>If you're unhappy with the result of a
|
2007-12-04 13:42:58 +02:00
|
|
|
<command>nix-env</command> action (e.g., an upgraded package turned
|
2004-10-13 18:35:47 +03:00
|
|
|
out not to work properly), you can go back:
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2004-10-13 18:35:47 +03:00
|
|
|
<screen>
|
|
|
|
$ nix-env --rollback</screen>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
</para></step>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
<step><para>You should periodically run the Nix garbage collector
|
2004-10-13 18:35:47 +03:00
|
|
|
to get rid of unused packages, since uninstalls or upgrades don't
|
2004-11-14 02:24:57 +02:00
|
|
|
actually delete them:
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2004-10-13 18:35:47 +03:00
|
|
|
<screen>
|
2006-09-28 12:10:53 +03:00
|
|
|
$ nix-collect-garbage -d</screen>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2006-09-28 12:10:53 +03:00
|
|
|
<!--
|
2005-04-08 16:00:38 +03:00
|
|
|
The first command deletes old “generations” of your profile (making
|
2007-12-04 13:42:58 +02:00
|
|
|
rollbacks impossible, but also making the packages in those old
|
2005-04-08 16:00:38 +03:00
|
|
|
generations available for garbage collection), while the second
|
2006-09-28 12:10:53 +03:00
|
|
|
command actually deletes them.-->
|
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
</para></step>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-08-27 19:41:09 +03:00
|
|
|
</procedure>
|
2004-01-20 17:37:55 +02:00
|
|
|
|
2014-09-24 12:14:12 +03:00
|
|
|
</chapter>
|