aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/introduction/quick-start.xml
blob: 5ae9f6ad543b432755e3ee482231b57534447490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<chapter xmlns="http://docbook.org/ns/docbook"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      version="5.0"
      xml:id="chap-quick-start">

<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>

<procedure>

<step><para>Install single-user Nix by running the following:

<screen>
$ curl https://nixos.org/nix/install | sh
</screen>

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
methods, see <xref linkend="chap-installation"/>.)</para></step>

<step><para>See what installable packages are currently available
in the channel:

<screen>
$ nix-env -qa
docbook-xml-4.3
docbook-xml-4.5
firefox-33.0.2
hello-2.9
libxslt-1.1.28
<replaceable>...</replaceable></screen>

</para></step>

<step><para>Install some packages from the channel:

<screen>
$ nix-env -i hello <replaceable>...</replaceable> </screen>

This should download pre-built packages; it should not build them
locally (if it does, something went wrong).</para></step>

<step><para>Test that they work:

<screen>
$ which hello
/home/eelco/.nix-profile/bin/hello
$ hello
Hello, world!
</screen>

</para></step>

<step><para>Uninstall a package:

<screen>
$ nix-env -e hello</screen>

</para></step>

<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>

<step><para>To keep up-to-date with the channel, do:

<screen>
$ nix-channel --update nixpkgs
$ nix-env -u '*'</screen>

The latter command will upgrade each installed package for which there
is a “newer” version (as determined by comparing the version
numbers).</para></step>

<step><para>If you're unhappy with the result of a
<command>nix-env</command> action (e.g., an upgraded package turned
out not to work properly), you can go back:

<screen>
$ nix-env --rollback</screen>

</para></step>

<step><para>You should periodically run the Nix garbage collector
to get rid of unused packages, since uninstalls or upgrades don't
actually delete them:

<screen>
$ nix-collect-garbage -d</screen>

<!--
The first command deletes old “generations” of your profile (making
rollbacks impossible, but also making the packages in those old
generations available for garbage collection), while the second
command actually deletes them.-->

</para></step>

</procedure>

</chapter>