guix-package: Fix typo.
[jackhill/guix/guix.git] / doc / guix.texi
CommitLineData
568717fd
LC
1\input texinfo
2@c -*-texinfo-*-
3
4@c %**start of header
5@setfilename guix.info
6@documentencoding UTF-8
f8348b91 7@settitle GNU Guix Reference Manual
568717fd
LC
8@c %**end of header
9
10@include version.texi
11
eeaf4427 12@dircategory Package management
568717fd
LC
13@direntry
14* guix: (guix). Guix, the functional package manager.
eeaf4427
LC
15* guix-package: (guix)Invoking guix-package
16 Managing packages with Guix.
568717fd
LC
17* guix-build: (guix)Invoking guix-build
18 Building packages with Guix.
19@end direntry
568717fd
LC
20
21@titlepage
f8348b91
LC
22@title{GNU Guix Reference Manual}
23@subtitle{Using the GNU Guix Functional Package Manager}
568717fd
LC
24@author Ludovic Courtès
25
26@page
27@vskip 0pt plus 1filll
28Edition @value{EDITION} @*
29@value{UPDATED} @*
30
31Copyright @copyright{} 2012 Ludovic Court@`es
32
33@quotation
34Permission is granted to copy, distribute and/or modify this document
35under the terms of the GNU Free Documentation License, Version 1.3 or
36any later version published by the Free Software Foundation; with no
37Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
38copy of the license is included in the section entitled ``GNU Free
39Documentation License''.
40@end quotation
41@end titlepage
42
43@copying
f8348b91 44This manual documents GNU Guix version @value{VERSION}.
568717fd
LC
45
46Copyright (C) 2012 Ludovic Courtès
47
48Permission is granted to copy, distribute and/or modify this document
49under the terms of the GNU Free Documentation License, Version 1.3 or
50any later version published by the Free Software Foundation; with no
51Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
52copy of the license is included in the section entitled ``GNU Free
53Documentation License.''
54@end copying
55
56@contents
57
58@c *********************************************************************
59@node Top
f8348b91 60@top GNU Guix
568717fd 61
f8348b91
LC
62This document describes GNU Guix version @value{VERSION}, a functional
63package management tool written for the GNU system.
568717fd
LC
64
65@menu
66* Introduction:: What is Guix about?
eeaf4427 67* Package Management:: Package installation, upgrade, etc.
568717fd
LC
68* Programming Interface:: Using Guix in Scheme.
69* Utilities:: Package management commands.
70
71* Acknowledgments:: Thanks!
72* GNU Free Documentation License:: The license of this manual.
73* Concept Index:: Concepts.
74* Function Index:: Functions.
75@end menu
76
77@c *********************************************************************
78@node Introduction
79@chapter Introduction
80
f8348b91
LC
81GNU Guix is a functional package management tool for the GNU system.
82Package management consists in all the activities that relate to
83building packages from source, honoring the build-time and run-time
84dependencies on packages, installing packages in user environments,
85upgrading installed packages to new versions or rolling back to a
86previous set, removing unused software packages, etc.
568717fd
LC
87
88@cindex functional package management
89The term @dfn{functional} refers to a specific package management
90discipline. In Guix, the package build and installation process is seen
91as a function, in the mathematical sense: that function takes inputs,
92such as build scripts, a compiler, and libraries depended on, and
93returns the installed package. As a pure function, its result depends
94solely on its inputs---for instance, it cannot refer to software or
95scripts that were not explicitly passed as inputs. A build function
96always produces the same result when passed a given set of inputs. Last
97but not least, a build function cannot alter the system's environment in
98any way; for instance, it cannot create, modify, or delete files outside
99of its build and installation directories. This is achieved by running
100build processes in dedicated ``chroots'', where only their explicit
101inputs are visible.
102
103@cindex package store
104The result of package build functions is @dfn{cached} in the file
105system, in a special directory called the @dfn{package store}. In
106practice, each package is installed in a directory of its own, in the
107store---by default under @file{/nix/store}. The directory name contains
108a hash of all the inputs used to build that package; thus, changing an
109input yields a different directory name.
110
111This approach is the foundation of Guix's salient features: support for
112transactional package upgrades and rollback, per-user installation, and
eeaf4427 113garbage collection of packages (@pxref{Features}).
568717fd
LC
114
115Guix has a command-line interface allowing users to build, install,
116upgrade, and remove packages, as well as a Scheme programming interface.
117The remainder of this manual describes them.
118
eeaf4427
LC
119@c *********************************************************************
120@node Package Management
121@chapter Package Management
122
f8348b91 123The purpose of GNU Guix is to allow users to easily install, upgrade, and
eeaf4427
LC
124remove software packages, without having to know about their build
125procedure or dependencies. Guix also goes beyond this obvious set of
126features.
127
128This chapter describes the main features of Guix, as well as the package
129management tools it provides.
130
131@menu
132* Features:: How Guix will make your life brighter.
133* Invoking guix-package:: Package installation, removal, etc.
134@end menu
135
136@node Features
137@section Features
138
139When using Guix, each package ends up in the @dfn{package store}, in its
140own directory---something that resembles
141@file{/nix/store/xxx-package-1.2}, where @code{xxx} is a base32 string.
142
143Instead of referring to these directories, users have their own
144@dfn{profile}, which points to the packages that they actually want to
145use. That profile is normally stored in @code{$HOME/.guix-profile}, and
146each user has its own profile.
147
148For example, if @code{alice} installed GCC 4.7.2, then
149@file{/home/alice/.guix-profile/bin/gcc} points to
150@file{/nix/store/xxx-gcc-4.7.2/bin/gcc}; on the same machine, @code{bob}
151may have installed GCC 4.8.0, in which case its profile refers to these
152particular package installation. Both coexist, without any
153interference.
154
155The @command{guix-package} command is the central tool to manage
156packages. It operates on those per-user profiles, and can be used
157@emph{with normal user privileges}.
158
159The command provides the obvious install, remove, and upgrade
160operations. Each invocation is actually a @emph{transaction}: either
161the specified operations succeed, or nothing happens. Thus, if the
162@command{guix-package} processed is terminated during the transaction,
163or if a power outage occurs during the transaction, then the user's
164profile remains in its previous state, and remains usable.
165
166In addition, any package transaction may be @emph{rolled back}. So, if,
167for example, an upgrade installs a new version of a package that turns
168out to have a serious bug, users may roll back to the previous instance
169of their profile, which was known to work well.
170
171All those packages in the package store may be @emph{garbage-collected}.
172Guix can determine which packages are still referenced by the user
173profiles, and remove those that are provably no longer referenced.
174Users may also explicitly remove old generations of their profile so
175that the packages they refer to can be collected.
176
177Finally, Guix takes a @dfn{purely functional} approach to package
178management, as described in the introduction (@pxref{Introduction}).
179Each @file{/nix/store} package directory name contains a hash of all the
180inputs that were used to build that package---compiler, libraries, build
181scripts, etc. This direct correspondence allows users to make sure a
182given package installation matches the current state of their
183distribution.
184
185This foundation allows Guix to support @dfn{transparent binary/source
186deployment}. When a pre-built binary for a @file{/nix/store} path is
187available from an external source, Guix just downloads it; otherwise, it
188builds the package from source, locally.
189
190@node Invoking guix-package
191@section Invoking @command{guix-package}
192
193The @command{guix-package} command it the tool that allows users to
194install, upgrade, and remove packages, as well as rolling back to
195previous configurations. It operates only on the user's own profile,
196and works with normal user privileges (@pxref{Features}). Its syntax
197is:
198
199@example
200guix-package @var{options}
201@end example
202
203Primarily, @var{options} specify the operations to be performed during
204the transaction. Upon completion, a new profile is created, but
205previous generations of the profile remain available, should the user
206want to roll back.
207
208@table @code
209
210@item --install=@var{package}
211@itemx -x @var{package}
212Install @var{package}.
213
214@var{package} may specify either a simple package name, such as
215@code{guile}, or a package name followed by a hyphen and version number,
216such as @code{guile-1.8}. In addition, @var{package} may contain a
217colon, followed by the name of one of the outputs of the package, as in
218@code{gcc:doc} or @code{libsigsegv-2.10:lib}.
219
220@item --remove=@var{package}
221@itemx -r @var{package}
222Remove @var{package}.
223
224@item --upgrade=@var{REGEXP}
225@itemx -u @var{REGEXP}
226Upgrade all the installed packages matching @var{regexp}.
227
228@item --profile=@var{profile}
229@itemx -p @var{profile}
230Use @var{profile} instead of the user's default profile.
231
232@item --dry-run
233@itemx -n
234Show what would be done without actually doing it.
235
236@item --bootstrap
237Use the bootstrap Guile to build the profile. This option is only
238useful to distribution developers.
239
240@end table
241
242
243
244
245
568717fd
LC
246@c *********************************************************************
247@node Programming Interface
248@chapter Programming Interface
249
250@menu
251* Defining Packages:: Defining new packages.
252* The Store:: Manipulating the package store.
253* Derivations:: Low-level interface to package derivations.
254@end menu
255
256@node Defining Packages
257@section Defining Packages
258
259@code{(guix packages)} and @code{(guix build-system)}
260
261@node The Store
262@section The Store
263
264@code{(guix store)}
265
266@node Derivations
267@section Derivations
268
269@code{(guix derivations)}
270
271@c *********************************************************************
272@node Utilities
273@chapter Utilities
274
275@menu
276* Invoking guix-build:: Building packages from the command line.
277@end menu
278
279@node Invoking guix-build
280@section Invoking @command{guix-build}
281
c78bd12b
LC
282The @command{guix-build} command builds packages or derivations and
283their dependencies, and prints the resulting store paths. It is mainly
284useful for distribution developers. The general syntax is:
285
286@example
287guix-build @var{options} @var{package-or-derivation}@dots{}
288@end example
289
290@var{package-or-derivation} may be either the name of a package found in
291the software distribution such as @code{coreutils}, or a derivation such
292as @file{/nix/store/xxx-coreutils-8.19.drv}. Alternatively, the
293@code{--expression} option may be used to specify a Scheme expression
294that evaluates to a package; this is useful when disambiguation among
295several same-named packages or package variants is needed.
296
297The @var{options} may be zero or more of the following:
298
299@table @code
300
301@item --expression=@var{expr}
302@itemx -e @var{expr}
303Build the package @var{expr} evaluates to.
304
305For example, @var{expr} may be @code{(@@ (distro packages guile)
306guile-1.8)}, which unambiguously designates this specific variant of
307version 1.8 of Guile.
308
309@item --source
310@itemx -S
311Build the packages' source derivations, rather than the packages
312themselves.
313
314For instance, @code{guix-build -S gcc} returns something like
315@file{/nix/store/xxx-gcc-4.7.2.tar.bz2}, which is GCC's source tarball.
316
317@item --system=@var{system}
318@itemx -s @var{system}
319Attempt to build for @var{system}---e.g., @code{i686-linux}---instead of
320the host's system type.
321
322An example use of this is on Linux-based systems, which can emulate
323different personalities. For instance, passing
324@code{--system=i686-linux} on an @code{x86_64-linux} system allows users
325to build packages in a complete 32-bit environment.
326
327@item --derivations
328@itemx -d
329Return the derivation paths, not the output paths, of the given
330packages.
331
332@item --keep-failed
333@itemx -K
334Keep the build tree of failed builds. Thus, if a build fail, its build
335tree is kept under @file{/tmp}, in a directory whose name is shown at
336the end of the build log. This is useful when debugging build issues.
337
338@item --dry-run
339@itemx -n
340Do not build the derivations.
341
342@item --no-substitutes
343Build instead of resorting to pre-built substitutes.
344
345@item --cores=@var{n}
346@itemx -c @var{n}
347Allow the use of up to @var{n} CPU cores for the build. The special
348value @code{0} means to use as many CPU cores as available.
349
350@item --root=@var{file}
351@itemx -r @var{file}
352Make @var{file} a symlink to the result, and register it as a garbage
353collector root.
354@end table
355
356Behind the scenes, @command{guix-build} is essentially an interface to
357the @code{package-derivation} procedure of the @code{(guix packages)}
358module, and to the @code{build-derivations} procedure of the @code{(guix
359store)} module.
360
361
568717fd
LC
362@c *********************************************************************
363@node Acknowledgments
364@chapter Acknowledgments
365
366Guix is based on the Nix package manager, which was designed and
367implemented by Eelco Dolstra. Nix pioneered functional package
368management, and promoted unprecedented features, such as transactional
369package upgrades and rollbacks, per-user profiles, and referentially
370transparent build processes. Without this work, Guix would not exist.
371
372The Nix-based software distributions, Nixpkgs and NixOS, have also been
373an inspiration for Guix.
374
375@c *********************************************************************
376@node GNU Free Documentation License
377@appendix GNU Free Documentation License
378
379@include fdl-1.3.texi
380
381@c *********************************************************************
382@node Concept Index
383@unnumbered Concept Index
384@printindex cp
385
386@node Function Index
387@unnumbered Function Index
388@printindex fn
389
390@bye
391
392@c Local Variables:
393@c ispell-local-dictionary: "american";
394@c End: