guix-package: Fix handling of the PACKAGE:OUTPUT syntax.
[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
7@settitle Guix Reference Manual
8@c %**end of header
9
10@include version.texi
11
568717fd
LC
12@dircategory Development
13@direntry
14* guix: (guix). Guix, the functional package manager.
15* guix-build: (guix)Invoking guix-build
16 Building packages with Guix.
17@end direntry
568717fd
LC
18
19@titlepage
20@title{Guix Reference Manual}
21@subtitle{Using the Guix Functional Package Manager}
22@author Ludovic Courtès
23
24@page
25@vskip 0pt plus 1filll
26Edition @value{EDITION} @*
27@value{UPDATED} @*
28
29Copyright @copyright{} 2012 Ludovic Court@`es
30
31@quotation
32Permission is granted to copy, distribute and/or modify this document
33under the terms of the GNU Free Documentation License, Version 1.3 or
34any later version published by the Free Software Foundation; with no
35Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
36copy of the license is included in the section entitled ``GNU Free
37Documentation License''.
38@end quotation
39@end titlepage
40
41@copying
42This manual documents Guix version @value{VERSION}.
43
44Copyright (C) 2012 Ludovic Courtès
45
46Permission is granted to copy, distribute and/or modify this document
47under the terms of the GNU Free Documentation License, Version 1.3 or
48any later version published by the Free Software Foundation; with no
49Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
50copy of the license is included in the section entitled ``GNU Free
51Documentation License.''
52@end copying
53
54@contents
55
56@c *********************************************************************
57@node Top
58@top Guix
59
60This document describes Guix version @value{VERSION}.
61
62@menu
63* Introduction:: What is Guix about?
64* Programming Interface:: Using Guix in Scheme.
65* Utilities:: Package management commands.
66
67* Acknowledgments:: Thanks!
68* GNU Free Documentation License:: The license of this manual.
69* Concept Index:: Concepts.
70* Function Index:: Functions.
71@end menu
72
73@c *********************************************************************
74@node Introduction
75@chapter Introduction
76
77Guix is a functional package management tool. Package management
78consists in all the activities that relate to building packages from
79source, honoring the build-time and run-time dependencies on packages,
80installing packages in user environments, upgrading installed packages
81to new versions or rolling back to a previous set, removing unused
82software packages, etc.
83
84@cindex functional package management
85The term @dfn{functional} refers to a specific package management
86discipline. In Guix, the package build and installation process is seen
87as a function, in the mathematical sense: that function takes inputs,
88such as build scripts, a compiler, and libraries depended on, and
89returns the installed package. As a pure function, its result depends
90solely on its inputs---for instance, it cannot refer to software or
91scripts that were not explicitly passed as inputs. A build function
92always produces the same result when passed a given set of inputs. Last
93but not least, a build function cannot alter the system's environment in
94any way; for instance, it cannot create, modify, or delete files outside
95of its build and installation directories. This is achieved by running
96build processes in dedicated ``chroots'', where only their explicit
97inputs are visible.
98
99@cindex package store
100The result of package build functions is @dfn{cached} in the file
101system, in a special directory called the @dfn{package store}. In
102practice, each package is installed in a directory of its own, in the
103store---by default under @file{/nix/store}. The directory name contains
104a hash of all the inputs used to build that package; thus, changing an
105input yields a different directory name.
106
107This approach is the foundation of Guix's salient features: support for
108transactional package upgrades and rollback, per-user installation, and
109garbage collection of packages.
110
111Guix has a command-line interface allowing users to build, install,
112upgrade, and remove packages, as well as a Scheme programming interface.
113The remainder of this manual describes them.
114
115@c *********************************************************************
116@node Programming Interface
117@chapter Programming Interface
118
119@menu
120* Defining Packages:: Defining new packages.
121* The Store:: Manipulating the package store.
122* Derivations:: Low-level interface to package derivations.
123@end menu
124
125@node Defining Packages
126@section Defining Packages
127
128@code{(guix packages)} and @code{(guix build-system)}
129
130@node The Store
131@section The Store
132
133@code{(guix store)}
134
135@node Derivations
136@section Derivations
137
138@code{(guix derivations)}
139
140@c *********************************************************************
141@node Utilities
142@chapter Utilities
143
144@menu
145* Invoking guix-build:: Building packages from the command line.
146@end menu
147
148@node Invoking guix-build
149@section Invoking @command{guix-build}
150
c78bd12b
LC
151The @command{guix-build} command builds packages or derivations and
152their dependencies, and prints the resulting store paths. It is mainly
153useful for distribution developers. The general syntax is:
154
155@example
156guix-build @var{options} @var{package-or-derivation}@dots{}
157@end example
158
159@var{package-or-derivation} may be either the name of a package found in
160the software distribution such as @code{coreutils}, or a derivation such
161as @file{/nix/store/xxx-coreutils-8.19.drv}. Alternatively, the
162@code{--expression} option may be used to specify a Scheme expression
163that evaluates to a package; this is useful when disambiguation among
164several same-named packages or package variants is needed.
165
166The @var{options} may be zero or more of the following:
167
168@table @code
169
170@item --expression=@var{expr}
171@itemx -e @var{expr}
172Build the package @var{expr} evaluates to.
173
174For example, @var{expr} may be @code{(@@ (distro packages guile)
175guile-1.8)}, which unambiguously designates this specific variant of
176version 1.8 of Guile.
177
178@item --source
179@itemx -S
180Build the packages' source derivations, rather than the packages
181themselves.
182
183For instance, @code{guix-build -S gcc} returns something like
184@file{/nix/store/xxx-gcc-4.7.2.tar.bz2}, which is GCC's source tarball.
185
186@item --system=@var{system}
187@itemx -s @var{system}
188Attempt to build for @var{system}---e.g., @code{i686-linux}---instead of
189the host's system type.
190
191An example use of this is on Linux-based systems, which can emulate
192different personalities. For instance, passing
193@code{--system=i686-linux} on an @code{x86_64-linux} system allows users
194to build packages in a complete 32-bit environment.
195
196@item --derivations
197@itemx -d
198Return the derivation paths, not the output paths, of the given
199packages.
200
201@item --keep-failed
202@itemx -K
203Keep the build tree of failed builds. Thus, if a build fail, its build
204tree is kept under @file{/tmp}, in a directory whose name is shown at
205the end of the build log. This is useful when debugging build issues.
206
207@item --dry-run
208@itemx -n
209Do not build the derivations.
210
211@item --no-substitutes
212Build instead of resorting to pre-built substitutes.
213
214@item --cores=@var{n}
215@itemx -c @var{n}
216Allow the use of up to @var{n} CPU cores for the build. The special
217value @code{0} means to use as many CPU cores as available.
218
219@item --root=@var{file}
220@itemx -r @var{file}
221Make @var{file} a symlink to the result, and register it as a garbage
222collector root.
223@end table
224
225Behind the scenes, @command{guix-build} is essentially an interface to
226the @code{package-derivation} procedure of the @code{(guix packages)}
227module, and to the @code{build-derivations} procedure of the @code{(guix
228store)} module.
229
230
568717fd
LC
231@c *********************************************************************
232@node Acknowledgments
233@chapter Acknowledgments
234
235Guix is based on the Nix package manager, which was designed and
236implemented by Eelco Dolstra. Nix pioneered functional package
237management, and promoted unprecedented features, such as transactional
238package upgrades and rollbacks, per-user profiles, and referentially
239transparent build processes. Without this work, Guix would not exist.
240
241The Nix-based software distributions, Nixpkgs and NixOS, have also been
242an inspiration for Guix.
243
244@c *********************************************************************
245@node GNU Free Documentation License
246@appendix GNU Free Documentation License
247
248@include fdl-1.3.texi
249
250@c *********************************************************************
251@node Concept Index
252@unnumbered Concept Index
253@printindex cp
254
255@node Function Index
256@unnumbered Function Index
257@printindex fn
258
259@bye
260
261@c Local Variables:
262@c ispell-local-dictionary: "american";
263@c End: