git.iko.soy/typeable/nixpkgs
on master help sign in
doc: re-format
commit83c2ad80ca8c6087b034155e2a767c4f72a6df3f authorJan Tojnar <jtojnar@gmail.com> dateWed 18 Sep 2019, 22:12 (7 years ago) parent641f635
45 files changed+1105−4349
doc/coding-conventions.xml+70−236 doc/configuration.xml+44−140 doc/contributing.xml+5−10 doc/cross-compilation.xml+53−337 doc/functions.xml+1−2 doc/functions/appimagetools.xml+8−24 doc/functions/debug.xml+2−9 doc/functions/dockertools.xml+54−170 doc/functions/fetchers.xml+16−62 doc/functions/fhs-environments.xml+9−29 doc/functions/generators.xml+5−20 doc/functions/library.xml+1−2 doc/functions/library/asserts.xml+4−9 doc/functions/library/attrsets.xml+42−103 doc/functions/nix-gitignore.xml+5−19 doc/functions/ocitools.xml+6−20 doc/functions/overrides.xml+17−78 doc/functions/prefer-remote-fetch.xml+2−6 doc/functions/shell.xml+1−3 doc/functions/snaptools.xml+8−23 doc/functions/trivial-builders.xml+6−40 doc/languages-frameworks/beam.xml+36−127 doc/languages-frameworks/bower.xml+19−52 doc/languages-frameworks/coq.xml+4−16 doc/languages-frameworks/gnome.xml+30−155 doc/languages-frameworks/go.xml+19−54 doc/languages-frameworks/index.xml+1−6 doc/languages-frameworks/java.xml+9−31 doc/languages-frameworks/lua.xml+4−16 doc/languages-frameworks/ocaml.xml+4−28 doc/languages-frameworks/perl.xml+18−80 doc/languages-frameworks/qt.xml+13−47 doc/languages-frameworks/ruby.xml+5−32 doc/languages-frameworks/texlive.xml+8−19 doc/meta.xml+36−128 doc/multiple-output.xml+30−128 doc/overlays.xml+19−74 doc/package-notes.xml+47−215 doc/package-specific-user-notes.xml+28−147 doc/platform-notes.xml+6−28 doc/quick-start.xml+36−108 doc/release-notes.xml+55−205 doc/reviewing-contributions.xml+42−118 doc/stdenv.xml+238−1061 doc/submitting-changes.xml+39−132
doc/coding-conventions.xml+70−236
@@ -8,24 +8,17 @@
88 <itemizedlist>
99 <listitem>
1010 <para>
11− Use 2 spaces of indentation per indentation level in Nix expressions, 4
12− spaces in shell scripts.
11+ Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts.
1312 </para>
1413 </listitem>
1514 <listitem>
1615 <para>
17− Do not use tab characters, i.e. configure your editor to use soft tabs.
18− For instance, use <literal>(setq-default indent-tabs-mode nil)</literal>
19− in Emacs. Everybody has different tab settings so it’s asking for
20− trouble.
16+ Do not use tab characters, i.e. configure your editor to use soft tabs. For instance, use <literal>(setq-default indent-tabs-mode nil)</literal> in Emacs. Everybody has different tab settings so it’s asking for trouble.
2117 </para>
2218 </listitem>
2319 <listitem>
2420 <para>
25− Use <literal>lowerCamelCase</literal> for variable names, not
26− <literal>UpperCamelCase</literal>. Note, this rule does not apply to
27− package attribute names, which instead follow the rules in
28− <xref linkend="sec-package-naming"/>.
21+ Use <literal>lowerCamelCase</literal> for variable names, not <literal>UpperCamelCase</literal>. Note, this rule does not apply to package attribute names, which instead follow the rules in <xref linkend="sec-package-naming"/>.
2922 </para>
3023 </listitem>
3124 <listitem>
@@ -52,8 +45,7 @@ foo { arg = ...; }
5245 </listitem>
5346 <listitem>
5447 <para>
55− In attribute sets or lists that span multiple lines, the attribute names
56− or list elements should be aligned:
48+ In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned:
5749<programlisting>
5850# A long list.
5951list = [
@@ -97,8 +89,7 @@ attrs = { x = 1280; y = 1024; };
9789 </listitem>
9890 <listitem>
9991 <para>
100− Breaking in the middle of a function argument can give hard-to-read code,
101− like
92+ Breaking in the middle of a function argument can give hard-to-read code, like
10293<programlisting>
10394someFunction { x = 1280;
10495 y = 1024; } otherArg
@@ -123,8 +114,7 @@ in someFunction res otherArg yetAnotherArg
123114 </listitem>
124115 <listitem>
125116 <para>
126− The bodies of functions, asserts, and withs are not indented to prevent a
127− lot of superfluous indentation levels, i.e.
117+ The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e.
128118<programlisting>
129119{ arg1, arg2 }:
130120assert system == "i686-linux";
@@ -156,8 +146,7 @@ stdenv.mkDerivation { ...
156146 </listitem>
157147 <listitem>
158148 <para>
159− Functions should list their expected arguments as precisely as possible.
160− That is, write
149+ Functions should list their expected arguments as precisely as possible. That is, write
161150<programlisting>
162151{ stdenv, fetchurl, perl }: <replaceable>...</replaceable>
163152</programlisting>
@@ -171,9 +160,7 @@ args: with args; <replaceable>...</replaceable>
171160</programlisting>
172161 </para>
173162 <para>
174− For functions that are truly generic in the number of arguments (such as
175− wrappers around <varname>mkDerivation</varname>) that have some required
176− arguments, you should write them using an <literal>@</literal>-pattern:
163+ For functions that are truly generic in the number of arguments (such as wrappers around <varname>mkDerivation</varname>) that have some required arguments, you should write them using an <literal>@</literal>-pattern:
177164<programlisting>
178165{ stdenv, doCoverageAnalysis ? false, ... } @ args:
179166
@@ -197,35 +184,20 @@ args.stdenv.mkDerivation (args // {
197184 <title>Package naming</title>
198185
199186 <para>
200− The key words <emphasis>must</emphasis>, <emphasis>must not</emphasis>,
201− <emphasis>required</emphasis>, <emphasis>shall</emphasis>, <emphasis>shall
202− not</emphasis>, <emphasis>should</emphasis>, <emphasis>should
203− not</emphasis>, <emphasis>recommended</emphasis>, <emphasis>may</emphasis>,
204− and <emphasis>optional</emphasis> in this section are to be interpreted as
205− described in <link xlink:href="https://tools.ietf.org/html/rfc2119">RFC
206− 2119</link>. Only <emphasis>emphasized</emphasis> words are to be
207− interpreted in this way.
187+ The key words <emphasis>must</emphasis>, <emphasis>must not</emphasis>, <emphasis>required</emphasis>, <emphasis>shall</emphasis>, <emphasis>shall not</emphasis>, <emphasis>should</emphasis>, <emphasis>should not</emphasis>, <emphasis>recommended</emphasis>, <emphasis>may</emphasis>, and <emphasis>optional</emphasis> in this section are to be interpreted as described in <link xlink:href="https://tools.ietf.org/html/rfc2119">RFC 2119</link>. Only <emphasis>emphasized</emphasis> words are to be interpreted in this way.
208188 </para>
209189
210190 <para>
211− In Nixpkgs, there are generally three different names associated with a
212− package:
191+ In Nixpkgs, there are generally three different names associated with a package:
213192 <itemizedlist>
214193 <listitem>
215194 <para>
216− The <varname>name</varname> attribute of the derivation (excluding the
217− version part). This is what most users see, in particular when using
218− <command>nix-env</command>.
195+ The <varname>name</varname> attribute of the derivation (excluding the version part). This is what most users see, in particular when using <command>nix-env</command>.
219196 </para>
220197 </listitem>
221198 <listitem>
222199 <para>
223− The variable name used for the instantiated package in
224− <filename>all-packages.nix</filename>, and when passing it as a
225− dependency to other functions. Typically this is called the
226− <emphasis>package attribute name</emphasis>. This is what Nix expression
227− authors see. It can also be used when installing using <command>nix-env
228− -iA</command>.
200+ The variable name used for the instantiated package in <filename>all-packages.nix</filename>, and when passing it as a dependency to other functions. Typically this is called the <emphasis>package attribute name</emphasis>. This is what Nix expression authors see. It can also be used when installing using <command>nix-env -iA</command>.
229201 </para>
230202 </listitem>
231203 <listitem>
@@ -234,12 +206,7 @@ args.stdenv.mkDerivation (args // {
234206 </para>
235207 </listitem>
236208 </itemizedlist>
237− Most of the time, these are the same. For instance, the package
238− <literal>e2fsprogs</literal> has a <varname>name</varname> attribute
239− <literal>"e2fsprogs-<replaceable>version</replaceable>"</literal>, is bound
240− to the variable name <varname>e2fsprogs</varname> in
241− <filename>all-packages.nix</filename>, and the Nix expression is in
242− <filename>pkgs/os-specific/linux/e2fsprogs/default.nix</filename>.
209+ Most of the time, these are the same. For instance, the package <literal>e2fsprogs</literal> has a <varname>name</varname> attribute <literal>"e2fsprogs-<replaceable>version</replaceable>"</literal>, is bound to the variable name <varname>e2fsprogs</varname> in <filename>all-packages.nix</filename>, and the Nix expression is in <filename>pkgs/os-specific/linux/e2fsprogs/default.nix</filename>.
243210 </para>
244211
245212 <para>
@@ -247,51 +214,32 @@ args.stdenv.mkDerivation (args // {
247214 <itemizedlist>
248215 <listitem>
249216 <para>
250− The <literal>name</literal> attribute <emphasis>should</emphasis> be
251− identical to the upstream package name.
217+ The <literal>name</literal> attribute <emphasis>should</emphasis> be identical to the upstream package name.
252218 </para>
253219 </listitem>
254220 <listitem>
255221 <para>
256− The <literal>name</literal> attribute <emphasis>must not</emphasis>
257− contain uppercase letters — e.g., <literal>"mplayer-1.0rc2"</literal>
258− instead of <literal>"MPlayer-1.0rc2"</literal>.
222+ The <literal>name</literal> attribute <emphasis>must not</emphasis> contain uppercase letters — e.g., <literal>"mplayer-1.0rc2"</literal> instead of <literal>"MPlayer-1.0rc2"</literal>.
259223 </para>
260224 </listitem>
261225 <listitem>
262226 <para>
263− The version part of the <literal>name</literal> attribute
264− <emphasis>must</emphasis> start with a digit (following a dash) — e.g.,
265− <literal>"hello-0.3.1rc2"</literal>.
227+ The version part of the <literal>name</literal> attribute <emphasis>must</emphasis> start with a digit (following a dash) — e.g., <literal>"hello-0.3.1rc2"</literal>.
266228 </para>
267229 </listitem>
268230 <listitem>
269231 <para>
270− If a package is not a release but a commit from a repository, then the
271− version part of the name <emphasis>must</emphasis> be the date of that
272− (fetched) commit. The date <emphasis>must</emphasis> be in
273− <literal>"YYYY-MM-DD"</literal> format. Also append
274− <literal>"unstable"</literal> to the name - e.g.,
275− <literal>"pkgname-unstable-2014-09-23"</literal>.
232+ If a package is not a release but a commit from a repository, then the version part of the name <emphasis>must</emphasis> be the date of that (fetched) commit. The date <emphasis>must</emphasis> be in <literal>"YYYY-MM-DD"</literal> format. Also append <literal>"unstable"</literal> to the name - e.g., <literal>"pkgname-unstable-2014-09-23"</literal>.
276233 </para>
277234 </listitem>
278235 <listitem>
279236 <para>
280− Dashes in the package name <emphasis>should</emphasis> be preserved in
281− new variable names, rather than converted to underscores or camel cased
282− — e.g., <varname>http-parser</varname> instead of
283− <varname>http_parser</varname> or <varname>httpParser</varname>. The
284− hyphenated style is preferred in all three package names.
237+ Dashes in the package name <emphasis>should</emphasis> be preserved in new variable names, rather than converted to underscores or camel cased — e.g., <varname>http-parser</varname> instead of <varname>http_parser</varname> or <varname>httpParser</varname>. The hyphenated style is preferred in all three package names.
285238 </para>
286239 </listitem>
287240 <listitem>
288241 <para>
289− If there are multiple versions of a package, this
290− <emphasis>should</emphasis> be reflected in the variable names in
291− <filename>all-packages.nix</filename>, e.g. <varname>json-c-0-9</varname>
292− and <varname>json-c-0-11</varname>. If there is an obvious “default”
293− version, make an attribute like <literal>json-c = json-c-0-9;</literal>.
294− See also <xref linkend="sec-versioning" />
242+ If there are multiple versions of a package, this <emphasis>should</emphasis> be reflected in the variable names in <filename>all-packages.nix</filename>, e.g. <varname>json-c-0-9</varname> and <varname>json-c-0-11</varname>. If there is an obvious “default” version, make an attribute like <literal>json-c = json-c-0-9;</literal>. See also <xref linkend="sec-versioning" />
295243 </para>
296244 </listitem>
297245 </itemizedlist>
@@ -301,31 +249,18 @@ args.stdenv.mkDerivation (args // {
301249 <title>File naming and organisation</title>
302250
303251 <para>
304− Names of files and directories should be in lowercase, with dashes between
305− words — not in camel case. For instance, it should be
306− <filename>all-packages.nix</filename>, not
307− <filename>allPackages.nix</filename> or
308− <filename>AllPackages.nix</filename>.
252+ Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be <filename>all-packages.nix</filename>, not <filename>allPackages.nix</filename> or <filename>AllPackages.nix</filename>.
309253 </para>
310254
311255 <section xml:id="sec-hierarchy">
312256 <title>Hierarchy</title>
313257
314258 <para>
315− Each package should be stored in its own directory somewhere in the
316− <filename>pkgs/</filename> tree, i.e. in
317− <filename>pkgs/<replaceable>category</replaceable>/<replaceable>subcategory</replaceable>/<replaceable>...</replaceable>/<replaceable>pkgname</replaceable></filename>.
318− Below are some rules for picking the right category for a package. Many
319− packages fall under several categories; what matters is the
320− <emphasis>primary</emphasis> purpose of a package. For example, the
321− <literal>libxml2</literal> package builds both a library and some tools;
322− but it’s a library foremost, so it goes under
323− <filename>pkgs/development/libraries</filename>.
259+ Each package should be stored in its own directory somewhere in the <filename>pkgs/</filename> tree, i.e. in <filename>pkgs/<replaceable>category</replaceable>/<replaceable>subcategory</replaceable>/<replaceable>...</replaceable>/<replaceable>pkgname</replaceable></filename>. Below are some rules for picking the right category for a package. Many packages fall under several categories; what matters is the <emphasis>primary</emphasis> purpose of a package. For example, the <literal>libxml2</literal> package builds both a library and some tools; but it’s a library foremost, so it goes under <filename>pkgs/development/libraries</filename>.
324260 </para>
325261
326262 <para>
327− When in doubt, consider refactoring the <filename>pkgs/</filename> tree,
328− e.g. creating new categories or splitting up an existing category.
263+ When in doubt, consider refactoring the <filename>pkgs/</filename> tree, e.g. creating new categories or splitting up an existing category.
329264 </para>
330265
331266 <variablelist>
@@ -341,8 +276,7 @@ args.stdenv.mkDerivation (args // {
341276 </term>
342277 <listitem>
343278 <para>
344− <filename>development/libraries</filename> (e.g.
345− <filename>libxml2</filename>)
279+ <filename>development/libraries</filename> (e.g. <filename>libxml2</filename>)
346280 </para>
347281 </listitem>
348282 </varlistentry>
@@ -352,8 +286,7 @@ args.stdenv.mkDerivation (args // {
352286 </term>
353287 <listitem>
354288 <para>
355− <filename>development/compilers</filename> (e.g.
356− <filename>gcc</filename>)
289+ <filename>development/compilers</filename> (e.g. <filename>gcc</filename>)
357290 </para>
358291 </listitem>
359292 </varlistentry>
@@ -363,8 +296,7 @@ args.stdenv.mkDerivation (args // {
363296 </term>
364297 <listitem>
365298 <para>
366− <filename>development/interpreters</filename> (e.g.
367− <filename>guile</filename>)
299+ <filename>development/interpreters</filename> (e.g. <filename>guile</filename>)
368300 </para>
369301 </listitem>
370302 </varlistentry>
@@ -380,8 +312,7 @@ args.stdenv.mkDerivation (args // {
380312 </term>
381313 <listitem>
382314 <para>
383− <filename>development/tools/parsing</filename> (e.g.
384− <filename>bison</filename>, <filename>flex</filename>)
315+ <filename>development/tools/parsing</filename> (e.g. <filename>bison</filename>, <filename>flex</filename>)
385316 </para>
386317 </listitem>
387318 </varlistentry>
@@ -391,8 +322,7 @@ args.stdenv.mkDerivation (args // {
391322 </term>
392323 <listitem>
393324 <para>
394− <filename>development/tools/build-managers</filename> (e.g.
395− <filename>gnumake</filename>)
325+ <filename>development/tools/build-managers</filename> (e.g. <filename>gnumake</filename>)
396326 </para>
397327 </listitem>
398328 </varlistentry>
@@ -402,8 +332,7 @@ args.stdenv.mkDerivation (args // {
402332 </term>
403333 <listitem>
404334 <para>
405− <filename>development/tools/misc</filename> (e.g.
406− <filename>binutils</filename>)
335+ <filename>development/tools/misc</filename> (e.g. <filename>binutils</filename>)
407336 </para>
408337 </listitem>
409338 </varlistentry>
@@ -429,8 +358,7 @@ args.stdenv.mkDerivation (args // {
429358 </term>
430359 <listitem>
431360 <para>
432− (A tool is a relatively small program, especially one intended to be
433− used non-interactively.)
361+ (A tool is a relatively small program, especially one intended to be used non-interactively.)
434362 </para>
435363 <variablelist>
436364 <varlistentry>
@@ -439,8 +367,7 @@ args.stdenv.mkDerivation (args // {
439367 </term>
440368 <listitem>
441369 <para>
442− <filename>tools/networking</filename> (e.g.
443− <filename>wget</filename>)
370+ <filename>tools/networking</filename> (e.g. <filename>wget</filename>)
444371 </para>
445372 </listitem>
446373 </varlistentry>
@@ -470,8 +397,7 @@ args.stdenv.mkDerivation (args // {
470397 </term>
471398 <listitem>
472399 <para>
473− <filename>tools/archivers</filename> (e.g. <filename>zip</filename>,
474− <filename>tar</filename>)
400+ <filename>tools/archivers</filename> (e.g. <filename>zip</filename>, <filename>tar</filename>)
475401 </para>
476402 </listitem>
477403 </varlistentry>
@@ -481,8 +407,7 @@ args.stdenv.mkDerivation (args // {
481407 </term>
482408 <listitem>
483409 <para>
484− <filename>tools/compression</filename> (e.g.
485− <filename>gzip</filename>, <filename>bzip2</filename>)
410+ <filename>tools/compression</filename> (e.g. <filename>gzip</filename>, <filename>bzip2</filename>)
486411 </para>
487412 </listitem>
488413 </varlistentry>
@@ -492,8 +417,7 @@ args.stdenv.mkDerivation (args // {
492417 </term>
493418 <listitem>
494419 <para>
495− <filename>tools/security</filename> (e.g. <filename>nmap</filename>,
496− <filename>gnupg</filename>)
420+ <filename>tools/security</filename> (e.g. <filename>nmap</filename>, <filename>gnupg</filename>)
497421 </para>
498422 </listitem>
499423 </varlistentry>
@@ -532,8 +456,7 @@ args.stdenv.mkDerivation (args // {
532456 </term>
533457 <listitem>
534458 <para>
535− <filename>servers/http</filename> (e.g.
536− <filename>apache-httpd</filename>)
459+ <filename>servers/http</filename> (e.g. <filename>apache-httpd</filename>)
537460 </para>
538461 </listitem>
539462 </varlistentry>
@@ -543,8 +466,7 @@ args.stdenv.mkDerivation (args // {
543466 </term>
544467 <listitem>
545468 <para>
546− <filename>servers/x11</filename> (e.g. <filename>xorg</filename> —
547− this includes the client libraries and programs)
469+ <filename>servers/x11</filename> (e.g. <filename>xorg</filename> — this includes the client libraries and programs)
548470 </para>
549471 </listitem>
550472 </varlistentry>
@@ -567,8 +489,7 @@ args.stdenv.mkDerivation (args // {
567489 </term>
568490 <listitem>
569491 <para>
570− <filename>desktops</filename> (e.g. <filename>kde</filename>,
571− <filename>gnome</filename>, <filename>enlightenment</filename>)
492+ <filename>desktops</filename> (e.g. <filename>kde</filename>, <filename>gnome</filename>, <filename>enlightenment</filename>)
572493 </para>
573494 </listitem>
574495 </varlistentry>
@@ -578,8 +499,7 @@ args.stdenv.mkDerivation (args // {
578499 </term>
579500 <listitem>
580501 <para>
581− <filename>applications/window-managers</filename> (e.g.
582− <filename>awesome</filename>, <filename>stumpwm</filename>)
502+ <filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>stumpwm</filename>)
583503 </para>
584504 </listitem>
585505 </varlistentry>
@@ -589,8 +509,7 @@ args.stdenv.mkDerivation (args // {
589509 </term>
590510 <listitem>
591511 <para>
592− A (typically large) program with a distinct user interface, primarily
593− used interactively.
512+ A (typically large) program with a distinct user interface, primarily used interactively.
594513 </para>
595514 <variablelist>
596515 <varlistentry>
@@ -599,8 +518,7 @@ args.stdenv.mkDerivation (args // {
599518 </term>
600519 <listitem>
601520 <para>
602− <filename>applications/version-management</filename> (e.g.
603− <filename>subversion</filename>)
521+ <filename>applications/version-management</filename> (e.g. <filename>subversion</filename>)
604522 </para>
605523 </listitem>
606524 </varlistentry>
@@ -610,8 +528,7 @@ args.stdenv.mkDerivation (args // {
610528 </term>
611529 <listitem>
612530 <para>
613− <filename>applications/video</filename> (e.g.
614− <filename>vlc</filename>)
531+ <filename>applications/video</filename> (e.g. <filename>vlc</filename>)
615532 </para>
616533 </listitem>
617534 </varlistentry>
@@ -621,8 +538,7 @@ args.stdenv.mkDerivation (args // {
621538 </term>
622539 <listitem>
623540 <para>
624− <filename>applications/graphics</filename> (e.g.
625− <filename>gimp</filename>)
541+ <filename>applications/graphics</filename> (e.g. <filename>gimp</filename>)
626542 </para>
627543 </listitem>
628544 </varlistentry>
@@ -638,8 +554,7 @@ args.stdenv.mkDerivation (args // {
638554 </term>
639555 <listitem>
640556 <para>
641− <filename>applications/networking/mailreaders</filename> (e.g.
642− <filename>thunderbird</filename>)
557+ <filename>applications/networking/mailreaders</filename> (e.g. <filename>thunderbird</filename>)
643558 </para>
644559 </listitem>
645560 </varlistentry>
@@ -649,8 +564,7 @@ args.stdenv.mkDerivation (args // {
649564 </term>
650565 <listitem>
651566 <para>
652− <filename>applications/networking/newsreaders</filename> (e.g.
653− <filename>pan</filename>)
567+ <filename>applications/networking/newsreaders</filename> (e.g. <filename>pan</filename>)
654568 </para>
655569 </listitem>
656570 </varlistentry>
@@ -660,8 +574,7 @@ args.stdenv.mkDerivation (args // {
660574 </term>
661575 <listitem>
662576 <para>
663− <filename>applications/networking/browsers</filename> (e.g.
664− <filename>firefox</filename>)
577+ <filename>applications/networking/browsers</filename> (e.g. <filename>firefox</filename>)
665578 </para>
666579 </listitem>
667580 </varlistentry>
@@ -719,8 +632,7 @@ args.stdenv.mkDerivation (args // {
719632 </term>
720633 <listitem>
721634 <para>
722− <filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g.
723− <filename>docbook</filename>)
635+ <filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g. <filename>docbook</filename>)
724636 </para>
725637 </listitem>
726638 </varlistentry>
@@ -733,8 +645,7 @@ args.stdenv.mkDerivation (args // {
733645 (Okay, these are executable...)
734646 </para>
735647 <para>
736− <filename>data/sgml+xml/stylesheets/xslt</filename> (e.g.
737− <filename>docbook-xsl</filename>)
648+ <filename>data/sgml+xml/stylesheets/xslt</filename> (e.g. <filename>docbook-xsl</filename>)
738649 </para>
739650 </listitem>
740651 </varlistentry>
@@ -771,36 +682,15 @@ args.stdenv.mkDerivation (args // {
771682 <title>Versioning</title>
772683
773684 <para>
774− Because every version of a package in Nixpkgs creates a potential
775− maintenance burden, old versions of a package should not be kept unless
776− there is a good reason to do so. For instance, Nixpkgs contains several
777− versions of GCC because other packages don’t build with the latest
778− version of GCC. Other examples are having both the latest stable and latest
779− pre-release version of a package, or to keep several major releases of an
780− application that differ significantly in functionality.
685+ Because every version of a package in Nixpkgs creates a potential maintenance burden, old versions of a package should not be kept unless there is a good reason to do so. For instance, Nixpkgs contains several versions of GCC because other packages don’t build with the latest version of GCC. Other examples are having both the latest stable and latest pre-release version of a package, or to keep several major releases of an application that differ significantly in functionality.
781686 </para>
782687
783688 <para>
784− If there is only one version of a package, its Nix expression should be
785− named <filename>e2fsprogs/default.nix</filename>. If there are multiple
786− versions, this should be reflected in the filename, e.g.
787− <filename>e2fsprogs/1.41.8.nix</filename> and
788− <filename>e2fsprogs/1.41.9.nix</filename>. The version in the filename
789− should leave out unnecessary detail. For instance, if we keep the latest
790− Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named
791− <filename>firefox/2.0.nix</filename> and
792− <filename>firefox/3.5.nix</filename>, respectively (which, at a given
793− point, might contain versions <literal>2.0.0.20</literal> and
794− <literal>3.5.4</literal>). If a version requires many auxiliary files, you
795− can use a subdirectory for each version, e.g.
796− <filename>firefox/2.0/default.nix</filename> and
797− <filename>firefox/3.5/default.nix</filename>.
689+ If there is only one version of a package, its Nix expression should be named <filename>e2fsprogs/default.nix</filename>. If there are multiple versions, this should be reflected in the filename, e.g. <filename>e2fsprogs/1.41.8.nix</filename> and <filename>e2fsprogs/1.41.9.nix</filename>. The version in the filename should leave out unnecessary detail. For instance, if we keep the latest Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named <filename>firefox/2.0.nix</filename> and <filename>firefox/3.5.nix</filename>, respectively (which, at a given point, might contain versions <literal>2.0.0.20</literal> and <literal>3.5.4</literal>). If a version requires many auxiliary files, you can use a subdirectory for each version, e.g. <filename>firefox/2.0/default.nix</filename> and <filename>firefox/3.5/default.nix</filename>.
798690 </para>
799691
800692 <para>
801− All versions of a package <emphasis>must</emphasis> be included in
802− <filename>all-packages.nix</filename> to make sure that they evaluate
803− correctly.
693+ All versions of a package <emphasis>must</emphasis> be included in <filename>all-packages.nix</filename> to make sure that they evaluate correctly.
804694 </para>
805695 </section>
806696 </section>
@@ -808,25 +698,15 @@ args.stdenv.mkDerivation (args // {
808698 <title>Fetching Sources</title>
809699
810700 <para>
811− There are multiple ways to fetch a package source in nixpkgs. The general
812− guideline is that you should package reproducible sources with a high degree
813− of availability. Right now there is only one fetcher which has mirroring
814− support and that is <literal>fetchurl</literal>. Note that you should also
815− prefer protocols which have a corresponding proxy environment variable.
701+ There are multiple ways to fetch a package source in nixpkgs. The general guideline is that you should package reproducible sources with a high degree of availability. Right now there is only one fetcher which has mirroring support and that is <literal>fetchurl</literal>. Note that you should also prefer protocols which have a corresponding proxy environment variable.
816702 </para>
817703
818704 <para>
819− You can find many source fetch helpers in
820− <literal>pkgs/build-support/fetch*</literal>.
705+ You can find many source fetch helpers in <literal>pkgs/build-support/fetch*</literal>.
821706 </para>
822707
823708 <para>
824− In the file <literal>pkgs/top-level/all-packages.nix</literal> you can find
825− fetch helpers, these have names on the form <literal>fetchFrom*</literal>.
826− The intention of these are to provide snapshot fetches but using the same
827− api as some of the version controlled fetchers from
828− <literal>pkgs/build-support/</literal>. As an example going from bad to
829− good:
709+ In the file <literal>pkgs/top-level/all-packages.nix</literal> you can find fetch helpers, these have names on the form <literal>fetchFrom*</literal>. The intention of these are to provide snapshot fetches but using the same api as some of the version controlled fetchers from <literal>pkgs/build-support/</literal>. As an example going from bad to good:
830710 <itemizedlist>
831711 <listitem>
832712 <para>
@@ -863,11 +743,7 @@ src = fetchFromGitHub {
863743 sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc";
864744}
865745</programlisting>
866− Find the value to put as <literal>sha256</literal> by running
867− <literal>nix run -f '&lt;nixpkgs&gt;' nix-prefetch-github -c
868− nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS
869− nix</literal> or <literal>nix-prefetch-url --unpack
870− https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz</literal>.
746+ Find the value to put as <literal>sha256</literal> by running <literal>nix run -f '&lt;nixpkgs&gt;' nix-prefetch-github -c nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS nix</literal> or <literal>nix-prefetch-url --unpack https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz</literal>.
871747 </para>
872748 </listitem>
873749 </itemizedlist>
@@ -883,40 +759,23 @@ src = fetchFromGitHub {
883759 <orderedlist>
884760 <listitem>
885761 <para>
886− Prefetch URL (with <literal>nix-prefetch-<replaceable>XXX</replaceable>
887− <replaceable>URL</replaceable></literal>, where
888− <replaceable>XXX</replaceable> is one of <literal>url</literal>,
889− <literal>git</literal>, <literal>hg</literal>, <literal>cvs</literal>,
890− <literal>bzr</literal>, <literal>svn</literal>). Hash is printed to
891− stdout.
762+ Prefetch URL (with <literal>nix-prefetch-<replaceable>XXX</replaceable> <replaceable>URL</replaceable></literal>, where <replaceable>XXX</replaceable> is one of <literal>url</literal>, <literal>git</literal>, <literal>hg</literal>, <literal>cvs</literal>, <literal>bzr</literal>, <literal>svn</literal>). Hash is printed to stdout.
892763 </para>
893764 </listitem>
894765 <listitem>
895766 <para>
896− Prefetch by package source (with <literal>nix-prefetch-url
897− '&lt;nixpkgs&gt;' -A <replaceable>PACKAGE</replaceable>.src</literal>,
898− where <replaceable>PACKAGE</replaceable> is package attribute name). Hash
899− is printed to stdout.
767+ Prefetch by package source (with <literal>nix-prefetch-url '&lt;nixpkgs&gt;' -A <replaceable>PACKAGE</replaceable>.src</literal>, where <replaceable>PACKAGE</replaceable> is package attribute name). Hash is printed to stdout.
900768 </para>
901769 <para>
902− This works well when you've upgraded existing package version and want to
903− find out new hash, but is useless if package can't be accessed by
904− attribute or package has multiple sources (<literal>.srcs</literal>,
905− architecture-dependent sources, etc).
770+ This works well when you've upgraded existing package version and want to find out new hash, but is useless if package can't be accessed by attribute or package has multiple sources (<literal>.srcs</literal>, architecture-dependent sources, etc).
906771 </para>
907772 </listitem>
908773 <listitem>
909774 <para>
910− Upstream provided hash: use it when upstream provides
911− <literal>sha256</literal> or <literal>sha512</literal> (when upstream
912− provides <literal>md5</literal>, don't use it, compute
913− <literal>sha256</literal> instead).
775+ Upstream provided hash: use it when upstream provides <literal>sha256</literal> or <literal>sha512</literal> (when upstream provides <literal>md5</literal>, don't use it, compute <literal>sha256</literal> instead).
914776 </para>
915777 <para>
916− A little nuance is that <literal>nix-prefetch-*</literal> tools produce
917− hash encoded with <literal>base32</literal>, but upstream usually provides
918− hexadecimal (<literal>base16</literal>) encoding. Fetchers understand both
919− formats. Nixpkgs does not standardize on any one format.
778+ A little nuance is that <literal>nix-prefetch-*</literal> tools produce hash encoded with <literal>base32</literal>, but upstream usually provides hexadecimal (<literal>base16</literal>) encoding. Fetchers understand both formats. Nixpkgs does not standardize on any one format.
920779 </para>
921780 <para>
922781 You can convert between formats with nix-hash, for example:
@@ -927,28 +786,18 @@ src = fetchFromGitHub {
927786 </listitem>
928787 <listitem>
929788 <para>
930− Extracting hash from local source tarball can be done with
931− <literal>sha256sum</literal>. Use <literal>nix-prefetch-url
932− file:///path/to/tarball </literal> if you want base32 hash.
789+ Extracting hash from local source tarball can be done with <literal>sha256sum</literal>. Use <literal>nix-prefetch-url file:///path/to/tarball </literal> if you want base32 hash.
933790 </para>
934791 </listitem>
935792 <listitem>
936793 <para>
937− Fake hash: set fake hash in package expression, perform build and extract
938− correct hash from error Nix prints.
794+ Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints.
939795 </para>
940796 <para>
941− For package updates it is enough to change one symbol to make hash fake.
942− For new packages, you can use <literal>lib.fakeSha256</literal>,
943− <literal>lib.fakeSha512</literal> or any other fake hash.
797+ For package updates it is enough to change one symbol to make hash fake. For new packages, you can use <literal>lib.fakeSha256</literal>, <literal>lib.fakeSha512</literal> or any other fake hash.
944798 </para>
945799 <para>
946− This is last resort method when reconstructing source URL is non-trivial
947− and <literal>nix-prefetch-url -A</literal> isn't applicable (for example,
948− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73">
949− one of <literal>kodi</literal> dependencies</link>). The easiest way then
950− would be replace hash with a fake one and rebuild. Nix build will fail and
951− error message will contain desired hash.
800+ This is last resort method when reconstructing source URL is non-trivial and <literal>nix-prefetch-url -A</literal> isn't applicable (for example, <link xlink:href="https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73"> one of <literal>kodi</literal> dependencies</link>). The easiest way then would be replace hash with a fake one and rebuild. Nix build will fail and error message will contain desired hash.
952801 </para>
953802 <warning>
954803 <para>
@@ -962,9 +811,7 @@ src = fetchFromGitHub {
962811 <title>Obtaining hashes securely</title>
963812
964813 <para>
965− Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead
966− of fetching source you can fetch malware, and instead of source hash you
967− get hash of malware. Here are security considerations for this scenario:
814+ Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead of fetching source you can fetch malware, and instead of source hash you get hash of malware. Here are security considerations for this scenario:
968815 </para>
969816
970817 <itemizedlist>
@@ -975,8 +822,7 @@ src = fetchFromGitHub {
975822 </listitem>
976823 <listitem>
977824 <para>
978− hashes from upstream (in method 3) should be obtained via secure
979− protocol;
825+ hashes from upstream (in method 3) should be obtained via secure protocol;
980826 </para>
981827 </listitem>
982828 <listitem>
@@ -986,12 +832,7 @@ src = fetchFromGitHub {
986832 </listitem>
987833 <listitem>
988834 <para>
989− <literal>https://</literal> URLs are not secure in method 5. When
990− obtaining hashes with fake hash method, TLS checks are disabled. So
991− refetch source hash from several different networks to exclude MITM
992− scenario. Alternatively, use fake hash method to make Nix error, but
993− instead of extracting hash from error, extract
994− <literal>https://</literal> URL and prefetch it with method 1.
835+ <literal>https://</literal> URLs are not secure in method 5. When obtaining hashes with fake hash method, TLS checks are disabled. So refetch source hash from several different networks to exclude MITM scenario. Alternatively, use fake hash method to make Nix error, but instead of extracting hash from error, extract <literal>https://</literal> URL and prefetch it with method 1.
995836 </para>
996837 </listitem>
997838 </itemizedlist>
@@ -1001,8 +842,7 @@ src = fetchFromGitHub {
1001842 <title>Patches</title>
1002843
1003844 <para>
1004− Patches available online should be retrieved using
1005− <literal>fetchpatch</literal>.
845+ Patches available online should be retrieved using <literal>fetchpatch</literal>.
1006846 </para>
1007847
1008848 <para>
@@ -1018,10 +858,7 @@ patches = [
1018858 </para>
1019859
1020860 <para>
1021− Otherwise, you can add a <literal>.patch</literal> file to the
1022− <literal>nixpkgs</literal> repository. In the interest of keeping our
1023− maintenance burden to a minimum, only patches that are unique to
1024− <literal>nixpkgs</literal> should be added in this way.
861+ Otherwise, you can add a <literal>.patch</literal> file to the <literal>nixpkgs</literal> repository. In the interest of keeping our maintenance burden to a minimum, only patches that are unique to <literal>nixpkgs</literal> should be added in this way.
1025862 </para>
1026863
1027864 <para>
@@ -1031,8 +868,7 @@ patches = [ ./0001-changes.patch ];
1031868 </para>
1032869
1033870 <para>
1034− If you do need to do create this sort of patch file, one way to do so is
1035− with git:
871+ If you do need to do create this sort of patch file, one way to do so is with git:
1036872 <orderedlist>
1037873 <listitem>
1038874 <para>
@@ -1043,8 +879,7 @@ patches = [ ./0001-changes.patch ];
1043879 </listitem>
1044880 <listitem>
1045881 <para>
1046− If a git repository is not already present, create one and stage all of
1047− the source files.
882+ If a git repository is not already present, create one and stage all of the source files.
1048883<screen>
1049884<prompt>$ </prompt>git init
1050885<prompt>$ </prompt>git add .</screen>
@@ -1052,8 +887,7 @@ patches = [ ./0001-changes.patch ];
1052887 </listitem>
1053888 <listitem>
1054889 <para>
1055− Edit some files to make whatever changes need to be included in the
1056− patch.
890+ Edit some files to make whatever changes need to be included in the patch.
1057891 </para>
1058892 </listitem>
1059893 <listitem>
doc/configuration.xml+44−140
@@ -3,49 +3,38 @@
33 xml:id="chap-packageconfig">
44 <title>Global configuration</title>
55 <para>
6− Nix comes with certain defaults about what packages can and cannot be
7− installed, based on a package's metadata. By default, Nix will prevent
8− installation if any of the following criteria are true:
6+ Nix comes with certain defaults about what packages can and cannot be installed, based on a package's metadata. By default, Nix will prevent installation if any of the following criteria are true:
97 </para>
108 <itemizedlist>
119 <listitem>
1210 <para>
13− The package is thought to be broken, and has had its
14− <literal>meta.broken</literal> set to <literal>true</literal>.
11+ The package is thought to be broken, and has had its <literal>meta.broken</literal> set to <literal>true</literal>.
1512 </para>
1613 </listitem>
1714 <listitem>
1815 <para>
19− The package isn't intended to run on the given system, as none of its
20− <literal>meta.platforms</literal> match the given system.
16+ The package isn't intended to run on the given system, as none of its <literal>meta.platforms</literal> match the given system.
2117 </para>
2218 </listitem>
2319 <listitem>
2420 <para>
25− The package's <literal>meta.license</literal> is set to a license which is
26− considered to be unfree.
21+ The package's <literal>meta.license</literal> is set to a license which is considered to be unfree.
2722 </para>
2823 </listitem>
2924 <listitem>
3025 <para>
31− The package has known security vulnerabilities but has not or can not be
32− updated for some reason, and a list of issues has been entered in to the
33− package's <literal>meta.knownVulnerabilities</literal>.
26+ The package has known security vulnerabilities but has not or can not be updated for some reason, and a list of issues has been entered in to the package's <literal>meta.knownVulnerabilities</literal>.
3427 </para>
3528 </listitem>
3629 </itemizedlist>
3730 <para>
38− Note that all this is checked during evaluation already, and the check
39− includes any package that is evaluated. In particular, all build-time
40− dependencies are checked. <literal>nix-env -qa</literal> will (attempt to)
41− hide any packages that would be refused.
31+ Note that all this is checked during evaluation already, and the check includes any package that is evaluated. In particular, all build-time dependencies are checked. <literal>nix-env -qa</literal> will (attempt to) hide any packages that would be refused.
4232 </para>
4333 <para>
4434 Each of these criteria can be altered in the nixpkgs configuration.
4535 </para>
4636 <para>
47− The nixpkgs configuration for a NixOS system is set in the
48− <literal>configuration.nix</literal>, as in the following example:
37+ The nixpkgs configuration for a NixOS system is set in the <literal>configuration.nix</literal>, as in the following example:
4938<programlisting>
5039{
5140 nixpkgs.config = {
@@ -53,13 +42,10 @@
5342 };
5443}
5544</programlisting>
56− However, this does not allow unfree software for individual users. Their
57− configurations are managed separately.
45+ However, this does not allow unfree software for individual users. Their configurations are managed separately.
5846 </para>
5947 <para>
60− A user's of nixpkgs configuration is stored in a user-specific configuration
61− file located at <filename>~/.config/nixpkgs/config.nix</filename>. For
62− example:
48+ A user's of nixpkgs configuration is stored in a user-specific configuration file located at <filename>~/.config/nixpkgs/config.nix</filename>. For example:
6349<programlisting>
6450{
6551 allowUnfree = true;
@@ -67,31 +53,25 @@
6753</programlisting>
6854 </para>
6955 <para>
70− Note that we are not able to test or build unfree software on Hydra due to
71− policy. Most unfree licenses prohibit us from either executing or
72− distributing the software.
56+ Note that we are not able to test or build unfree software on Hydra due to policy. Most unfree licenses prohibit us from either executing or distributing the software.
7357 </para>
7458 <section xml:id="sec-allow-broken">
7559 <title>Installing broken packages</title>
7660
7761 <para>
78− There are two ways to try compiling a package which has been marked as
79− broken.
62+ There are two ways to try compiling a package which has been marked as broken.
8063 </para>
8164
8265 <itemizedlist>
8366 <listitem>
8467 <para>
85− For allowing the build of a broken package once, you can use an
86− environment variable for a single invocation of the nix tools:
68+ For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools:
8769<programlisting>$ export NIXPKGS_ALLOW_BROKEN=1</programlisting>
8870 </para>
8971 </listitem>
9072 <listitem>
9173 <para>
92− For permanently allowing broken packages to be built, you may add
93− <literal>allowBroken = true;</literal> to your user's configuration file,
94− like this:
74+ For permanently allowing broken packages to be built, you may add <literal>allowBroken = true;</literal> to your user's configuration file, like this:
9575<programlisting>
9676{
9777 allowBroken = true;
@@ -105,23 +85,19 @@
10585 <title>Installing packages on unsupported systems</title>
10686
10787 <para>
108− There are also two ways to try compiling a package which has been marked as
109− unsuported for the given system.
88+ There are also two ways to try compiling a package which has been marked as unsuported for the given system.
11089 </para>
11190
11291 <itemizedlist>
11392 <listitem>
11493 <para>
115− For allowing the build of a broken package once, you can use an
116− environment variable for a single invocation of the nix tools:
94+ For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools:
11795<programlisting>$ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1</programlisting>
11896 </para>
11997 </listitem>
12098 <listitem>
12199 <para>
122− For permanently allowing broken packages to be built, you may add
123− <literal>allowUnsupportedSystem = true;</literal> to your user's
124− configuration file, like this:
100+ For permanently allowing broken packages to be built, you may add <literal>allowUnsupportedSystem = true;</literal> to your user's configuration file, like this:
125101<programlisting>
126102{
127103 allowUnsupportedSystem = true;
@@ -132,42 +108,29 @@
132108 </itemizedlist>
133109
134110 <para>
135− The difference between a package being unsupported on some system and being
136− broken is admittedly a bit fuzzy. If a program <emphasis>ought</emphasis> to
137− work on a certain platform, but doesn't, the platform should be included in
138− <literal>meta.platforms</literal>, but marked as broken with e.g.
139− <literal>meta.broken = !hostPlatform.isWindows</literal>. Of course, this
140− begs the question of what "ought" means exactly. That is left to the package
141− maintainer.
111+ The difference between a package being unsupported on some system and being broken is admittedly a bit fuzzy. If a program <emphasis>ought</emphasis> to work on a certain platform, but doesn't, the platform should be included in <literal>meta.platforms</literal>, but marked as broken with e.g. <literal>meta.broken = !hostPlatform.isWindows</literal>. Of course, this begs the question of what "ought" means exactly. That is left to the package maintainer.
142112 </para>
143113 </section>
144114 <section xml:id="sec-allow-unfree">
145115 <title>Installing unfree packages</title>
146116
147117 <para>
148− There are several ways to tweak how Nix handles a package which has been
149− marked as unfree.
118+ There are several ways to tweak how Nix handles a package which has been marked as unfree.
150119 </para>
151120
152121 <itemizedlist>
153122 <listitem>
154123 <para>
155− To temporarily allow all unfree packages, you can use an environment
156− variable for a single invocation of the nix tools:
124+ To temporarily allow all unfree packages, you can use an environment variable for a single invocation of the nix tools:
157125<programlisting>$ export NIXPKGS_ALLOW_UNFREE=1</programlisting>
158126 </para>
159127 </listitem>
160128 <listitem>
161129 <para>
162− It is possible to permanently allow individual unfree packages, while
163− still blocking unfree packages by default using the
164− <literal>allowUnfreePredicate</literal> configuration option in the user
165− configuration file.
130+ It is possible to permanently allow individual unfree packages, while still blocking unfree packages by default using the <literal>allowUnfreePredicate</literal> configuration option in the user configuration file.
166131 </para>
167132 <para>
168− This option is a function which accepts a package as a parameter, and
169− returns a boolean. The following example configuration accepts a package
170− and always returns false:
133+ This option is a function which accepts a package as a parameter, and returns a boolean. The following example configuration accepts a package and always returns false:
171134<programlisting>
172135{
173136 allowUnfreePredicate = (pkg: false);
@@ -175,8 +138,7 @@
175138</programlisting>
176139 </para>
177140 <para>
178− For a more useful example, try the following. This configuration only
179− allows unfree packages named flash player and visual studio code:
141+ For a more useful example, try the following. This configuration only allows unfree packages named flash player and visual studio code:
180142<programlisting>
181143{
182144 allowUnfreePredicate = (pkg: builtins.elem
@@ -190,14 +152,10 @@
190152 </listitem>
191153 <listitem>
192154 <para>
193− It is also possible to whitelist and blacklist licenses that are
194− specifically acceptable or not acceptable, using
195− <literal>whitelistedLicenses</literal> and
196− <literal>blacklistedLicenses</literal>, respectively.
155+ It is also possible to whitelist and blacklist licenses that are specifically acceptable or not acceptable, using <literal>whitelistedLicenses</literal> and <literal>blacklistedLicenses</literal>, respectively.
197156 </para>
198157 <para>
199− The following example configuration whitelists the licenses
200− <literal>amd</literal> and <literal>wtfpl</literal>:
158+ The following example configuration whitelists the licenses <literal>amd</literal> and <literal>wtfpl</literal>:
201159<programlisting>
202160{
203161 whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
@@ -205,8 +163,7 @@
205163</programlisting>
206164 </para>
207165 <para>
208− The following example configuration blacklists the <literal>gpl3</literal>
209− and <literal>agpl3</literal> licenses:
166+ The following example configuration blacklists the <literal>gpl3</literal> and <literal>agpl3</literal> licenses:
210167<programlisting>
211168{
212169 blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
@@ -217,37 +174,29 @@
217174 </itemizedlist>
218175
219176 <para>
220− A complete list of licenses can be found in the file
221− <filename>lib/licenses.nix</filename> of the nixpkgs tree.
177+ A complete list of licenses can be found in the file <filename>lib/licenses.nix</filename> of the nixpkgs tree.
222178 </para>
223179 </section>
224180 <section xml:id="sec-allow-insecure">
225181 <title>Installing insecure packages</title>
226182
227183 <para>
228− There are several ways to tweak how Nix handles a package which has been
229− marked as insecure.
184+ There are several ways to tweak how Nix handles a package which has been marked as insecure.
230185 </para>
231186
232187 <itemizedlist>
233188 <listitem>
234189 <para>
235− To temporarily allow all insecure packages, you can use an environment
236− variable for a single invocation of the nix tools:
190+ To temporarily allow all insecure packages, you can use an environment variable for a single invocation of the nix tools:
237191<programlisting>$ export NIXPKGS_ALLOW_INSECURE=1</programlisting>
238192 </para>
239193 </listitem>
240194 <listitem>
241195 <para>
242− It is possible to permanently allow individual insecure packages, while
243− still blocking other insecure packages by default using the
244− <literal>permittedInsecurePackages</literal> configuration option in the
245− user configuration file.
196+ It is possible to permanently allow individual insecure packages, while still blocking other insecure packages by default using the <literal>permittedInsecurePackages</literal> configuration option in the user configuration file.
246197 </para>
247198 <para>
248− The following example configuration permits the installation of the
249− hypothetically insecure package <literal>hello</literal>, version
250− <literal>1.2.3</literal>:
199+ The following example configuration permits the installation of the hypothetically insecure package <literal>hello</literal>, version <literal>1.2.3</literal>:
251200<programlisting>
252201{
253202 permittedInsecurePackages = [
@@ -259,18 +208,13 @@
259208 </listitem>
260209 <listitem>
261210 <para>
262− It is also possible to create a custom policy around which insecure
263− packages to allow and deny, by overriding the
264− <literal>allowInsecurePredicate</literal> configuration option.
211+ It is also possible to create a custom policy around which insecure packages to allow and deny, by overriding the <literal>allowInsecurePredicate</literal> configuration option.
265212 </para>
266213 <para>
267− The <literal>allowInsecurePredicate</literal> option is a function which
268− accepts a package and returns a boolean, much like
269− <literal>allowUnfreePredicate</literal>.
214+ The <literal>allowInsecurePredicate</literal> option is a function which accepts a package and returns a boolean, much like <literal>allowUnfreePredicate</literal>.
270215 </para>
271216 <para>
272− The following configuration example only allows insecure packages with
273− very short names:
217+ The following configuration example only allows insecure packages with very short names:
274218<programlisting>
275219{
276220 allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) &lt;= 5);
@@ -278,8 +222,7 @@
278222</programlisting>
279223 </para>
280224 <para>
281− Note that <literal>permittedInsecurePackages</literal> is only checked if
282− <literal>allowInsecurePredicate</literal> is not specified.
225+ Note that <literal>permittedInsecurePackages</literal> is only checked if <literal>allowInsecurePredicate</literal> is not specified.
283226 </para>
284227 </listitem>
285228 </itemizedlist>
@@ -289,10 +232,7 @@
289232 <title>Modify packages via <literal>packageOverrides</literal></title>
290233
291234 <para>
292− You can define a function called <varname>packageOverrides</varname> in your
293− local <filename>~/.config/nixpkgs/config.nix</filename> to override Nix
294− packages. It must be a function that takes pkgs as an argument and returns a
295− modified set of packages.
235+ You can define a function called <varname>packageOverrides</varname> in your local <filename>~/.config/nixpkgs/config.nix</filename> to override Nix packages. It must be a function that takes pkgs as an argument and returns a modified set of packages.
296236<programlisting>
297237{
298238 packageOverrides = pkgs: rec {
@@ -309,15 +249,7 @@
309249 <title>Build an environment</title>
310250
311251 <para>
312− Using <literal>packageOverrides</literal>, it is possible to manage
313− packages declaratively. This means that we can list all of our desired
314− packages within a declarative Nix expression. For example, to have
315− <literal>aspell</literal>, <literal>bc</literal>,
316− <literal>ffmpeg</literal>, <literal>coreutils</literal>,
317− <literal>gdb</literal>, <literal>nixUnstable</literal>,
318− <literal>emscripten</literal>, <literal>jq</literal>,
319− <literal>nox</literal>, and <literal>silver-searcher</literal>, we could
320− use the following in <filename>~/.config/nixpkgs/config.nix</filename>:
252+ Using <literal>packageOverrides</literal>, it is possible to manage packages declaratively. This means that we can list all of our desired packages within a declarative Nix expression. For example, to have <literal>aspell</literal>, <literal>bc</literal>, <literal>ffmpeg</literal>, <literal>coreutils</literal>, <literal>gdb</literal>, <literal>nixUnstable</literal>, <literal>emscripten</literal>, <literal>jq</literal>, <literal>nox</literal>, and <literal>silver-searcher</literal>, we could use the following in <filename>~/.config/nixpkgs/config.nix</filename>:
321253 </para>
322254
323255<screen>
@@ -343,13 +275,7 @@
343275</screen>
344276
345277 <para>
346− To install it into our environment, you can just run <literal>nix-env -iA
347− nixpkgs.myPackages</literal>. If you want to load the packages to be built
348− from a working copy of <literal>nixpkgs</literal> you just run
349− <literal>nix-env -f. -iA myPackages</literal>. To explore what's been
350− installed, just look through <filename>~/.nix-profile/</filename>. You can
351− see that a lot of stuff has been installed. Some of this stuff is useful
352− some of it isn't. Let's tell Nixpkgs to only link the stuff that we want:
278+ To install it into our environment, you can just run <literal>nix-env -iA nixpkgs.myPackages</literal>. If you want to load the packages to be built from a working copy of <literal>nixpkgs</literal> you just run <literal>nix-env -f. -iA myPackages</literal>. To explore what's been installed, just look through <filename>~/.nix-profile/</filename>. You can see that a lot of stuff has been installed. Some of this stuff is useful some of it isn't. Let's tell Nixpkgs to only link the stuff that we want:
353279 </para>
354280
355281<screen>
@@ -376,12 +302,7 @@
376302</screen>
377303
378304 <para>
379− <literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed
380− which gets rid of the extra stuff in the profile. <filename>/bin</filename>
381− and <filename>/share</filename> are good defaults for a user environment,
382− getting rid of the clutter. If you are running on Nix on MacOS, you may
383− want to add another path as well, <filename>/Applications</filename>, that
384− makes GUI apps available.
305+ <literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed which gets rid of the extra stuff in the profile. <filename>/bin</filename> and <filename>/share</filename> are good defaults for a user environment, getting rid of the clutter. If you are running on Nix on MacOS, you may want to add another path as well, <filename>/Applications</filename>, that makes GUI apps available.
385306 </para>
386307 </section>
387308
@@ -389,13 +310,7 @@
389310 <title>Getting documentation</title>
390311
391312 <para>
392− After building that new environment, look through
393− <filename>~/.nix-profile</filename> to make sure everything is there that
394− we wanted. Discerning readers will note that some files are missing. Look
395− inside <filename>~/.nix-profile/share/man/man1/</filename> to verify this.
396− There are no man pages for any of the Nix tools! This is because some
397− packages like Nix have multiple outputs for things like documentation (see
398− section 4). Let's make Nix install those as well.
313+ After building that new environment, look through <filename>~/.nix-profile</filename> to make sure everything is there that we wanted. Discerning readers will note that some files are missing. Look inside <filename>~/.nix-profile/share/man/man1/</filename> to verify this. There are no man pages for any of the Nix tools! This is because some packages like Nix have multiple outputs for things like documentation (see section 4). Let's make Nix install those as well.
399314 </para>
400315
401316<screen>
@@ -422,9 +337,7 @@
422337</screen>
423338
424339 <para>
425− This provides us with some useful documentation for using our packages.
426− However, if we actually want those manpages to be detected by man, we need
427− to set up our environment. This can also be managed within Nix expressions.
340+ This provides us with some useful documentation for using our packages. However, if we actually want those manpages to be detected by man, we need to set up our environment. This can also be managed within Nix expressions.
428341 </para>
429342
430343<screen>
@@ -460,9 +373,7 @@
460373</screen>
461374
462375 <para>
463− For this to work fully, you must also have this script sourced when you are
464− logged in. Try adding something like this to your
465− <filename>~/.profile</filename> file:
376+ For this to work fully, you must also have this script sourced when you are logged in. Try adding something like this to your <filename>~/.profile</filename> file:
466377 </para>
467378
468379<screen>
@@ -477,8 +388,7 @@ fi
477388</screen>
478389
479390 <para>
480− Now just run <literal>source $HOME/.profile</literal> and you can starting
481− loading man pages from your environent.
391+ Now just run <literal>source $HOME/.profile</literal> and you can starting loading man pages from your environent.
482392 </para>
483393 </section>
484394
@@ -486,9 +396,7 @@ fi
486396 <title>GNU info setup</title>
487397
488398 <para>
489− Configuring GNU info is a little bit trickier than man pages. To work
490− correctly, info needs a database to be generated. This can be done with
491− some small modifications to our environment scripts.
399+ Configuring GNU info is a little bit trickier than man pages. To work correctly, info needs a database to be generated. This can be done with some small modifications to our environment scripts.
492400 </para>
493401
494402<screen>
@@ -534,11 +442,7 @@ fi
534442</screen>
535443
536444 <para>
537− <literal>postBuild</literal> tells Nixpkgs to run a command after building
538− the environment. In this case, <literal>install-info</literal> adds the
539− installed info pages to <literal>dir</literal> which is GNU info's default
540− root node. Note that <literal>texinfoInteractive</literal> is added to the
541− environment to give the <literal>install-info</literal> command.
445+ <literal>postBuild</literal> tells Nixpkgs to run a command after building the environment. In this case, <literal>install-info</literal> adds the installed info pages to <literal>dir</literal> which is GNU info's default root node. Note that <literal>texinfoInteractive</literal> is added to the environment to give the <literal>install-info</literal> command.
542446 </para>
543447 </section>
544448 </section>
doc/contributing.xml+5−10
@@ -3,10 +3,8 @@
33 xml:id="chap-contributing">
44 <title>Contributing to this documentation</title>
55 <para>
6− The DocBook sources of the Nixpkgs manual are in the
7− <filename
8−xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename>
9− subdirectory of the Nixpkgs repository.
6+ The DocBook sources of the Nixpkgs manual are in the <filename
7+xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename> subdirectory of the Nixpkgs repository.
108 </para>
119 <para>
1210 You can quickly check your edits with <command>make</command>:
@@ -17,19 +15,16 @@ xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename>
1715<prompt>[nix-shell]$ </prompt>make
1816</screen>
1917 <para>
20− If you experience problems, run <command>make debug</command> to help
21− understand the docbook errors.
18+ If you experience problems, run <command>make debug</command> to help understand the docbook errors.
2219 </para>
2320 <para>
24− After making modifications to the manual, it's important to build it before
25− committing. You can do that as follows:
21+ After making modifications to the manual, it's important to build it before committing. You can do that as follows:
2622<screen>
2723<prompt>$ </prompt>cd /path/to/nixpkgs/doc
2824<prompt>$ </prompt>nix-shell
2925<prompt>[nix-shell]$ </prompt>make clean
3026<prompt>[nix-shell]$ </prompt>nix-build .
3127</screen>
32− If the build succeeds, the manual will be in
33− <filename>./result/share/doc/nixpkgs/manual.html</filename>.
28+ If the build succeeds, the manual will be in <filename>./result/share/doc/nixpkgs/manual.html</filename>.
3429 </para>
3530</chapter>
doc/cross-compilation.xml+53−337
@@ -6,25 +6,11 @@
66 <title>Introduction</title>
77
88 <para>
9− "Cross-compilation" means compiling a program on one machine for another
10− type of machine. For example, a typical use of cross-compilation is to
11− compile programs for embedded devices. These devices often don't have the
12− computing power and memory to compile their own programs. One might think
13− that cross-compilation is a fairly niche concern. However, there are
14− significant advantages to rigorously distinguishing between build-time and
15− run-time environments! Significant, because the benefits apply even when one
16− is developing and deploying on the same machine. Nixpkgs is increasingly
17− adopting the opinion that packages should be written with cross-compilation
18− in mind, and nixpkgs should evaluate in a similar way (by minimizing
19− cross-compilation-specific special cases) whether or not one is
20− cross-compiling.
9+ "Cross-compilation" means compiling a program on one machine for another type of machine. For example, a typical use of cross-compilation is to compile programs for embedded devices. These devices often don't have the computing power and memory to compile their own programs. One might think that cross-compilation is a fairly niche concern. However, there are significant advantages to rigorously distinguishing between build-time and run-time environments! Significant, because the benefits apply even when one is developing and deploying on the same machine. Nixpkgs is increasingly adopting the opinion that packages should be written with cross-compilation in mind, and nixpkgs should evaluate in a similar way (by minimizing cross-compilation-specific special cases) whether or not one is cross-compiling.
2110 </para>
2211
2312 <para>
24− This chapter will be organized in three parts. First, it will describe the
25− basics of how to package software in a way that supports cross-compilation.
26− Second, it will describe how to use Nixpkgs when cross-compiling. Third, it
27− will describe the internal infrastructure supporting cross-compilation.
13+ This chapter will be organized in three parts. First, it will describe the basics of how to package software in a way that supports cross-compilation. Second, it will describe how to use Nixpkgs when cross-compiling. Third, it will describe the internal infrastructure supporting cross-compilation.
2814 </para>
2915 </section>
3016<!--============================================================-->
@@ -35,24 +21,12 @@
3521 <title>Platform parameters</title>
3622
3723 <para>
38− Nixpkgs follows the
39− <link
40− xlink:href="https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html">conventions
41− of GNU autoconf</link>. We distinguish between 3 types of platforms when
42− building a derivation: <wordasword>build</wordasword>,
43− <wordasword>host</wordasword>, and <wordasword>target</wordasword>. In
44− summary, <wordasword>build</wordasword> is the platform on which a package
45− is being built, <wordasword>host</wordasword> is the platform on which it
46− will run. The third attribute, <wordasword>target</wordasword>, is relevant
47− only for certain specific compilers and build tools.
24+ Nixpkgs follows the <link
25+ xlink:href="https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html">conventions of GNU autoconf</link>. We distinguish between 3 types of platforms when building a derivation: <wordasword>build</wordasword>, <wordasword>host</wordasword>, and <wordasword>target</wordasword>. In summary, <wordasword>build</wordasword> is the platform on which a package is being built, <wordasword>host</wordasword> is the platform on which it will run. The third attribute, <wordasword>target</wordasword>, is relevant only for certain specific compilers and build tools.
4826 </para>
4927
5028 <para>
51− In Nixpkgs, these three platforms are defined as attribute sets under the
52− names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>,
53− and <literal>targetPlatform</literal>. They are always defined as
54− attributes in the standard environment. That means one can access them
55− like:
29+ In Nixpkgs, these three platforms are defined as attribute sets under the names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal>. They are always defined as attributes in the standard environment. That means one can access them like:
5630<programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>
5731 .
5832 </para>
@@ -64,9 +38,7 @@
6438 </term>
6539 <listitem>
6640 <para>
67− The "build platform" is the platform on which a package is built. Once
68− someone has a built package, or pre-built binary package, the build
69− platform should not matter and can be ignored.
41+ The "build platform" is the platform on which a package is built. Once someone has a built package, or pre-built binary package, the build platform should not matter and can be ignored.
7042 </para>
7143 </listitem>
7244 </varlistentry>
@@ -76,9 +48,7 @@
7648 </term>
7749 <listitem>
7850 <para>
79− The "host platform" is the platform on which a package will be run. This
80− is the simplest platform to understand, but also the one with the worst
81− name.
51+ The "host platform" is the platform on which a package will be run. This is the simplest platform to understand, but also the one with the worst name.
8252 </para>
8353 </listitem>
8454 </varlistentry>
@@ -88,44 +58,23 @@
8858 </term>
8959 <listitem>
9060 <para>
91− The "target platform" attribute is, unlike the other two attributes, not
92− actually fundamental to the process of building software. Instead, it is
93− only relevant for compatibility with building certain specific compilers
94− and build tools. It can be safely ignored for all other packages.
61+ The "target platform" attribute is, unlike the other two attributes, not actually fundamental to the process of building software. Instead, it is only relevant for compatibility with building certain specific compilers and build tools. It can be safely ignored for all other packages.
9562 </para>
9663 <para>
97− The build process of certain compilers is written in such a way that the
98− compiler resulting from a single build can itself only produce binaries
99− for a single platform. The task of specifying this single "target
100− platform" is thus pushed to build time of the compiler. The root cause
101− of this is that the compiler (which will be run on the host) and the
102− standard library/runtime (which will be run on the target) are built by
103− a single build process.
64+ The build process of certain compilers is written in such a way that the compiler resulting from a single build can itself only produce binaries for a single platform. The task of specifying this single "target platform" is thus pushed to build time of the compiler. The root cause of this is that the compiler (which will be run on the host) and the standard library/runtime (which will be run on the target) are built by a single build process.
10465 </para>
10566 <para>
106− There is no fundamental need to think about a single target ahead of
107− time like this. If the tool supports modular or pluggable backends, both
108− the need to specify the target at build time and the constraint of
109− having only a single target disappear. An example of such a tool is
110− LLVM.
67+ There is no fundamental need to think about a single target ahead of time like this. If the tool supports modular or pluggable backends, both the need to specify the target at build time and the constraint of having only a single target disappear. An example of such a tool is LLVM.
11168 </para>
11269 <para>
113− Although the existence of a "target platfom" is arguably a historical
114− mistake, it is a common one: examples of tools that suffer from it are
115− GCC, Binutils, GHC and Autoconf. Nixpkgs tries to avoid sharing in the
116− mistake where possible. Still, because the concept of a target platform
117− is so ingrained, it is best to support it as is.
70+ Although the existence of a "target platfom" is arguably a historical mistake, it is a common one: examples of tools that suffer from it are GCC, Binutils, GHC and Autoconf. Nixpkgs tries to avoid sharing in the mistake where possible. Still, because the concept of a target platform is so ingrained, it is best to support it as is.
11871 </para>
11972 </listitem>
12073 </varlistentry>
12174 </variablelist>
12275
12376 <para>
124− The exact schema these fields follow is a bit ill-defined due to a long and
125− convoluted evolution, but this is slowly being cleaned up. You can see
126− examples of ones used in practice in
127− <literal>lib.systems.examples</literal>; note how they are not all very
128− consistent. For now, here are few fields can count on them containing:
77+ The exact schema these fields follow is a bit ill-defined due to a long and convoluted evolution, but this is slowly being cleaned up. You can see examples of ones used in practice in <literal>lib.systems.examples</literal>; note how they are not all very consistent. For now, here are few fields can count on them containing:
12978 </para>
13079
13180 <variablelist>
@@ -135,13 +84,7 @@
13584 </term>
13685 <listitem>
13786 <para>
138− This is a two-component shorthand for the platform. Examples of this
139− would be "x86_64-darwin" and "i686-linux"; see
140− <literal>lib.systems.doubles</literal> for more. The first component
141− corresponds to the CPU architecture of the platform and the second to
142− the operating system of the platform (<literal>[cpu]-[os]</literal>).
143− This format has built-in support in Nix, such as the
144− <varname>builtins.currentSystem</varname> impure string.
87+ This is a two-component shorthand for the platform. Examples of this would be "x86_64-darwin" and "i686-linux"; see <literal>lib.systems.doubles</literal> for more. The first component corresponds to the CPU architecture of the platform and the second to the operating system of the platform (<literal>[cpu]-[os]</literal>). This format has built-in support in Nix, such as the <varname>builtins.currentSystem</varname> impure string.
14588 </para>
14689 </listitem>
14790 </varlistentry>
@@ -151,15 +94,7 @@
15194 </term>
15295 <listitem>
15396 <para>
154− This is a 3- or 4- component shorthand for the platform. Examples of
155− this would be <literal>x86_64-unknown-linux-gnu</literal> and
156− <literal>aarch64-apple-darwin14</literal>. This is a standard format
157− called the "LLVM target triple", as they are pioneered by LLVM. In the
158− 4-part form, this corresponds to
159− <literal>[cpu]-[vendor]-[os]-[abi]</literal>. This format is strictly
160− more informative than the "Nix host double", as the previous format
161− could analogously be termed. This needs a better name than
162− <varname>config</varname>!
97+ This is a 3- or 4- component shorthand for the platform. Examples of this would be <literal>x86_64-unknown-linux-gnu</literal> and <literal>aarch64-apple-darwin14</literal>. This is a standard format called the "LLVM target triple", as they are pioneered by LLVM. In the 4-part form, this corresponds to <literal>[cpu]-[vendor]-[os]-[abi]</literal>. This format is strictly more informative than the "Nix host double", as the previous format could analogously be termed. This needs a better name than <varname>config</varname>!
16398 </para>
16499 </listitem>
165100 </varlistentry>
@@ -169,10 +104,7 @@
169104 </term>
170105 <listitem>
171106 <para>
172− This is a Nix representation of a parsed LLVM target triple with
173− white-listed components. This can be specified directly, or actually
174− parsed from the <varname>config</varname>. See
175− <literal>lib.systems.parse</literal> for the exact representation.
107+ This is a Nix representation of a parsed LLVM target triple with white-listed components. This can be specified directly, or actually parsed from the <varname>config</varname>. See <literal>lib.systems.parse</literal> for the exact representation.
176108 </para>
177109 </listitem>
178110 </varlistentry>
@@ -182,10 +114,7 @@
182114 </term>
183115 <listitem>
184116 <para>
185− This is a string identifying the standard C library used. Valid
186− identifiers include "glibc" for GNU libc, "libSystem" for Darwin's
187− Libsystem, and "uclibc" for µClibc. It should probably be refactored to
188− use the module system, like <varname>parse</varname>.
117+ This is a string identifying the standard C library used. Valid identifiers include "glibc" for GNU libc, "libSystem" for Darwin's Libsystem, and "uclibc" for µClibc. It should probably be refactored to use the module system, like <varname>parse</varname>.
189118 </para>
190119 </listitem>
191120 </varlistentry>
@@ -195,10 +124,7 @@
195124 </term>
196125 <listitem>
197126 <para>
198− These predicates are defined in <literal>lib.systems.inspect</literal>,
199− and slapped onto every platform. They are superior to the ones in
200− <varname>stdenv</varname> as they force the user to be explicit about
201− which platform they are inspecting. Please use these instead of those.
127+ These predicates are defined in <literal>lib.systems.inspect</literal>, and slapped onto every platform. They are superior to the ones in <varname>stdenv</varname> as they force the user to be explicit about which platform they are inspecting. Please use these instead of those.
202128 </para>
203129 </listitem>
204130 </varlistentry>
@@ -208,11 +134,7 @@
208134 </term>
209135 <listitem>
210136 <para>
211− This is, quite frankly, a dumping ground of ad-hoc settings (it's an
212− attribute set). See <literal>lib.systems.platforms</literal> for
213− examples—there's hopefully one in there that will work verbatim for
214− each platform that is working. Please help us triage these flags and
215− give them better homes!
137+ This is, quite frankly, a dumping ground of ad-hoc settings (it's an attribute set). See <literal>lib.systems.platforms</literal> for examples—there's hopefully one in there that will work verbatim for each platform that is working. Please help us triage these flags and give them better homes!
216138 </para>
217139 </listitem>
218140 </varlistentry>
@@ -224,62 +146,33 @@
224146
225147 <note>
226148 <para>
227− This is a rather philosophical description that isn't very
228− Nixpkgs-specific. For an overview of all the relevant attributes given to
229− <varname>mkDerivation</varname>, see
230− <xref
231− linkend="ssec-stdenv-dependencies"/>. For a description of how
232− everything is implemented, see
233− <xref linkend="ssec-cross-dependency-implementation" />.
149+ This is a rather philosophical description that isn't very Nixpkgs-specific. For an overview of all the relevant attributes given to <varname>mkDerivation</varname>, see <xref
150+ linkend="ssec-stdenv-dependencies"/>. For a description of how everything is implemented, see <xref linkend="ssec-cross-dependency-implementation" />.
234151 </para>
235152 </note>
236153
237154 <para>
238− In this section we explore the relationship between both runtime and
239− build-time dependencies and the 3 Autoconf platforms.
155+ In this section we explore the relationship between both runtime and build-time dependencies and the 3 Autoconf platforms.
240156 </para>
241157
242158 <para>
243− A run time dependency between two packages requires that their host
244− platforms match. This is directly implied by the meaning of "host platform"
245− and "runtime dependency": The package dependency exists while both packages
246− are running on a single host platform.
159+ A run time dependency between two packages requires that their host platforms match. This is directly implied by the meaning of "host platform" and "runtime dependency": The package dependency exists while both packages are running on a single host platform.
247160 </para>
248161
249162 <para>
250− A build time dependency, however, has a shift in platforms between the
251− depending package and the depended-on package. "build time dependency"
252− means that to build the depending package we need to be able to run the
253− depended-on's package. The depending package's build platform is therefore
254− equal to the depended-on package's host platform.
163+ A build time dependency, however, has a shift in platforms between the depending package and the depended-on package. "build time dependency" means that to build the depending package we need to be able to run the depended-on's package. The depending package's build platform is therefore equal to the depended-on package's host platform.
255164 </para>
256165
257166 <para>
258− If both the dependency and depending packages aren't compilers or other
259− machine-code-producing tools, we're done. And indeed
260− <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname>
261− have covered these simpler build-time and run-time (respectively) changes
262− for many years. But if the dependency does produce machine code, we might
263− need to worry about its target platform too. In principle, that target
264− platform might be any of the depending package's build, host, or target
265− platforms, but we prohibit dependencies from a "later" platform to an
266− earlier platform to limit confusion because we've never seen a legitimate
267− use for them.
167+ If both the dependency and depending packages aren't compilers or other machine-code-producing tools, we're done. And indeed <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname> have covered these simpler build-time and run-time (respectively) changes for many years. But if the dependency does produce machine code, we might need to worry about its target platform too. In principle, that target platform might be any of the depending package's build, host, or target platforms, but we prohibit dependencies from a "later" platform to an earlier platform to limit confusion because we've never seen a legitimate use for them.
268168 </para>
269169
270170 <para>
271− Finally, if the depending package is a compiler or other
272− machine-code-producing tool, it might need dependencies that run at "emit
273− time". This is for compilers that (regrettably) insist on being built
274− together with their source langauges' standard libraries. Assuming build !=
275− host != target, a run-time dependency of the standard library cannot be run
276− at the compiler's build time or run time, but only at the run time of code
277− emitted by the compiler.
171+ Finally, if the depending package is a compiler or other machine-code-producing tool, it might need dependencies that run at "emit time". This is for compilers that (regrettably) insist on being built together with their source langauges' standard libraries. Assuming build != host != target, a run-time dependency of the standard library cannot be run at the compiler's build time or run time, but only at the run time of code emitted by the compiler.
278172 </para>
279173
280174 <para>
281− Putting this all together, that means we have dependencies in the form
282− "host → target", in at most the following six combinations:
175+ Putting this all together, that means we have dependencies in the form "host → target", in at most the following six combinations:
283176 <table>
284177 <caption>Possible dependency types</caption>
285178 <thead>
@@ -318,16 +211,7 @@
318211 </para>
319212
320213 <para>
321− Some examples will make this table clearer. Suppose there's some package
322− that is being built with a <literal>(build, host, target)</literal>
323− platform triple of <literal>(foo, bar, baz)</literal>. If it has a
324− build-time library dependency, that would be a "host → build" dependency
325− with a triple of <literal>(foo, foo, *)</literal> (the target platform is
326− irrelevant). If it needs a compiler to be built, that would be a "build →
327− host" dependency with a triple of <literal>(foo, foo, *)</literal> (the
328− target platform is irrelevant). That compiler, would be built with another
329− compiler, also "build → host" dependency, with a triple of <literal>(foo,
330− foo, foo)</literal>.
214+ Some examples will make this table clearer. Suppose there's some package that is being built with a <literal>(build, host, target)</literal> platform triple of <literal>(foo, bar, baz)</literal>. If it has a build-time library dependency, that would be a "host → build" dependency with a triple of <literal>(foo, foo, *)</literal> (the target platform is irrelevant). If it needs a compiler to be built, that would be a "build → host" dependency with a triple of <literal>(foo, foo, *)</literal> (the target platform is irrelevant). That compiler, would be built with another compiler, also "build → host" dependency, with a triple of <literal>(foo, foo, foo)</literal>.
331215 </para>
332216 </section>
333217
@@ -335,20 +219,14 @@
335219 <title>Cross packaging cookbook</title>
336220
337221 <para>
338− Some frequently encountered problems when packaging for cross-compilation
339− should be answered here. Ideally, the information above is exhaustive, so
340− this section cannot provide any new information, but it is ludicrous and
341− cruel to expect everyone to spend effort working through the interaction of
342− many features just to figure out the same answer to the same common
343− problem. Feel free to add to this list!
222+ Some frequently encountered problems when packaging for cross-compilation should be answered here. Ideally, the information above is exhaustive, so this section cannot provide any new information, but it is ludicrous and cruel to expect everyone to spend effort working through the interaction of many features just to figure out the same answer to the same common problem. Feel free to add to this list!
344223 </para>
345224
346225 <qandaset>
347226 <qandaentry xml:id="cross-qa-build-c-program-in-build-environment">
348227 <question>
349228 <para>
350− What if my package's build system needs to build a C program to be run
351− under the build environment?
229+ What if my package's build system needs to build a C program to be run under the build environment?
352230 </para>
353231 </question>
354232 <answer>
@@ -366,11 +244,7 @@
366244 </question>
367245 <answer>
368246 <para>
369− Many packages assume that an unprefixed <command>ar</command> is
370− available, but Nix doesn't provide one. It only provides a prefixed one,
371− just as it only does for all the other binutils programs. It may be
372− necessary to patch the package to fix the build system to use a prefixed
373− `ar`.
247+ Many packages assume that an unprefixed <command>ar</command> is available, but Nix doesn't provide one. It only provides a prefixed one, just as it only does for all the other binutils programs. It may be necessary to patch the package to fix the build system to use a prefixed `ar`.
374248 </para>
375249 </answer>
376250 </qandaentry>
@@ -395,82 +269,32 @@
395269 <title>Cross-building packages</title>
396270
397271 <para>
398− Nixpkgs can be instantiated with <varname>localSystem</varname> alone, in
399− which case there is no cross-compiling and everything is built by and for
400− that system, or also with <varname>crossSystem</varname>, in which case
401− packages run on the latter, but all building happens on the former. Both
402− parameters take the same schema as the 3 (build, host, and target) platforms
403− defined in the previous section. As mentioned above,
404− <literal>lib.systems.examples</literal> has some platforms which are used as
405− arguments for these parameters in practice. You can use them
406− programmatically, or on the command line:
272+ Nixpkgs can be instantiated with <varname>localSystem</varname> alone, in which case there is no cross-compiling and everything is built by and for that system, or also with <varname>crossSystem</varname>, in which case packages run on the latter, but all building happens on the former. Both parameters take the same schema as the 3 (build, host, and target) platforms defined in the previous section. As mentioned above, <literal>lib.systems.examples</literal> has some platforms which are used as arguments for these parameters in practice. You can use them programmatically, or on the command line:
407273<programlisting>
408274nix-build &lt;nixpkgs&gt; --arg crossSystem '(import &lt;nixpkgs/lib&gt;).systems.examples.fooBarBaz' -A whatever</programlisting>
409275 </para>
410276
411277 <note>
412278 <para>
413− Eventually we would like to make these platform examples an unnecessary
414− convenience so that
279+ Eventually we would like to make these platform examples an unnecessary convenience so that
415280<programlisting>
416281nix-build &lt;nixpkgs&gt; --arg crossSystem '{ config = "&lt;arch&gt;-&lt;os&gt;-&lt;vendor&gt;-&lt;abi&gt;"; }' -A whatever</programlisting>
417− works in the vast majority of cases. The problem today is dependencies on
418− other sorts of configuration which aren't given proper defaults. We rely on
419− the examples to crudely to set those configuration parameters in some
420− vaguely sane manner on the users behalf. Issue
421− <link xlink:href="https://github.com/NixOS/nixpkgs/issues/34274">#34274</link>
422− tracks this inconvenience along with its root cause in crufty configuration
423− options.
282+ works in the vast majority of cases. The problem today is dependencies on other sorts of configuration which aren't given proper defaults. We rely on the examples to crudely to set those configuration parameters in some vaguely sane manner on the users behalf. Issue <link xlink:href="https://github.com/NixOS/nixpkgs/issues/34274">#34274</link> tracks this inconvenience along with its root cause in crufty configuration options.
424283 </para>
425284 </note>
426285
427286 <para>
428− While one is free to pass both parameters in full, there's a lot of logic to
429− fill in missing fields. As discussed in the previous section, only one of
430− <varname>system</varname>, <varname>config</varname>, and
431− <varname>parsed</varname> is needed to infer the other two. Additionally,
432− <varname>libc</varname> will be inferred from <varname>parse</varname>.
433− Finally, <literal>localSystem.system</literal> is also
434− <emphasis>impurely</emphasis> inferred based on the platform evaluation
435− occurs. This means it is often not necessary to pass
436− <varname>localSystem</varname> at all, as in the command-line example in the
437− previous paragraph.
287+ While one is free to pass both parameters in full, there's a lot of logic to fill in missing fields. As discussed in the previous section, only one of <varname>system</varname>, <varname>config</varname>, and <varname>parsed</varname> is needed to infer the other two. Additionally, <varname>libc</varname> will be inferred from <varname>parse</varname>. Finally, <literal>localSystem.system</literal> is also <emphasis>impurely</emphasis> inferred based on the platform evaluation occurs. This means it is often not necessary to pass <varname>localSystem</varname> at all, as in the command-line example in the previous paragraph.
438288 </para>
439289
440290 <note>
441291 <para>
442− Many sources (manual, wiki, etc) probably mention passing
443− <varname>system</varname>, <varname>platform</varname>, along with the
444− optional <varname>crossSystem</varname> to nixpkgs: <literal>import
445− &lt;nixpkgs&gt; { system = ..; platform = ..; crossSystem = ..;
446− }</literal>. Passing those two instead of <varname>localSystem</varname> is
447− still supported for compatibility, but is discouraged. Indeed, much of the
448− inference we do for these parameters is motivated by compatibility as much
449− as convenience.
292+ Many sources (manual, wiki, etc) probably mention passing <varname>system</varname>, <varname>platform</varname>, along with the optional <varname>crossSystem</varname> to nixpkgs: <literal>import &lt;nixpkgs&gt; { system = ..; platform = ..; crossSystem = ..; }</literal>. Passing those two instead of <varname>localSystem</varname> is still supported for compatibility, but is discouraged. Indeed, much of the inference we do for these parameters is motivated by compatibility as much as convenience.
450293 </para>
451294 </note>
452295
453296 <para>
454− One would think that <varname>localSystem</varname> and
455− <varname>crossSystem</varname> overlap horribly with the three
456− <varname>*Platforms</varname> (<varname>buildPlatform</varname>,
457− <varname>hostPlatform,</varname> and <varname>targetPlatform</varname>; see
458− <varname>stage.nix</varname> or the manual). Actually, those identifiers are
459− purposefully not used here to draw a subtle but important distinction: While
460− the granularity of having 3 platforms is necessary to properly *build*
461− packages, it is overkill for specifying the user's *intent* when making a
462− build plan or package set. A simple "build vs deploy" dichotomy is adequate:
463− the sliding window principle described in the previous section shows how to
464− interpolate between the these two "end points" to get the 3 platform triple
465− for each bootstrapping stage. That means for any package a given package
466− set, even those not bound on the top level but only reachable via
467− dependencies or <varname>buildPackages</varname>, the three platforms will
468− be defined as one of <varname>localSystem</varname> or
469− <varname>crossSystem</varname>, with the former replacing the latter as one
470− traverses build-time dependencies. A last simple difference is that
471− <varname>crossSystem</varname> should be null when one doesn't want to
472− cross-compile, while the <varname>*Platform</varname>s are always non-null.
473− <varname>localSystem</varname> is always non-null.
297+ One would think that <varname>localSystem</varname> and <varname>crossSystem</varname> overlap horribly with the three <varname>*Platforms</varname> (<varname>buildPlatform</varname>, <varname>hostPlatform,</varname> and <varname>targetPlatform</varname>; see <varname>stage.nix</varname> or the manual). Actually, those identifiers are purposefully not used here to draw a subtle but important distinction: While the granularity of having 3 platforms is necessary to properly *build* packages, it is overkill for specifying the user's *intent* when making a build plan or package set. A simple "build vs deploy" dichotomy is adequate: the sliding window principle described in the previous section shows how to interpolate between the these two "end points" to get the 3 platform triple for each bootstrapping stage. That means for any package a given package set, even those not bound on the top level but only reachable via dependencies or <varname>buildPackages</varname>, the three platforms will be defined as one of <varname>localSystem</varname> or <varname>crossSystem</varname>, with the former replacing the latter as one traverses build-time dependencies. A last simple difference is that <varname>crossSystem</varname> should be null when one doesn't want to cross-compile, while the <varname>*Platform</varname>s are always non-null. <varname>localSystem</varname> is always non-null.
474298 </para>
475299 </section>
476300<!--============================================================-->
@@ -481,61 +305,20 @@ nix-build &lt;nixpkgs&gt; --arg crossSystem '{ config = "&lt;arch&gt;-&lt;os&gt;
481305 <title>Implementation of dependencies</title>
482306
483307 <para>
484− The categorizes of dependencies developed in
485− <xref
486− linkend="ssec-cross-dependency-categorization"/> are specified as
487− lists of derivations given to <varname>mkDerivation</varname>, as
488− documented in <xref linkend="ssec-stdenv-dependencies"/>. In short, each
489− list of dependencies for "host → target" of "foo → bar" is called
490− <varname>depsFooBar</varname>, with exceptions for backwards compatibility
491− that <varname>depsBuildHost</varname> is instead called
492− <varname>nativeBuildInputs</varname> and <varname>depsHostTarget</varname>
493− is instead called <varname>buildInputs</varname>. Nixpkgs is now structured
494− so that each <varname>depsFooBar</varname> is automatically taken from
495− <varname>pkgsFooBar</varname>. (These <varname>pkgsFooBar</varname>s are
496− quite new, so there is no special case for
497− <varname>nativeBuildInputs</varname> and <varname>buildInputs</varname>.)
498− For example, <varname>pkgsBuildHost.gcc</varname> should be used at
499− build-time, while <varname>pkgsHostTarget.gcc</varname> should be used at
500− run-time.
308+ The categorizes of dependencies developed in <xref
309+ linkend="ssec-cross-dependency-categorization"/> are specified as lists of derivations given to <varname>mkDerivation</varname>, as documented in <xref linkend="ssec-stdenv-dependencies"/>. In short, each list of dependencies for "host → target" of "foo → bar" is called <varname>depsFooBar</varname>, with exceptions for backwards compatibility that <varname>depsBuildHost</varname> is instead called <varname>nativeBuildInputs</varname> and <varname>depsHostTarget</varname> is instead called <varname>buildInputs</varname>. Nixpkgs is now structured so that each <varname>depsFooBar</varname> is automatically taken from <varname>pkgsFooBar</varname>. (These <varname>pkgsFooBar</varname>s are quite new, so there is no special case for <varname>nativeBuildInputs</varname> and <varname>buildInputs</varname>.) For example, <varname>pkgsBuildHost.gcc</varname> should be used at build-time, while <varname>pkgsHostTarget.gcc</varname> should be used at run-time.
501310 </para>
502311
503312 <para>
504− Now, for most of Nixpkgs's history, there were no
505− <varname>pkgsFooBar</varname> attributes, and most packages have not been
506− refactored to use it explicitly. Prior to those, there were just
507− <varname>buildPackages</varname>, <varname>pkgs</varname>, and
508− <varname>targetPackages</varname>. Those are now redefined as aliases to
509− <varname>pkgsBuildHost</varname>, <varname>pkgsHostTarget</varname>, and
510− <varname>pkgsTargetTarget</varname>. It is acceptable, even recommended, to
511− use them for libraries to show that the host platform is irrelevant.
313+ Now, for most of Nixpkgs's history, there were no <varname>pkgsFooBar</varname> attributes, and most packages have not been refactored to use it explicitly. Prior to those, there were just <varname>buildPackages</varname>, <varname>pkgs</varname>, and <varname>targetPackages</varname>. Those are now redefined as aliases to <varname>pkgsBuildHost</varname>, <varname>pkgsHostTarget</varname>, and <varname>pkgsTargetTarget</varname>. It is acceptable, even recommended, to use them for libraries to show that the host platform is irrelevant.
512314 </para>
513315
514316 <para>
515− But before that, there was just <varname>pkgs</varname>, even though both
516− <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname>
517− existed. [Cross barely worked, and those were implemented with some hacks
518− on <varname>mkDerivation</varname> to override dependencies.] What this
519− means is the vast majority of packages do not use any explicit package set
520− to populate their dependencies, just using whatever
521− <varname>callPackage</varname> gives them even if they do correctly sort
522− their dependencies into the multiple lists described above. And indeed,
523− asking that users both sort their dependencies, <emphasis>and</emphasis>
524− take them from the right attribute set, is both too onerous and redundant,
525− so the recommended approach (for now) is to continue just categorizing by
526− list and not using an explicit package set.
317+ But before that, there was just <varname>pkgs</varname>, even though both <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname> existed. [Cross barely worked, and those were implemented with some hacks on <varname>mkDerivation</varname> to override dependencies.] What this means is the vast majority of packages do not use any explicit package set to populate their dependencies, just using whatever <varname>callPackage</varname> gives them even if they do correctly sort their dependencies into the multiple lists described above. And indeed, asking that users both sort their dependencies, <emphasis>and</emphasis> take them from the right attribute set, is both too onerous and redundant, so the recommended approach (for now) is to continue just categorizing by list and not using an explicit package set.
527318 </para>
528319
529320 <para>
530− To make this work, we "splice" together the six
531− <varname>pkgsFooBar</varname> package sets and have
532− <varname>callPackage</varname> actually take its arguments from that. This
533− is currently implemented in <filename>pkgs/top-level/splice.nix</filename>.
534− <varname>mkDerivation</varname> then, for each dependency attribute, pulls
535− the right derivation out from the splice. This splicing can be skipped when
536− not cross-compiling as the package sets are the same, but still is a bit
537− slow for cross-compiling. We'd like to do something better, but haven't
538− come up with anything yet.
321+ To make this work, we "splice" together the six <varname>pkgsFooBar</varname> package sets and have <varname>callPackage</varname> actually take its arguments from that. This is currently implemented in <filename>pkgs/top-level/splice.nix</filename>. <varname>mkDerivation</varname> then, for each dependency attribute, pulls the right derivation out from the splice. This splicing can be skipped when not cross-compiling as the package sets are the same, but still is a bit slow for cross-compiling. We'd like to do something better, but haven't come up with anything yet.
539322 </para>
540323 </section>
541324
@@ -543,21 +326,11 @@ nix-build &lt;nixpkgs&gt; --arg crossSystem '{ config = "&lt;arch&gt;-&lt;os&gt;
543326 <title>Bootstrapping</title>
544327
545328 <para>
546− Each of the package sets described above come from a single bootstrapping
547− stage. While <filename>pkgs/top-level/default.nix</filename>, coordinates
548− the composition of stages at a high level,
549− <filename>pkgs/top-level/stage.nix</filename> "ties the knot" (creates the
550− fixed point) of each stage. The package sets are defined per-stage however,
551− so they can be thought of as edges between stages (the nodes) in a graph.
552− Compositions like <literal>pkgsBuildTarget.targetPackages</literal> can be
553− thought of as paths to this graph.
329+ Each of the package sets described above come from a single bootstrapping stage. While <filename>pkgs/top-level/default.nix</filename>, coordinates the composition of stages at a high level, <filename>pkgs/top-level/stage.nix</filename> "ties the knot" (creates the fixed point) of each stage. The package sets are defined per-stage however, so they can be thought of as edges between stages (the nodes) in a graph. Compositions like <literal>pkgsBuildTarget.targetPackages</literal> can be thought of as paths to this graph.
554330 </para>
555331
556332 <para>
557− While there are many package sets, and thus many edges, the stages can also
558− be arranged in a linear chain. In other words, many of the edges are
559− redundant as far as connectivity is concerned. This hinges on the type of
560− bootstrapping we do. Currently for cross it is:
333+ While there are many package sets, and thus many edges, the stages can also be arranged in a linear chain. In other words, many of the edges are redundant as far as connectivity is concerned. This hinges on the type of bootstrapping we do. Currently for cross it is:
561334 <orderedlist>
562335 <listitem>
563336 <para>
@@ -575,102 +348,45 @@ nix-build &lt;nixpkgs&gt; --arg crossSystem '{ config = "&lt;arch&gt;-&lt;os&gt;
575348 </para>
576349 </listitem>
577350 </orderedlist>
578− In each stage, <varname>pkgsBuildHost</varname> refers the the previous
579− stage, <varname>pkgsBuildBuild</varname> refers to the one before that, and
580− <varname>pkgsHostTarget</varname> refers to the current one, and
581− <varname>pkgsTargetTarget</varname> refers to the next one. When there is
582− no previous or next stage, they instead refer to the current stage. Note
583− how all the invariants regarding the mapping between dependency and
584− depending packages' build host and target platforms are preserved.
585− <varname>pkgsBuildTarget</varname> and <varname>pkgsHostHost</varname> are
586− more complex in that the stage fitting the requirements isn't always a
587− fixed chain of "prevs" and "nexts" away (modulo the "saturating"
588− self-references at the ends). We just special case each instead. All the
589− primary edges are implemented is in
590− <filename>pkgs/stdenv/booter.nix</filename>, and secondarily aliases in
591− <filename>pkgs/top-level/stage.nix</filename>.
351+ In each stage, <varname>pkgsBuildHost</varname> refers the the previous stage, <varname>pkgsBuildBuild</varname> refers to the one before that, and <varname>pkgsHostTarget</varname> refers to the current one, and <varname>pkgsTargetTarget</varname> refers to the next one. When there is no previous or next stage, they instead refer to the current stage. Note how all the invariants regarding the mapping between dependency and depending packages' build host and target platforms are preserved. <varname>pkgsBuildTarget</varname> and <varname>pkgsHostHost</varname> are more complex in that the stage fitting the requirements isn't always a fixed chain of "prevs" and "nexts" away (modulo the "saturating" self-references at the ends). We just special case each instead. All the primary edges are implemented is in <filename>pkgs/stdenv/booter.nix</filename>, and secondarily aliases in <filename>pkgs/top-level/stage.nix</filename>.
592352 </para>
593353
594354 <note>
595355 <para>
596− Note the native stages are bootstrapped in legacy ways that predate the
597− current cross implementation. This is why the the bootstrapping stages
598− leading up to the final stages are ignored inthe previous paragraph.
356+ Note the native stages are bootstrapped in legacy ways that predate the current cross implementation. This is why the the bootstrapping stages leading up to the final stages are ignored inthe previous paragraph.
599357 </para>
600358 </note>
601359
602360 <para>
603− If one looks at the 3 platform triples, one can see that they overlap such
604− that one could put them together into a chain like:
361+ If one looks at the 3 platform triples, one can see that they overlap such that one could put them together into a chain like:
605362<programlisting>
606363(native, native, native, foreign, foreign)
607364</programlisting>
608− If one imagines the saturating self references at the end being replaced
609− with infinite stages, and then overlays those platform triples, one ends up
610− with the infinite tuple:
365+ If one imagines the saturating self references at the end being replaced with infinite stages, and then overlays those platform triples, one ends up with the infinite tuple:
611366<programlisting>
612367(native..., native, native, native, foreign, foreign, foreign...)
613368</programlisting>
614− On can then imagine any sequence of platforms such that there are bootstrap
615− stages with their 3 platforms determined by "sliding a window" that is the
616− 3 tuple through the sequence. This was the original model for
617− bootstrapping. Without a target platform (assume a better world where all
618− compilers are multi-target and all standard libraries are built in their
619− own derivation), this is sufficient. Conversely if one wishes to cross
620− compile "faster", with a "Canadian Cross" bootstraping stage where
621− <literal>build != host != target</literal>, more bootstrapping stages are
622− needed since no sliding window providess the pesky
623− <varname>pkgsBuildTarget</varname> package set since it skips the Canadian
624− cross stage's "host".
369+ On can then imagine any sequence of platforms such that there are bootstrap stages with their 3 platforms determined by "sliding a window" that is the 3 tuple through the sequence. This was the original model for bootstrapping. Without a target platform (assume a better world where all compilers are multi-target and all standard libraries are built in their own derivation), this is sufficient. Conversely if one wishes to cross compile "faster", with a "Canadian Cross" bootstraping stage where <literal>build != host != target</literal>, more bootstrapping stages are needed since no sliding window providess the pesky <varname>pkgsBuildTarget</varname> package set since it skips the Canadian cross stage's "host".
625370 </para>
626371
627372 <note>
628373 <para>
629− It is much better to refer to <varname>buildPackages</varname> than
630− <varname>targetPackages</varname>, or more broadly package sets that do
631− not mention "target". There are three reasons for this.
374+ It is much better to refer to <varname>buildPackages</varname> than <varname>targetPackages</varname>, or more broadly package sets that do not mention "target". There are three reasons for this.
632375 </para>
633376 <para>
634− First, it is because bootstrapping stages do not have a unique
635− <varname>targetPackages</varname>. For example a <literal>(x86-linux,
636− x86-linux, arm-linux)</literal> and <literal>(x86-linux, x86-linux,
637− x86-windows)</literal> package set both have a <literal>(x86-linux,
638− x86-linux, x86-linux)</literal> package set. Because there is no canonical
639− <varname>targetPackages</varname> for such a native (<literal>build ==
640− host == target</literal>) package set, we set their
641− <varname>targetPackages</varname>
377+ First, it is because bootstrapping stages do not have a unique <varname>targetPackages</varname>. For example a <literal>(x86-linux, x86-linux, arm-linux)</literal> and <literal>(x86-linux, x86-linux, x86-windows)</literal> package set both have a <literal>(x86-linux, x86-linux, x86-linux)</literal> package set. Because there is no canonical <varname>targetPackages</varname> for such a native (<literal>build == host == target</literal>) package set, we set their <varname>targetPackages</varname>
642378 </para>
643379 <para>
644− Second, it is because this is a frequent source of hard-to-follow
645− "infinite recursions" / cycles. When only package sets that don't mention
646− target are used, the package set forms a directed acyclic graph. This
647− means that all cycles that exist are confined to one stage. This means
648− they are a lot smaller, and easier to follow in the code or a backtrace.
649− It also means they are present in native and cross builds alike, and so
650− more likely to be caught by CI and other users.
380+ Second, it is because this is a frequent source of hard-to-follow "infinite recursions" / cycles. When only package sets that don't mention target are used, the package set forms a directed acyclic graph. This means that all cycles that exist are confined to one stage. This means they are a lot smaller, and easier to follow in the code or a backtrace. It also means they are present in native and cross builds alike, and so more likely to be caught by CI and other users.
651381 </para>
652382 <para>
653− Thirdly, it is because everything target-mentioning only exists to
654− accommodate compilers with lousy build systems that insist on the compiler
655− itself and standard library being built together. Of course that is bad
656− because bigger derivations means longer rebuilds. It is also problematic
657− because it tends to make the standard libraries less like other libraries
658− than they could be, complicating code and build systems alike. Because of
659− the other problems, and because of these innate disadvantages, compilers
660− ought to be packaged another way where possible.
383+ Thirdly, it is because everything target-mentioning only exists to accommodate compilers with lousy build systems that insist on the compiler itself and standard library being built together. Of course that is bad because bigger derivations means longer rebuilds. It is also problematic because it tends to make the standard libraries less like other libraries than they could be, complicating code and build systems alike. Because of the other problems, and because of these innate disadvantages, compilers ought to be packaged another way where possible.
661384 </para>
662385 </note>
663386
664387 <note>
665388 <para>
666− If one explores Nixpkgs, they will see derivations with names like
667− <literal>gccCross</literal>. Such <literal>*Cross</literal> derivations is
668− a holdover from before we properly distinguished between the host and
669− target platforms—the derivation with "Cross" in the name covered the
670− <literal>build = host != target</literal> case, while the other covered
671− the <literal>host = target</literal>, with build platform the same or not
672− based on whether one was using its <literal>.nativeDrv</literal> or
673− <literal>.crossDrv</literal>. This ugliness will disappear soon.
389+ If one explores Nixpkgs, they will see derivations with names like <literal>gccCross</literal>. Such <literal>*Cross</literal> derivations is a holdover from before we properly distinguished between the host and target platforms—the derivation with "Cross" in the name covered the <literal>build = host != target</literal> case, while the other covered the <literal>host = target</literal>, with build platform the same or not based on whether one was using its <literal>.nativeDrv</literal> or <literal>.crossDrv</literal>. This ugliness will disappear soon.
674390 </para>
675391 </note>
676392 </section>
doc/functions.xml+1−2
@@ -4,8 +4,7 @@
44 xml:id="chap-functions">
55 <title>Functions reference</title>
66 <para>
7− The nixpkgs repository has several utility functions to manipulate Nix
8− expressions.
7+ The nixpkgs repository has several utility functions to manipulate Nix expressions.
98 </para>
109 <xi:include href="functions/library.xml" />
1110 <xi:include href="functions/overrides.xml" />
doc/functions/appimagetools.xml+8−24
@@ -5,17 +5,12 @@
55 <title>pkgs.appimageTools</title>
66
77 <para>
8− <varname>pkgs.appimageTools</varname> is a set of functions for extracting
9− and wrapping <link xlink:href="https://appimage.org/">AppImage</link> files.
10− They are meant to be used if traditional packaging from source is infeasible,
11− or it would take too long. To quickly run an AppImage file,
12− <literal>pkgs.appimage-run</literal> can be used as well.
8+ <varname>pkgs.appimageTools</varname> is a set of functions for extracting and wrapping <link xlink:href="https://appimage.org/">AppImage</link> files. They are meant to be used if traditional packaging from source is infeasible, or it would take too long. To quickly run an AppImage file, <literal>pkgs.appimage-run</literal> can be used as well.
139 </para>
1410
1511 <warning>
1612 <para>
17− The <varname>appimageTools</varname> API is unstable and may be subject to
18− backwards-incompatible changes in the future.
13+ The <varname>appimageTools</varname> API is unstable and may be subject to backwards-incompatible changes in the future.
1914 </para>
2015 </warning>
2116
@@ -23,9 +18,7 @@
2318 <title>AppImage formats</title>
2419
2520 <para>
26− There are different formats for AppImages, see
27− <link xlink:href="https://github.com/AppImage/AppImageSpec/blob/74ad9ca2f94bf864a4a0dac1f369dd4f00bd1c28/draft.md#image-format">the
28− specification</link> for details.
21+ There are different formats for AppImages, see <link xlink:href="https://github.com/AppImage/AppImageSpec/blob/74ad9ca2f94bf864a4a0dac1f369dd4f00bd1c28/draft.md#image-format">the specification</link> for details.
2922 </para>
3023
3124 <itemizedlist>
@@ -55,8 +48,7 @@ type2.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (Lepton 3.x)
5548</screen>
5649
5750 <para>
58− Note how the type 1 AppImage is described as an <literal>ISO 9660 CD-ROM
59− filesystem</literal>, and the type 2 AppImage is not.
51+ Note how the type 1 AppImage is described as an <literal>ISO 9660 CD-ROM filesystem</literal>, and the type 2 AppImage is not.
6052 </para>
6153 </section>
6254
@@ -64,8 +56,7 @@ type2.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (Lepton 3.x)
6456 <title>Wrapping</title>
6557
6658 <para>
67− Depending on the type of AppImage you're wrapping, you'll have to use
68− <varname>wrapType1</varname> or <varname>wrapType2</varname>.
59+ Depending on the type of AppImage you're wrapping, you'll have to use <varname>wrapType1</varname> or <varname>wrapType2</varname>.
6960 </para>
7061
7162<programlisting>
@@ -91,23 +82,16 @@ appimageTools.wrapType2 { # or wrapType1
9182 </callout>
9283 <callout arearefs='ex-appimageTools-wrapping-2'>
9384 <para>
94− <varname>extraPkgs</varname> allows you to pass a function to include
95− additional packages inside the FHS environment your AppImage is going to
96− run in. There are a few ways to learn which dependencies an application
97− needs:
85+ <varname>extraPkgs</varname> allows you to pass a function to include additional packages inside the FHS environment your AppImage is going to run in. There are a few ways to learn which dependencies an application needs:
9886 <itemizedlist>
9987 <listitem>
10088 <para>
101− Looking through the extracted AppImage files, reading its scripts and
102− running <command>patchelf</command> and <command>ldd</command> on its
103− executables. This can also be done in <command>appimage-run</command>,
104− by setting <command>APPIMAGE_DEBUG_EXEC=bash</command>.
89+ Looking through the extracted AppImage files, reading its scripts and running <command>patchelf</command> and <command>ldd</command> on its executables. This can also be done in <command>appimage-run</command>, by setting <command>APPIMAGE_DEBUG_EXEC=bash</command>.
10590 </para>
10691 </listitem>
10792 <listitem>
10893 <para>
109− Running <command>strace -vfefile</command> on the wrapped executable,
110− looking for libraries that can't be found.
94+ Running <command>strace -vfefile</command> on the wrapped executable, looking for libraries that can't be found.
11195 </para>
11296 </listitem>
11397 </itemizedlist>
doc/functions/debug.xml+2−9
@@ -5,17 +5,10 @@
55 <title>Debugging Nix Expressions</title>
66
77 <para>
8− Nix is a unityped, dynamic language, this means every value can potentially
9− appear anywhere. Since it is also non-strict, evaluation order and what
10− ultimately is evaluated might surprise you. Therefore it is important to be
11− able to debug nix expressions.
8+ Nix is a unityped, dynamic language, this means every value can potentially appear anywhere. Since it is also non-strict, evaluation order and what ultimately is evaluated might surprise you. Therefore it is important to be able to debug nix expressions.
129 </para>
1310
1411 <para>
15− In the <literal>lib/debug.nix</literal> file you will find a number of
16− functions that help (pretty-)printing values while evaluation is runnnig. You
17− can even specify how deep these values should be printed recursively, and
18− transform them on the fly. Please consult the docstrings in
19− <literal>lib/debug.nix</literal> for usage information.
12+ In the <literal>lib/debug.nix</literal> file you will find a number of functions that help (pretty-)printing values while evaluation is runnnig. You can even specify how deep these values should be printed recursively, and transform them on the fly. Please consult the docstrings in <literal>lib/debug.nix</literal> for usage information.
2013 </para>
2114</section>
doc/functions/dockertools.xml+54−170
@@ -5,17 +5,12 @@
55 <title>pkgs.dockerTools</title>
66
77 <para>
8− <varname>pkgs.dockerTools</varname> is a set of functions for creating and
9− manipulating Docker images according to the
10− <link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#docker-image-specification-v120">
11− Docker Image Specification v1.2.0 </link>. Docker itself is not used to
12− perform any of the operations done by these functions.
8+ <varname>pkgs.dockerTools</varname> is a set of functions for creating and manipulating Docker images according to the <link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#docker-image-specification-v120"> Docker Image Specification v1.2.0 </link>. Docker itself is not used to perform any of the operations done by these functions.
139 </para>
1410
1511 <warning>
1612 <para>
17− The <varname>dockerTools</varname> API is unstable and may be subject to
18− backwards-incompatible changes in the future.
13+ The <varname>dockerTools</varname> API is unstable and may be subject to backwards-incompatible changes in the future.
1914 </para>
2015 </warning>
2116
@@ -23,15 +18,11 @@
2318 <title>buildImage</title>
2419
2520 <para>
26− This function is analogous to the <command>docker build</command> command,
27− in that it can be used to build a Docker-compatible repository tarball
28− containing a single image with one or multiple layers. As such, the result
29− is suitable for being loaded in Docker with <command>docker load</command>.
21+ This function is analogous to the <command>docker build</command> command, in that it can be used to build a Docker-compatible repository tarball containing a single image with one or multiple layers. As such, the result is suitable for being loaded in Docker with <command>docker load</command>.
3022 </para>
3123
3224 <para>
33− The parameters of <varname>buildImage</varname> with relative example values
34− are described below:
25+ The parameters of <varname>buildImage</varname> with relative example values are described below:
3526 </para>
3627
3728 <example xml:id='ex-dockerTools-buildImage'>
@@ -63,135 +54,89 @@ buildImage {
6354 </example>
6455
6556 <para>
66− The above example will build a Docker image <literal>redis/latest</literal>
67− from the given base image. Loading and running this image in Docker results
68− in <literal>redis-server</literal> being started automatically.
57+ The above example will build a Docker image <literal>redis/latest</literal> from the given base image. Loading and running this image in Docker results in <literal>redis-server</literal> being started automatically.
6958 </para>
7059
7160 <calloutlist>
7261 <callout arearefs='ex-dockerTools-buildImage-1'>
7362 <para>
74− <varname>name</varname> specifies the name of the resulting image. This is
75− the only required argument for <varname>buildImage</varname>.
63+ <varname>name</varname> specifies the name of the resulting image. This is the only required argument for <varname>buildImage</varname>.
7664 </para>
7765 </callout>
7866 <callout arearefs='ex-dockerTools-buildImage-2'>
7967 <para>
80− <varname>tag</varname> specifies the tag of the resulting image. By
81− default it's <literal>null</literal>, which indicates that the nix output
82− hash will be used as tag.
68+ <varname>tag</varname> specifies the tag of the resulting image. By default it's <literal>null</literal>, which indicates that the nix output hash will be used as tag.
8369 </para>
8470 </callout>
8571 <callout arearefs='ex-dockerTools-buildImage-3'>
8672 <para>
87− <varname>fromImage</varname> is the repository tarball containing the base
88− image. It must be a valid Docker image, such as exported by
89− <command>docker save</command>. By default it's <literal>null</literal>,
90− which can be seen as equivalent to <literal>FROM scratch</literal> of a
91− <filename>Dockerfile</filename>.
73+ <varname>fromImage</varname> is the repository tarball containing the base image. It must be a valid Docker image, such as exported by <command>docker save</command>. By default it's <literal>null</literal>, which can be seen as equivalent to <literal>FROM scratch</literal> of a <filename>Dockerfile</filename>.
9274 </para>
9375 </callout>
9476 <callout arearefs='ex-dockerTools-buildImage-4'>
9577 <para>
96− <varname>fromImageName</varname> can be used to further specify the base
97− image within the repository, in case it contains multiple images. By
98− default it's <literal>null</literal>, in which case
99− <varname>buildImage</varname> will peek the first image available in the
100− repository.
78+ <varname>fromImageName</varname> can be used to further specify the base image within the repository, in case it contains multiple images. By default it's <literal>null</literal>, in which case <varname>buildImage</varname> will peek the first image available in the repository.
10179 </para>
10280 </callout>
10381 <callout arearefs='ex-dockerTools-buildImage-5'>
10482 <para>
105− <varname>fromImageTag</varname> can be used to further specify the tag of
106− the base image within the repository, in case an image contains multiple
107− tags. By default it's <literal>null</literal>, in which case
108− <varname>buildImage</varname> will peek the first tag available for the
109− base image.
83+ <varname>fromImageTag</varname> can be used to further specify the tag of the base image within the repository, in case an image contains multiple tags. By default it's <literal>null</literal>, in which case <varname>buildImage</varname> will peek the first tag available for the base image.
11084 </para>
11185 </callout>
11286 <callout arearefs='ex-dockerTools-buildImage-6'>
11387 <para>
114− <varname>contents</varname> is a derivation that will be copied in the new
115− layer of the resulting image. This can be similarly seen as <command>ADD
116− contents/ /</command> in a <filename>Dockerfile</filename>. By default
117− it's <literal>null</literal>.
88+ <varname>contents</varname> is a derivation that will be copied in the new layer of the resulting image. This can be similarly seen as <command>ADD contents/ /</command> in a <filename>Dockerfile</filename>. By default it's <literal>null</literal>.
11889 </para>
11990 </callout>
12091 <callout arearefs='ex-dockerTools-buildImage-runAsRoot'>
12192 <para>
122− <varname>runAsRoot</varname> is a bash script that will run as root in an
123− environment that overlays the existing layers of the base image with the
124− new resulting layer, including the previously copied
125− <varname>contents</varname> derivation. This can be similarly seen as
126− <command>RUN ...</command> in a <filename>Dockerfile</filename>.
93+ <varname>runAsRoot</varname> is a bash script that will run as root in an environment that overlays the existing layers of the base image with the new resulting layer, including the previously copied <varname>contents</varname> derivation. This can be similarly seen as <command>RUN ...</command> in a <filename>Dockerfile</filename>.
12794 <note>
12895 <para>
129− Using this parameter requires the <literal>kvm</literal> device to be
130− available.
96+ Using this parameter requires the <literal>kvm</literal> device to be available.
13197 </para>
13298 </note>
13399 </para>
134100 </callout>
135101 <callout arearefs='ex-dockerTools-buildImage-8'>
136102 <para>
137− <varname>config</varname> is used to specify the configuration of the
138− containers that will be started off the built image in Docker. The
139− available options are listed in the
140− <link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions">
141− Docker Image Specification v1.2.0 </link>.
103+ <varname>config</varname> is used to specify the configuration of the containers that will be started off the built image in Docker. The available options are listed in the <link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions"> Docker Image Specification v1.2.0 </link>.
142104 </para>
143105 </callout>
144106 </calloutlist>
145107
146108 <para>
147− After the new layer has been created, its closure (to which
148− <varname>contents</varname>, <varname>config</varname> and
149− <varname>runAsRoot</varname> contribute) will be copied in the layer itself.
150− Only new dependencies that are not already in the existing layers will be
151− copied.
109+ After the new layer has been created, its closure (to which <varname>contents</varname>, <varname>config</varname> and <varname>runAsRoot</varname> contribute) will be copied in the layer itself. Only new dependencies that are not already in the existing layers will be copied.
152110 </para>
153111
154112 <para>
155− At the end of the process, only one new single layer will be produced and
156− added to the resulting image.
113+ At the end of the process, only one new single layer will be produced and added to the resulting image.
157114 </para>
158115
159116 <para>
160− The resulting repository will only list the single image
161− <varname>image/tag</varname>. In the case of
162− <xref linkend='ex-dockerTools-buildImage'/> it would be
163− <varname>redis/latest</varname>.
117+ The resulting repository will only list the single image <varname>image/tag</varname>. In the case of <xref linkend='ex-dockerTools-buildImage'/> it would be <varname>redis/latest</varname>.
164118 </para>
165119
166120 <para>
167− It is possible to inspect the arguments with which an image was built using
168− its <varname>buildArgs</varname> attribute.
121+ It is possible to inspect the arguments with which an image was built using its <varname>buildArgs</varname> attribute.
169122 </para>
170123
171124 <note>
172125 <para>
173− If you see errors similar to <literal>getProtocolByName: does not exist (no
174− such protocol name: tcp)</literal> you may need to add
175− <literal>pkgs.iana-etc</literal> to <varname>contents</varname>.
126+ If you see errors similar to <literal>getProtocolByName: does not exist (no such protocol name: tcp)</literal> you may need to add <literal>pkgs.iana-etc</literal> to <varname>contents</varname>.
176127 </para>
177128 </note>
178129
179130 <note>
180131 <para>
181− If you see errors similar to <literal>Error_Protocol ("certificate has
182− unknown CA",True,UnknownCa)</literal> you may need to add
183− <literal>pkgs.cacert</literal> to <varname>contents</varname>.
132+ If you see errors similar to <literal>Error_Protocol ("certificate has unknown CA",True,UnknownCa)</literal> you may need to add <literal>pkgs.cacert</literal> to <varname>contents</varname>.
184133 </para>
185134 </note>
186135
187136 <example xml:id="example-pkgs-dockerTools-buildImage-creation-date">
188137 <title>Impurely Defining a Docker Layer's Creation Date</title>
189138 <para>
190− By default <function>buildImage</function> will use a static date of one
191− second past the UNIX Epoch. This allows <function>buildImage</function> to
192− produce binary reproducible images. When listing images with
193− <command>docker images</command>, the newly created images will be listed
194− like this:
139+ By default <function>buildImage</function> will use a static date of one second past the UNIX Epoch. This allows <function>buildImage</function> to produce binary reproducible images. When listing images with <command>docker images</command>, the newly created images will be listed like this:
195140 </para>
196141<screen><![CDATA[
197142$ docker images
@@ -199,9 +144,7 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
199144hello latest 08c791c7846e 48 years ago 25.2MB
200145]]></screen>
201146 <para>
202− You can break binary reproducibility but have a sorted, meaningful
203− <literal>CREATED</literal> column by setting <literal>created</literal> to
204− <literal>now</literal>.
147+ You can break binary reproducibility but have a sorted, meaningful <literal>CREATED</literal> column by setting <literal>created</literal> to <literal>now</literal>.
205148 </para>
206149<programlisting><![CDATA[
207150pkgs.dockerTools.buildImage {
@@ -214,8 +157,7 @@ pkgs.dockerTools.buildImage {
214157}
215158]]></programlisting>
216159 <para>
217− and now the Docker CLI will display a reasonable date and sort the images
218− as expected:
160+ and now the Docker CLI will display a reasonable date and sort the images as expected:
219161<screen><![CDATA[
220162$ docker images
221163REPOSITORY TAG IMAGE ID CREATED SIZE
@@ -230,8 +172,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB
230172 <title>buildLayeredImage</title>
231173
232174 <para>
233− Create a Docker image with many of the store paths being on their own layer
234− to improve sharing between images.
175+ Create a Docker image with many of the store paths being on their own layer to improve sharing between images.
235176 </para>
236177
237178 <variablelist>
@@ -264,8 +205,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB
264205 </term>
265206 <listitem>
266207 <para>
267− Top level paths in the container. Either a single derivation, or a list
268− of derivations.
208+ Top level paths in the container. Either a single derivation, or a list of derivations.
269209 </para>
270210 <para>
271211 <emphasis>Default:</emphasis> <literal>[]</literal>
@@ -278,10 +218,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB
278218 </term>
279219 <listitem>
280220 <para>
281− Run-time configuration of the container. A full list of the options are
282− available at in the
283− <link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions">
284− Docker Image Specification v1.2.0 </link>.
221+ Run-time configuration of the container. A full list of the options are available at in the <link xlink:href="https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions"> Docker Image Specification v1.2.0 </link>.
285222 </para>
286223 <para>
287224 <emphasis>Default:</emphasis> <literal>{}</literal>
@@ -294,9 +231,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB
294231 </term>
295232 <listitem>
296233 <para>
297− Date and time the layers were created. Follows the same
298− <literal>now</literal> exception supported by
299− <literal>buildImage</literal>.
234+ Date and time the layers were created. Follows the same <literal>now</literal> exception supported by <literal>buildImage</literal>.
300235 </para>
301236 <para>
302237 <emphasis>Default:</emphasis> <literal>1970-01-01T00:00:01Z</literal>
@@ -325,9 +260,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB
325260 </term>
326261 <listitem>
327262 <para>
328− Shell commands to run while building the final layer, without access to
329− most of the layer contents. Changes to this layer are "on top" of all the
330− other layers, so can create additional directories and files.
263+ Shell commands to run while building the final layer, without access to most of the layer contents. Changes to this layer are "on top" of all the other layers, so can create additional directories and files.
331264 </para>
332265 </listitem>
333266 </varlistentry>
@@ -337,8 +270,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB
337270 <title>Behavior of <varname>contents</varname> in the final image</title>
338271
339272 <para>
340− Each path directly listed in <varname>contents</varname> will have a
341− symlink in the root of the image.
273+ Each path directly listed in <varname>contents</varname> will have a symlink in the root of the image.
342274 </para>
343275
344276 <para>
@@ -349,8 +281,7 @@ pkgs.dockerTools.buildLayeredImage {
349281 contents = [ pkgs.hello ];
350282}
351283]]></programlisting>
352− will create symlinks for all the paths in the <literal>hello</literal>
353− package:
284+ will create symlinks for all the paths in the <literal>hello</literal> package:
354285<screen><![CDATA[
355286/bin/hello -> /nix/store/h1zb1padqbbb7jicsvkmrym3r6snphxg-hello-2.10/bin/hello
356287/share/info/hello.info -> /nix/store/h1zb1padqbbb7jicsvkmrym3r6snphxg-hello-2.10/share/info/hello.info
@@ -363,13 +294,11 @@ pkgs.dockerTools.buildLayeredImage {
363294 <title>Automatic inclusion of <varname>config</varname> references</title>
364295
365296 <para>
366− The closure of <varname>config</varname> is automatically included in the
367− closure of the final image.
297+ The closure of <varname>config</varname> is automatically included in the closure of the final image.
368298 </para>
369299
370300 <para>
371− This allows you to make very simple Docker images with very little code.
372− This container will start up and run <command>hello</command>:
301+ This allows you to make very simple Docker images with very little code. This container will start up and run <command>hello</command>:
373302<programlisting><![CDATA[
374303pkgs.dockerTools.buildLayeredImage {
375304 name = "hello";
@@ -383,31 +312,23 @@ pkgs.dockerTools.buildLayeredImage {
383312 <title>Adjusting <varname>maxLayers</varname></title>
384313
385314 <para>
386− Increasing the <varname>maxLayers</varname> increases the number of layers
387− which have a chance to be shared between different images.
315+ Increasing the <varname>maxLayers</varname> increases the number of layers which have a chance to be shared between different images.
388316 </para>
389317
390318 <para>
391− Modern Docker installations support up to 128 layers, however older
392− versions support as few as 42.
319+ Modern Docker installations support up to 128 layers, however older versions support as few as 42.
393320 </para>
394321
395322 <para>
396− If the produced image will not be extended by other Docker builds, it is
397− safe to set <varname>maxLayers</varname> to <literal>128</literal>. However
398− it will be impossible to extend the image further.
323+ If the produced image will not be extended by other Docker builds, it is safe to set <varname>maxLayers</varname> to <literal>128</literal>. However it will be impossible to extend the image further.
399324 </para>
400325
401326 <para>
402− The first (<literal>maxLayers-2</literal>) most "popular" paths will have
403− their own individual layers, then layer #<literal>maxLayers-1</literal>
404− will contain all the remaining "unpopular" paths, and finally layer
405− #<literal>maxLayers</literal> will contain the Image configuration.
327+ The first (<literal>maxLayers-2</literal>) most "popular" paths will have their own individual layers, then layer #<literal>maxLayers-1</literal> will contain all the remaining "unpopular" paths, and finally layer #<literal>maxLayers</literal> will contain the Image configuration.
406328 </para>
407329
408330 <para>
409− Docker's Layers are not inherently ordered, they are content-addressable
410− and are not explicitly layered until they are composed in to an Image.
331+ Docker's Layers are not inherently ordered, they are content-addressable and are not explicitly layered until they are composed in to an Image.
411332 </para>
412333 </section>
413334 </section>
@@ -416,10 +337,7 @@ pkgs.dockerTools.buildLayeredImage {
416337 <title>pullImage</title>
417338
418339 <para>
419− This function is analogous to the <command>docker pull</command> command, in
420− that it can be used to pull a Docker image from a Docker registry. By
421− default <link xlink:href="https://hub.docker.com/">Docker Hub</link> is used
422− to pull images.
340+ This function is analogous to the <command>docker pull</command> command, in that it can be used to pull a Docker image from a Docker registry. By default <link xlink:href="https://hub.docker.com/">Docker Hub</link> is used to pull images.
423341 </para>
424342
425343 <para>
@@ -444,71 +362,51 @@ pullImage {
444362 <calloutlist>
445363 <callout arearefs='ex-dockerTools-pullImage-1'>
446364 <para>
447− <varname>imageName</varname> specifies the name of the image to be
448− downloaded, which can also include the registry namespace (e.g.
449− <literal>nixos</literal>). This argument is required.
365+ <varname>imageName</varname> specifies the name of the image to be downloaded, which can also include the registry namespace (e.g. <literal>nixos</literal>). This argument is required.
450366 </para>
451367 </callout>
452368 <callout arearefs='ex-dockerTools-pullImage-2'>
453369 <para>
454− <varname>imageDigest</varname> specifies the digest of the image to be
455− downloaded. This argument is required.
370+ <varname>imageDigest</varname> specifies the digest of the image to be downloaded. This argument is required.
456371 </para>
457372 </callout>
458373 <callout arearefs='ex-dockerTools-pullImage-3'>
459374 <para>
460− <varname>finalImageName</varname>, if specified, this is the name of the
461− image to be created. Note it is never used to fetch the image since we
462− prefer to rely on the immutable digest ID. By default it's equal to
463− <varname>imageName</varname>.
375+ <varname>finalImageName</varname>, if specified, this is the name of the image to be created. Note it is never used to fetch the image since we prefer to rely on the immutable digest ID. By default it's equal to <varname>imageName</varname>.
464376 </para>
465377 </callout>
466378 <callout arearefs='ex-dockerTools-pullImage-4'>
467379 <para>
468− <varname>finalImageTag</varname>, if specified, this is the tag of the
469− image to be created. Note it is never used to fetch the image since we
470− prefer to rely on the immutable digest ID. By default it's
471− <literal>latest</literal>.
380+ <varname>finalImageTag</varname>, if specified, this is the tag of the image to be created. Note it is never used to fetch the image since we prefer to rely on the immutable digest ID. By default it's <literal>latest</literal>.
472381 </para>
473382 </callout>
474383 <callout arearefs='ex-dockerTools-pullImage-5'>
475384 <para>
476− <varname>sha256</varname> is the checksum of the whole fetched image. This
477− argument is required.
385+ <varname>sha256</varname> is the checksum of the whole fetched image. This argument is required.
478386 </para>
479387 </callout>
480388 <callout arearefs='ex-dockerTools-pullImage-6'>
481389 <para>
482− <varname>os</varname>, if specified, is the operating system of the
483− fetched image. By default it's <literal>linux</literal>.
390+ <varname>os</varname>, if specified, is the operating system of the fetched image. By default it's <literal>linux</literal>.
484391 </para>
485392 </callout>
486393 <callout arearefs='ex-dockerTools-pullImage-7'>
487394 <para>
488− <varname>arch</varname>, if specified, is the cpu architecture of the
489− fetched image. By default it's <literal>x86_64</literal>.
395+ <varname>arch</varname>, if specified, is the cpu architecture of the fetched image. By default it's <literal>x86_64</literal>.
490396 </para>
491397 </callout>
492398 </calloutlist>
493399
494400 <para>
495− <literal>nix-prefetch-docker</literal> command can be used to get required
496− image parameters:
401+ <literal>nix-prefetch-docker</literal> command can be used to get required image parameters:
497402<screen>
498403<prompt>$ </prompt>nix run nixpkgs.nix-prefetch-docker -c nix-prefetch-docker --image-name mysql --image-tag 5
499404</screen>
500− Since a given <varname>imageName</varname> may transparently refer to a
501− manifest list of images which support multiple architectures and/or
502− operating systems, you can supply the <option>--os</option> and
503− <option>--arch</option> arguments to specify exactly which image you want.
504− By default it will match the OS and architecture of the host the command is
505− run on.
405+ Since a given <varname>imageName</varname> may transparently refer to a manifest list of images which support multiple architectures and/or operating systems, you can supply the <option>--os</option> and <option>--arch</option> arguments to specify exactly which image you want. By default it will match the OS and architecture of the host the command is run on.
506406<screen>
507407<prompt>$ </prompt>nix-prefetch-docker --image-name mysql --image-tag 5 --arch x86_64 --os linux
508408</screen>
509− Desired image name and tag can be set using
510− <option>--final-image-name</option> and <option>--final-image-tag</option>
511− arguments:
409+ Desired image name and tag can be set using <option>--final-image-name</option> and <option>--final-image-tag</option> arguments:
512410<screen>
513411<prompt>$ </prompt>nix-prefetch-docker --image-name mysql --image-tag 5 --final-image-name eu.gcr.io/my-project/mysql --final-image-tag prod
514412</screen>
@@ -519,17 +417,12 @@ pullImage {
519417 <title>exportImage</title>
520418
521419 <para>
522− This function is analogous to the <command>docker export</command> command,
523− in that it can be used to flatten a Docker image that contains multiple
524− layers. It is in fact the result of the merge of all the layers of the
525− image. As such, the result is suitable for being imported in Docker with
526− <command>docker import</command>.
420+ This function is analogous to the <command>docker export</command> command, in that it can be used to flatten a Docker image that contains multiple layers. It is in fact the result of the merge of all the layers of the image. As such, the result is suitable for being imported in Docker with <command>docker import</command>.
527421 </para>
528422
529423 <note>
530424 <para>
531− Using this function requires the <literal>kvm</literal> device to be
532− available.
425+ Using this function requires the <literal>kvm</literal> device to be available.
533426 </para>
534427 </note>
535428
@@ -551,14 +444,11 @@ exportImage {
551444 </example>
552445
553446 <para>
554− The parameters relative to the base image have the same synopsis as
555− described in <xref linkend='ssec-pkgs-dockerTools-buildImage'/>, except that
556− <varname>fromImage</varname> is the only required argument in this case.
447+ The parameters relative to the base image have the same synopsis as described in <xref linkend='ssec-pkgs-dockerTools-buildImage'/>, except that <varname>fromImage</varname> is the only required argument in this case.
557448 </para>
558449
559450 <para>
560− The <varname>name</varname> argument is the name of the derivation output,
561− which defaults to <varname>fromImage.name</varname>.
451+ The <varname>name</varname> argument is the name of the derivation output, which defaults to <varname>fromImage.name</varname>.
562452 </para>
563453 </section>
564454
@@ -566,11 +456,7 @@ exportImage {
566456 <title>shadowSetup</title>
567457
568458 <para>
569− This constant string is a helper for setting up the base files for managing
570− users and groups, only if such files don't exist already. It is suitable for
571− being used in a <varname>runAsRoot</varname>
572− <xref linkend='ex-dockerTools-buildImage-runAsRoot'/> script for cases like
573− in the example below:
459+ This constant string is a helper for setting up the base files for managing users and groups, only if such files don't exist already. It is suitable for being used in a <varname>runAsRoot</varname> <xref linkend='ex-dockerTools-buildImage-runAsRoot'/> script for cases like in the example below:
574460 </para>
575461
576462 <example xml:id='ex-dockerTools-shadowSetup'>
@@ -592,9 +478,7 @@ buildImage {
592478 </example>
593479
594480 <para>
595− Creating base files like <literal>/etc/passwd</literal> or
596− <literal>/etc/login.defs</literal> is necessary for shadow-utils to
597− manipulate users and groups.
481+ Creating base files like <literal>/etc/passwd</literal> or <literal>/etc/login.defs</literal> is necessary for shadow-utils to manipulate users and groups.
598482 </para>
599483 </section>
600484</section>
doc/functions/fetchers.xml+16−62
@@ -5,18 +5,11 @@
55 <title>Fetcher functions</title>
66
77 <para>
8− When using Nix, you will frequently need to download source code and other
9− files from the internet. Nixpkgs comes with a few helper functions that allow
10− you to fetch fixed-output derivations in a structured way.
8+ When using Nix, you will frequently need to download source code and other files from the internet. Nixpkgs comes with a few helper functions that allow you to fetch fixed-output derivations in a structured way.
119 </para>
1210
1311 <para>
14− The two fetcher primitives are <function>fetchurl</function> and
15− <function>fetchzip</function>. Both of these have two required arguments, a
16− URL and a hash. The hash is typically <literal>sha256</literal>, although
17− many more hash algorithms are supported. Nixpkgs contributors are currently
18− recommended to use <literal>sha256</literal>. This hash will be used by Nix
19− to identify your source. A typical usage of fetchurl is provided below.
12+ The two fetcher primitives are <function>fetchurl</function> and <function>fetchzip</function>. Both of these have two required arguments, a URL and a hash. The hash is typically <literal>sha256</literal>, although many more hash algorithms are supported. Nixpkgs contributors are currently recommended to use <literal>sha256</literal>. This hash will be used by Nix to identify your source. A typical usage of fetchurl is provided below.
2013 </para>
2114
2215<programlisting><![CDATA[
@@ -32,30 +25,15 @@ stdenv.mkDerivation {
3225]]></programlisting>
3326
3427 <para>
35− The main difference between <function>fetchurl</function> and
36− <function>fetchzip</function> is in how they store the contents.
37− <function>fetchurl</function> will store the unaltered contents of the URL
38− within the Nix store. <function>fetchzip</function> on the other hand will
39− decompress the archive for you, making files and directories directly
40− accessible in the future. <function>fetchzip</function> can only be used with
41− archives. Despite the name, <function>fetchzip</function> is not limited to
42− .zip files and can also be used with any tarball.
28+ The main difference between <function>fetchurl</function> and <function>fetchzip</function> is in how they store the contents. <function>fetchurl</function> will store the unaltered contents of the URL within the Nix store. <function>fetchzip</function> on the other hand will decompress the archive for you, making files and directories directly accessible in the future. <function>fetchzip</function> can only be used with archives. Despite the name, <function>fetchzip</function> is not limited to .zip files and can also be used with any tarball.
4329 </para>
4430
4531 <para>
46− <function>fetchpatch</function> works very similarly to
47− <function>fetchurl</function> with the same arguments expected. It expects
48− patch files as a source and and performs normalization on them before
49− computing the checksum. For example it will remove comments or other unstable
50− parts that are sometimes added by version control systems and can change over
51− time.
32+ <function>fetchpatch</function> works very similarly to <function>fetchurl</function> with the same arguments expected. It expects patch files as a source and and performs normalization on them before computing the checksum. For example it will remove comments or other unstable parts that are sometimes added by version control systems and can change over time.
5233 </para>
5334
5435 <para>
55− Other fetcher functions allow you to add source code directly from a VCS such
56− as subversion or git. These are mostly straightforward names based on the
57− name of the command used with the VCS system. Because they give you a working
58− repository, they act most like <function>fetchzip</function>.
36+ Other fetcher functions allow you to add source code directly from a VCS such as subversion or git. These are mostly straightforward names based on the name of the command used with the VCS system. Because they give you a working repository, they act most like <function>fetchzip</function>.
5937 </para>
6038
6139 <variablelist>
@@ -65,8 +43,7 @@ stdenv.mkDerivation {
6543 </term>
6644 <listitem>
6745 <para>
68− Used with Subversion. Expects <literal>url</literal> to a Subversion
69− directory, <literal>rev</literal>, and <literal>sha256</literal>.
46+ Used with Subversion. Expects <literal>url</literal> to a Subversion directory, <literal>rev</literal>, and <literal>sha256</literal>.
7047 </para>
7148 </listitem>
7249 </varlistentry>
@@ -76,10 +53,7 @@ stdenv.mkDerivation {
7653 </term>
7754 <listitem>
7855 <para>
79− Used with Git. Expects <literal>url</literal> to a Git repo,
80− <literal>rev</literal>, and <literal>sha256</literal>.
81− <literal>rev</literal> in this case can be full the git commit id (SHA1
82− hash) or a tag name like <literal>refs/tags/v1.0</literal>.
56+ Used with Git. Expects <literal>url</literal> to a Git repo, <literal>rev</literal>, and <literal>sha256</literal>. <literal>rev</literal> in this case can be full the git commit id (SHA1 hash) or a tag name like <literal>refs/tags/v1.0</literal>.
8357 </para>
8458 </listitem>
8559 </varlistentry>
@@ -89,8 +63,7 @@ stdenv.mkDerivation {
8963 </term>
9064 <listitem>
9165 <para>
92− Used with Fossil. Expects <literal>url</literal> to a Fossil archive,
93− <literal>rev</literal>, and <literal>sha256</literal>.
66+ Used with Fossil. Expects <literal>url</literal> to a Fossil archive, <literal>rev</literal>, and <literal>sha256</literal>.
9467 </para>
9568 </listitem>
9669 </varlistentry>
@@ -100,8 +73,7 @@ stdenv.mkDerivation {
10073 </term>
10174 <listitem>
10275 <para>
103− Used with CVS. Expects <literal>cvsRoot</literal>, <literal>tag</literal>,
104− and <literal>sha256</literal>.
76+ Used with CVS. Expects <literal>cvsRoot</literal>, <literal>tag</literal>, and <literal>sha256</literal>.
10577 </para>
10678 </listitem>
10779 </varlistentry>
@@ -111,18 +83,14 @@ stdenv.mkDerivation {
11183 </term>
11284 <listitem>
11385 <para>
114− Used with Mercurial. Expects <literal>url</literal>,
115− <literal>rev</literal>, and <literal>sha256</literal>.
86+ Used with Mercurial. Expects <literal>url</literal>, <literal>rev</literal>, and <literal>sha256</literal>.
11687 </para>
11788 </listitem>
11889 </varlistentry>
11990 </variablelist>
12091
12192 <para>
122− A number of fetcher functions wrap part of <function>fetchurl</function> and
123− <function>fetchzip</function>. They are mainly convenience functions intended
124− for commonly used destinations of source code in Nixpkgs. These wrapper
125− fetchers are listed below.
93+ A number of fetcher functions wrap part of <function>fetchurl</function> and <function>fetchzip</function>. They are mainly convenience functions intended for commonly used destinations of source code in Nixpkgs. These wrapper fetchers are listed below.
12694 </para>
12795
12896 <variablelist>
@@ -132,17 +100,7 @@ stdenv.mkDerivation {
132100 </term>
133101 <listitem>
134102 <para>
135− <function>fetchFromGitHub</function> expects four arguments.
136− <literal>owner</literal> is a string corresponding to the GitHub user or
137− organization that controls this repository. <literal>repo</literal>
138− corresponds to the name of the software repository. These are located at
139− the top of every GitHub HTML page as
140− <literal>owner</literal>/<literal>repo</literal>. <literal>rev</literal>
141− corresponds to the Git commit hash or tag (e.g <literal>v1.0</literal>)
142− that will be downloaded from Git. Finally, <literal>sha256</literal>
143− corresponds to the hash of the extracted directory. Again, other hash
144− algorithms are also available but <literal>sha256</literal> is currently
145− preferred.
103+ <function>fetchFromGitHub</function> expects four arguments. <literal>owner</literal> is a string corresponding to the GitHub user or organization that controls this repository. <literal>repo</literal> corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as <literal>owner</literal>/<literal>repo</literal>. <literal>rev</literal> corresponds to the Git commit hash or tag (e.g <literal>v1.0</literal>) that will be downloaded from Git. Finally, <literal>sha256</literal> corresponds to the hash of the extracted directory. Again, other hash algorithms are also available but <literal>sha256</literal> is currently preferred.
146104 </para>
147105 </listitem>
148106 </varlistentry>
@@ -152,8 +110,7 @@ stdenv.mkDerivation {
152110 </term>
153111 <listitem>
154112 <para>
155− This is used with GitLab repositories. The arguments expected are very
156− similar to fetchFromGitHub above.
113+ This is used with GitLab repositories. The arguments expected are very similar to fetchFromGitHub above.
157114 </para>
158115 </listitem>
159116 </varlistentry>
@@ -163,8 +120,7 @@ stdenv.mkDerivation {
163120 </term>
164121 <listitem>
165122 <para>
166− This is used with BitBucket repositories. The arguments expected are very
167− similar to fetchFromGitHub above.
123+ This is used with BitBucket repositories. The arguments expected are very similar to fetchFromGitHub above.
168124 </para>
169125 </listitem>
170126 </varlistentry>
@@ -174,8 +130,7 @@ stdenv.mkDerivation {
174130 </term>
175131 <listitem>
176132 <para>
177− This is used with Savannah repositories. The arguments expected are very
178− similar to fetchFromGitHub above.
133+ This is used with Savannah repositories. The arguments expected are very similar to fetchFromGitHub above.
179134 </para>
180135 </listitem>
181136 </varlistentry>
@@ -185,8 +140,7 @@ stdenv.mkDerivation {
185140 </term>
186141 <listitem>
187142 <para>
188− This is used with repo.or.cz repositories. The arguments expected are very
189− similar to fetchFromGitHub above.
143+ This is used with repo.or.cz repositories. The arguments expected are very similar to fetchFromGitHub above.
190144 </para>
191145 </listitem>
192146 </varlistentry>
doc/functions/fhs-environments.xml+9−29
@@ -5,15 +5,7 @@
55 <title>buildFHSUserEnv</title>
66
77 <para>
8− <function>buildFHSUserEnv</function> provides a way to build and run
9− FHS-compatible lightweight sandboxes. It creates an isolated root with bound
10− <filename>/nix/store</filename>, so its footprint in terms of disk space
11− needed is quite small. This allows one to run software which is hard or
12− unfeasible to patch for NixOS -- 3rd-party source trees with FHS assumptions,
13− games distributed as tarballs, software with integrity checking and/or
14− external self-updated binaries. It uses Linux namespaces feature to create
15− temporary lightweight environments which are destroyed after all child
16− processes exit, without root user rights requirement. Accepted arguments are:
8+ <function>buildFHSUserEnv</function> provides a way to build and run FHS-compatible lightweight sandboxes. It creates an isolated root with bound <filename>/nix/store</filename>, so its footprint in terms of disk space needed is quite small. This allows one to run software which is hard or unfeasible to patch for NixOS -- 3rd-party source trees with FHS assumptions, games distributed as tarballs, software with integrity checking and/or external self-updated binaries. It uses Linux namespaces feature to create temporary lightweight environments which are destroyed after all child processes exit, without root user rights requirement. Accepted arguments are:
179 </para>
1810
1911 <variablelist>
@@ -33,8 +25,7 @@
3325 </term>
3426 <listitem>
3527 <para>
36− Packages to be installed for the main host's architecture (i.e. x86_64 on
37− x86_64 installations). Along with libraries binaries are also installed.
28+ Packages to be installed for the main host's architecture (i.e. x86_64 on x86_64 installations). Along with libraries binaries are also installed.
3829 </para>
3930 </listitem>
4031 </varlistentry>
@@ -44,9 +35,7 @@
4435 </term>
4536 <listitem>
4637 <para>
47− Packages to be installed for all architectures supported by a host (i.e.
48− i686 and x86_64 on x86_64 installations). Only libraries are installed by
49− default.
38+ Packages to be installed for all architectures supported by a host (i.e. i686 and x86_64 on x86_64 installations). Only libraries are installed by default.
5039 </para>
5140 </listitem>
5241 </varlistentry>
@@ -66,8 +55,7 @@
6655 </term>
6756 <listitem>
6857 <para>
69− Like <literal>extraBuildCommands</literal>, but executed only on multilib
70− architectures.
58+ Like <literal>extraBuildCommands</literal>, but executed only on multilib architectures.
7159 </para>
7260 </listitem>
7361 </varlistentry>
@@ -77,8 +65,7 @@
7765 </term>
7866 <listitem>
7967 <para>
80− Additional derivation outputs to be linked for both target and
81− multi-architecture packages.
68+ Additional derivation outputs to be linked for both target and multi-architecture packages.
8269 </para>
8370 </listitem>
8471 </varlistentry>
@@ -88,8 +75,7 @@
8875 </term>
8976 <listitem>
9077 <para>
91− Additional commands to be executed for finalizing the derivation with
92− runner script.
78+ Additional commands to be executed for finalizing the derivation with runner script.
9379 </para>
9480 </listitem>
9581 </varlistentry>
@@ -99,16 +85,14 @@
9985 </term>
10086 <listitem>
10187 <para>
102− A command that would be executed inside the sandbox and passed all the
103− command line arguments. It defaults to <literal>bash</literal>.
88+ A command that would be executed inside the sandbox and passed all the command line arguments. It defaults to <literal>bash</literal>.
10489 </para>
10590 </listitem>
10691 </varlistentry>
10792 </variablelist>
10893
10994 <para>
110− One can create a simple environment using a <literal>shell.nix</literal> like
111− that:
95+ One can create a simple environment using a <literal>shell.nix</literal> like that:
11296 </para>
11397
11498<programlisting><![CDATA[
@@ -133,10 +117,6 @@
133117]]></programlisting>
134118
135119 <para>
136− Running <literal>nix-shell</literal> would then drop you into a shell with
137− these libraries and binaries available. You can use this to run closed-source
138− applications which expect FHS structure without hassles: simply change
139− <literal>runScript</literal> to the application path, e.g.
140− <filename>./bin/start.sh</filename> -- relative paths are supported.
120+ Running <literal>nix-shell</literal> would then drop you into a shell with these libraries and binaries available. You can use this to run closed-source applications which expect FHS structure without hassles: simply change <literal>runScript</literal> to the application path, e.g. <filename>./bin/start.sh</filename> -- relative paths are supported.
141121 </para>
142122</section>
doc/functions/generators.xml+5−20
@@ -5,28 +5,15 @@
55 <title>Generators</title>
66
77 <para>
8− Generators are functions that create file formats from nix data structures,
9− e. g. for configuration files. There are generators available for:
10− <literal>INI</literal>, <literal>JSON</literal> and <literal>YAML</literal>
8+ Generators are functions that create file formats from nix data structures, e. g. for configuration files. There are generators available for: <literal>INI</literal>, <literal>JSON</literal> and <literal>YAML</literal>
119 </para>
1210
1311 <para>
14− All generators follow a similar call interface: <code>generatorName
15− configFunctions data</code>, where <literal>configFunctions</literal> is an
16− attrset of user-defined functions that format nested parts of the content.
17− They each have common defaults, so often they do not need to be set manually.
18− An example is <code>mkSectionName ? (name: libStr.escape [ "[" "]" ]
19− name)</code> from the <literal>INI</literal> generator. It receives the name
20− of a section and sanitizes it. The default <literal>mkSectionName</literal>
21− escapes <literal>[</literal> and <literal>]</literal> with a backslash.
12+ All generators follow a similar call interface: <code>generatorName configFunctions data</code>, where <literal>configFunctions</literal> is an attrset of user-defined functions that format nested parts of the content. They each have common defaults, so often they do not need to be set manually. An example is <code>mkSectionName ? (name: libStr.escape [ "[" "]" ] name)</code> from the <literal>INI</literal> generator. It receives the name of a section and sanitizes it. The default <literal>mkSectionName</literal> escapes <literal>[</literal> and <literal>]</literal> with a backslash.
2213 </para>
2314
2415 <para>
25− Generators can be fine-tuned to produce exactly the file format required by
26− your application/service. One example is an INI-file format which uses
27− <literal>: </literal> as separator, the strings
28− <literal>"yes"</literal>/<literal>"no"</literal> as boolean values and
29− requires all string values to be quoted:
16+ Generators can be fine-tuned to produce exactly the file format required by your application/service. One example is an INI-file format which uses <literal>: </literal> as separator, the strings <literal>"yes"</literal>/<literal>"no"</literal> as boolean values and requires all string values to be quoted:
3017 </para>
3118
3219<programlisting>
@@ -77,13 +64,11 @@ merge:"diff3"
7764
7865 <note>
7966 <para>
80− Nix store paths can be converted to strings by enclosing a derivation
81− attribute like so: <code>"${drv}"</code>.
67+ Nix store paths can be converted to strings by enclosing a derivation attribute like so: <code>"${drv}"</code>.
8268 </para>
8369 </note>
8470
8571 <para>
86− Detailed documentation for each generator can be found in
87− <literal>lib/generators.nix</literal>.
72+ Detailed documentation for each generator can be found in <literal>lib/generators.nix</literal>.
8873 </para>
8974</section>
doc/functions/library.xml+1−2
@@ -5,8 +5,7 @@
55 <title>Nixpkgs Library Functions</title>
66
77 <para>
8− Nixpkgs provides a standard library at <varname>pkgs.lib</varname>, or
9− through <code>import &lt;nixpkgs/lib&gt;</code>.
8+ Nixpkgs provides a standard library at <varname>pkgs.lib</varname>, or through <code>import &lt;nixpkgs/lib&gt;</code>.
109 </para>
1110
1211 <xi:include href="./library/asserts.xml" />
doc/functions/library/asserts.xml+4−9
@@ -27,8 +27,7 @@
2727 </term>
2828 <listitem>
2929 <para>
30− Condition under which the <varname>msg</varname> should
31− <emphasis>not</emphasis> be printed.
30+ Condition under which the <varname>msg</varname> should <emphasis>not</emphasis> be printed.
3231 </para>
3332 </listitem>
3433 </varlistentry>
@@ -64,9 +63,7 @@ stderr> assert failed
6463 <xi:include href="./locations.xml" xpointer="lib.asserts.assertOneOf" />
6564
6665 <para>
67− Specialized <function>asserts.assertMsg</function> for checking if
68− <varname>val</varname> is one of the elements of <varname>xs</varname>.
69− Useful for checking enums.
66+ Specialized <function>asserts.assertMsg</function> for checking if <varname>val</varname> is one of the elements of <varname>xs</varname>. Useful for checking enums.
7067 </para>
7168
7269 <variablelist>
@@ -76,8 +73,7 @@ stderr> assert failed
7673 </term>
7774 <listitem>
7875 <para>
79− The name of the variable the user entered <varname>val</varname> into,
80− for inclusion in the error message.
76+ The name of the variable the user entered <varname>val</varname> into, for inclusion in the error message.
8177 </para>
8278 </listitem>
8379 </varlistentry>
@@ -87,8 +83,7 @@ stderr> assert failed
8783 </term>
8884 <listitem>
8985 <para>
90− The value of what the user provided, to be compared against the values in
91− <varname>xs</varname>.
86+ The value of what the user provided, to be compared against the values in <varname>xs</varname>.
9287 </para>
9388 </listitem>
9489 </varlistentry>
doc/functions/library/attrsets.xml+42−103
@@ -23,8 +23,7 @@
2323 </term>
2424 <listitem>
2525 <para>
26− A list of strings representing the path through the nested attribute set
27− <varname>set</varname>.
26+ A list of strings representing the path through the nested attribute set <varname>set</varname>.
2827 </para>
2928 </listitem>
3029 </varlistentry>
@@ -34,8 +33,7 @@
3433 </term>
3534 <listitem>
3635 <para>
37− Default value if <varname>attrPath</varname> does not resolve to an
38− existing value.
36+ Default value if <varname>attrPath</varname> does not resolve to an existing value.
3937 </para>
4038 </listitem>
4139 </varlistentry>
@@ -88,8 +86,7 @@ lib.attrsets.attrByPath [ "a" "b" ] 0 {}
8886 </term>
8987 <listitem>
9088 <para>
91− A list of strings representing the path through the nested attribute set
92− <varname>set</varname>.
89+ A list of strings representing the path through the nested attribute set <varname>set</varname>.
9390 </para>
9491 </listitem>
9592 </varlistentry>
@@ -125,8 +122,7 @@ lib.attrsets.hasAttrByPath
125122 <xi:include href="./locations.xml" xpointer="lib.attrsets.setAttrByPath" />
126123
127124 <para>
128− Create a new attribute set with <varname>value</varname> set at the nested
129− attribute location specified in <varname>attrPath</varname>.
125+ Create a new attribute set with <varname>value</varname> set at the nested attribute location specified in <varname>attrPath</varname>.
130126 </para>
131127
132128 <variablelist>
@@ -146,8 +142,7 @@ lib.attrsets.hasAttrByPath
146142 </term>
147143 <listitem>
148144 <para>
149− The value to set at the location described by
150− <varname>attrPath</varname>.
145+ The value to set at the location described by <varname>attrPath</varname>.
151146 </para>
152147 </listitem>
153148 </varlistentry>
@@ -171,8 +166,7 @@ lib.attrsets.setAttrByPath [ "a" "b" ] 3
171166 <xi:include href="./locations.xml" xpointer="lib.attrsets.getAttrFromPath" />
172167
173168 <para>
174− Like <xref linkend="function-library-lib.attrsets.attrByPath" /> except
175− without a default, and it will throw if the value doesn't exist.
169+ Like <xref linkend="function-library-lib.attrsets.attrByPath" /> except without a default, and it will throw if the value doesn't exist.
176170 </para>
177171
178172 <variablelist>
@@ -182,8 +176,7 @@ lib.attrsets.setAttrByPath [ "a" "b" ] 3
182176 </term>
183177 <listitem>
184178 <para>
185− A list of strings representing the path through the nested attribute set
186− <varname>set</varname>.
179+ A list of strings representing the path through the nested attribute set <varname>set</varname>.
187180 </para>
188181 </listitem>
189182 </varlistentry>
@@ -235,8 +228,7 @@ lib.attrsets.getAttrFromPath [ "x" "y" ] { }
235228 </term>
236229 <listitem>
237230 <para>
238− The list of attributes to fetch from <varname>set</varname>. Each
239− attribute name must exist on the attrbitue set.
231+ The list of attributes to fetch from <varname>set</varname>. Each attribute name must exist on the attrbitue set.
240232 </para>
241233 </listitem>
242234 </varlistentry>
@@ -282,8 +274,7 @@ error: attribute 'd' missing
282274 </para>
283275
284276 <para>
285− Provides a backwards-compatible interface of
286− <function>builtins.attrValues</function> for Nix version older than 1.8.
277+ Provides a backwards-compatible interface of <function>builtins.attrValues</function> for Nix version older than 1.8.
287278 </para>
288279
289280 <variablelist>
@@ -317,14 +308,11 @@ lib.attrsets.attrValues { a = 1; b = 2; c = 3; }
317308 <xi:include href="./locations.xml" xpointer="lib.attrsets.catAttrs" />
318309
319310 <para>
320− Collect each attribute named `attr' from the list of attribute sets,
321− <varname>sets</varname>. Sets that don't contain the named attribute are
322− ignored.
311+ Collect each attribute named `attr' from the list of attribute sets, <varname>sets</varname>. Sets that don't contain the named attribute are ignored.
323312 </para>
324313
325314 <para>
326− Provides a backwards-compatible interface of
327− <function>builtins.catAttrs</function> for Nix version older than 1.9.
315+ Provides a backwards-compatible interface of <function>builtins.catAttrs</function> for Nix version older than 1.9.
328316 </para>
329317
330318 <variablelist>
@@ -334,8 +322,7 @@ lib.attrsets.attrValues { a = 1; b = 2; c = 3; }
334322 </term>
335323 <listitem>
336324 <para>
337− Attribute name to select from each attribute set in
338− <varname>sets</varname>.
325+ Attribute name to select from each attribute set in <varname>sets</varname>.
339326 </para>
340327 </listitem>
341328 </varlistentry>
@@ -372,8 +359,7 @@ catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}]
372359 <xi:include href="./locations.xml" xpointer="lib.attrsets.filterAttrs" />
373360
374361 <para>
375− Filter an attribute set by removing all attributes for which the given
376− predicate return false.
362+ Filter an attribute set by removing all attributes for which the given predicate return false.
377363 </para>
378364
379365 <variablelist>
@@ -386,8 +372,7 @@ catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}]
386372 <literal>String -> Any -> Bool</literal>
387373 </para>
388374 <para>
389− Predicate which returns true to include an attribute, or returns false to
390− exclude it.
375+ Predicate which returns true to include an attribute, or returns false to exclude it.
391376 </para>
392377 <variablelist>
393378 <varlistentry>
@@ -412,8 +397,7 @@ catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}]
412397 </varlistentry>
413398 </variablelist>
414399 <para>
415− Returns <literal>true</literal> to include the attribute,
416− <literal>false</literal> to exclude the attribute.
400+ Returns <literal>true</literal> to include the attribute, <literal>false</literal> to exclude the attribute.
417401 </para>
418402 </listitem>
419403 </varlistentry>
@@ -447,8 +431,7 @@ filterAttrs (n: v: n == "foo") { foo = 1; bar = 2; }
447431 <xi:include href="./locations.xml" xpointer="lib.attrsets.filterAttrsRecursive" />
448432
449433 <para>
450− Filter an attribute set recursively by removing all attributes for which the
451− given predicate return false.
434+ Filter an attribute set recursively by removing all attributes for which the given predicate return false.
452435 </para>
453436
454437 <variablelist>
@@ -461,8 +444,7 @@ filterAttrs (n: v: n == "foo") { foo = 1; bar = 2; }
461444 <literal>String -> Any -> Bool</literal>
462445 </para>
463446 <para>
464− Predicate which returns true to include an attribute, or returns false to
465− exclude it.
447+ Predicate which returns true to include an attribute, or returns false to exclude it.
466448 </para>
467449 <variablelist>
468450 <varlistentry>
@@ -487,8 +469,7 @@ filterAttrs (n: v: n == "foo") { foo = 1; bar = 2; }
487469 </varlistentry>
488470 </variablelist>
489471 <para>
490− Returns <literal>true</literal> to include the attribute,
491− <literal>false</literal> to exclude the attribute.
472+ Returns <literal>true</literal> to include the attribute, <literal>false</literal> to exclude the attribute.
492473 </para>
493474 </listitem>
494475 </varlistentry>
@@ -557,8 +538,7 @@ lib.attrsets.filterAttrsRecursive
557538 <literal>Any -> Any -> Any</literal>
558539 </para>
559540 <para>
560− Given a value <varname>val</varname> and a collector
561− <varname>col</varname>, combine the two.
541+ Given a value <varname>val</varname> and a collector <varname>col</varname>, combine the two.
562542 </para>
563543 <variablelist>
564544 <varlistentry>
@@ -578,8 +558,7 @@ lib.attrsets.filterAttrsRecursive
578558 <listitem>
579559<!-- TODO: make this not bad, use more fold-ey terms -->
580560 <para>
581− The result of previous <function>op</function> calls with other values
582− and <function>nul</function>.
561+ The result of previous <function>op</function> calls with other values and <function>nul</function>.
583562 </para>
584563 </listitem>
585564 </varlistentry>
@@ -632,9 +611,7 @@ lib.attrsets.foldAttrs
632611 <xi:include href="./locations.xml" xpointer="lib.attrsets.collect" />
633612
634613 <para>
635− Recursively collect sets that verify a given predicate named
636− <varname>pred</varname> from the set <varname>attrs</varname>. The recursion
637− stops when <varname>pred</varname> returns <literal>true</literal>.
614+ Recursively collect sets that verify a given predicate named <varname>pred</varname> from the set <varname>attrs</varname>. The recursion stops when <varname>pred</varname> returns <literal>true</literal>.
638615 </para>
639616
640617 <variablelist>
@@ -702,8 +679,7 @@ collect (x: x ? outPath)
702679 <xi:include href="./locations.xml" xpointer="lib.attrsets.nameValuePair" />
703680
704681 <para>
705− Utility function that creates a <literal>{name, value}</literal> pair as
706− expected by <function>builtins.listToAttrs</function>.
682+ Utility function that creates a <literal>{name, value}</literal> pair as expected by <function>builtins.listToAttrs</function>.
707683 </para>
708684
709685 <variablelist>
@@ -747,13 +723,11 @@ nameValuePair "some" 6
747723 <xi:include href="./locations.xml" xpointer="lib.attrsets.mapAttrs" />
748724
749725 <para>
750− Apply a function to each element in an attribute set, creating a new
751− attribute set.
726+ Apply a function to each element in an attribute set, creating a new attribute set.
752727 </para>
753728
754729 <para>
755− Provides a backwards-compatible interface of
756− <function>builtins.mapAttrs</function> for Nix version older than 2.1.
730+ Provides a backwards-compatible interface of <function>builtins.mapAttrs</function> for Nix version older than 2.1.
757731 </para>
758732
759733 <variablelist>
@@ -814,9 +788,7 @@ lib.attrsets.mapAttrs
814788 <xi:include href="./locations.xml" xpointer="lib.attrsets.mapAttrs-prime" />
815789
816790 <para>
817− Like <function>mapAttrs</function>, but allows the name of each attribute to
818− be changed in addition to the value. The applied function should return both
819− the new name and value as a <function>nameValuePair</function>.
791+ Like <function>mapAttrs</function>, but allows the name of each attribute to be changed in addition to the value. The applied function should return both the new name and value as a <function>nameValuePair</function>.
820792 </para>
821793
822794 <variablelist>
@@ -829,10 +801,8 @@ lib.attrsets.mapAttrs
829801 <literal>String -> Any -> { name = String; value = Any }</literal>
830802 </para>
831803 <para>
832− Given an attribute's name and value, return a new
833− <link
834− linkend="function-library-lib.attrsets.nameValuePair">name
835− value pair</link>.
804+ Given an attribute's name and value, return a new <link
805+ linkend="function-library-lib.attrsets.nameValuePair">name value pair</link>.
836806 </para>
837807 <variablelist>
838808 <varlistentry>
@@ -891,8 +861,7 @@ lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair ("foo_" + name)
891861 <xi:include href="./locations.xml" xpointer="lib.attrsets.mapAttrsToList" />
892862
893863 <para>
894− Call <varname>fn</varname> for each attribute in the given
895− <varname>set</varname> and return the result in a list.
864+ Call <varname>fn</varname> for each attribute in the given <varname>set</varname> and return the result in a list.
896865 </para>
897866
898867 <variablelist>
@@ -962,9 +931,7 @@ lib.attrsets.mapAttrsToList (name: value: "${name}=${value}")
962931 <xi:include href="./locations.xml" xpointer="lib.attrsets.mapAttrsRecursive" />
963932
964933 <para>
965− Like <function>mapAttrs</function>, except that it recursively applies
966− itself to attribute sets. Also, the first argument of the argument function
967− is a <emphasis>list</emphasis> of the names of the containing attributes.
934+ Like <function>mapAttrs</function>, except that it recursively applies itself to attribute sets. Also, the first argument of the argument function is a <emphasis>list</emphasis> of the names of the containing attributes.
968935 </para>
969936
970937 <variablelist>
@@ -989,10 +956,7 @@ lib.attrsets.mapAttrsToList (name: value: "${name}=${value}")
989956 The list of attribute names to this value.
990957 </para>
991958 <para>
992− For example, the <varname>name_path</varname> for the
993− <literal>example</literal> string in the attribute set <literal>{ foo
994− = { bar = "example"; }; }</literal> is <literal>[ "foo" "bar"
995− ]</literal>.
959+ For example, the <varname>name_path</varname> for the <literal>example</literal> string in the attribute set <literal>{ foo = { bar = "example"; }; }</literal> is <literal>[ "foo" "bar" ]</literal>.
996960 </para>
997961 </listitem>
998962 </varlistentry>
@@ -1059,11 +1023,7 @@ mapAttrsRecursive
10591023 <xi:include href="./locations.xml" xpointer="lib.attrsets.mapAttrsRecursiveCond" />
10601024
10611025 <para>
1062− Like <function>mapAttrsRecursive</function>, but it takes an additional
1063− predicate function that tells it whether to recursive into an attribute set.
1064− If it returns false, <function>mapAttrsRecursiveCond</function> does not
1065− recurse, but does apply the map function. It is returns true, it does
1066− recurse, and does not apply the map function.
1026+ Like <function>mapAttrsRecursive</function>, but it takes an additional predicate function that tells it whether to recursive into an attribute set. If it returns false, <function>mapAttrsRecursiveCond</function> does not recurse, but does apply the map function. It is returns true, it does recurse, and does not apply the map function.
10671027 </para>
10681028
10691029 <variablelist>
@@ -1076,8 +1036,7 @@ mapAttrsRecursive
10761036 <literal>(AttrSet -> Bool)</literal>
10771037 </para>
10781038 <para>
1079− Determine if <function>mapAttrsRecursive</function> should recurse deeper
1080− in to the attribute set.
1039+ Determine if <function>mapAttrsRecursive</function> should recurse deeper in to the attribute set.
10811040 </para>
10821041 <variablelist>
10831042 <varlistentry>
@@ -1114,10 +1073,7 @@ mapAttrsRecursive
11141073 The list of attribute names to this value.
11151074 </para>
11161075 <para>
1117− For example, the <varname>name_path</varname> for the
1118− <literal>example</literal> string in the attribute set <literal>{ foo
1119− = { bar = "example"; }; }</literal> is <literal>[ "foo" "bar"
1120− ]</literal>.
1076+ For example, the <varname>name_path</varname> for the <literal>example</literal> string in the attribute set <literal>{ foo = { bar = "example"; }; }</literal> is <literal>[ "foo" "bar" ]</literal>.
11211077 </para>
11221078 </listitem>
11231079 </varlistentry>
@@ -1181,8 +1137,7 @@ lib.attrsets.mapAttrsRecursiveCond
11811137 <xi:include href="./locations.xml" xpointer="lib.attrsets.genAttrs" />
11821138
11831139 <para>
1184− Generate an attribute set by mapping a function over a list of attribute
1185− names.
1140+ Generate an attribute set by mapping a function over a list of attribute names.
11861141 </para>
11871142
11881143 <variablelist>
@@ -1241,8 +1196,7 @@ lib.attrsets.genAttrs [ "foo" "bar" ] (name: "x_${name}")
12411196 <xi:include href="./locations.xml" xpointer="lib.attrsets.isDerivation" />
12421197
12431198 <para>
1244− Check whether the argument is a derivation. Any set with <code>{ type =
1245− "derivation"; }</code> counts as a derivation.
1199+ Check whether the argument is a derivation. Any set with <code>{ type = "derivation"; }</code> counts as a derivation.
12461200 </para>
12471201
12481202 <variablelist>
@@ -1320,8 +1274,7 @@ lib.attrsets.isDerivation "foobar"
13201274 </term>
13211275 <listitem>
13221276 <para>
1323− Condition under which the <varname>as</varname> attribute set is
1324− returned.
1277+ Condition under which the <varname>as</varname> attribute set is returned.
13251278 </para>
13261279 </listitem>
13271280 </varlistentry>
@@ -1363,8 +1316,7 @@ lib.attrsets.optionalAttrs false { my = "set"; }
13631316 <xi:include href="./locations.xml" xpointer="lib.attrsets.zipAttrsWithNames" />
13641317
13651318 <para>
1366− Merge sets of attributes and use the function <varname>f</varname> to merge
1367− attribute values where the attribute name is in <varname>names</varname>.
1319+ Merge sets of attributes and use the function <varname>f</varname> to merge attribute values where the attribute name is in <varname>names</varname>.
13681320 </para>
13691321
13701322 <variablelist>
@@ -1451,11 +1403,8 @@ lib.attrsets.zipAttrsWithNames
14511403 <xi:include href="./locations.xml" xpointer="lib.attrsets.zipAttrsWith" />
14521404
14531405 <para>
1454− Merge sets of attributes and use the function <varname>f</varname> to merge
1455− attribute values. Similar to
1456− <xref
1457− linkend="function-library-lib.attrsets.zipAttrsWithNames" /> where
1458− all key names are passed for <varname>names</varname>.
1406+ Merge sets of attributes and use the function <varname>f</varname> to merge attribute values. Similar to <xref
1407+ linkend="function-library-lib.attrsets.zipAttrsWithNames" /> where all key names are passed for <varname>names</varname>.
14591408 </para>
14601409
14611410 <variablelist>
@@ -1531,9 +1480,7 @@ lib.attrsets.zipAttrsWith
15311480 <xi:include href="./locations.xml" xpointer="lib.attrsets.zipAttrs" />
15321481
15331482 <para>
1534− Merge sets of attributes and combine each attribute value in to a list.
1535− Similar to <xref linkend="function-library-lib.attrsets.zipAttrsWith" />
1536− where the merge function returns a list of all values.
1483+ Merge sets of attributes and combine each attribute value in to a list. Similar to <xref linkend="function-library-lib.attrsets.zipAttrsWith" /> where the merge function returns a list of all values.
15371484 </para>
15381485
15391486 <variablelist>
@@ -1573,12 +1520,7 @@ lib.attrsets.zipAttrs
15731520 <xi:include href="./locations.xml" xpointer="lib.attrsets.recursiveUpdateUntil" />
15741521
15751522 <para>
1576− Does the same as the update operator <literal>//</literal> except that
1577− attributes are merged until the given predicate is verified. The predicate
1578− should accept 3 arguments which are the path to reach the attribute, a part
1579− of the first attribute set and a part of the second attribute set. When the
1580− predicate is verified, the value of the first attribute set is replaced by
1581− the value of the second attribute set.
1523+ Does the same as the update operator <literal>//</literal> except that attributes are merged until the given predicate is verified. The predicate should accept 3 arguments which are the path to reach the attribute, a part of the first attribute set and a part of the second attribute set. When the predicate is verified, the value of the first attribute set is replaced by the value of the second attribute set.
15821524 </para>
15831525
15841526 <variablelist>
@@ -1681,10 +1623,7 @@ lib.attrsets.recursiveUpdateUntil (path: l: r: path == ["foo"])
16811623 <xi:include href="./locations.xml" xpointer="lib.attrsets.recursiveUpdate" />
16821624
16831625 <para>
1684− A recursive variant of the update operator <literal>//</literal>. The
1685− recursion stops when one of the attribute values is not an attribute set, in
1686− which case the right hand side value takes precedence over the left hand
1687− side value.
1626+ A recursive variant of the update operator <literal>//</literal>. The recursion stops when one of the attribute values is not an attribute set, in which case the right hand side value takes precedence over the left hand side value.
16881627 </para>
16891628
16901629 <variablelist>
doc/functions/nix-gitignore.xml+5−19
@@ -5,21 +5,14 @@
55 <title>pkgs.nix-gitignore</title>
66
77 <para>
8− <function>pkgs.nix-gitignore</function> is a function that acts similarly to
9− <literal>builtins.filterSource</literal> but also allows filtering with the
10− help of the gitignore format.
8+ <function>pkgs.nix-gitignore</function> is a function that acts similarly to <literal>builtins.filterSource</literal> but also allows filtering with the help of the gitignore format.
119 </para>
1210
1311 <section xml:id="sec-pkgs-nix-gitignore-usage">
1412 <title>Usage</title>
1513
1614 <para>
17− <literal>pkgs.nix-gitignore</literal> exports a number of functions, but
18− you'll most likely need either <literal>gitignoreSource</literal> or
19− <literal>gitignoreSourcePure</literal>. As their first argument, they both
20− accept either 1. a file with gitignore lines or 2. a string with gitignore
21− lines, or 3. a list of either of the two. They will be concatenated into a
22− single big string.
15+ <literal>pkgs.nix-gitignore</literal> exports a number of functions, but you'll most likely need either <literal>gitignoreSource</literal> or <literal>gitignoreSourcePure</literal>. As their first argument, they both accept either 1. a file with gitignore lines or 2. a string with gitignore lines, or 3. a list of either of the two. They will be concatenated into a single big string.
2316 </para>
2417
2518<programlisting><![CDATA[
@@ -40,8 +33,7 @@
4033 ]]></programlisting>
4134
4235 <para>
43− These functions are derived from the <literal>Filter</literal> functions by
44− setting the first filter argument to <literal>(_: _: true)</literal>:
36+ These functions are derived from the <literal>Filter</literal> functions by setting the first filter argument to <literal>(_: _: true)</literal>:
4537 </para>
4638
4739<programlisting><![CDATA[
@@ -50,12 +42,7 @@ gitignoreSource = gitignoreFilterSource (_: _: true);
5042 ]]></programlisting>
5143
5244 <para>
53− Those filter functions accept the same arguments the
54− <literal>builtins.filterSource</literal> function would pass to its filters,
55− thus <literal>fn: gitignoreFilterSourcePure fn ""</literal> should be
56− extensionally equivalent to <literal>filterSource</literal>. The file is
57− blacklisted iff it's blacklisted by either your filter or the
58− gitignoreFilter.
45+ Those filter functions accept the same arguments the <literal>builtins.filterSource</literal> function would pass to its filters, thus <literal>fn: gitignoreFilterSourcePure fn ""</literal> should be extensionally equivalent to <literal>filterSource</literal>. The file is blacklisted iff it's blacklisted by either your filter or the gitignoreFilter.
5946 </para>
6047
6148 <para>
@@ -71,8 +58,7 @@ gitignoreFilter = ign: root: filterPattern (gitignoreToPatterns ign) root;
7158 <title>gitignore files in subdirectories</title>
7259
7360 <para>
74− If you wish to use a filter that would search for .gitignore files in
75− subdirectories, just like git does by default, use this function:
61+ If you wish to use a filter that would search for .gitignore files in subdirectories, just like git does by default, use this function:
7662 </para>
7763
7864<programlisting><![CDATA[
doc/functions/ocitools.xml+6−20
@@ -5,26 +5,18 @@
55 <title>pkgs.ociTools</title>
66
77 <para>
8− <varname>pkgs.ociTools</varname> is a set of functions for creating
9− containers according to the
10− <link xlink:href="https://github.com/opencontainers/runtime-spec">OCI
11− container specification v1.0.0</link>. Beyond that it makes no assumptions
12− about the container runner you choose to use to run the created container.
8+ <varname>pkgs.ociTools</varname> is a set of functions for creating containers according to the <link xlink:href="https://github.com/opencontainers/runtime-spec">OCI container specification v1.0.0</link>. Beyond that it makes no assumptions about the container runner you choose to use to run the created container.
139 </para>
1410
1511 <section xml:id="ssec-pkgs-ociTools-buildContainer">
1612 <title>buildContainer</title>
1713
1814 <para>
19− This function creates a simple OCI container that runs a single command
20− inside of it. An OCI container consists of a <varname>config.json</varname>
21− and a rootfs directory.The nix store of the container will contain all
22− referenced dependencies of the given command.
15+ This function creates a simple OCI container that runs a single command inside of it. An OCI container consists of a <varname>config.json</varname> and a rootfs directory.The nix store of the container will contain all referenced dependencies of the given command.
2316 </para>
2417
2518 <para>
26− The parameters of <varname>buildContainer</varname> with an example value
27− are described below:
19+ The parameters of <varname>buildContainer</varname> with an example value are described below:
2820 </para>
2921
3022 <example xml:id='ex-ociTools-buildContainer'>
@@ -51,23 +43,17 @@ buildContainer {
5143 <calloutlist>
5244 <callout arearefs='ex-ociTools-buildContainer-1'>
5345 <para>
54− <varname>args</varname> specifies a set of arguments to run inside the
55− container. This is the only required argument for
56− <varname>buildContainer</varname>. All referenced packages inside the
57− derivation will be made available inside the container
46+ <varname>args</varname> specifies a set of arguments to run inside the container. This is the only required argument for <varname>buildContainer</varname>. All referenced packages inside the derivation will be made available inside the container
5847 </para>
5948 </callout>
6049 <callout arearefs='ex-ociTools-buildContainer-2'>
6150 <para>
62− <varname>mounts</varname> specifies additional mount points chosen by the
63− user. By default only a minimal set of necessary filesystems are mounted
64− into the container (e.g procfs, cgroupfs)
51+ <varname>mounts</varname> specifies additional mount points chosen by the user. By default only a minimal set of necessary filesystems are mounted into the container (e.g procfs, cgroupfs)
6552 </para>
6653 </callout>
6754 <callout arearefs='ex-ociTools-buildContainer-3'>
6855 <para>
69− <varname>readonly</varname> makes the container's rootfs read-only if it
70− is set to true. The default value is false <literal>false</literal>.
56+ <varname>readonly</varname> makes the container's rootfs read-only if it is set to true. The default value is false <literal>false</literal>.
7157 </para>
7258 </callout>
7359 </calloutlist>
doc/functions/overrides.xml+17−78
@@ -5,23 +5,18 @@
55 <title>Overriding</title>
66
77 <para>
8− Sometimes one wants to override parts of <literal>nixpkgs</literal>, e.g.
9− derivation attributes, the results of derivations.
8+ Sometimes one wants to override parts of <literal>nixpkgs</literal>, e.g. derivation attributes, the results of derivations.
109 </para>
1110
1211 <para>
13− These functions are used to make changes to packages, returning only single
14− packages. <link xlink:href="#chap-overlays">Overlays</link>, on the other
15− hand, can be used to combine the overridden packages across the entire
16− package set of Nixpkgs.
12+ These functions are used to make changes to packages, returning only single packages. <link xlink:href="#chap-overlays">Overlays</link>, on the other hand, can be used to combine the overridden packages across the entire package set of Nixpkgs.
1713 </para>
1814
1915 <section xml:id="sec-pkg-override">
2016 <title>&lt;pkg&gt;.override</title>
2117
2218 <para>
23− The function <varname>override</varname> is usually available for all the
24− derivations in the nixpkgs expression (<varname>pkgs</varname>).
19+ The function <varname>override</varname> is usually available for all the derivations in the nixpkgs expression (<varname>pkgs</varname>).
2520 </para>
2621
2722 <para>
@@ -47,10 +42,7 @@ mypkg = pkgs.callPackage ./mypkg.nix {
4742 </para>
4843
4944 <para>
50− In the first example, <varname>pkgs.foo</varname> is the result of a
51− function call with some default arguments, usually a derivation. Using
52− <varname>pkgs.foo.override</varname> will call the same function with the
53− given new arguments.
45+ In the first example, <varname>pkgs.foo</varname> is the result of a function call with some default arguments, usually a derivation. Using <varname>pkgs.foo.override</varname> will call the same function with the given new arguments.
5446 </para>
5547 </section>
5648
@@ -58,12 +50,7 @@ mypkg = pkgs.callPackage ./mypkg.nix {
5850 <title>&lt;pkg&gt;.overrideAttrs</title>
5951
6052 <para>
61− The function <varname>overrideAttrs</varname> allows overriding the
62− attribute set passed to a <varname>stdenv.mkDerivation</varname> call,
63− producing a new derivation based on the original one. This function is
64− available on all derivations produced by the
65− <varname>stdenv.mkDerivation</varname> function, which is most packages in
66− the nixpkgs expression <varname>pkgs</varname>.
53+ The function <varname>overrideAttrs</varname> allows overriding the attribute set passed to a <varname>stdenv.mkDerivation</varname> call, producing a new derivation based on the original one. This function is available on all derivations produced by the <varname>stdenv.mkDerivation</varname> function, which is most packages in the nixpkgs expression <varname>pkgs</varname>.
6754 </para>
6855
6956 <para>
@@ -76,30 +63,16 @@ helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec {
7663 </para>
7764
7865 <para>
79− In the above example, the <varname>separateDebugInfo</varname> attribute is
80− overridden to be true, thus building debug info for
81− <varname>helloWithDebug</varname>, while all other attributes will be
82− retained from the original <varname>hello</varname> package.
66+ In the above example, the <varname>separateDebugInfo</varname> attribute is overridden to be true, thus building debug info for <varname>helloWithDebug</varname>, while all other attributes will be retained from the original <varname>hello</varname> package.
8367 </para>
8468
8569 <para>
86− The argument <varname>oldAttrs</varname> is conventionally used to refer to
87− the attr set originally passed to <varname>stdenv.mkDerivation</varname>.
70+ The argument <varname>oldAttrs</varname> is conventionally used to refer to the attr set originally passed to <varname>stdenv.mkDerivation</varname>.
8871 </para>
8972
9073 <note>
9174 <para>
92− Note that <varname>separateDebugInfo</varname> is processed only by the
93− <varname>stdenv.mkDerivation</varname> function, not the generated, raw Nix
94− derivation. Thus, using <varname>overrideDerivation</varname> will not work
95− in this case, as it overrides only the attributes of the final derivation.
96− It is for this reason that <varname>overrideAttrs</varname> should be
97− preferred in (almost) all cases to <varname>overrideDerivation</varname>,
98− i.e. to allow using <varname>stdenv.mkDerivation</varname> to process input
99− arguments, as well as the fact that it is easier to use (you can use the
100− same attribute names you see in your Nix code, instead of the ones
101− generated (e.g. <varname>buildInputs</varname> vs
102− <varname>nativeBuildInputs</varname>), and it involves less typing).
75+ Note that <varname>separateDebugInfo</varname> is processed only by the <varname>stdenv.mkDerivation</varname> function, not the generated, raw Nix derivation. Thus, using <varname>overrideDerivation</varname> will not work in this case, as it overrides only the attributes of the final derivation. It is for this reason that <varname>overrideAttrs</varname> should be preferred in (almost) all cases to <varname>overrideDerivation</varname>, i.e. to allow using <varname>stdenv.mkDerivation</varname> to process input arguments, as well as the fact that it is easier to use (you can use the same attribute names you see in your Nix code, instead of the ones generated (e.g. <varname>buildInputs</varname> vs <varname>nativeBuildInputs</varname>), and it involves less typing).
10376 </para>
10477 </note>
10578 </section>
@@ -109,34 +82,18 @@ helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec {
10982
11083 <warning>
11184 <para>
112− You should prefer <varname>overrideAttrs</varname> in almost all cases, see
113− its documentation for the reasons why.
114− <varname>overrideDerivation</varname> is not deprecated and will continue
115− to work, but is less nice to use and does not have as many abilities as
116− <varname>overrideAttrs</varname>.
85+ You should prefer <varname>overrideAttrs</varname> in almost all cases, see its documentation for the reasons why. <varname>overrideDerivation</varname> is not deprecated and will continue to work, but is less nice to use and does not have as many abilities as <varname>overrideAttrs</varname>.
11786 </para>
11887 </warning>
11988
12089 <warning>
12190 <para>
122− Do not use this function in Nixpkgs as it evaluates a Derivation before
123− modifying it, which breaks package abstraction and removes error-checking
124− of function arguments. In addition, this evaluation-per-function
125− application incurs a performance penalty, which can become a problem if
126− many overrides are used. It is only intended for ad-hoc customisation, such
127− as in <filename>~/.config/nixpkgs/config.nix</filename>.
91+ Do not use this function in Nixpkgs as it evaluates a Derivation before modifying it, which breaks package abstraction and removes error-checking of function arguments. In addition, this evaluation-per-function application incurs a performance penalty, which can become a problem if many overrides are used. It is only intended for ad-hoc customisation, such as in <filename>~/.config/nixpkgs/config.nix</filename>.
12892 </para>
12993 </warning>
13094
13195 <para>
132− The function <varname>overrideDerivation</varname> creates a new derivation
133− based on an existing one by overriding the original's attributes with the
134− attribute set produced by the specified function. This function is available
135− on all derivations defined using the <varname>makeOverridable</varname>
136− function. Most standard derivation-producing functions, such as
137− <varname>stdenv.mkDerivation</varname>, are defined using this function,
138− which means most packages in the nixpkgs expression,
139− <varname>pkgs</varname>, have this function.
96+ The function <varname>overrideDerivation</varname> creates a new derivation based on an existing one by overriding the original's attributes with the attribute set produced by the specified function. This function is available on all derivations defined using the <varname>makeOverridable</varname> function. Most standard derivation-producing functions, such as <varname>stdenv.mkDerivation</varname>, are defined using this function, which means most packages in the nixpkgs expression, <varname>pkgs</varname>, have this function.
14097 </para>
14198
14299 <para>
@@ -154,27 +111,16 @@ mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
154111 </para>
155112
156113 <para>
157− In the above example, the <varname>name</varname>, <varname>src</varname>,
158− and <varname>patches</varname> of the derivation will be overridden, while
159− all other attributes will be retained from the original derivation.
114+ In the above example, the <varname>name</varname>, <varname>src</varname>, and <varname>patches</varname> of the derivation will be overridden, while all other attributes will be retained from the original derivation.
160115 </para>
161116
162117 <para>
163− The argument <varname>oldAttrs</varname> is used to refer to the attribute
164− set of the original derivation.
118+ The argument <varname>oldAttrs</varname> is used to refer to the attribute set of the original derivation.
165119 </para>
166120
167121 <note>
168122 <para>
169− A package's attributes are evaluated *before* being modified by the
170− <varname>overrideDerivation</varname> function. For example, the
171− <varname>name</varname> attribute reference in <varname>url =
172− "mirror://gnu/hello/${name}.tar.gz";</varname> is filled-in *before* the
173− <varname>overrideDerivation</varname> function modifies the attribute set.
174− This means that overriding the <varname>name</varname> attribute, in this
175− example, *will not* change the value of the <varname>url</varname>
176− attribute. Instead, we need to override both the <varname>name</varname>
177− *and* <varname>url</varname> attributes.
123+ A package's attributes are evaluated *before* being modified by the <varname>overrideDerivation</varname> function. For example, the <varname>name</varname> attribute reference in <varname>url = "mirror://gnu/hello/${name}.tar.gz";</varname> is filled-in *before* the <varname>overrideDerivation</varname> function modifies the attribute set. This means that overriding the <varname>name</varname> attribute, in this example, *will not* change the value of the <varname>url</varname> attribute. Instead, we need to override both the <varname>name</varname> *and* <varname>url</varname> attributes.
178124 </para>
179125 </note>
180126 </section>
@@ -183,9 +129,7 @@ mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
183129 <title>lib.makeOverridable</title>
184130
185131 <para>
186− The function <varname>lib.makeOverridable</varname> is used to make the
187− result of a function easily customizable. This utility only makes sense for
188− functions that accept an argument set and return an attribute set.
132+ The function <varname>lib.makeOverridable</varname> is used to make the result of a function easily customizable. This utility only makes sense for functions that accept an argument set and return an attribute set.
189133 </para>
190134
191135 <para>
@@ -197,16 +141,11 @@ c = lib.makeOverridable f { a = 1; b = 2; };
197141 </para>
198142
199143 <para>
200− The variable <varname>c</varname> is the value of the <varname>f</varname>
201− function applied with some default arguments. Hence the value of
202− <varname>c.result</varname> is <literal>3</literal>, in this example.
144+ The variable <varname>c</varname> is the value of the <varname>f</varname> function applied with some default arguments. Hence the value of <varname>c.result</varname> is <literal>3</literal>, in this example.
203145 </para>
204146
205147 <para>
206− The variable <varname>c</varname> however also has some additional
207− functions, like <link linkend="sec-pkg-override">c.override</link> which can
208− be used to override the default arguments. In this example the value of
209− <varname>(c.override { a = 4; }).result</varname> is 6.
148+ The variable <varname>c</varname> however also has some additional functions, like <link linkend="sec-pkg-override">c.override</link> which can be used to override the default arguments. In this example the value of <varname>(c.override { a = 4; }).result</varname> is 6.
210149 </para>
211150 </section>
212151</section>
doc/functions/prefer-remote-fetch.xml+2−6
@@ -5,16 +5,12 @@
55 <title>prefer-remote-fetch overlay</title>
66
77 <para>
8− <function>prefer-remote-fetch</function> is an overlay that download sources
9− on remote builder. This is useful when the evaluating machine has a slow
10− upload while the builder can fetch faster directly from the source. To use
11− it, put the following snippet as a new overlay:
8+ <function>prefer-remote-fetch</function> is an overlay that download sources on remote builder. This is useful when the evaluating machine has a slow upload while the builder can fetch faster directly from the source. To use it, put the following snippet as a new overlay:
129<programlisting>
1310self: super:
1411 (super.prefer-remote-fetch self super)
1512</programlisting>
16− A full configuration example for that sets the overlay up for your own
17− account, could look like this
13+ A full configuration example for that sets the overlay up for your own account, could look like this
1814<screen>
1915<prompt>$ </prompt>mkdir ~/.config/nixpkgs/overlays/
2016<prompt>$ </prompt>cat &gt; ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix &lt;&lt;EOF
doc/functions/shell.xml+1−3
@@ -5,9 +5,7 @@
55 <title>pkgs.mkShell</title>
66
77 <para>
8− <function>pkgs.mkShell</function> is a special kind of derivation that is
9− only useful when using it combined with <command>nix-shell</command>. It will
10− in fact fail to instantiate when invoked with <command>nix-build</command>.
8+ <function>pkgs.mkShell</function> is a special kind of derivation that is only useful when using it combined with <command>nix-shell</command>. It will in fact fail to instantiate when invoked with <command>nix-build</command>.
119 </para>
1210
1311 <section xml:id="sec-pkgs-mkShell-usage">
doc/functions/snaptools.xml+8−23
@@ -5,28 +5,22 @@
55 <title>pkgs.snapTools</title>
66
77 <para>
8− <varname>pkgs.snapTools</varname> is a set of functions for creating
9− Snapcraft images. Snap and Snapcraft is not used to perform these operations.
8+ <varname>pkgs.snapTools</varname> is a set of functions for creating Snapcraft images. Snap and Snapcraft is not used to perform these operations.
109 </para>
1110
1211 <section xml:id="ssec-pkgs-snapTools-makeSnap-signature">
1312 <title>The makeSnap Function</title>
1413
1514 <para>
16− <function>makeSnap</function> takes a single named argument,
17− <parameter>meta</parameter>. This argument mirrors
18− <link xlink:href="https://docs.snapcraft.io/snap-format">the upstream
19− <filename>snap.yaml</filename> format</link> exactly.
15+ <function>makeSnap</function> takes a single named argument, <parameter>meta</parameter>. This argument mirrors <link xlink:href="https://docs.snapcraft.io/snap-format">the upstream <filename>snap.yaml</filename> format</link> exactly.
2016 </para>
2117
2218 <para>
23− The <parameter>base</parameter> should not be be specified, as
24− <function>makeSnap</function> will force set it.
19+ The <parameter>base</parameter> should not be be specified, as <function>makeSnap</function> will force set it.
2520 </para>
2621
2722 <para>
28− Currently, <function>makeSnap</function> does not support creating GUI
29− stubs.
23+ Currently, <function>makeSnap</function> does not support creating GUI stubs.
3024 </para>
3125 </section>
3226
@@ -40,9 +34,7 @@
4034 </para>
4135<programlisting><xi:include href="./snap/example-hello.nix" parse="text" /></programlisting>
4236 <para>
43− <command>nix-build</command> this expression and install it with
44− <command>snap install ./result --dangerous</command>.
45− <command>hello</command> will now be the Snapcraft version of the package.
37+ <command>nix-build</command> this expression and install it with <command>snap install ./result --dangerous</command>. <command>hello</command> will now be the Snapcraft version of the package.
4638 </para>
4739 </example>
4840 </section>
@@ -53,21 +45,14 @@
5345 <example xml:id="ex-snapTools-buildSnap-firefox">
5446 <title>Making a Graphical Snap</title>
5547 <para>
56− Graphical programs require many more integrations with the host. This
57− example uses Firefox as an example, because it is one of the most
58− complicated programs we could package.
48+ Graphical programs require many more integrations with the host. This example uses Firefox as an example, because it is one of the most complicated programs we could package.
5949 </para>
6050<programlisting><xi:include href="./snap/example-firefox.nix" parse="text" /></programlisting>
6151 <para>
62− <command>nix-build</command> this expression and install it with
63− <command>snap install ./result --dangerous</command>.
64− <command>nix-example-firefox</command> will now be the Snapcraft version of
65− the Firefox package.
52+ <command>nix-build</command> this expression and install it with <command>snap install ./result --dangerous</command>. <command>nix-example-firefox</command> will now be the Snapcraft version of the Firefox package.
6653 </para>
6754 <para>
68− The specific meaning behind plugs can be looked up in the
69− <link xlink:href="https://docs.snapcraft.io/supported-interfaces">Snapcraft
70− interface documentation</link>.
55+ The specific meaning behind plugs can be looked up in the <link xlink:href="https://docs.snapcraft.io/supported-interfaces">Snapcraft interface documentation</link>.
7156 </para>
7257 </example>
7358 </section>
doc/functions/trivial-builders.xml+6−40
@@ -5,11 +5,7 @@
55 <title>Trivial builders</title>
66
77 <para>
8− Nixpkgs provides a couple of functions that help with building derivations.
9− The most important one, <function>stdenv.mkDerivation</function>, has already
10− been documented above. The following functions wrap
11− <function>stdenv.mkDerivation</function>, making it easier to use in certain
12− cases.
8+ Nixpkgs provides a couple of functions that help with building derivations. The most important one, <function>stdenv.mkDerivation</function>, has already been documented above. The following functions wrap <function>stdenv.mkDerivation</function>, making it easier to use in certain cases.
139 </para>
1410
1511 <variablelist>
@@ -19,17 +15,7 @@
1915 </term>
2016 <listitem>
2117 <para>
22− This takes three arguments, <literal>name</literal>,
23− <literal>env</literal>, and <literal>buildCommand</literal>.
24− <literal>name</literal> is just the name that Nix will append to the store
25− path in the same way that <literal>stdenv.mkDerivation</literal> uses its
26− <literal>name</literal> attribute. <literal>env</literal> is an attribute
27− set specifying environment variables that will be set for this derivation.
28− These attributes are then passed to the wrapped
29− <literal>stdenv.mkDerivation</literal>. <literal>buildCommand</literal>
30− specifies the commands that will be run to create this derivation. Note
31− that you will need to create <literal>$out</literal> for Nix to register
32− the command as successful.
18+ This takes three arguments, <literal>name</literal>, <literal>env</literal>, and <literal>buildCommand</literal>. <literal>name</literal> is just the name that Nix will append to the store path in the same way that <literal>stdenv.mkDerivation</literal> uses its <literal>name</literal> attribute. <literal>env</literal> is an attribute set specifying environment variables that will be set for this derivation. These attributes are then passed to the wrapped <literal>stdenv.mkDerivation</literal>. <literal>buildCommand</literal> specifies the commands that will be run to create this derivation. Note that you will need to create <literal>$out</literal> for Nix to register the command as successful.
3319 </para>
3420 <para>
3521 An example of using <literal>runCommand</literal> is provided below.
@@ -62,10 +48,7 @@
6248 </term>
6349 <listitem>
6450 <para>
65− This works just like <literal>runCommand</literal>. The only difference is
66− that it also provides a C compiler in <literal>buildCommand</literal>’s
67− environment. To minimize your dependencies, you should only use this if
68− you are sure you will need a C compiler as part of running your command.
51+ This works just like <literal>runCommand</literal>. The only difference is that it also provides a C compiler in <literal>buildCommand</literal>’s environment. To minimize your dependencies, you should only use this if you are sure you will need a C compiler as part of running your command.
6952 </para>
7053 </listitem>
7154 </varlistentry>
@@ -75,20 +58,10 @@
7558 </term>
7659 <listitem>
7760 <para>
78− These functions write <literal>text</literal> to the Nix store. This is
79− useful for creating scripts from Nix expressions.
80− <literal>writeTextFile</literal> takes an attribute set and expects two
81− arguments, <literal>name</literal> and <literal>text</literal>.
82− <literal>name</literal> corresponds to the name used in the Nix store
83− path. <literal>text</literal> will be the contents of the file. You can
84− also set <literal>executable</literal> to true to make this file have the
85− executable bit set.
61+ These functions write <literal>text</literal> to the Nix store. This is useful for creating scripts from Nix expressions. <literal>writeTextFile</literal> takes an attribute set and expects two arguments, <literal>name</literal> and <literal>text</literal>. <literal>name</literal> corresponds to the name used in the Nix store path. <literal>text</literal> will be the contents of the file. You can also set <literal>executable</literal> to true to make this file have the executable bit set.
8662 </para>
8763 <para>
88− Many more commands wrap <literal>writeTextFile</literal> including
89− <literal>writeText</literal>, <literal>writeTextDir</literal>,
90− <literal>writeScript</literal>, and <literal>writeScriptBin</literal>.
91− These are convenience functions over <literal>writeTextFile</literal>.
64+ Many more commands wrap <literal>writeTextFile</literal> including <literal>writeText</literal>, <literal>writeTextDir</literal>, <literal>writeScript</literal>, and <literal>writeScriptBin</literal>. These are convenience functions over <literal>writeTextFile</literal>.
9265 </para>
9366 </listitem>
9467 </varlistentry>
@@ -98,14 +71,7 @@
9871 </term>
9972 <listitem>
10073 <para>
101− This can be used to put many derivations into the same directory
102− structure. It works by creating a new derivation and adding symlinks to
103− each of the paths listed. It expects two arguments,
104− <literal>name</literal>, and <literal>paths</literal>.
105− <literal>name</literal> is the name used in the Nix store path for the
106− created derivation. <literal>paths</literal> is a list of paths that will
107− be symlinked. These paths can be to Nix store derivations or any other
108− subdirectory contained within.
74+ This can be used to put many derivations into the same directory structure. It works by creating a new derivation and adding symlinks to each of the paths listed. It expects two arguments, <literal>name</literal>, and <literal>paths</literal>. <literal>name</literal> is the name used in the Nix store path for the created derivation. <literal>paths</literal> is a list of paths that will be symlinked. These paths can be to Nix store derivations or any other subdirectory contained within.
10975 </para>
11076 </listitem>
11177 </varlistentry>
doc/languages-frameworks/beam.xml+36−127
@@ -7,12 +7,7 @@
77 <title>Introduction</title>
88
99 <para>
10− In this document and related Nix expressions, we use the term,
11− <emphasis>BEAM</emphasis>, to describe the environment. BEAM is the name of
12− the Erlang Virtual Machine and, as far as we're concerned, from a packaging
13− perspective, all languages that run on the BEAM are interchangeable. That
14− which varies, like the build system, is transparent to users of any given
15− BEAM package, so we make no distinction.
10+ In this document and related Nix expressions, we use the term, <emphasis>BEAM</emphasis>, to describe the environment. BEAM is the name of the Erlang Virtual Machine and, as far as we're concerned, from a packaging perspective, all languages that run on the BEAM are interchangeable. That which varies, like the build system, is transparent to users of any given BEAM package, so we make no distinction.
1611 </para>
1712 </section>
1813
@@ -20,57 +15,36 @@
2015 <title>Structure</title>
2116
2217 <para>
23− All BEAM-related expressions are available via the top-level
24− <literal>beam</literal> attribute, which includes:
18+ All BEAM-related expressions are available via the top-level <literal>beam</literal> attribute, which includes:
2519 </para>
2620
2721 <itemizedlist>
2822 <listitem>
2923 <para>
30− <literal>interpreters</literal>: a set of compilers running on the BEAM,
31− including multiple Erlang/OTP versions
32− (<literal>beam.interpreters.erlangR19</literal>, etc), Elixir
33− (<literal>beam.interpreters.elixir</literal>) and LFE
34− (<literal>beam.interpreters.lfe</literal>).
24+ <literal>interpreters</literal>: a set of compilers running on the BEAM, including multiple Erlang/OTP versions (<literal>beam.interpreters.erlangR19</literal>, etc), Elixir (<literal>beam.interpreters.elixir</literal>) and LFE (<literal>beam.interpreters.lfe</literal>).
3525 </para>
3626 </listitem>
3727 <listitem>
3828 <para>
39− <literal>packages</literal>: a set of package sets, each compiled with a
40− specific Erlang/OTP version, e.g.
41− <literal>beam.packages.erlangR19</literal>.
29+ <literal>packages</literal>: a set of package sets, each compiled with a specific Erlang/OTP version, e.g. <literal>beam.packages.erlangR19</literal>.
4230 </para>
4331 </listitem>
4432 </itemizedlist>
4533
4634 <para>
47− The default Erlang compiler, defined by
48− <literal>beam.interpreters.erlang</literal>, is aliased as
49− <literal>erlang</literal>. The default BEAM package set is defined by
50− <literal>beam.packages.erlang</literal> and aliased at the top level as
51− <literal>beamPackages</literal>.
35+ The default Erlang compiler, defined by <literal>beam.interpreters.erlang</literal>, is aliased as <literal>erlang</literal>. The default BEAM package set is defined by <literal>beam.packages.erlang</literal> and aliased at the top level as <literal>beamPackages</literal>.
5236 </para>
5337
5438 <para>
55− To create a package set built with a custom Erlang version, use the lambda,
56− <literal>beam.packagesWith</literal>, which accepts an Erlang/OTP derivation
57− and produces a package set similar to
58− <literal>beam.packages.erlang</literal>.
39+ To create a package set built with a custom Erlang version, use the lambda, <literal>beam.packagesWith</literal>, which accepts an Erlang/OTP derivation and produces a package set similar to <literal>beam.packages.erlang</literal>.
5940 </para>
6041
6142 <para>
62− Many Erlang/OTP distributions available in
63− <literal>beam.interpreters</literal> have versions with ODBC and/or Java
64− enabled. For example, there's
65− <literal>beam.interpreters.erlangR19_odbc_javac</literal>, which corresponds
66− to <literal>beam.interpreters.erlangR19</literal>.
43+ Many Erlang/OTP distributions available in <literal>beam.interpreters</literal> have versions with ODBC and/or Java enabled. For example, there's <literal>beam.interpreters.erlangR19_odbc_javac</literal>, which corresponds to <literal>beam.interpreters.erlangR19</literal>.
6744 </para>
6845
6946 <para xml:id="erlang-call-package">
70− We also provide the lambda,
71− <literal>beam.packages.erlang.callPackage</literal>, which simplifies
72− writing BEAM package definitions by injecting all packages from
73− <literal>beam.packages.erlang</literal> into the top-level context.
47+ We also provide the lambda, <literal>beam.packages.erlang.callPackage</literal>, which simplifies writing BEAM package definitions by injecting all packages from <literal>beam.packages.erlang</literal> into the top-level context.
7448 </para>
7549 </section>
7650
@@ -81,24 +55,16 @@
8155 <title>Rebar3</title>
8256
8357 <para>
84− By default, Rebar3 wants to manage its own dependencies. This is perfectly
85− acceptable in the normal, non-Nix setup, but in the Nix world, it is not.
86− To rectify this, we provide two versions of Rebar3:
58+ By default, Rebar3 wants to manage its own dependencies. This is perfectly acceptable in the normal, non-Nix setup, but in the Nix world, it is not. To rectify this, we provide two versions of Rebar3:
8759 <itemizedlist>
8860 <listitem>
8961 <para>
90− <literal>rebar3</literal>: patched to remove the ability to download
91− anything. When not running it via <literal>nix-shell</literal> or
92− <literal>nix-build</literal>, it's probably not going to work as
93− desired.
62+ <literal>rebar3</literal>: patched to remove the ability to download anything. When not running it via <literal>nix-shell</literal> or <literal>nix-build</literal>, it's probably not going to work as desired.
9463 </para>
9564 </listitem>
9665 <listitem>
9766 <para>
98− <literal>rebar3-open</literal>: the normal, unmodified Rebar3. It should
99− work exactly as would any other version of Rebar3. Any Erlang package
100− should rely on <literal>rebar3</literal> instead. See
101− <xref
67+ <literal>rebar3-open</literal>: the normal, unmodified Rebar3. It should work exactly as would any other version of Rebar3. Any Erlang package should rely on <literal>rebar3</literal> instead. See <xref
10268 linkend="rebar3-packages"/>.
10369 </para>
10470 </listitem>
@@ -110,10 +76,7 @@
11076 <title>Mix &amp; Erlang.mk</title>
11177
11278 <para>
113− Both Mix and Erlang.mk work exactly as expected. There is a bootstrap
114− process that needs to be run for both, however, which is supported by the
115− <literal>buildMix</literal> and <literal>buildErlangMk</literal>
116− derivations, respectively.
79+ Both Mix and Erlang.mk work exactly as expected. There is a bootstrap process that needs to be run for both, however, which is supported by the <literal>buildMix</literal> and <literal>buildErlangMk</literal> derivations, respectively.
11780 </para>
11881 </section>
11982 </section>
@@ -122,13 +85,7 @@
12285 <title>How to Install BEAM Packages</title>
12386
12487 <para>
125− BEAM packages are not registered at the top level, simply because they are
126− not relevant to the vast majority of Nix users. They are installable using
127− the <literal>beam.packages.erlang</literal> attribute set (aliased as
128− <literal>beamPackages</literal>), which points to packages built by the
129− default Erlang/OTP version in Nixpkgs, as defined by
130− <literal>beam.interpreters.erlang</literal>. To list the available packages
131− in <literal>beamPackages</literal>, use the following command:
88+ BEAM packages are not registered at the top level, simply because they are not relevant to the vast majority of Nix users. They are installable using the <literal>beam.packages.erlang</literal> attribute set (aliased as <literal>beamPackages</literal>), which points to packages built by the default Erlang/OTP version in Nixpkgs, as defined by <literal>beam.interpreters.erlang</literal>. To list the available packages in <literal>beamPackages</literal>, use the following command:
13289 </para>
13390
13491<screen>
@@ -143,8 +100,7 @@ beamPackages.rebar3-pc pc-1.1.0
143100</screen>
144101
145102 <para>
146− To install any of those packages into your profile, refer to them by their
147− attribute path (first column):
103+ To install any of those packages into your profile, refer to them by their attribute path (first column):
148104 </para>
149105
150106<screen>
@@ -152,9 +108,7 @@ beamPackages.rebar3-pc pc-1.1.0
152108</screen>
153109
154110 <para>
155− The attribute path of any BEAM package corresponds to the name of that
156− particular package in <link xlink:href="https://hex.pm">Hex</link> or its
157− OTP Application/Release name.
111+ The attribute path of any BEAM package corresponds to the name of that particular package in <link xlink:href="https://hex.pm">Hex</link> or its OTP Application/Release name.
158112 </para>
159113 </section>
160114
@@ -168,13 +122,8 @@ beamPackages.rebar3-pc pc-1.1.0
168122 <title>Rebar3 Packages</title>
169123
170124 <para>
171− The Nix function, <literal>buildRebar3</literal>, defined in
172− <literal>beam.packages.erlang.buildRebar3</literal> and aliased at the top
173− level, can be used to build a derivation that understands how to build a
174− Rebar3 project. For example, we can build
175− <link
176− xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link>
177− as follows:
125+ The Nix function, <literal>buildRebar3</literal>, defined in <literal>beam.packages.erlang.buildRebar3</literal> and aliased at the top level, can be used to build a derivation that understands how to build a Rebar3 project. For example, we can build <link
126+ xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link> as follows:
178127 </para>
179128
180129<programlisting>
@@ -196,25 +145,16 @@ buildRebar3 rec {
196145</programlisting>
197146
198147 <para>
199− Such derivations are callable with
200− <literal>beam.packages.erlang.callPackage</literal> (see
201− <xref
202− linkend="erlang-call-package"/>). To call this package using
203− the normal <literal>callPackage</literal>, refer to dependency packages
204− via <literal>beamPackages</literal>, e.g.
205− <literal>beamPackages.ibrowse</literal>.
148+ Such derivations are callable with <literal>beam.packages.erlang.callPackage</literal> (see <xref
149+ linkend="erlang-call-package"/>). To call this package using the normal <literal>callPackage</literal>, refer to dependency packages via <literal>beamPackages</literal>, e.g. <literal>beamPackages.ibrowse</literal>.
206150 </para>
207151
208152 <para>
209− Notably, <literal>buildRebar3</literal> includes
210− <literal>beamDeps</literal>, while <literal>stdenv.mkDerivation</literal>
211− does not. BEAM dependencies added there will be correctly handled by the
212− system.
153+ Notably, <literal>buildRebar3</literal> includes <literal>beamDeps</literal>, while <literal>stdenv.mkDerivation</literal> does not. BEAM dependencies added there will be correctly handled by the system.
213154 </para>
214155
215156 <para>
216− If a package needs to compile native code via Rebar3's port compilation
217− mechanism, add <literal>compilePort = true;</literal> to the derivation.
157+ If a package needs to compile native code via Rebar3's port compilation mechanism, add <literal>compilePort = true;</literal> to the derivation.
218158 </para>
219159 </section>
220160
@@ -222,9 +162,7 @@ buildRebar3 rec {
222162 <title>Erlang.mk Packages</title>
223163
224164 <para>
225− Erlang.mk functions similarly to Rebar3, except we use
226− <literal>buildErlangMk</literal> instead of
227− <literal>buildRebar3</literal>.
165+ Erlang.mk functions similarly to Rebar3, except we use <literal>buildErlangMk</literal> instead of <literal>buildRebar3</literal>.
228166 </para>
229167
230168<programlisting>
@@ -257,8 +195,7 @@ buildErlangMk {
257195 <title>Mix Packages</title>
258196
259197 <para>
260− Mix functions similarly to Rebar3, except we use
261− <literal>buildMix</literal> instead of <literal>buildRebar3</literal>.
198+ Mix functions similarly to Rebar3, except we use <literal>buildMix</literal> instead of <literal>buildRebar3</literal>.
262199 </para>
263200
264201<programlisting>
@@ -323,11 +260,7 @@ buildHex {
323260 <title>Accessing an Environment</title>
324261
325262 <para>
326− Often, we simply want to access a valid environment that contains a
327− specific package and its dependencies. We can accomplish that with the
328− <literal>env</literal> attribute of a derivation. For example, let's say we
329− want to access an Erlang REPL with <literal>ibrowse</literal> loaded up. We
330− could do the following:
263+ Often, we simply want to access a valid environment that contains a specific package and its dependencies. We can accomplish that with the <literal>env</literal> attribute of a derivation. For example, let's say we want to access an Erlang REPL with <literal>ibrowse</literal> loaded up. We could do the following:
331264 </para>
332265
333266<screen>
@@ -373,8 +306,7 @@ ok</computeroutput>
373306</screen>
374307
375308 <para>
376− Notice the <literal>-A beamPackages.ibrowse.env</literal>. That is the key
377− to this functionality.
309+ Notice the <literal>-A beamPackages.ibrowse.env</literal>. That is the key to this functionality.
378310 </para>
379311 </section>
380312
@@ -382,11 +314,7 @@ ok</computeroutput>
382314 <title>Creating a Shell</title>
383315
384316 <para>
385− Getting access to an environment often isn't enough to do real development.
386− Usually, we need to create a <literal>shell.nix</literal> file and do our
387− development inside of the environment specified therein. This file looks a
388− lot like the packaging described above, except that <literal>src</literal>
389− points to the project root and we call the package directly.
317+ Getting access to an environment often isn't enough to do real development. Usually, we need to create a <literal>shell.nix</literal> file and do our development inside of the environment specified therein. This file looks a lot like the packaging described above, except that <literal>src</literal> points to the project root and we call the package directly.
390318 </para>
391319
392320<programlisting>
@@ -414,8 +342,7 @@ in
414342 <title>Building in a Shell (for Mix Projects)</title>
415343
416344 <para>
417− We can leverage the support of the derivation, irrespective of the build
418− derivation, by calling the commands themselves.
345+ We can leverage the support of the derivation, irrespective of the build derivation, by calling the commands themselves.
419346 </para>
420347
421348<programlisting>
@@ -477,12 +404,8 @@ analyze: build plt
477404</programlisting>
478405
479406 <para>
480− Using a <literal>shell.nix</literal> as described (see
481− <xref
482− linkend="creating-a-shell"/>) should just work. Aside from
483− <literal>test</literal>, <literal>plt</literal>, and
484− <literal>analyze</literal>, the Make targets work just fine for all of the
485− build derivations.
407+ Using a <literal>shell.nix</literal> as described (see <xref
408+ linkend="creating-a-shell"/>) should just work. Aside from <literal>test</literal>, <literal>plt</literal>, and <literal>analyze</literal>, the Make targets work just fine for all of the build derivations.
486409 </para>
487410 </section>
488411 </section>
@@ -492,25 +415,14 @@ analyze: build plt
492415 <title>Generating Packages from Hex with <literal>hex2nix</literal></title>
493416
494417 <para>
495− Updating the <link xlink:href="https://hex.pm">Hex</link> package set
496− requires
497− <link
498− xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link>.
499− Given the path to the Erlang modules (usually
500− <literal>pkgs/development/erlang-modules</literal>), it will dump a file
501− called <literal>hex-packages.nix</literal>, containing all the packages that
502− use a recognized build system in
503− <link
504− xlink:href="https://hex.pm">Hex</link>. It can't be determined,
505− however, whether every package is buildable.
418+ Updating the <link xlink:href="https://hex.pm">Hex</link> package set requires <link
419+ xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link>. Given the path to the Erlang modules (usually <literal>pkgs/development/erlang-modules</literal>), it will dump a file called <literal>hex-packages.nix</literal>, containing all the packages that use a recognized build system in <link
420+ xlink:href="https://hex.pm">Hex</link>. It can't be determined, however, whether every package is buildable.
506421 </para>
507422
508423 <para>
509− To make life easier for our users, try to build every
510− <link
511− xlink:href="https://hex.pm">Hex</link> package and remove those
512− that fail. To do that, simply run the following command in the root of your
513− <literal>nixpkgs</literal> repository:
424+ To make life easier for our users, try to build every <link
425+ xlink:href="https://hex.pm">Hex</link> package and remove those that fail. To do that, simply run the following command in the root of your <literal>nixpkgs</literal> repository:
514426 </para>
515427
516428<screen>
@@ -518,11 +430,8 @@ analyze: build plt
518430</screen>
519431
520432 <para>
521− That will attempt to build every package in <literal>beamPackages</literal>.
522− Then manually remove those that fail. Hopefully, someone will improve
523− <link
524− xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link>
525− in the future to automate the process.
433+ That will attempt to build every package in <literal>beamPackages</literal>. Then manually remove those that fail. Hopefully, someone will improve <link
434+ xlink:href="https://github.com/erlang-nix/hex2nix">hex2nix</link> in the future to automate the process.
526435 </para>
527436 </section>
528437</section>
doc/languages-frameworks/bower.xml+19−52
@@ -4,32 +4,22 @@
44 <title>Bower</title>
55
66 <para>
7− <link xlink:href="http://bower.io">Bower</link> is a package manager for web
8− site front-end components. Bower packages (comprising of build artefacts and
9− sometimes sources) are stored in <command>git</command> repositories,
10− typically on Github. The package registry is run by the Bower team with
11− package metadata coming from the <filename>bower.json</filename> file within
12− each package.
7+ <link xlink:href="http://bower.io">Bower</link> is a package manager for web site front-end components. Bower packages (comprising of build artefacts and sometimes sources) are stored in <command>git</command> repositories, typically on Github. The package registry is run by the Bower team with package metadata coming from the <filename>bower.json</filename> file within each package.
138 </para>
149
1510 <para>
16− The end result of running Bower is a <filename>bower_components</filename>
17− directory which can be included in the web app's build process.
11+ The end result of running Bower is a <filename>bower_components</filename> directory which can be included in the web app's build process.
1812 </para>
1913
2014 <para>
21− Bower can be run interactively, by installing
22− <varname>nodePackages.bower</varname>. More interestingly, the Bower
23− components can be declared in a Nix derivation, with the help of
24− <varname>nodePackages.bower2nix</varname>.
15+ Bower can be run interactively, by installing <varname>nodePackages.bower</varname>. More interestingly, the Bower components can be declared in a Nix derivation, with the help of <varname>nodePackages.bower2nix</varname>.
2516 </para>
2617
2718 <section xml:id="ssec-bower2nix-usage">
2819 <title><command>bower2nix</command> usage</title>
2920
3021 <para>
31− Suppose you have a <filename>bower.json</filename> with the following
32− contents:
22+ Suppose you have a <filename>bower.json</filename> with the following contents:
3323 <example xml:id="ex-bowerJson">
3424 <title><filename>bower.json</filename></title>
3525<programlisting language="json">
@@ -45,8 +35,7 @@
4535 </para>
4636
4737 <para>
48− Running <command>bower2nix</command> will produce something like the
49− following output:
38+ Running <command>bower2nix</command> will produce something like the following output:
5039<programlisting language="nix">
5140<![CDATA[{ fetchbower, buildEnv }:
5241buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
@@ -58,15 +47,11 @@ buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
5847 </para>
5948
6049 <para>
61− Using the <command>bower2nix</command> command line arguments, the output
62− can be redirected to a file. A name like
63− <filename>bower-packages.nix</filename> would be fine.
50+ Using the <command>bower2nix</command> command line arguments, the output can be redirected to a file. A name like <filename>bower-packages.nix</filename> would be fine.
6451 </para>
6552
6653 <para>
67− The resulting derivation is a union of all the downloaded Bower packages
68− (and their dependencies). To use it, they still need to be linked together
69− by Bower, which is where <varname>buildBowerComponents</varname> is useful.
54+ The resulting derivation is a union of all the downloaded Bower packages (and their dependencies). To use it, they still need to be linked together by Bower, which is where <varname>buildBowerComponents</varname> is useful.
7055 </para>
7156 </section>
7257
@@ -74,10 +59,7 @@ buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
7459 <title><varname>buildBowerComponents</varname> function</title>
7560
7661 <para>
77− The function is implemented in
78− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/bower-modules/generic/default.nix">
79− <filename>pkgs/development/bower-modules/generic/default.nix</filename></link>.
80− Example usage:
62+ The function is implemented in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/bower-modules/generic/default.nix"> <filename>pkgs/development/bower-modules/generic/default.nix</filename></link>. Example usage:
8163 <example xml:id="ex-buildBowerComponents">
8264 <title>buildBowerComponents</title>
8365<programlisting language="nix">
@@ -91,34 +73,27 @@ bowerComponents = buildBowerComponents {
9173 </para>
9274
9375 <para>
94− In <xref linkend="ex-buildBowerComponents" />, the following arguments are
95− of special significance to the function:
76+ In <xref linkend="ex-buildBowerComponents" />, the following arguments are of special significance to the function:
9677 <calloutlist>
9778 <callout arearefs="ex-buildBowerComponents-1">
9879 <para>
99− <varname>generated</varname> specifies the file which was created by
100− <command>bower2nix</command>.
80+ <varname>generated</varname> specifies the file which was created by <command>bower2nix</command>.
10181 </para>
10282 </callout>
10383 <callout arearefs="ex-buildBowerComponents-2">
10484 <para>
105− <varname>src</varname> is your project's sources. It needs to contain a
106− <filename>bower.json</filename> file.
85+ <varname>src</varname> is your project's sources. It needs to contain a <filename>bower.json</filename> file.
10786 </para>
10887 </callout>
10988 </calloutlist>
11089 </para>
11190
11291 <para>
113− <varname>buildBowerComponents</varname> will run Bower to link together the
114− output of <command>bower2nix</command>, resulting in a
115− <filename>bower_components</filename> directory which can be used.
92+ <varname>buildBowerComponents</varname> will run Bower to link together the output of <command>bower2nix</command>, resulting in a <filename>bower_components</filename> directory which can be used.
11693 </para>
11794
11895 <para>
119− Here is an example of a web frontend build process using
120− <command>gulp</command>. You might use <command>grunt</command>, or anything
121− else.
96+ Here is an example of a web frontend build process using <command>gulp</command>. You might use <command>grunt</command>, or anything else.
12297 </para>
12398
12499 <example xml:id="ex-bowerGulpFile">
@@ -174,21 +149,17 @@ pkgs.stdenv.mkDerivation {
174149 <calloutlist>
175150 <callout arearefs="ex-buildBowerComponentsDefault-1">
176151 <para>
177− The result of <varname>buildBowerComponents</varname> is an input to the
178− frontend build.
152+ The result of <varname>buildBowerComponents</varname> is an input to the frontend build.
179153 </para>
180154 </callout>
181155 <callout arearefs="ex-buildBowerComponentsDefault-2">
182156 <para>
183− Whether to symlink or copy the <filename>bower_components</filename>
184− directory depends on the build tool in use. In this case a copy is used
185− to avoid <command>gulp</command> silliness with permissions.
157+ Whether to symlink or copy the <filename>bower_components</filename> directory depends on the build tool in use. In this case a copy is used to avoid <command>gulp</command> silliness with permissions.
186158 </para>
187159 </callout>
188160 <callout arearefs="ex-buildBowerComponentsDefault-3">
189161 <para>
190− <command>gulp</command> requires <varname>HOME</varname> to refer to a
191− writeable directory.
162+ <command>gulp</command> requires <varname>HOME</varname> to refer to a writeable directory.
192163 </para>
193164 </callout>
194165 <callout arearefs="ex-buildBowerComponentsDefault-4">
@@ -210,17 +181,13 @@ pkgs.stdenv.mkDerivation {
210181 </term>
211182 <listitem>
212183 <para>
213− This means that Bower was looking for a package version which doesn't
214− exist in the generated <filename>bower-packages.nix</filename>.
184+ This means that Bower was looking for a package version which doesn't exist in the generated <filename>bower-packages.nix</filename>.
215185 </para>
216186 <para>
217− If <filename>bower.json</filename> has been updated, then run
218− <command>bower2nix</command> again.
187+ If <filename>bower.json</filename> has been updated, then run <command>bower2nix</command> again.
219188 </para>
220189 <para>
221− It could also be a bug in <command>bower2nix</command> or
222− <command>fetchbower</command>. If possible, try reformulating the version
223− specification in <filename>bower.json</filename>.
190+ It could also be a bug in <command>bower2nix</command> or <command>fetchbower</command>. If possible, try reformulating the version specification in <filename>bower.json</filename>.
224191 </para>
225192 </listitem>
226193 </varlistentry>
doc/languages-frameworks/coq.xml+4−16
@@ -4,31 +4,19 @@
44 <title>Coq</title>
55
66 <para>
7− Coq libraries should be installed in
8− <literal>$(out)/lib/coq/${coq.coq-version}/user-contrib/</literal>. Such
9− directories are automatically added to the <literal>$COQPATH</literal>
10− environment variable by the hook defined in the Coq derivation.
7+ Coq libraries should be installed in <literal>$(out)/lib/coq/${coq.coq-version}/user-contrib/</literal>. Such directories are automatically added to the <literal>$COQPATH</literal> environment variable by the hook defined in the Coq derivation.
118 </para>
129
1310 <para>
14− Some extensions (plugins) might require OCaml and sometimes other OCaml
15− packages. The <literal>coq.ocamlPackages</literal> attribute can be used to
16− depend on the same package set Coq was built against.
11+ Some extensions (plugins) might require OCaml and sometimes other OCaml packages. The <literal>coq.ocamlPackages</literal> attribute can be used to depend on the same package set Coq was built against.
1712 </para>
1813
1914 <para>
20− Coq libraries may be compatible with some specific versions of Coq only. The
21− <literal>compatibleCoqVersions</literal> attribute is used to precisely
22− select those versions of Coq that are compatible with this derivation.
15+ Coq libraries may be compatible with some specific versions of Coq only. The <literal>compatibleCoqVersions</literal> attribute is used to precisely select those versions of Coq that are compatible with this derivation.
2316 </para>
2417
2518 <para>
26− Here is a simple package example. It is a pure Coq library, thus it depends
27− on Coq. It builds on the Mathematical Components library, thus it also takes
28− <literal>mathcomp</literal> as <literal>buildInputs</literal>. Its
29− <literal>Makefile</literal> has been generated using
30− <literal>coq_makefile</literal> so we only have to set the
31− <literal>$COQLIB</literal> variable at install time.
19+ Here is a simple package example. It is a pure Coq library, thus it depends on Coq. It builds on the Mathematical Components library, thus it also takes <literal>mathcomp</literal> as <literal>buildInputs</literal>. Its <literal>Makefile</literal> has been generated using <literal>coq_makefile</literal> so we only have to set the <literal>$COQLIB</literal> variable at install time.
3220 </para>
3321
3422<programlisting>
doc/languages-frameworks/gnome.xml+30−155
@@ -5,53 +5,26 @@
55 <title>Packaging GNOME applications</title>
66
77 <para>
8− Programs in the GNOME universe are written in various languages but they all
9− use GObject-based libraries like GLib, GTK or GStreamer. These libraries are
10− often modular, relying on looking into certain directories to find their
11− modules. However, due to Nix’s specific file system organization, this
12− will fail without our intervention. Fortunately, the libraries usually allow
13− overriding the directories through environment variables, either natively or
14− thanks to a patch in nixpkgs.
15− <link xlink:href="#fun-wrapProgram">Wrapping</link> the executables to
16− ensure correct paths are available to the application constitutes a
17− significant part of packaging a modern desktop application. In this section,
18− we will describe various modules needed by such applications, environment
19− variables needed to make the modules load, and finally a script that will do
20− the work for us.
8+ Programs in the GNOME universe are written in various languages but they all use GObject-based libraries like GLib, GTK or GStreamer. These libraries are often modular, relying on looking into certain directories to find their modules. However, due to Nix’s specific file system organization, this will fail without our intervention. Fortunately, the libraries usually allow overriding the directories through environment variables, either natively or thanks to a patch in nixpkgs. <link xlink:href="#fun-wrapProgram">Wrapping</link> the executables to ensure correct paths are available to the application constitutes a significant part of packaging a modern desktop application. In this section, we will describe various modules needed by such applications, environment variables needed to make the modules load, and finally a script that will do the work for us.
219 </para>
2210
2311 <section xml:id="ssec-gnome-settings">
2412 <title>Settings</title>
2513
2614 <para>
27− <link xlink:href="https://developer.gnome.org/gio/stable/GSettings.html">GSettings</link>
28− API is often used for storing settings. GSettings schemas are required, to
29− know the type and other metadata of the stored values. GLib looks for
30− <filename>glib-2.0/schemas/gschemas.compiled</filename> files inside the
31− directories of <envar>XDG_DATA_DIRS</envar>.
15+ <link xlink:href="https://developer.gnome.org/gio/stable/GSettings.html">GSettings</link> API is often used for storing settings. GSettings schemas are required, to know the type and other metadata of the stored values. GLib looks for <filename>glib-2.0/schemas/gschemas.compiled</filename> files inside the directories of <envar>XDG_DATA_DIRS</envar>.
3216 </para>
3317
3418 <para>
35− On Linux, GSettings API is implemented using
36− <link xlink:href="https://wiki.gnome.org/Projects/dconf">dconf</link>
37− backend. You will need to add <literal>dconf</literal> GIO module to
38− <envar>GIO_EXTRA_MODULES</envar> variable, otherwise the
39− <literal>memory</literal> backend will be used and the saved settings will
40− not be persistent.
19+ On Linux, GSettings API is implemented using <link xlink:href="https://wiki.gnome.org/Projects/dconf">dconf</link> backend. You will need to add <literal>dconf</literal> GIO module to <envar>GIO_EXTRA_MODULES</envar> variable, otherwise the <literal>memory</literal> backend will be used and the saved settings will not be persistent.
4120 </para>
4221
4322 <para>
44− Last you will need the dconf database D-Bus service itself. You can enable
45− it using <option>programs.dconf.enable</option>.
23+ Last you will need the dconf database D-Bus service itself. You can enable it using <option>programs.dconf.enable</option>.
4624 </para>
4725
4826 <para>
49− Some applications will also require
50− <package>gsettings-desktop-schemas</package> for things like reading proxy
51− configuration or user interface customization. This dependency is often not
52− mentioned by upstream, you should grep for
53− <literal>org.gnome.desktop</literal> and
54− <literal>org.gnome.system</literal> to see if the schemas are needed.
27+ Some applications will also require <package>gsettings-desktop-schemas</package> for things like reading proxy configuration or user interface customization. This dependency is often not mentioned by upstream, you should grep for <literal>org.gnome.desktop</literal> and <literal>org.gnome.system</literal> to see if the schemas are needed.
5528 </para>
5629 </section>
5730
@@ -59,16 +32,7 @@
5932 <title>Icons</title>
6033
6134 <para>
62− When an application uses icons, an icon theme should be available in
63− <envar>XDG_DATA_DIRS</envar>. The package for the default, icon-less
64− <link xlink:href="https://www.freedesktop.org/wiki/Software/icon-theme/">hicolor-icon-theme</link>
65− contains <link linkend="ssec-gnome-hooks-hicolor-icon-theme">a setup
66− hook</link> that will pick up icon themes from
67− <literal>buildInputs</literal> and pass it to our wrapper. Unfortunately,
68− relying on that would mean every user has to download the theme included in
69− the package expression no matter their preference. For that reason, we
70− leave the installation of icon theme on the user. If you use one of the
71− desktop environments, you probably already have an icon theme installed.
35+ When an application uses icons, an icon theme should be available in <envar>XDG_DATA_DIRS</envar>. The package for the default, icon-less <link xlink:href="https://www.freedesktop.org/wiki/Software/icon-theme/">hicolor-icon-theme</link> contains <link linkend="ssec-gnome-hooks-hicolor-icon-theme">a setup hook</link> that will pick up icon themes from <literal>buildInputs</literal> and pass it to our wrapper. Unfortunately, relying on that would mean every user has to download the theme included in the package expression no matter their preference. For that reason, we leave the installation of icon theme on the user. If you use one of the desktop environments, you probably already have an icon theme installed.
7236 </para>
7337 </section>
7438
@@ -76,12 +40,7 @@
7640 <title>GTK Themes</title>
7741
7842 <para>
79− Previously, a GTK theme needed to be in <envar>XDG_DATA_DIRS</envar>. This
80− is no longer necessary for most programs since GTK incorporated Adwaita
81− theme. Some programs (for example, those designed for
82− <link xlink:href="https://elementary.io/docs/human-interface-guidelines#human-interface-guidelines">elementary
83− HIG</link>) might require a special theme like
84− <package>pantheon.elementary-gtk-theme</package>.
43+ Previously, a GTK theme needed to be in <envar>XDG_DATA_DIRS</envar>. This is no longer necessary for most programs since GTK incorporated Adwaita theme. Some programs (for example, those designed for <link xlink:href="https://elementary.io/docs/human-interface-guidelines#human-interface-guidelines">elementary HIG</link>) might require a special theme like <package>pantheon.elementary-gtk-theme</package>.
8544 </para>
8645 </section>
8746
@@ -89,10 +48,7 @@
8948 <title>GObject introspection typelibs</title>
9049
9150 <para>
92− <link xlink:href="https://wiki.gnome.org/Projects/GObjectIntrospection">GObject
93− introspection</link> allows applications to use C libraries in other
94− languages easily. It does this through <literal>typelib</literal> files
95− searched in <envar>GI_TYPELIB_PATH</envar>.
51+ <link xlink:href="https://wiki.gnome.org/Projects/GObjectIntrospection">GObject introspection</link> allows applications to use C libraries in other languages easily. It does this through <literal>typelib</literal> files searched in <envar>GI_TYPELIB_PATH</envar>.
9652 </para>
9753 </section>
9854
@@ -100,11 +56,7 @@
10056 <title>Various plug-ins</title>
10157
10258 <para>
103− If your application uses
104− <link xlink:href="https://gstreamer.freedesktop.org/">GStreamer</link> or
105− <link xlink:href="https://wiki.gnome.org/Projects/Grilo">Grilo</link>, you
106− should set <envar>GST_PLUGIN_SYSTEM_PATH_1_0</envar> and
107− <envar>GRL_PLUGIN_PATH</envar>, respectively.
59+ If your application uses <link xlink:href="https://gstreamer.freedesktop.org/">GStreamer</link> or <link xlink:href="https://wiki.gnome.org/Projects/Grilo">Grilo</link>, you should set <envar>GST_PLUGIN_SYSTEM_PATH_1_0</envar> and <envar>GRL_PLUGIN_PATH</envar>, respectively.
10860 </para>
10961 </section>
11062 </section>
@@ -113,8 +65,7 @@
11365 <title>Onto <package>wrapGAppsHook</package></title>
11466
11567 <para>
116− Given the requirements above, the package expression would become messy
117− quickly:
68+ Given the requirements above, the package expression would become messy quickly:
11869<programlisting>
11970preFixup = ''
12071 for f in $(find $out/bin/ $out/libexec/ -type f -executable); do
@@ -128,76 +79,48 @@ preFixup = ''
12879 done
12980'';
13081</programlisting>
131− Fortunately, there is <package>wrapGAppsHook</package>, that does the
132− wrapping for us. In particular, it works in conjunction with other setup
133− hooks that will populate the variable:
82+ Fortunately, there is <package>wrapGAppsHook</package>, that does the wrapping for us. In particular, it works in conjunction with other setup hooks that will populate the variable:
13483 <itemizedlist>
13584 <listitem xml:id="ssec-gnome-hooks-wrapgappshook">
13685 <para>
137− <package>wrapGAppsHook</package> itself will add the package’s
138− <filename>share</filename> directory to <envar>XDG_DATA_DIRS</envar>.
86+ <package>wrapGAppsHook</package> itself will add the package’s <filename>share</filename> directory to <envar>XDG_DATA_DIRS</envar>.
13987 </para>
14088 </listitem>
14189 <listitem xml:id="ssec-gnome-hooks-glib">
14290 <para>
143− <package>glib</package> setup hook will populate
144− <envar>GSETTINGS_SCHEMAS_PATH</envar> and then
145− <package>wrapGAppsHook</package> will prepend it to
146− <envar>XDG_DATA_DIRS</envar>.
91+ <package>glib</package> setup hook will populate <envar>GSETTINGS_SCHEMAS_PATH</envar> and then <package>wrapGAppsHook</package> will prepend it to <envar>XDG_DATA_DIRS</envar>.
14792 </para>
14893 </listitem>
14994 <listitem xml:id="ssec-gnome-hooks-dconf">
15095 <para>
151− <package>gnome3.dconf.lib</package> is a dependency of
152− <package>wrapGAppsHook</package>, which then also adds it to the
153− <envar>GIO_EXTRA_MODULES</envar> variable.
96+ <package>gnome3.dconf.lib</package> is a dependency of <package>wrapGAppsHook</package>, which then also adds it to the <envar>GIO_EXTRA_MODULES</envar> variable.
15497 </para>
15598 </listitem>
15699 <listitem xml:id="ssec-gnome-hooks-hicolor-icon-theme">
157100 <para>
158− <package>hicolor-icon-theme</package>’s setup hook will add icon themes
159− to <envar>XDG_ICON_DIRS</envar> which is prepended to
160− <envar>XDG_DATA_DIRS</envar> by <package>wrapGAppsHook</package>.
101+ <package>hicolor-icon-theme</package>’s setup hook will add icon themes to <envar>XDG_ICON_DIRS</envar> which is prepended to <envar>XDG_DATA_DIRS</envar> by <package>wrapGAppsHook</package>.
161102 </para>
162103 </listitem>
163104 <listitem xml:id="ssec-gnome-hooks-gobject-introspection">
164105 <para>
165− <package>gobject-introspection</package> setup hook populates
166− <envar>GI_TYPELIB_PATH</envar> variable with
167− <filename>lib/girepository-1.0</filename> directories of dependencies,
168− which is then added to wrapper by <package>wrapGAppsHook</package>. It
169− also adds <filename>share</filename> directories of dependencies to
170− <envar>XDG_DATA_DIRS</envar>, which is intended to promote GIR files but
171− it also
172− <link xlink:href="https://github.com/NixOS/nixpkgs/issues/32790">pollutes
173− the closures</link> of packages using <package>wrapGAppsHook</package>.
106+ <package>gobject-introspection</package> setup hook populates <envar>GI_TYPELIB_PATH</envar> variable with <filename>lib/girepository-1.0</filename> directories of dependencies, which is then added to wrapper by <package>wrapGAppsHook</package>. It also adds <filename>share</filename> directories of dependencies to <envar>XDG_DATA_DIRS</envar>, which is intended to promote GIR files but it also <link xlink:href="https://github.com/NixOS/nixpkgs/issues/32790">pollutes the closures</link> of packages using <package>wrapGAppsHook</package>.
174107 </para>
175108 <warning>
176109 <para>
177− The setup hook
178− <link xlink:href="https://github.com/NixOS/nixpkgs/issues/56943">currently</link>
179− does not work in expressions with <literal>strictDeps</literal> enabled,
180− like Python packages. In those cases, you will need to disable it with
181− <code>strictDeps = false;</code>.
110+ The setup hook <link xlink:href="https://github.com/NixOS/nixpkgs/issues/56943">currently</link> does not work in expressions with <literal>strictDeps</literal> enabled, like Python packages. In those cases, you will need to disable it with <code>strictDeps = false;</code>.
182111 </para>
183112 </warning>
184113 </listitem>
185114 <listitem xml:id="ssec-gnome-hooks-gst-grl-plugins">
186115 <para>
187− Setup hooks of <package>gst_all_1.gstreamer</package> and
188− <package>gnome3.grilo</package> will populate the
189− <envar>GST_PLUGIN_SYSTEM_PATH_1_0</envar> and
190− <envar>GRL_PLUGIN_PATH</envar> variables, respectively, which will then
191− be added to the wrapper by <literal>wrapGAppsHook</literal>.
116+ Setup hooks of <package>gst_all_1.gstreamer</package> and <package>gnome3.grilo</package> will populate the <envar>GST_PLUGIN_SYSTEM_PATH_1_0</envar> and <envar>GRL_PLUGIN_PATH</envar> variables, respectively, which will then be added to the wrapper by <literal>wrapGAppsHook</literal>.
192117 </para>
193118 </listitem>
194119 </itemizedlist>
195120 </para>
196121
197122 <para>
198− You can also pass additional arguments to <literal>makeWrapper</literal>
199− using <literal>gappsWrapperArgs</literal> in <literal>preFixup</literal>
200− hook:
123+ You can also pass additional arguments to <literal>makeWrapper</literal> using <literal>gappsWrapperArgs</literal> in <literal>preFixup</literal> hook:
201124<programlisting>
202125preFixup = ''
203126 gappsWrapperArgs+=(
@@ -215,13 +138,7 @@ preFixup = ''
215138 <title>Updating GNOME packages</title>
216139
217140 <para>
218− Most GNOME package offer
219− <link linkend="var-passthru-updateScript"><literal>updateScript</literal></link>,
220− it is therefore possible to update to latest source tarball by running
221− <command>nix-shell maintainers/scripts/update.nix --argstr package
222− gnome3.nautilus</command> or even en masse with <command>nix-shell
223− maintainers/scripts/update.nix --argstr path gnome3</command>. Read the
224− package’s <filename>NEWS</filename> file to see what changed.
141+ Most GNOME package offer <link linkend="var-passthru-updateScript"><literal>updateScript</literal></link>, it is therefore possible to update to latest source tarball by running <command>nix-shell maintainers/scripts/update.nix --argstr package gnome3.nautilus</command> or even en masse with <command>nix-shell maintainers/scripts/update.nix --argstr path gnome3</command>. Read the package’s <filename>NEWS</filename> file to see what changed.
225142 </para>
226143 </section>
227144
@@ -235,17 +152,7 @@ preFixup = ''
235152 </term>
236153 <listitem>
237154 <para>
238− There are no schemas avalable in <envar>XDG_DATA_DIRS</envar>.
239− Temporarily add a random package containing schemas like
240− <package>gsettings-desktop-schemas</package> to
241− <literal>buildInputs</literal>.
242− <link linkend="ssec-gnome-hooks-glib"><package>glib</package></link> and
243− <link linkend="ssec-gnome-hooks-wrapgappshook"><package>wrapGAppsHook</package></link>
244− setup hooks will take care of making the schemas available to application
245− and you will see the actual missing schemas with the
246− <link linkend="ssec-gnome-common-issues-missing-schema">next
247− error</link>. Or you can try looking through the source code for the
248− actual schemas used.
155+ There are no schemas avalable in <envar>XDG_DATA_DIRS</envar>. Temporarily add a random package containing schemas like <package>gsettings-desktop-schemas</package> to <literal>buildInputs</literal>. <link linkend="ssec-gnome-hooks-glib"><package>glib</package></link> and <link linkend="ssec-gnome-hooks-wrapgappshook"><package>wrapGAppsHook</package></link> setup hooks will take care of making the schemas available to application and you will see the actual missing schemas with the <link linkend="ssec-gnome-common-issues-missing-schema">next error</link>. Or you can try looking through the source code for the actual schemas used.
249156 </para>
250157 </listitem>
251158 </varlistentry>
@@ -255,11 +162,7 @@ preFixup = ''
255162 </term>
256163 <listitem>
257164 <para>
258− Package is missing some GSettings schemas. You can find out the package
259− containing the schema with <command>nix-locate
260− <replaceable>org.gnome.foo</replaceable>.gschema.xml</command> and let
261− the hooks handle the wrapping as
262− <link linkend="ssec-gnome-common-issues-no-schemas">above</link>.
165+ Package is missing some GSettings schemas. You can find out the package containing the schema with <command>nix-locate <replaceable>org.gnome.foo</replaceable>.gschema.xml</command> and let the hooks handle the wrapping as <link linkend="ssec-gnome-common-issues-no-schemas">above</link>.
263166 </para>
264167 </listitem>
265168 </varlistentry>
@@ -269,14 +172,7 @@ preFixup = ''
269172 </term>
270173 <listitem>
271174 <para>
272− This is because derivers like
273− <function>python.pkgs.buildPythonApplication</function> or
274− <function>qt5.mkDerivation</function> have setup-hooks automatically
275− added that produce wrappers with <package>makeWrapper</package>. The
276− simplest way to workaround that is to disable the
277− <package>wrapGAppsHook</package> automatic wrapping with
278− <code>dontWrapGApps = true;</code> and pass the arguments it intended to
279− pass to <package>makeWrapper</package> to another.
175+ This is because derivers like <function>python.pkgs.buildPythonApplication</function> or <function>qt5.mkDerivation</function> have setup-hooks automatically added that produce wrappers with <package>makeWrapper</package>. The simplest way to workaround that is to disable the <package>wrapGAppsHook</package> automatic wrapping with <code>dontWrapGApps = true;</code> and pass the arguments it intended to pass to <package>makeWrapper</package> to another.
280176 </para>
281177 <para>
282178 In the case of a Python application it could look like:
@@ -328,55 +224,34 @@ mkDerivation {
328224 </term>
329225 <listitem>
330226 <para>
331− You can rely on applications depending on the library set the necessary
332− environment variables but that it often easy to miss. Instead we
333− recommend to patch the paths in the source code whenever possible. Here
334− are some examples:
227+ You can rely on applications depending on the library set the necessary environment variables but that it often easy to miss. Instead we recommend to patch the paths in the source code whenever possible. Here are some examples:
335228 <itemizedlist>
336229 <listitem xml:id="ssec-gnome-common-issues-unwrappable-package-gnome-shell-ext">
337230 <para>
338− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/7bb8f05f12ca3cff9da72b56caa2f7472d5732bc/pkgs/desktops/gnome-3/core/gnome-shell-extensions/default.nix#L21-L24">Replacing
339− a <envar>GI_TYPELIB_PATH</envar> in GNOME Shell extension</link> –
340− we are using <function>substituteAll</function> to include the path to
341− a typelib into a patch.
231+ <link xlink:href="https://github.com/NixOS/nixpkgs/blob/7bb8f05f12ca3cff9da72b56caa2f7472d5732bc/pkgs/desktops/gnome-3/core/gnome-shell-extensions/default.nix#L21-L24">Replacing a <envar>GI_TYPELIB_PATH</envar> in GNOME Shell extension</link> – we are using <function>substituteAll</function> to include the path to a typelib into a patch.
342232 </para>
343233 </listitem>
344234 <listitem xml:id="ssec-gnome-common-issues-unwrappable-package-gsettings">
345235 <para>
346− The following examples are hardcoding GSettings schema paths. To get
347− the schema paths we use the functions
236+ The following examples are hardcoding GSettings schema paths. To get the schema paths we use the functions
348237 <itemizedlist>
349238 <listitem>
350239 <para>
351− <function>glib.getSchemaPath</function> Takes a nix package
352− attribute as an argument.
240+ <function>glib.getSchemaPath</function> Takes a nix package attribute as an argument.
353241 </para>
354242 </listitem>
355243 <listitem>
356244 <para>
357− <function>glib.makeSchemaPath</function> Takes a package output
358− like <literal>$out</literal> and a derivation name. You should use
359− this if the schemas you need to hardcode are in the same
360− derivation.
245+ <function>glib.makeSchemaPath</function> Takes a package output like <literal>$out</literal> and a derivation name. You should use this if the schemas you need to hardcode are in the same derivation.
361246 </para>
362247 </listitem>
363248 </itemizedlist>
364249 </para>
365250 <para xml:id="ssec-gnome-common-issues-unwrappable-package-gsettings-vala">
366− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/7bb8f05f12ca3cff9da72b56caa2f7472d5732bc/pkgs/desktops/pantheon/apps/elementary-files/default.nix#L78-L86">Hard-coding
367− GSettings schema path in Vala plug-in (dynamically loaded
368− library)</link> – here, <function>substituteAll</function> cannot be
369− used since the schema comes from the same package preventing us from
370− pass its path to the function, probably due to a
371− <link xlink:href="https://github.com/NixOS/nix/issues/1846">Nix
372− bug</link>.
251+ <link xlink:href="https://github.com/NixOS/nixpkgs/blob/7bb8f05f12ca3cff9da72b56caa2f7472d5732bc/pkgs/desktops/pantheon/apps/elementary-files/default.nix#L78-L86">Hard-coding GSettings schema path in Vala plug-in (dynamically loaded library)</link> – here, <function>substituteAll</function> cannot be used since the schema comes from the same package preventing us from pass its path to the function, probably due to a <link xlink:href="https://github.com/NixOS/nix/issues/1846">Nix bug</link>.
373252 </para>
374253 <para xml:id="ssec-gnome-common-issues-unwrappable-package-gsettings-c">
375− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/29c120c065d03b000224872251bed93932d42412/pkgs/development/libraries/glib-networking/default.nix#L31-L34">Hard-coding
376− GSettings schema path in C library</link> – nothing special other
377− than using
378− <link xlink:href="https://github.com/NixOS/nixpkgs/pull/67957#issuecomment-527717467">Coccinelle
379− patch</link> to generate the patch itself.
254+ <link xlink:href="https://github.com/NixOS/nixpkgs/blob/29c120c065d03b000224872251bed93932d42412/pkgs/development/libraries/glib-networking/default.nix#L31-L34">Hard-coding GSettings schema path in C library</link> – nothing special other than using <link xlink:href="https://github.com/NixOS/nixpkgs/pull/67957#issuecomment-527717467">Coccinelle patch</link> to generate the patch itself.
380255 </para>
381256 </listitem>
382257 </itemizedlist>
doc/languages-frameworks/go.xml+19−54
@@ -7,21 +7,16 @@
77 <title>Go modules</title>
88
99 <para>
10− The function <varname> buildGoModule </varname> builds Go programs managed
11− with Go modules. It builds a
12− <link xlink:href="https://github.com/golang/go/wiki/Modules">Go
13− modules</link> through a two phase build:
10+ The function <varname> buildGoModule </varname> builds Go programs managed with Go modules. It builds a <link xlink:href="https://github.com/golang/go/wiki/Modules">Go modules</link> through a two phase build:
1411 <itemizedlist>
1512 <listitem>
1613 <para>
17− An intermediate fetcher derivation. This derivation will be used to fetch
18− all of the dependencies of the Go module.
14+ An intermediate fetcher derivation. This derivation will be used to fetch all of the dependencies of the Go module.
1915 </para>
2016 </listitem>
2117 <listitem>
2218 <para>
23− A final derivation will use the output of the intermediate derivation to
24− build the binaries and produce the final output.
19+ A final derivation will use the output of the intermediate derivation to build the binaries and produce the final output.
2520 </para>
2621 </listitem>
2722 </itemizedlist>
@@ -57,21 +52,16 @@ pet = buildGoModule rec {
5752 </example>
5853
5954 <para>
60− <xref linkend='ex-buildGoModule'/> is an example expression using
61− buildGoModule, the following arguments are of special significance to the
62− function:
55+ <xref linkend='ex-buildGoModule'/> is an example expression using buildGoModule, the following arguments are of special significance to the function:
6356 <calloutlist>
6457 <callout arearefs='ex-buildGoModule-1'>
6558 <para>
66− <varname>modSha256</varname> is the hash of the output of the
67− intermediate fetcher derivation.
59+ <varname>modSha256</varname> is the hash of the output of the intermediate fetcher derivation.
6860 </para>
6961 </callout>
7062 <callout arearefs='ex-buildGoModule-2'>
7163 <para>
72− <varname>subPackages</varname> limits the builder from building child
73− packages that have not been listed. If <varname>subPackages</varname> is
74− not specified, all child packages will be built.
64+ <varname>subPackages</varname> limits the builder from building child packages that have not been listed. If <varname>subPackages</varname> is not specified, all child packages will be built.
7565 </para>
7666 </callout>
7767 </calloutlist>
@@ -82,8 +72,7 @@ pet = buildGoModule rec {
8272 <title>Go legacy</title>
8373
8474 <para>
85− The function <varname> buildGoPackage </varname> builds legacy Go programs,
86− not supporting Go modules.
75+ The function <varname> buildGoPackage </varname> builds legacy Go programs, not supporting Go modules.
8776 </para>
8877
8978 <example xml:id='ex-buildGoPackage'>
@@ -111,49 +100,36 @@ deis = buildGoPackage rec {
111100 </example>
112101
113102 <para>
114− <xref linkend='ex-buildGoPackage'/> is an example expression using
115− buildGoPackage, the following arguments are of special significance to the
116− function:
103+ <xref linkend='ex-buildGoPackage'/> is an example expression using buildGoPackage, the following arguments are of special significance to the function:
117104 <calloutlist>
118105 <callout arearefs='ex-buildGoPackage-1'>
119106 <para>
120− <varname>goPackagePath</varname> specifies the package's canonical Go
121− import path.
107+ <varname>goPackagePath</varname> specifies the package's canonical Go import path.
122108 </para>
123109 </callout>
124110 <callout arearefs='ex-buildGoPackage-2'>
125111 <para>
126− <varname>subPackages</varname> limits the builder from building child
127− packages that have not been listed. If <varname>subPackages</varname> is
128− not specified, all child packages will be built.
112+ <varname>subPackages</varname> limits the builder from building child packages that have not been listed. If <varname>subPackages</varname> is not specified, all child packages will be built.
129113 </para>
130114 <para>
131− In this example only <literal>github.com/deis/deis/client</literal> will
132− be built.
115+ In this example only <literal>github.com/deis/deis/client</literal> will be built.
133116 </para>
134117 </callout>
135118 <callout arearefs='ex-buildGoPackage-3'>
136119 <para>
137− <varname>goDeps</varname> is where the Go dependencies of a Go program
138− are listed as a list of package source identified by Go import path. It
139− could be imported as a separate <varname>deps.nix</varname> file for
140− readability. The dependency data structure is described below.
120+ <varname>goDeps</varname> is where the Go dependencies of a Go program are listed as a list of package source identified by Go import path. It could be imported as a separate <varname>deps.nix</varname> file for readability. The dependency data structure is described below.
141121 </para>
142122 </callout>
143123 <callout arearefs='ex-buildGoPackage-4'>
144124 <para>
145− <varname>buildFlags</varname> is a list of flags passed to the go build
146− command.
125+ <varname>buildFlags</varname> is a list of flags passed to the go build command.
147126 </para>
148127 </callout>
149128 </calloutlist>
150129 </para>
151130
152131 <para>
153− The <varname>goDeps</varname> attribute can be imported from a separate
154− <varname>nix</varname> file that defines which Go libraries are needed and
155− should be included in <varname>GOPATH</varname> for
156− <varname>buildPhase</varname>.
132+ The <varname>goDeps</varname> attribute can be imported from a separate <varname>nix</varname> file that defines which Go libraries are needed and should be included in <varname>GOPATH</varname> for <varname>buildPhase</varname>.
157133 </para>
158134
159135 <example xml:id='ex-goDeps'>
@@ -196,27 +172,18 @@ deis = buildGoPackage rec {
196172 </callout>
197173 <callout arearefs='ex-goDeps-3'>
198174 <para>
199− <varname>fetch type</varname> that needs to be used to get package
200− source. If <varname>git</varname> is used there should be
201− <varname>url</varname>, <varname>rev</varname> and
202− <varname>sha256</varname> defined next to it.
175+ <varname>fetch type</varname> that needs to be used to get package source. If <varname>git</varname> is used there should be <varname>url</varname>, <varname>rev</varname> and <varname>sha256</varname> defined next to it.
203176 </para>
204177 </callout>
205178 </calloutlist>
206179 </para>
207180
208181 <para>
209− To extract dependency information from a Go package in automated way use
210− <link xlink:href="https://github.com/kamilchm/go2nix">go2nix</link>. It can
211− produce complete derivation and <varname>goDeps</varname> file for Go
212− programs.
182+ To extract dependency information from a Go package in automated way use <link xlink:href="https://github.com/kamilchm/go2nix">go2nix</link>. It can produce complete derivation and <varname>goDeps</varname> file for Go programs.
213183 </para>
214184
215185 <para>
216− <varname>buildGoPackage</varname> produces
217− <xref linkend='chap-multiple-output' xrefstyle="select: title" /> where
218− <varname>bin</varname> includes program binaries. You can test build a Go
219− binary as follows:
186+ <varname>buildGoPackage</varname> produces <xref linkend='chap-multiple-output' xrefstyle="select: title" /> where <varname>bin</varname> includes program binaries. You can test build a Go binary as follows:
220187<screen>
221188<prompt>$ </prompt>nix-build -A deis.bin
222189</screen>
@@ -224,13 +191,11 @@ deis = buildGoPackage rec {
224191<screen>
225192<prompt>$ </prompt>nix-build -A deis.all
226193</screen>
227− <varname>bin</varname> output will be installed by default with
228− <varname>nix-env -i</varname> or <varname>systemPackages</varname>.
194+ <varname>bin</varname> output will be installed by default with <varname>nix-env -i</varname> or <varname>systemPackages</varname>.
229195 </para>
230196
231197 <para>
232− You may use Go packages installed into the active Nix profiles by adding the
233− following to your ~/.bashrc:
198+ You may use Go packages installed into the active Nix profiles by adding the following to your ~/.bashrc:
234199<screen>
235200for p in $NIX_PROFILES; do
236201 GOPATH="$p/share/go:$GOPATH"
doc/languages-frameworks/index.xml+1−6
@@ -3,12 +3,7 @@
33 xml:id="chap-language-support">
44 <title>Support for specific programming languages and frameworks</title>
55 <para>
6− The <link linkend="chap-stdenv">standard build environment</link> makes it
7− easy to build typical Autotools-based packages with very little code. Any
8− other kind of package can be accomodated by overriding the appropriate phases
9− of <literal>stdenv</literal>. However, there are specialised functions in
10− Nixpkgs to easily build packages for other programming languages, such as
11− Perl or Haskell. These are described in this chapter.
6+ The <link linkend="chap-stdenv">standard build environment</link> makes it easy to build typical Autotools-based packages with very little code. Any other kind of package can be accomodated by overriding the appropriate phases of <literal>stdenv</literal>. However, there are specialised functions in Nixpkgs to easily build packages for other programming languages, such as Perl or Haskell. These are described in this chapter.
127 </para>
138 <xi:include href="android.section.xml" />
149 <xi:include href="beam.xml" />
doc/languages-frameworks/java.xml+9−31
@@ -15,37 +15,24 @@ stdenv.mkDerivation {
1515 buildPhase = "ant";
1616}
1717</programlisting>
18− Note that <varname>jdk</varname> is an alias for the OpenJDK (self-built
19− where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in
20− Nixpkgs (<literal>Aarch32</literal>, <literal>Aarch64</literal>) point to the
21− (unfree) <literal>oraclejdk</literal>.
18+ Note that <varname>jdk</varname> is an alias for the OpenJDK (self-built where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs (<literal>Aarch32</literal>, <literal>Aarch64</literal>) point to the (unfree) <literal>oraclejdk</literal>.
2219 </para>
2320
2421 <para>
25− JAR files that are intended to be used by other packages should be installed
26− in <filename>$out/share/java</filename>. JDKs have a stdenv setup hook that
27− add any JARs in the <filename>share/java</filename> directories of the build
28− inputs to the <envar>CLASSPATH</envar> environment variable. For instance, if
29− the package <literal>libfoo</literal> installs a JAR named
30− <filename>foo.jar</filename> in its <filename>share/java</filename>
31− directory, and another package declares the attribute
22+ JAR files that are intended to be used by other packages should be installed in <filename>$out/share/java</filename>. JDKs have a stdenv setup hook that add any JARs in the <filename>share/java</filename> directories of the build inputs to the <envar>CLASSPATH</envar> environment variable. For instance, if the package <literal>libfoo</literal> installs a JAR named <filename>foo.jar</filename> in its <filename>share/java</filename> directory, and another package declares the attribute
3223<programlisting>
3324buildInputs = [ libfoo ];
3425nativeBuildInputs = [ jdk ];
3526</programlisting>
36− then <envar>CLASSPATH</envar> will be set to
37− <filename>/nix/store/...-libfoo/share/java/foo.jar</filename>.
27+ then <envar>CLASSPATH</envar> will be set to <filename>/nix/store/...-libfoo/share/java/foo.jar</filename>.
3828 </para>
3929
4030 <para>
41− Private JARs should be installed in a location like
42− <filename>$out/share/<replaceable>package-name</replaceable></filename>.
31+ Private JARs should be installed in a location like <filename>$out/share/<replaceable>package-name</replaceable></filename>.
4332 </para>
4433
4534 <para>
46− If your Java package provides a program, you need to generate a wrapper
47− script to run it using the OpenJRE. You can use
48− <literal>makeWrapper</literal> for this:
35+ If your Java package provides a program, you need to generate a wrapper script to run it using the OpenJRE. You can use <literal>makeWrapper</literal> for this:
4936<programlisting>
5037nativeBuildInputs = [ makeWrapper ];
5138
@@ -56,30 +43,21 @@ installPhase =
5643 --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
5744 '';
5845</programlisting>
59− Note the use of <literal>jre</literal>, which is the part of the OpenJDK
60− package that contains the Java Runtime Environment. By using
61− <literal>${jre}/bin/java</literal> instead of
62− <literal>${jdk}/bin/java</literal>, you prevent your package from depending
63− on the JDK at runtime.
46+ Note the use of <literal>jre</literal>, which is the part of the OpenJDK package that contains the Java Runtime Environment. By using <literal>${jre}/bin/java</literal> instead of <literal>${jdk}/bin/java</literal>, you prevent your package from depending on the JDK at runtime.
6447 </para>
6548
6649 <para>
67− Note all JDKs passthru <literal>home</literal>, so if your application
68− requires environment variables like <envar>JAVA_HOME</envar> being set, that
69− can be done in a generic fashion with the <literal>--set</literal> argument
70− of <literal>makeWrapper</literal>:
50+ Note all JDKs passthru <literal>home</literal>, so if your application requires environment variables like <envar>JAVA_HOME</envar> being set, that can be done in a generic fashion with the <literal>--set</literal> argument of <literal>makeWrapper</literal>:
7151<programlisting>
7252--set JAVA_HOME ${jdk.home}
7353</programlisting>
7454 </para>
7555
7656 <para>
77− It is possible to use a different Java compiler than <command>javac</command>
78− from the OpenJDK. For instance, to use the GNU Java Compiler:
57+ It is possible to use a different Java compiler than <command>javac</command> from the OpenJDK. For instance, to use the GNU Java Compiler:
7958<programlisting>
8059nativeBuildInputs = [ gcj ant ];
8160</programlisting>
82− Here, Ant will automatically use <command>gij</command> (the GNU Java
83− Runtime) instead of the OpenJRE.
61+ Here, Ant will automatically use <command>gij</command> (the GNU Java Runtime) instead of the OpenJRE.
8462 </para>
8563</section>
doc/languages-frameworks/lua.xml+4−16
@@ -4,18 +4,11 @@
44 <title>Lua</title>
55
66 <para>
7− Lua packages are built by the <varname>buildLuaPackage</varname> function.
8− This function is implemented in
9− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules/generic/default.nix">
10− <filename>pkgs/development/lua-modules/generic/default.nix</filename></link>
11− and works similarly to <varname>buildPerlPackage</varname>. (See
12− <xref linkend="sec-language-perl"/> for details.)
7+ Lua packages are built by the <varname>buildLuaPackage</varname> function. This function is implemented in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules/generic/default.nix"> <filename>pkgs/development/lua-modules/generic/default.nix</filename></link> and works similarly to <varname>buildPerlPackage</varname>. (See <xref linkend="sec-language-perl"/> for details.)
138 </para>
149
1510 <para>
16− Lua packages are defined in
17− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/lua-packages.nix"><filename>pkgs/top-level/lua-packages.nix</filename></link>.
18− Most of them are simple. For example:
11+ Lua packages are defined in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/lua-packages.nix"><filename>pkgs/top-level/lua-packages.nix</filename></link>. Most of them are simple. For example:
1912<programlisting>
2013fileSystem = buildLuaPackage {
2114 name = "filesystem-1.6.2";
@@ -33,16 +26,11 @@ fileSystem = buildLuaPackage {
3326 </para>
3427
3528 <para>
36− Though, more complicated package should be placed in a seperate file in
37− <link
29+ Though, more complicated package should be placed in a seperate file in <link
3830 xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules"><filename>pkgs/development/lua-modules</filename></link>.
3931 </para>
4032
4133 <para>
42− Lua packages accept additional parameter <varname>disabled</varname>, which
43− defines the condition of disabling package from luaPackages. For example, if
44− package has <varname>disabled</varname> assigned to <literal>lua.luaversion
45− != "5.1"</literal>, it will not be included in any luaPackages except
46− lua51Packages, making it only be built for lua 5.1.
34+ Lua packages accept additional parameter <varname>disabled</varname>, which defines the condition of disabling package from luaPackages. For example, if package has <varname>disabled</varname> assigned to <literal>lua.luaversion != "5.1"</literal>, it will not be included in any luaPackages except lua51Packages, making it only be built for lua 5.1.
4735 </para>
4836</section>
doc/languages-frameworks/ocaml.xml+4−28
@@ -4,35 +4,15 @@
44 <title>OCaml</title>
55
66 <para>
7− OCaml libraries should be installed in
8− <literal>$(out)/lib/ocaml/${ocaml.version}/site-lib/</literal>. Such
9− directories are automatically added to the <literal>$OCAMLPATH</literal>
10− environment variable when building another package that depends on them or
11− when opening a <literal>nix-shell</literal>.
7+ OCaml libraries should be installed in <literal>$(out)/lib/ocaml/${ocaml.version}/site-lib/</literal>. Such directories are automatically added to the <literal>$OCAMLPATH</literal> environment variable when building another package that depends on them or when opening a <literal>nix-shell</literal>.
128 </para>
139
1410 <para>
15− Given that most of the OCaml ecosystem is now built with dune, nixpkgs
16− includes a convenience build support function called
17− <literal>buildDunePackage</literal> that will build an OCaml package using
18− dune, OCaml and findlib and any additional dependencies provided as
19− <literal>buildInputs</literal> or <literal>propagatedBuildInputs</literal>.
11+ Given that most of the OCaml ecosystem is now built with dune, nixpkgs includes a convenience build support function called <literal>buildDunePackage</literal> that will build an OCaml package using dune, OCaml and findlib and any additional dependencies provided as <literal>buildInputs</literal> or <literal>propagatedBuildInputs</literal>.
2012 </para>
2113
2214 <para>
23− Here is a simple package example. It defines an (optional) attribute
24− <literal>minimumOCamlVersion</literal> that will be used to throw a
25− descriptive evaluation error if building with an older OCaml is attempted. It
26− uses the <literal>fetchFromGitHub</literal> fetcher to get its source. It
27− sets the <literal>doCheck</literal> (optional) attribute to
28− <literal>true</literal> which means that tests will be run with <literal>dune
29− runtest -p angstrom</literal> after the build (<literal>dune build -p
30− angstrom</literal>) is complete. It uses <literal>alcotest</literal> as a
31− build input (because it is needed to run the tests) and
32− <literal>bigstringaf</literal> and <literal>result</literal> as propagated
33− build inputs (thus they will also be available to libraries depending on this
34− library). The library will be installed using the
35− <literal>angstrom.install</literal> file that dune generates.
15+ Here is a simple package example. It defines an (optional) attribute <literal>minimumOCamlVersion</literal> that will be used to throw a descriptive evaluation error if building with an older OCaml is attempted. It uses the <literal>fetchFromGitHub</literal> fetcher to get its source. It sets the <literal>doCheck</literal> (optional) attribute to <literal>true</literal> which means that tests will be run with <literal>dune runtest -p angstrom</literal> after the build (<literal>dune build -p angstrom</literal>) is complete. It uses <literal>alcotest</literal> as a build input (because it is needed to run the tests) and <literal>bigstringaf</literal> and <literal>result</literal> as propagated build inputs (thus they will also be available to libraries depending on this library). The library will be installed using the <literal>angstrom.install</literal> file that dune generates.
3616 </para>
3717
3818<programlisting>
@@ -65,11 +45,7 @@ buildDunePackage rec {
6545</programlisting>
6646
6747 <para>
68− Here is a second example, this time using a source archive generated with
69− <literal>dune-release</literal>. It is a good idea to use this archive when
70− it is available as it will usually contain substituted variables such as a
71− <literal>%%VERSION%%</literal> field. This library does not depend on any
72− other OCaml library and no tests are run after building it.
48+ Here is a second example, this time using a source archive generated with <literal>dune-release</literal>. It is a good idea to use this archive when it is available as it will usually contain substituted variables such as a <literal>%%VERSION%%</literal> field. This library does not depend on any other OCaml library and no tests are run after building it.
7349 </para>
7450
7551<programlisting>
doc/languages-frameworks/perl.xml+18−80
@@ -4,24 +4,13 @@
44 <title>Perl</title>
55
66 <para>
7− Nixpkgs provides a function <varname>buildPerlPackage</varname>, a generic
8− package builder function for any Perl package that has a standard
9− <varname>Makefile.PL</varname>. It’s implemented in
10− <link
7+ Nixpkgs provides a function <varname>buildPerlPackage</varname>, a generic package builder function for any Perl package that has a standard <varname>Makefile.PL</varname>. It’s implemented in <link
118xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/perl-modules/generic"><filename>pkgs/development/perl-modules/generic</filename></link>.
129 </para>
1310
1411 <para>
15− Perl packages from CPAN are defined in
16− <link
17−xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix"><filename>pkgs/top-level/perl-packages.nix</filename></link>,
18− rather than <filename>pkgs/all-packages.nix</filename>. Most Perl packages
19− are so straight-forward to build that they are defined here directly, rather
20− than having a separate function for each package called from
21− <filename>perl-packages.nix</filename>. However, more complicated packages
22− should be put in a separate file, typically in
23− <filename>pkgs/development/perl-modules</filename>. Here is an example of the
24− former:
12+ Perl packages from CPAN are defined in <link
13+xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix"><filename>pkgs/top-level/perl-packages.nix</filename></link>, rather than <filename>pkgs/all-packages.nix</filename>. Most Perl packages are so straight-forward to build that they are defined here directly, rather than having a separate function for each package called from <filename>perl-packages.nix</filename>. However, more complicated packages should be put in a separate file, typically in <filename>pkgs/development/perl-modules</filename>. Here is an example of the former:
2514<programlisting>
2615ClassC3 = buildPerlPackage rec {
2716 name = "Class-C3-0.21";
@@ -31,32 +20,22 @@ ClassC3 = buildPerlPackage rec {
3120 };
3221};
3322</programlisting>
34− Note the use of <literal>mirror://cpan/</literal>, and the
35− <literal>${name}</literal> in the URL definition to ensure that the name
36− attribute is consistent with the source that we’re actually downloading.
37− Perl packages are made available in <filename>all-packages.nix</filename>
38− through the variable <varname>perlPackages</varname>. For instance, if you
39− have a package that needs <varname>ClassC3</varname>, you would typically
40− write
23+ Note the use of <literal>mirror://cpan/</literal>, and the <literal>${name}</literal> in the URL definition to ensure that the name attribute is consistent with the source that we’re actually downloading. Perl packages are made available in <filename>all-packages.nix</filename> through the variable <varname>perlPackages</varname>. For instance, if you have a package that needs <varname>ClassC3</varname>, you would typically write
4124<programlisting>
4225foo = import ../path/to/foo.nix {
4326 inherit stdenv fetchurl ...;
4427 inherit (perlPackages) ClassC3;
4528};
4629</programlisting>
47− in <filename>all-packages.nix</filename>. You can test building a Perl
48− package as follows:
30+ in <filename>all-packages.nix</filename>. You can test building a Perl package as follows:
4931<screen>
5032<prompt>$ </prompt>nix-build -A perlPackages.ClassC3
5133</screen>
52− <varname>buildPerlPackage</varname> adds <literal>perl-</literal> to the
53− start of the name attribute, so the package above is actually called
54− <literal>perl-Class-C3-0.21</literal>. So to install it, you can say:
34+ <varname>buildPerlPackage</varname> adds <literal>perl-</literal> to the start of the name attribute, so the package above is actually called <literal>perl-Class-C3-0.21</literal>. So to install it, you can say:
5535<screen>
5636<prompt>$ </prompt>nix-env -i perl-Class-C3
5737</screen>
58− (Of course you can also install using the attribute name: <literal>nix-env -i
59− -A perlPackages.ClassC3</literal>.)
38+ (Of course you can also install using the attribute name: <literal>nix-env -i -A perlPackages.ClassC3</literal>.)
6039 </para>
6140
6241 <para>
@@ -64,40 +43,24 @@ foo = import ../path/to/foo.nix {
6443 <orderedlist>
6544 <listitem>
6645 <para>
67− In the configure phase, it calls <literal>perl Makefile.PL</literal> to
68− generate a Makefile. You can set the variable
69− <varname>makeMakerFlags</varname> to pass flags to
70− <filename>Makefile.PL</filename>
46+ In the configure phase, it calls <literal>perl Makefile.PL</literal> to generate a Makefile. You can set the variable <varname>makeMakerFlags</varname> to pass flags to <filename>Makefile.PL</filename>
7147 </para>
7248 </listitem>
7349 <listitem>
7450 <para>
75− It adds the contents of the <envar>PERL5LIB</envar> environment variable
76− to <literal>#! .../bin/perl</literal> line of Perl scripts as
77− <literal>-I<replaceable>dir</replaceable></literal> flags. This ensures
78− that a script can find its dependencies. (This can cause this shebang line
79− to become too long for Darwin to handle; see the note below.)
51+ It adds the contents of the <envar>PERL5LIB</envar> environment variable to <literal>#! .../bin/perl</literal> line of Perl scripts as <literal>-I<replaceable>dir</replaceable></literal> flags. This ensures that a script can find its dependencies. (This can cause this shebang line to become too long for Darwin to handle; see the note below.)
8052 </para>
8153 </listitem>
8254 <listitem>
8355 <para>
84− In the fixup phase, it writes the propagated build inputs
85− (<varname>propagatedBuildInputs</varname>) to the file
86− <filename>$out/nix-support/propagated-user-env-packages</filename>.
87− <command>nix-env</command> recursively installs all packages listed in
88− this file when you install a package that has it. This ensures that a Perl
89− package can find its dependencies.
56+ In the fixup phase, it writes the propagated build inputs (<varname>propagatedBuildInputs</varname>) to the file <filename>$out/nix-support/propagated-user-env-packages</filename>. <command>nix-env</command> recursively installs all packages listed in this file when you install a package that has it. This ensures that a Perl package can find its dependencies.
9057 </para>
9158 </listitem>
9259 </orderedlist>
9360 </para>
9461
9562 <para>
96− <varname>buildPerlPackage</varname> is built on top of
97− <varname>stdenv</varname>, so everything can be customised in the usual way.
98− For instance, the <literal>BerkeleyDB</literal> module has a
99− <varname>preConfigure</varname> hook to generate a configuration file used by
100− <filename>Makefile.PL</filename>:
63+ <varname>buildPerlPackage</varname> is built on top of <varname>stdenv</varname>, so everything can be customised in the usual way. For instance, the <literal>BerkeleyDB</literal> module has a <varname>preConfigure</varname> hook to generate a configuration file used by <filename>Makefile.PL</filename>:
10164<programlisting>
10265{ buildPerlPackage, fetchurl, db }:
10366
@@ -118,12 +81,7 @@ buildPerlPackage rec {
11881 </para>
11982
12083 <para>
121− Dependencies on other Perl packages can be specified in the
122− <varname>buildInputs</varname> and <varname>propagatedBuildInputs</varname>
123− attributes. If something is exclusively a build-time dependency, use
124− <varname>buildInputs</varname>; if it’s (also) a runtime dependency, use
125− <varname>propagatedBuildInputs</varname>. For instance, this builds a Perl
126− module that has runtime dependencies on a bunch of other modules:
84+ Dependencies on other Perl packages can be specified in the <varname>buildInputs</varname> and <varname>propagatedBuildInputs</varname> attributes. If something is exclusively a build-time dependency, use <varname>buildInputs</varname>; if it’s (also) a runtime dependency, use <varname>propagatedBuildInputs</varname>. For instance, this builds a Perl module that has runtime dependencies on a bunch of other modules:
12785<programlisting>
12886ClassC3Componentised = buildPerlPackage rec {
12987 name = "Class-C3-Componentised-1.0004";
@@ -139,11 +97,7 @@ ClassC3Componentised = buildPerlPackage rec {
13997 </para>
14098
14199 <para>
142− On Darwin, if a script has too many
143− <literal>-I<replaceable>dir</replaceable></literal> flags in its first line
144− (its “shebang line”), it will not run. This can be worked around by
145− calling the <literal>shortenPerlShebang</literal> function from the
146− <literal>postInstall</literal> phase:
100+ On Darwin, if a script has too many <literal>-I<replaceable>dir</replaceable></literal> flags in its first line (its “shebang line”), it will not run. This can be worked around by calling the <literal>shortenPerlShebang</literal> function from the <literal>postInstall</literal> phase:
147101<programlisting>
148102{ stdenv, buildPerlPackage, fetchurl, shortenPerlShebang }:
149103
@@ -162,20 +116,14 @@ ImageExifTool = buildPerlPackage {
162116 '';
163117};
164118</programlisting>
165− This will remove the <literal>-I</literal> flags from the shebang line,
166− rewrite them in the <literal>use lib</literal> form, and put them on the next
167− line instead. This function can be given any number of Perl scripts as
168− arguments; it will modify them in-place.
119+ This will remove the <literal>-I</literal> flags from the shebang line, rewrite them in the <literal>use lib</literal> form, and put them on the next line instead. This function can be given any number of Perl scripts as arguments; it will modify them in-place.
169120 </para>
170121
171122 <section xml:id="ssec-generation-from-CPAN">
172123 <title>Generation from CPAN</title>
173124
174125 <para>
175− Nix expressions for Perl packages can be generated (almost) automatically
176− from CPAN. This is done by the program
177− <command>nix-generate-from-cpan</command>, which can be installed as
178− follows:
126+ Nix expressions for Perl packages can be generated (almost) automatically from CPAN. This is done by the program <command>nix-generate-from-cpan</command>, which can be installed as follows:
179127 </para>
180128
181129<screen>
@@ -183,9 +131,7 @@ ImageExifTool = buildPerlPackage {
183131</screen>
184132
185133 <para>
186− This program takes a Perl module name, looks it up on CPAN, fetches and
187− unpacks the corresponding package, and prints a Nix expression on standard
188− output. For example:
134+ This program takes a Perl module name, looks it up on CPAN, fetches and unpacks the corresponding package, and prints a Nix expression on standard output. For example:
189135<screen>
190136<prompt>$ </prompt>nix-generate-from-cpan XML::Simple
191137 XMLSimple = buildPerlPackage rec {
@@ -201,9 +147,7 @@ ImageExifTool = buildPerlPackage {
201147 };
202148 };
203149</screen>
204− The output can be pasted into
205− <filename>pkgs/top-level/perl-packages.nix</filename> or wherever else you
206− need it.
150+ The output can be pasted into <filename>pkgs/top-level/perl-packages.nix</filename> or wherever else you need it.
207151 </para>
208152 </section>
209153
@@ -211,13 +155,7 @@ ImageExifTool = buildPerlPackage {
211155 <title>Cross-compiling modules</title>
212156
213157 <para>
214− Nixpkgs has experimental support for cross-compiling Perl modules. In many
215− cases, it will just work out of the box, even for modules with native
216− extensions. Sometimes, however, the Makefile.PL for a module may
217− (indirectly) import a native module. In that case, you will need to make a
218− stub for that module that will satisfy the Makefile.PL and install it into
219− <filename>lib/perl5/site_perl/cross_perl/${perl.version}</filename>. See the
220− <varname>postInstall</varname> for <varname>DBI</varname> for an example.
158+ Nixpkgs has experimental support for cross-compiling Perl modules. In many cases, it will just work out of the box, even for modules with native extensions. Sometimes, however, the Makefile.PL for a module may (indirectly) import a native module. In that case, you will need to make a stub for that module that will satisfy the Makefile.PL and install it into <filename>lib/perl5/site_perl/cross_perl/${perl.version}</filename>. See the <varname>postInstall</varname> for <varname>DBI</varname> for an example.
221159 </para>
222160 </section>
223161</section>
doc/languages-frameworks/qt.xml+13−47
@@ -4,11 +4,7 @@
44 <title>Qt</title>
55
66 <para>
7− This section describes the differences between Nix expressions for Qt
8− libraries and applications and Nix expressions for other C++ software. Some
9− knowledge of the latter is assumed. There are primarily two problems which
10− the Qt infrastructure is designed to address: ensuring consistent versioning
11− of all dependencies and finding dependencies at runtime.
7+ This section describes the differences between Nix expressions for Qt libraries and applications and Nix expressions for other C++ software. Some knowledge of the latter is assumed. There are primarily two problems which the Qt infrastructure is designed to address: ensuring consistent versioning of all dependencies and finding dependencies at runtime.
128 </para>
139
1410 <example xml:id='qt-default-nix'>
@@ -28,38 +24,26 @@ mkDerivation { <co xml:id='qt-default-nix-co-2' />
2824 <calloutlist>
2925 <callout arearefs='qt-default-nix-co-1'>
3026 <para>
31− Import <literal>mkDerivation</literal> and Qt (such as
32− <literal>qtbase</literal> modules directly. <emphasis>Do not</emphasis>
33− import Qt package sets; the Qt versions of dependencies may not be
34− coherent, causing build and runtime failures.
27+ Import <literal>mkDerivation</literal> and Qt (such as <literal>qtbase</literal> modules directly. <emphasis>Do not</emphasis> import Qt package sets; the Qt versions of dependencies may not be coherent, causing build and runtime failures.
3528 </para>
3629 </callout>
3730 <callout arearefs='qt-default-nix-co-2'>
3831 <para>
39− Use <literal>mkDerivation</literal> instead of
40− <literal>stdenv.mkDerivation</literal>. <literal>mkDerivation</literal> is
41− a wrapper around <literal>stdenv.mkDerivation</literal> which applies some
42− Qt-specific settings. This deriver accepts the same arguments as
43− <literal>stdenv.mkDerivation</literal>; refer to
44− <xref linkend='chap-stdenv' /> for details.
32+ Use <literal>mkDerivation</literal> instead of <literal>stdenv.mkDerivation</literal>. <literal>mkDerivation</literal> is a wrapper around <literal>stdenv.mkDerivation</literal> which applies some Qt-specific settings. This deriver accepts the same arguments as <literal>stdenv.mkDerivation</literal>; refer to <xref linkend='chap-stdenv' /> for details.
4533 </para>
4634 <para>
47− To use another deriver instead of <literal>stdenv.mkDerivation</literal>,
48− use <literal>mkDerivationWith</literal>:
35+ To use another deriver instead of <literal>stdenv.mkDerivation</literal>, use <literal>mkDerivationWith</literal>:
4936<programlisting>
5037mkDerivationWith myDeriver {
5138 # ...
5239}
5340</programlisting>
54− If you cannot use <literal>mkDerivationWith</literal>, please refer to
55− <xref linkend='qt-runtime-dependencies' />.
41+ If you cannot use <literal>mkDerivationWith</literal>, please refer to <xref linkend='qt-runtime-dependencies' />.
5642 </para>
5743 </callout>
5844 <callout arearefs='qt-default-nix-co-3'>
5945 <para>
60− <literal>mkDerivation</literal> accepts the same arguments as
61− <literal>stdenv.mkDerivation</literal>, such as
62− <literal>buildInputs</literal>.
46+ <literal>mkDerivation</literal> accepts the same arguments as <literal>stdenv.mkDerivation</literal>, such as <literal>buildInputs</literal>.
6347 </para>
6448 </callout>
6549 </calloutlist>
@@ -67,10 +51,7 @@ mkDerivationWith myDeriver {
6751 <formalpara xml:id='qt-runtime-dependencies'>
6852 <title>Locating runtime dependencies</title>
6953 <para>
70− Qt applications need to be wrapped to find runtime dependencies. If you
71− cannot use <literal>mkDerivation</literal> or
72− <literal>mkDerivationWith</literal> above, include
73− <literal>wrapQtAppsHook</literal> in <literal>nativeBuildInputs</literal>:
54+ Qt applications need to be wrapped to find runtime dependencies. If you cannot use <literal>mkDerivation</literal> or <literal>mkDerivationWith</literal> above, include <literal>wrapQtAppsHook</literal> in <literal>nativeBuildInputs</literal>:
7455<programlisting>
7556stdenv.mkDerivation {
7657 # ...
@@ -82,9 +63,7 @@ stdenv.mkDerivation {
8263 </formalpara>
8364
8465 <para>
85− Entries added to <literal>qtWrapperArgs</literal> are used to modify the
86− wrappers created by <literal>wrapQtAppsHook</literal>. The entries are passed
87− as arguments to <xref linkend='fun-wrapProgram' />.
66+ Entries added to <literal>qtWrapperArgs</literal> are used to modify the wrappers created by <literal>wrapQtAppsHook</literal>. The entries are passed as arguments to <xref linkend='fun-wrapProgram' />.
8867<programlisting>
8968mkDerivation {
9069 # ...
@@ -95,10 +74,7 @@ mkDerivation {
9574 </para>
9675
9776 <para>
98− Set <literal>dontWrapQtApps</literal> to stop applications from being wrapped
99− automatically. It is required to wrap applications manually with
100− <literal>wrapQtApp</literal>, using the syntax of
101− <xref linkend='fun-wrapProgram' />:
77+ Set <literal>dontWrapQtApps</literal> to stop applications from being wrapped automatically. It is required to wrap applications manually with <literal>wrapQtApp</literal>, using the syntax of <xref linkend='fun-wrapProgram' />:
10278<programlisting>
10379mkDerivation {
10480 # ...
@@ -113,17 +89,12 @@ mkDerivation {
11389
11490 <note>
11591 <para>
116− <literal>wrapQtAppsHook</literal> ignores files that are non-ELF
117− executables. This means that scripts won't be automatically wrapped so
118− you'll need to manually wrap them as previously mentioned. An example of
119− when you'd always need to do this is with Python applications that use PyQT.
92+ <literal>wrapQtAppsHook</literal> ignores files that are non-ELF executables. This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned. An example of when you'd always need to do this is with Python applications that use PyQT.
12093 </para>
12194 </note>
12295
12396 <para>
124− Libraries are built with every available version of Qt. Use the
125− <literal>meta.broken</literal> attribute to disable the package for
126− unsupported Qt versions:
97+ Libraries are built with every available version of Qt. Use the <literal>meta.broken</literal> attribute to disable the package for unsupported Qt versions:
12798<programlisting>
12899mkDerivation {
129100 # ...
@@ -137,9 +108,7 @@ mkDerivation {
137108 <formalpara>
138109 <title>Adding a library to Nixpkgs</title>
139110 <para>
140− Add a Qt library to <filename>all-packages.nix</filename> by adding it to
141− the collection inside <literal>mkLibsForQt5</literal>. This ensures that the
142− library is built with every available version of Qt as needed.
111+ Add a Qt library to <filename>all-packages.nix</filename> by adding it to the collection inside <literal>mkLibsForQt5</literal>. This ensures that the library is built with every available version of Qt as needed.
143112 <example xml:id='qt-library-all-packages-nix'>
144113 <title>Adding a Qt library to <filename>all-packages.nix</filename></title>
145114<programlisting>
@@ -162,10 +131,7 @@ mkDerivation {
162131 <formalpara>
163132 <title>Adding an application to Nixpkgs</title>
164133 <para>
165− Add a Qt application to <filename>all-packages.nix</filename> using
166− <literal>libsForQt5.callPackage</literal> instead of the usual
167− <literal>callPackage</literal>. The former ensures that all dependencies are
168− built with the same version of Qt.
134+ Add a Qt application to <filename>all-packages.nix</filename> using <literal>libsForQt5.callPackage</literal> instead of the usual <literal>callPackage</literal>. The former ensures that all dependencies are built with the same version of Qt.
169135 <example xml:id='qt-application-all-packages-nix'>
170136 <title>Adding a Qt application to <filename>all-packages.nix</filename></title>
171137<programlisting>
doc/languages-frameworks/ruby.xml+5−32
@@ -4,11 +4,7 @@
44 <title>Ruby</title>
55
66 <para>
7− There currently is support to bundle applications that are packaged as Ruby
8− gems. The utility "bundix" allows you to write a
9− <filename>Gemfile</filename>, let bundler create a
10− <filename>Gemfile.lock</filename>, and then convert this into a nix
11− expression that contains all Gem dependencies automatically.
7+ There currently is support to bundle applications that are packaged as Ruby gems. The utility "bundix" allows you to write a <filename>Gemfile</filename>, let bundler create a <filename>Gemfile.lock</filename>, and then convert this into a nix expression that contains all Gem dependencies automatically.
128 </para>
139
1410 <para>
@@ -45,9 +41,7 @@ bundlerEnv rec {
4541</screen>
4642
4743 <para>
48− Please check in the <filename>Gemfile</filename>,
49− <filename>Gemfile.lock</filename> and the <filename>gemset.nix</filename> so
50− future updates can be run easily.
44+ Please check in the <filename>Gemfile</filename>, <filename>Gemfile.lock</filename> and the <filename>gemset.nix</filename> so future updates can be run easily.
5145 </para>
5246
5347 <para>
@@ -62,10 +56,7 @@ $ nix-shell -p bundix --run 'bundix'
6256</screen>
6357
6458 <para>
65− For tools written in Ruby - i.e. where the desire is to install a package and
66− then execute e.g. <command>rake</command> at the command line, there is an
67− alternative builder called <literal>bundlerApp</literal>. Set up the
68− <filename>gemset.nix</filename> the same way, and then, for example:
59+ For tools written in Ruby - i.e. where the desire is to install a package and then execute e.g. <command>rake</command> at the command line, there is an alternative builder called <literal>bundlerApp</literal>. Set up the <filename>gemset.nix</filename> the same way, and then, for example:
6960 </para>
7061
7162<screen>
@@ -87,29 +78,11 @@ bundlerApp {
8778</screen>
8879
8980 <para>
90− The chief advantage of <literal>bundlerApp</literal> over
91− <literal>bundlerEnv</literal> is the executables introduced in the
92− environment are precisely those selected in the <literal>exes</literal> list,
93− as opposed to <literal>bundlerEnv</literal> which adds all the executables
94− made available by gems in the gemset, which can mean e.g.
95− <command>rspec</command> or <command>rake</command> in unpredictable versions
96− available from various packages.
81+ The chief advantage of <literal>bundlerApp</literal> over <literal>bundlerEnv</literal> is the executables introduced in the environment are precisely those selected in the <literal>exes</literal> list, as opposed to <literal>bundlerEnv</literal> which adds all the executables made available by gems in the gemset, which can mean e.g. <command>rspec</command> or <command>rake</command> in unpredictable versions available from various packages.
9782 </para>
9883
9984 <para>
100− Resulting derivations for both builders also have two helpful attributes,
101− <literal>env</literal> and <literal>wrappedRuby</literal>. The first one
102− allows one to quickly drop into <command>nix-shell</command> with the
103− specified environment present. E.g. <command>nix-shell -A sensu.env</command>
104− would give you an environment with Ruby preset so it has all the libraries
105− necessary for <literal>sensu</literal> in its paths. The second one can be
106− used to make derivations from custom Ruby scripts which have
107− <filename>Gemfile</filename>s with their dependencies specified. It is a
108− derivation with <command>ruby</command> wrapped so it can find all the needed
109− dependencies. For example, to make a derivation <literal>my-script</literal>
110− for a <filename>my-script.rb</filename> (which should be placed in
111− <filename>bin</filename>) you should run <command>bundix</command> as
112− specified above and then use <literal>bundlerEnv</literal> like this:
85+ Resulting derivations for both builders also have two helpful attributes, <literal>env</literal> and <literal>wrappedRuby</literal>. The first one allows one to quickly drop into <command>nix-shell</command> with the specified environment present. E.g. <command>nix-shell -A sensu.env</command> would give you an environment with Ruby preset so it has all the libraries necessary for <literal>sensu</literal> in its paths. The second one can be used to make derivations from custom Ruby scripts which have <filename>Gemfile</filename>s with their dependencies specified. It is a derivation with <command>ruby</command> wrapped so it can find all the needed dependencies. For example, to make a derivation <literal>my-script</literal> for a <filename>my-script.rb</filename> (which should be placed in <filename>bin</filename>) you should run <command>bundix</command> as specified above and then use <literal>bundlerEnv</literal> like this:
11386 </para>
11487
11588<programlisting>
doc/languages-frameworks/texlive.xml+8−19
@@ -4,8 +4,7 @@
44 <title>TeX Live</title>
55
66 <para>
7− Since release 15.09 there is a new TeX Live packaging that lives entirely
8− under attribute <varname>texlive</varname>.
7+ Since release 15.09 there is a new TeX Live packaging that lives entirely under attribute <varname>texlive</varname>.
98 </para>
109
1110 <section xml:id="sec-language-texlive-users-guide">
@@ -14,28 +13,23 @@
1413 <itemizedlist>
1514 <listitem>
1615 <para>
17− For basic usage just pull <varname>texlive.combined.scheme-basic</varname>
18− for an environment with basic LaTeX support.
16+ For basic usage just pull <varname>texlive.combined.scheme-basic</varname> for an environment with basic LaTeX support.
1917 </para>
2018 </listitem>
2119 <listitem>
2220 <para>
23− It typically won't work to use separately installed packages together.
24− Instead, you can build a custom set of packages like this:
21+ It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this:
2522<programlisting>
2623texlive.combine {
2724 inherit (texlive) scheme-small collection-langkorean algorithms cm-super;
2825}
2926</programlisting>
30− There are all the schemes, collections and a few thousand packages, as
31− defined upstream (perhaps with tiny differences).
27+ There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences).
3228 </para>
3329 </listitem>
3430 <listitem>
3531 <para>
36− By default you only get executables and files needed during runtime, and a
37− little documentation for the core packages. To change that, you need to
38− add <varname>pkgFilter</varname> function to <varname>combine</varname>.
32+ By default you only get executables and files needed during runtime, and a little documentation for the core packages. To change that, you need to add <varname>pkgFilter</varname> function to <varname>combine</varname>.
3933<programlisting>
4034texlive.combine {
4135 # inherit (texlive) whatever-you-want;
@@ -59,10 +53,7 @@ nix-repl> texlive.collection-<TAB>
5953 </listitem>
6054 <listitem>
6155 <para>
62− Note that the wrapper assumes that the result has a chance to be useful.
63− For example, the core executables should be present, as well as some core
64− data files. The supported way of ensuring this is by including some
65− scheme, for example <varname>scheme-basic</varname>, into the combination.
56+ Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example <varname>scheme-basic</varname>, into the combination.
6657 </para>
6758 </listitem>
6859 </itemizedlist>
@@ -84,14 +75,12 @@ nix-repl> texlive.collection-<TAB>
8475 </listitem>
8576 <listitem>
8677 <para>
87− feature/bug: when a package is rejected by <varname>pkgFilter</varname>,
88− its dependencies are still propagated;
78+ feature/bug: when a package is rejected by <varname>pkgFilter</varname>, its dependencies are still propagated;
8979 </para>
9080 </listitem>
9181 <listitem>
9282 <para>
93− in case of any bugs or feature requests, file a github issue or better a
94− pull request and /cc @vcunat.
83+ in case of any bugs or feature requests, file a github issue or better a pull request and /cc @vcunat.
9584 </para>
9685 </listitem>
9786 </itemizedlist>
doc/meta.xml+36−128
@@ -3,10 +3,7 @@
33 xml:id="chap-meta">
44 <title>Meta-attributes</title>
55 <para>
6− Nix packages can declare <emphasis>meta-attributes</emphasis> that contain
7− information about a package such as a description, its homepage, its license,
8− and so on. For instance, the GNU Hello package has a <varname>meta</varname>
9− declaration like this:
6+ Nix packages can declare <emphasis>meta-attributes</emphasis> that contain information about a package such as a description, its homepage, its license, and so on. For instance, the GNU Hello package has a <varname>meta</varname> declaration like this:
107<programlisting>
118meta = with stdenv.lib; {
129 description = "A program that produces a familiar, friendly greeting";
@@ -22,13 +19,10 @@ meta = with stdenv.lib; {
2219</programlisting>
2320 </para>
2421 <para>
25− Meta-attributes are not passed to the builder of the package. Thus, a change
26− to a meta-attribute doesn’t trigger a recompilation of the package. The
27− value of a meta-attribute must be a string.
22+ Meta-attributes are not passed to the builder of the package. Thus, a change to a meta-attribute doesn’t trigger a recompilation of the package. The value of a meta-attribute must be a string.
2823 </para>
2924 <para>
30− The meta-attributes of a package can be queried from the command-line using
31− <command>nix-env</command>:
25+ The meta-attributes of a package can be queried from the command-line using <command>nix-env</command>:
3226<screen>
3327<prompt>$ </prompt>nix-env -qa hello --json
3428{
@@ -67,8 +61,7 @@ meta = with stdenv.lib; {
6761
6862
6963</screen>
70− <command>nix-env</command> knows about the <varname>description</varname>
71− field specifically:
64+ <command>nix-env</command> knows about the <varname>description</varname> field specifically:
7265<screen>
7366<prompt>$ </prompt>nix-env -qa hello --description
7467hello-2.3 A program that produces a familiar, friendly greeting
@@ -88,18 +81,13 @@ hello-2.3 A program that produces a familiar, friendly greeting
8881 </term>
8982 <listitem>
9083 <para>
91− A short (one-line) description of the package. This is shown by
92− <command>nix-env -q --description</command> and also on the Nixpkgs
93− release pages.
84+ A short (one-line) description of the package. This is shown by <command>nix-env -q --description</command> and also on the Nixpkgs release pages.
9485 </para>
9586 <para>
96− Don’t include a period at the end. Don’t include newline characters.
97− Capitalise the first character. For brevity, don’t repeat the name of
98− package — just describe what it does.
87+ Don’t include a period at the end. Don’t include newline characters. Capitalise the first character. For brevity, don’t repeat the name of package — just describe what it does.
9988 </para>
10089 <para>
101− Wrong: <literal>"libpng is a library that allows you to decode PNG
102− images."</literal>
90+ Wrong: <literal>"libpng is a library that allows you to decode PNG images."</literal>
10391 </para>
10492 <para>
10593 Right: <literal>"A library for decoding PNG images"</literal>
@@ -122,9 +110,7 @@ hello-2.3 A program that produces a familiar, friendly greeting
122110 </term>
123111 <listitem>
124112 <para>
125− Release branch. Used to specify that a package is not going to receive
126− updates that are not in this branch; for example, Linux kernel 3.0 is
127− supposed to be updated to 3.0.X, not 3.1.
113+ Release branch. Used to specify that a package is not going to receive updates that are not in this branch; for example, Linux kernel 3.0 is supposed to be updated to 3.0.X, not 3.1.
128114 </para>
129115 </listitem>
130116 </varlistentry>
@@ -134,8 +120,7 @@ hello-2.3 A program that produces a familiar, friendly greeting
134120 </term>
135121 <listitem>
136122 <para>
137− The package’s homepage. Example:
138− <literal>https://www.gnu.org/software/hello/manual/</literal>
123+ The package’s homepage. Example: <literal>https://www.gnu.org/software/hello/manual/</literal>
139124 </para>
140125 </listitem>
141126 </varlistentry>
@@ -145,8 +130,7 @@ hello-2.3 A program that produces a familiar, friendly greeting
145130 </term>
146131 <listitem>
147132 <para>
148− The page where a link to the current version can be found. Example:
149− <literal>https://ftp.gnu.org/gnu/hello/</literal>
133+ The page where a link to the current version can be found. Example: <literal>https://ftp.gnu.org/gnu/hello/</literal>
150134 </para>
151135 </listitem>
152136 </varlistentry>
@@ -156,10 +140,7 @@ hello-2.3 A program that produces a familiar, friendly greeting
156140 </term>
157141 <listitem>
158142 <para>
159− A link or a list of links to the location of Changelog for a package. A
160− link may use expansion to refer to the correct changelog version.
161− Example:
162− <literal>"https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${version}"</literal>
143+ A link or a list of links to the location of Changelog for a package. A link may use expansion to refer to the correct changelog version. Example: <literal>"https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${version}"</literal>
163144 </para>
164145 </listitem>
165146 </varlistentry>
@@ -169,46 +150,32 @@ hello-2.3 A program that produces a familiar, friendly greeting
169150 </term>
170151 <listitem>
171152 <para>
172− The license, or licenses, for the package. One from the attribute set
173− defined in
174− <link
175− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix">
176− <filename>nixpkgs/lib/licenses.nix</filename></link>. At this moment
177− using both a list of licenses and a single license is valid. If the
178− license field is in the form of a list representation, then it means that
179− parts of the package are licensed differently. Each license should
180− preferably be referenced by their attribute. The non-list attribute value
181− can also be a space delimited string representation of the contained
182− attribute shortNames or spdxIds. The following are all valid examples:
153+ The license, or licenses, for the package. One from the attribute set defined in <link
154+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix"> <filename>nixpkgs/lib/licenses.nix</filename></link>. At this moment using both a list of licenses and a single license is valid. If the license field is in the form of a list representation, then it means that parts of the package are licensed differently. Each license should preferably be referenced by their attribute. The non-list attribute value can also be a space delimited string representation of the contained attribute shortNames or spdxIds. The following are all valid examples:
183155 <itemizedlist>
184156 <listitem>
185157 <para>
186− Single license referenced by attribute (preferred)
187− <literal>stdenv.lib.licenses.gpl3</literal>.
158+ Single license referenced by attribute (preferred) <literal>stdenv.lib.licenses.gpl3</literal>.
188159 </para>
189160 </listitem>
190161 <listitem>
191162 <para>
192− Single license referenced by its attribute shortName (frowned upon)
193− <literal>"gpl3"</literal>.
163+ Single license referenced by its attribute shortName (frowned upon) <literal>"gpl3"</literal>.
194164 </para>
195165 </listitem>
196166 <listitem>
197167 <para>
198− Single license referenced by its attribute spdxId (frowned upon)
199− <literal>"GPL-3.0"</literal>.
168+ Single license referenced by its attribute spdxId (frowned upon) <literal>"GPL-3.0"</literal>.
200169 </para>
201170 </listitem>
202171 <listitem>
203172 <para>
204− Multiple licenses referenced by attribute (preferred) <literal>with
205− stdenv.lib.licenses; [ asl20 free ofl ]</literal>.
173+ Multiple licenses referenced by attribute (preferred) <literal>with stdenv.lib.licenses; [ asl20 free ofl ]</literal>.
206174 </para>
207175 </listitem>
208176 <listitem>
209177 <para>
210− Multiple licenses referenced as a space delimited string of attribute
211− shortNames (frowned upon) <literal>"asl20 free ofl"</literal>.
178+ Multiple licenses referenced as a space delimited string of attribute shortNames (frowned upon) <literal>"asl20 free ofl"</literal>.
212179 </para>
213180 </listitem>
214181 </itemizedlist>
@@ -222,13 +189,8 @@ hello-2.3 A program that produces a familiar, friendly greeting
222189 </term>
223190 <listitem>
224191 <para>
225− A list of names and e-mail addresses of the maintainers of this Nix
226− expression. If you would like to be a maintainer of a package, you may
227− want to add yourself to
228− <link
229− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix"><filename>nixpkgs/maintainers/maintainer-list.nix</filename></link>
230− and write something like <literal>[ stdenv.lib.maintainers.alice
231− stdenv.lib.maintainers.bob ]</literal>.
192+ A list of names and e-mail addresses of the maintainers of this Nix expression. If you would like to be a maintainer of a package, you may want to add yourself to <link
193+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix"><filename>nixpkgs/maintainers/maintainer-list.nix</filename></link> and write something like <literal>[ stdenv.lib.maintainers.alice stdenv.lib.maintainers.bob ]</literal>.
232194 </para>
233195 </listitem>
234196 </varlistentry>
@@ -238,10 +200,7 @@ hello-2.3 A program that produces a familiar, friendly greeting
238200 </term>
239201 <listitem>
240202 <para>
241− The <emphasis>priority</emphasis> of the package, used by
242− <command>nix-env</command> to resolve file name conflicts between
243− packages. See the Nix manual page for <command>nix-env</command> for
244− details. Example: <literal>"10"</literal> (a low-priority package).
203+ The <emphasis>priority</emphasis> of the package, used by <command>nix-env</command> to resolve file name conflicts between packages. See the Nix manual page for <command>nix-env</command> for details. Example: <literal>"10"</literal> (a low-priority package).
245204 </para>
246205 </listitem>
247206 </varlistentry>
@@ -251,15 +210,11 @@ hello-2.3 A program that produces a familiar, friendly greeting
251210 </term>
252211 <listitem>
253212 <para>
254− The list of Nix platform types on which the package is supported. Hydra
255− builds packages according to the platform specified. If no platform is
256− specified, the package does not have prebuilt binaries. An example is:
213+ The list of Nix platform types on which the package is supported. Hydra builds packages according to the platform specified. If no platform is specified, the package does not have prebuilt binaries. An example is:
257214<programlisting>
258215meta.platforms = stdenv.lib.platforms.linux;
259216</programlisting>
260− Attribute Set <varname>stdenv.lib.platforms</varname> defines
261− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix">
262− various common lists</link> of platforms types.
217+ Attribute Set <varname>stdenv.lib.platforms</varname> defines <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix"> various common lists</link> of platforms types.
263218 </para>
264219 </listitem>
265220 </varlistentry>
@@ -270,23 +225,14 @@ meta.platforms = stdenv.lib.platforms.linux;
270225 <listitem>
271226 <warning>
272227 <para>
273− This attribute is special in that it is not actually under the
274− <literal>meta</literal> attribute set but rather under the
275− <literal>passthru</literal> attribute set. This is due to how
276− <literal>meta</literal> attributes work, and the fact that they are
277− supposed to contain only metadata, not derivations.
228+ This attribute is special in that it is not actually under the <literal>meta</literal> attribute set but rather under the <literal>passthru</literal> attribute set. This is due to how <literal>meta</literal> attributes work, and the fact that they are supposed to contain only metadata, not derivations.
278229 </para>
279230 </warning>
280231 <para>
281− An attribute set with as values tests. A test is a derivation, which
282− builds successfully when the test passes, and fails to build otherwise. A
283− derivation that is a test needs to have <literal>meta.timeout</literal>
284− defined.
232+ An attribute set with as values tests. A test is a derivation, which builds successfully when the test passes, and fails to build otherwise. A derivation that is a test needs to have <literal>meta.timeout</literal> defined.
285233 </para>
286234 <para>
287− The NixOS tests are available as <literal>nixosTests</literal> in
288− parameters of derivations. For instance, the OpenSMTPD derivation
289− includes lines similar to:
235+ The NixOS tests are available as <literal>nixosTests</literal> in parameters of derivations. For instance, the OpenSMTPD derivation includes lines similar to:
290236<programlisting>
291237{ /* ... */, nixosTests }:
292238{
@@ -305,13 +251,7 @@ meta.platforms = stdenv.lib.platforms.linux;
305251 </term>
306252 <listitem>
307253 <para>
308− A timeout (in seconds) for building the derivation. If the derivation
309− takes longer than this time to build, it can fail due to breaking the
310− timeout. However, all computers do not have the same computing power,
311− hence some builders may decide to apply a multiplicative factor to this
312− value. When filling this value in, try to keep it approximately
313− consistent with other values already present in
314− <literal>nixpkgs</literal>.
254+ A timeout (in seconds) for building the derivation. If the derivation takes longer than this time to build, it can fail due to breaking the timeout. However, all computers do not have the same computing power, hence some builders may decide to apply a multiplicative factor to this value. When filling this value in, try to keep it approximately consistent with other values already present in <literal>nixpkgs</literal>.
315255 </para>
316256 </listitem>
317257 </varlistentry>
@@ -321,13 +261,7 @@ meta.platforms = stdenv.lib.platforms.linux;
321261 </term>
322262 <listitem>
323263 <para>
324− The list of Nix platform types for which the Hydra instance at
325− <literal>hydra.nixos.org</literal> will build the package. (Hydra is the
326− Nix-based continuous build system.) It defaults to the value of
327− <varname>meta.platforms</varname>. Thus, the only reason to set
328− <varname>meta.hydraPlatforms</varname> is if you want
329− <literal>hydra.nixos.org</literal> to build the package on a subset of
330− <varname>meta.platforms</varname>, or not at all, e.g.
264+ The list of Nix platform types for which the Hydra instance at <literal>hydra.nixos.org</literal> will build the package. (Hydra is the Nix-based continuous build system.) It defaults to the value of <varname>meta.platforms</varname>. Thus, the only reason to set <varname>meta.hydraPlatforms</varname> is if you want <literal>hydra.nixos.org</literal> to build the package on a subset of <varname>meta.platforms</varname>, or not at all, e.g.
331265<programlisting>
332266meta.platforms = stdenv.lib.platforms.linux;
333267meta.hydraPlatforms = [];
@@ -341,10 +275,7 @@ meta.hydraPlatforms = [];
341275 </term>
342276 <listitem>
343277 <para>
344− If set to <literal>true</literal>, the package is marked as “broken”,
345− meaning that it won’t show up in <literal>nix-env -qa</literal>, and
346− cannot be built or installed. Such packages should be removed from
347− Nixpkgs eventually unless they are fixed.
278+ If set to <literal>true</literal>, the package is marked as “broken”, meaning that it won’t show up in <literal>nix-env -qa</literal>, and cannot be built or installed. Such packages should be removed from Nixpkgs eventually unless they are fixed.
348279 </para>
349280 </listitem>
350281 </varlistentry>
@@ -354,12 +285,7 @@ meta.hydraPlatforms = [];
354285 </term>
355286 <listitem>
356287 <para>
357− If set to <literal>true</literal>, the package is tested to be updated
358− correctly by the <literal>update-walker.sh</literal> script without
359− additional settings. Such packages have <varname>meta.version</varname>
360− set and their homepage (or the page specified by
361− <varname>meta.downloadPage</varname>) contains a direct link to the
362− package tarball.
288+ If set to <literal>true</literal>, the package is tested to be updated correctly by the <literal>update-walker.sh</literal> script without additional settings. Such packages have <varname>meta.version</varname> set and their homepage (or the page specified by <varname>meta.downloadPage</varname>) contains a direct link to the package tarball.
363289 </para>
364290 </listitem>
365291 </varlistentry>
@@ -369,17 +295,11 @@ meta.hydraPlatforms = [];
369295 <title>Licenses</title>
370296
371297 <para>
372− The <varname>meta.license</varname> attribute should preferrably contain a
373− value from <varname>stdenv.lib.licenses</varname> defined in
374− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix">
375− <filename>nixpkgs/lib/licenses.nix</filename></link>, or in-place license
376− description of the same format if the license is unlikely to be useful in
377− another expression.
298+ The <varname>meta.license</varname> attribute should preferrably contain a value from <varname>stdenv.lib.licenses</varname> defined in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix"> <filename>nixpkgs/lib/licenses.nix</filename></link>, or in-place license description of the same format if the license is unlikely to be useful in another expression.
378299 </para>
379300
380301 <para>
381− Although it's typically better to indicate the specific license, a few
382− generic options are available:
302+ Although it's typically better to indicate the specific license, a few generic options are available:
383303 <variablelist>
384304 <varlistentry>
385305 <term>
@@ -397,18 +317,10 @@ meta.hydraPlatforms = [];
397317 </term>
398318 <listitem>
399319 <para>
400− Unfree package that can be redistributed in binary form. That is, it’s
401− legal to redistribute the <emphasis>output</emphasis> of the derivation.
402− This means that the package can be included in the Nixpkgs channel.
320+ Unfree package that can be redistributed in binary form. That is, it’s legal to redistribute the <emphasis>output</emphasis> of the derivation. This means that the package can be included in the Nixpkgs channel.
403321 </para>
404322 <para>
405− Sometimes proprietary software can only be redistributed unmodified.
406− Make sure the builder doesn’t actually modify the original binaries;
407− otherwise we’re breaking the license. For instance, the NVIDIA X11
408− drivers can be redistributed unmodified, but our builder applies
409− <command>patchelf</command> to make them work. Thus, its license is
410− <varname>"unfree"</varname> and it cannot be included in the Nixpkgs
411− channel.
323+ Sometimes proprietary software can only be redistributed unmodified. Make sure the builder doesn’t actually modify the original binaries; otherwise we’re breaking the license. For instance, the NVIDIA X11 drivers can be redistributed unmodified, but our builder applies <command>patchelf</command> to make them work. Thus, its license is <varname>"unfree"</varname> and it cannot be included in the Nixpkgs channel.
412324 </para>
413325 </listitem>
414326 </varlistentry>
@@ -418,9 +330,7 @@ meta.hydraPlatforms = [];
418330 </term>
419331 <listitem>
420332 <para>
421− Unfree package that cannot be redistributed. You can build it yourself,
422− but you cannot redistribute the output of the derivation. Thus it cannot
423− be included in the Nixpkgs channel.
333+ Unfree package that cannot be redistributed. You can build it yourself, but you cannot redistribute the output of the derivation. Thus it cannot be included in the Nixpkgs channel.
424334 </para>
425335 </listitem>
426336 </varlistentry>
@@ -430,9 +340,7 @@ meta.hydraPlatforms = [];
430340 </term>
431341 <listitem>
432342 <para>
433− This package supplies unfree, redistributable firmware. This is a
434− separate value from <varname>unfree-redistributable</varname> because
435− not everybody cares whether firmware is free.
343+ This package supplies unfree, redistributable firmware. This is a separate value from <varname>unfree-redistributable</varname> because not everybody cares whether firmware is free.
436344 </para>
437345 </listitem>
438346 </varlistentry>
doc/multiple-output.xml+30−128
@@ -10,31 +10,16 @@
1010 <title>Introduction</title>
1111
1212 <para>
13− The Nix language allows a derivation to produce multiple outputs, which is
14− similar to what is utilized by other Linux distribution packaging systems.
15− The outputs reside in separate Nix store paths, so they can be mostly
16− handled independently of each other, including passing to build inputs,
17− garbage collection or binary substitution. The exception is that building
18− from source always produces all the outputs.
13+ The Nix language allows a derivation to produce multiple outputs, which is similar to what is utilized by other Linux distribution packaging systems. The outputs reside in separate Nix store paths, so they can be mostly handled independently of each other, including passing to build inputs, garbage collection or binary substitution. The exception is that building from source always produces all the outputs.
1914 </para>
2015
2116 <para>
22− The main motivation is to save disk space by reducing runtime closure sizes;
23− consequently also sizes of substituted binaries get reduced. Splitting can
24− be used to have more granular runtime dependencies, for example the typical
25− reduction is to split away development-only files, as those are typically
26− not needed during runtime. As a result, closure sizes of many packages can
27− get reduced to a half or even much less.
17+ The main motivation is to save disk space by reducing runtime closure sizes; consequently also sizes of substituted binaries get reduced. Splitting can be used to have more granular runtime dependencies, for example the typical reduction is to split away development-only files, as those are typically not needed during runtime. As a result, closure sizes of many packages can get reduced to a half or even much less.
2818 </para>
2919
3020 <note>
3121 <para>
32− The reduction effects could be instead achieved by building the parts in
33− completely separate derivations. That would often additionally reduce
34− build-time closures, but it tends to be much harder to write such
35− derivations, as build systems typically assume all parts are being built at
36− once. This compromise approach of single source package producing multiple
37− binary packages is also utilized often by rpm and deb.
22+ The reduction effects could be instead achieved by building the parts in completely separate derivations. That would often additionally reduce build-time closures, but it tends to be much harder to write such derivations, as build systems typically assume all parts are being built at once. This compromise approach of single source package producing multiple binary packages is also utilized often by rpm and deb.
3823 </para>
3924 </note>
4025 </section>
@@ -42,23 +27,18 @@
4227 <title>Installing a split package</title>
4328
4429 <para>
45− When installing a package via <varname>systemPackages</varname> or
46− <command>nix-env</command> you have several options:
30+ When installing a package via <varname>systemPackages</varname> or <command>nix-env</command> you have several options:
4731 </para>
4832
4933 <itemizedlist>
5034 <listitem>
5135 <para>
52− You can install particular outputs explicitly, as each is available in the
53− Nix language as an attribute of the package. The
54− <varname>outputs</varname> attribute contains a list of output names.
36+ You can install particular outputs explicitly, as each is available in the Nix language as an attribute of the package. The <varname>outputs</varname> attribute contains a list of output names.
5537 </para>
5638 </listitem>
5739 <listitem>
5840 <para>
59− You can let it use the default outputs. These are handled by
60− <varname>meta.outputsToInstall</varname> attribute that contains a list of
61− output names.
41+ You can let it use the default outputs. These are handled by <varname>meta.outputsToInstall</varname> attribute that contains a list of output names.
6242 </para>
6343 <para>
6444 TODO: more about tweaking the attribute, etc.
@@ -66,19 +46,11 @@
6646 </listitem>
6747 <listitem>
6848 <para>
69− NixOS provides configuration option
70− <varname>environment.extraOutputsToInstall</varname> that allows adding
71− extra outputs of <varname>environment.systemPackages</varname> atop the
72− default ones. It's mainly meant for documentation and debug symbols, and
73− it's also modified by specific options.
49+ NixOS provides configuration option <varname>environment.extraOutputsToInstall</varname> that allows adding extra outputs of <varname>environment.systemPackages</varname> atop the default ones. It's mainly meant for documentation and debug symbols, and it's also modified by specific options.
7450 </para>
7551 <note>
7652 <para>
77− At this moment there is no similar configurability for packages installed
78− by <command>nix-env</command>. You can still use approach from
79− <xref linkend="sec-modify-via-packageOverrides" /> to override
80− <varname>meta.outputsToInstall</varname> attributes, but that's a rather
81− inconvenient way.
53+ At this moment there is no similar configurability for packages installed by <command>nix-env</command>. You can still use approach from <xref linkend="sec-modify-via-packageOverrides" /> to override <varname>meta.outputsToInstall</varname> attributes, but that's a rather inconvenient way.
8254 </para>
8355 </note>
8456 </listitem>
@@ -88,25 +60,15 @@
8860 <title>Using a split package</title>
8961
9062 <para>
91− In the Nix language the individual outputs can be reached explicitly as
92− attributes, e.g. <varname>coreutils.info</varname>, but the typical case is
93− just using packages as build inputs.
63+ In the Nix language the individual outputs can be reached explicitly as attributes, e.g. <varname>coreutils.info</varname>, but the typical case is just using packages as build inputs.
9464 </para>
9565
9666 <para>
97− When a multiple-output derivation gets into a build input of another
98− derivation, the <varname>dev</varname> output is added if it exists,
99− otherwise the first output is added. In addition to that,
100− <varname>propagatedBuildOutputs</varname> of that package which by default
101− contain <varname>$outputBin</varname> and <varname>$outputLib</varname> are
102− also added. (See <xref linkend="multiple-output-file-type-groups" />.)
67+ When a multiple-output derivation gets into a build input of another derivation, the <varname>dev</varname> output is added if it exists, otherwise the first output is added. In addition to that, <varname>propagatedBuildOutputs</varname> of that package which by default contain <varname>$outputBin</varname> and <varname>$outputLib</varname> are also added. (See <xref linkend="multiple-output-file-type-groups" />.)
10368 </para>
10469
10570 <para>
106− In some cases it may be desirable to combine different outputs under a
107− single store path. A function <literal>symlinkJoin</literal> can be used to
108− do this. (Note that it may negate some closure size benefits of using a
109− multiple-output package.)
71+ In some cases it may be desirable to combine different outputs under a single store path. A function <literal>symlinkJoin</literal> can be used to do this. (Note that it may negate some closure size benefits of using a multiple-output package.)
11072 </para>
11173 </section>
11274 <section xml:id="sec-multiple-outputs-">
@@ -117,29 +79,18 @@
11779 </para>
11880
11981 <para>
120− In nixpkgs there is a framework supporting multiple-output derivations. It
121− tries to cover most cases by default behavior. You can find the source
122− separated in
123− &lt;<filename>nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh</filename>&gt;;
124− it's relatively well-readable. The whole machinery is triggered by defining
125− the <varname>outputs</varname> attribute to contain the list of desired
126− output names (strings).
82+ In nixpkgs there is a framework supporting multiple-output derivations. It tries to cover most cases by default behavior. You can find the source separated in &lt;<filename>nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh</filename>&gt;; it's relatively well-readable. The whole machinery is triggered by defining the <varname>outputs</varname> attribute to contain the list of desired output names (strings).
12783 </para>
12884
12985<programlisting>outputs = [ "bin" "dev" "out" "doc" ];</programlisting>
13086
13187 <para>
132− Often such a single line is enough. For each output an equally named
133− environment variable is passed to the builder and contains the path in nix
134− store for that output. Typically you also want to have the main
135− <varname>out</varname> output, as it catches any files that didn't get
136− elsewhere.
88+ Often such a single line is enough. For each output an equally named environment variable is passed to the builder and contains the path in nix store for that output. Typically you also want to have the main <varname>out</varname> output, as it catches any files that didn't get elsewhere.
13789 </para>
13890
13991 <note>
14092 <para>
141− There is a special handling of the <varname>debug</varname> output,
142− described at <xref linkend="stdenv-separateDebugInfo" />.
93+ There is a special handling of the <varname>debug</varname> output, described at <xref linkend="stdenv-separateDebugInfo" />.
14394 </para>
14495 </note>
14596
@@ -147,36 +98,15 @@
14798 <title><quote>Binaries first</quote></title>
14899
149100 <para>
150− A commonly adopted convention in <literal>nixpkgs</literal> is that
151− executables provided by the package are contained within its first output.
152− This convention allows the dependent packages to reference the executables
153− provided by packages in a uniform manner. For instance, provided with the
154− knowledge that the <literal>perl</literal> package contains a
155− <literal>perl</literal> executable it can be referenced as
156− <literal>${pkgs.perl}/bin/perl</literal> within a Nix derivation that needs
157− to execute a Perl script.
101+ A commonly adopted convention in <literal>nixpkgs</literal> is that executables provided by the package are contained within its first output. This convention allows the dependent packages to reference the executables provided by packages in a uniform manner. For instance, provided with the knowledge that the <literal>perl</literal> package contains a <literal>perl</literal> executable it can be referenced as <literal>${pkgs.perl}/bin/perl</literal> within a Nix derivation that needs to execute a Perl script.
158102 </para>
159103
160104 <para>
161− The <literal>glibc</literal> package is a deliberate single exception to
162− the <quote>binaries first</quote> convention. The <literal>glibc</literal>
163− has <literal>libs</literal> as its first output allowing the libraries
164− provided by <literal>glibc</literal> to be referenced directly (e.g.
165− <literal>${stdenv.glibc}/lib/ld-linux-x86-64.so.2</literal>). The
166− executables provided by <literal>glibc</literal> can be accessed via its
167− <literal>bin</literal> attribute (e.g.
168− <literal>${stdenv.glibc.bin}/bin/ldd</literal>).
105+ The <literal>glibc</literal> package is a deliberate single exception to the <quote>binaries first</quote> convention. The <literal>glibc</literal> has <literal>libs</literal> as its first output allowing the libraries provided by <literal>glibc</literal> to be referenced directly (e.g. <literal>${stdenv.glibc}/lib/ld-linux-x86-64.so.2</literal>). The executables provided by <literal>glibc</literal> can be accessed via its <literal>bin</literal> attribute (e.g. <literal>${stdenv.glibc.bin}/bin/ldd</literal>).
169106 </para>
170107
171108 <para>
172− The reason for why <literal>glibc</literal> deviates from the convention is
173− because referencing a library provided by <literal>glibc</literal> is a
174− very common operation among Nix packages. For instance, third-party
175− executables packaged by Nix are typically patched and relinked with the
176− relevant version of <literal>glibc</literal> libraries from Nix packages
177− (please see the documentation on
178− <link xlink:href="https://nixos.org/patchelf.html">patchelf</link> for more
179− details).
109+ The reason for why <literal>glibc</literal> deviates from the convention is because referencing a library provided by <literal>glibc</literal> is a very common operation among Nix packages. For instance, third-party executables packaged by Nix are typically patched and relinked with the relevant version of <literal>glibc</literal> libraries from Nix packages (please see the documentation on <link xlink:href="https://nixos.org/patchelf.html">patchelf</link> for more details).
180110 </para>
181111 </section>
182112
@@ -184,13 +114,7 @@
184114 <title>File type groups</title>
185115
186116 <para>
187− The support code currently recognizes some particular kinds of outputs and
188− either instructs the build system of the package to put files into their
189− desired outputs or it moves the files during the fixup phase. Each group of
190− file types has an <varname>outputFoo</varname> variable specifying the
191− output name where they should go. If that variable isn't defined by the
192− derivation writer, it is guessed &ndash; a default output name is defined,
193− falling back to other possibilities if the output isn't defined.
117+ The support code currently recognizes some particular kinds of outputs and either instructs the build system of the package to put files into their desired outputs or it moves the files during the fixup phase. Each group of file types has an <varname>outputFoo</varname> variable specifying the output name where they should go. If that variable isn't defined by the derivation writer, it is guessed &ndash; a default output name is defined, falling back to other possibilities if the output isn't defined.
194118 </para>
195119
196120 <variablelist>
@@ -200,9 +124,7 @@
200124 </term>
201125 <listitem>
202126 <para>
203− is for development-only files. These include C(++) headers, pkg-config,
204− cmake and aclocal files. They go to <varname>dev</varname> or
205− <varname>out</varname> by default.
127+ is for development-only files. These include C(++) headers, pkg-config, cmake and aclocal files. They go to <varname>dev</varname> or <varname>out</varname> by default.
206128 </para>
207129 </listitem>
208130 </varlistentry>
@@ -212,8 +134,7 @@
212134 </term>
213135 <listitem>
214136 <para>
215− is meant for user-facing binaries, typically residing in bin/. They go
216− to <varname>bin</varname> or <varname>out</varname> by default.
137+ is meant for user-facing binaries, typically residing in bin/. They go to <varname>bin</varname> or <varname>out</varname> by default.
217138 </para>
218139 </listitem>
219140 </varlistentry>
@@ -223,9 +144,7 @@
223144 </term>
224145 <listitem>
225146 <para>
226− is meant for libraries, typically residing in <filename>lib/</filename>
227− and <filename>libexec/</filename>. They go to <varname>lib</varname> or
228− <varname>out</varname> by default.
147+ is meant for libraries, typically residing in <filename>lib/</filename> and <filename>libexec/</filename>. They go to <varname>lib</varname> or <varname>out</varname> by default.
229148 </para>
230149 </listitem>
231150 </varlistentry>
@@ -235,9 +154,7 @@
235154 </term>
236155 <listitem>
237156 <para>
238− is for user documentation, typically residing in
239− <filename>share/doc/</filename>. It goes to <varname>doc</varname> or
240− <varname>out</varname> by default.
157+ is for user documentation, typically residing in <filename>share/doc/</filename>. It goes to <varname>doc</varname> or <varname>out</varname> by default.
241158 </para>
242159 </listitem>
243160 </varlistentry>
@@ -247,10 +164,7 @@
247164 </term>
248165 <listitem>
249166 <para>
250− is for <emphasis>developer</emphasis> documentation. Currently we count
251− gtk-doc and devhelp books in there. It goes to <varname>devdoc</varname>
252− or is removed (!) by default. This is because e.g. gtk-doc tends to be
253− rather large and completely unused by nixpkgs users.
167+ is for <emphasis>developer</emphasis> documentation. Currently we count gtk-doc and devhelp books in there. It goes to <varname>devdoc</varname> or is removed (!) by default. This is because e.g. gtk-doc tends to be rather large and completely unused by nixpkgs users.
254168 </para>
255169 </listitem>
256170 </varlistentry>
@@ -260,8 +174,7 @@
260174 </term>
261175 <listitem>
262176 <para>
263− is for man pages (except for section 3). They go to
264− <varname>man</varname> or <varname>$outputBin</varname> by default.
177+ is for man pages (except for section 3). They go to <varname>man</varname> or <varname>$outputBin</varname> by default.
265178 </para>
266179 </listitem>
267180 </varlistentry>
@@ -271,8 +184,7 @@
271184 </term>
272185 <listitem>
273186 <para>
274− is for section 3 man pages. They go to <varname>devman</varname> or
275− <varname>$outputMan</varname> by default.
187+ is for section 3 man pages. They go to <varname>devman</varname> or <varname>$outputMan</varname> by default.
276188 </para>
277189 </listitem>
278190 </varlistentry>
@@ -282,8 +194,7 @@
282194 </term>
283195 <listitem>
284196 <para>
285− is for info pages. They go to <varname>info</varname> or
286− <varname>$outputBin</varname> by default.
197+ is for info pages. They go to <varname>info</varname> or <varname>$outputBin</varname> by default.
287198 </para>
288199 </listitem>
289200 </varlistentry>
@@ -296,31 +207,22 @@
296207 <itemizedlist>
297208 <listitem>
298209 <para>
299− Some configure scripts don't like some of the parameters passed by
300− default by the framework, e.g. <literal>--docdir=/foo/bar</literal>. You
301− can disable this by setting <literal>setOutputFlags = false;</literal>.
210+ Some configure scripts don't like some of the parameters passed by default by the framework, e.g. <literal>--docdir=/foo/bar</literal>. You can disable this by setting <literal>setOutputFlags = false;</literal>.
302211 </para>
303212 </listitem>
304213 <listitem>
305214 <para>
306− The outputs of a single derivation can retain references to each other,
307− but note that circular references are not allowed. (And each
308− strongly-connected component would act as a single output anyway.)
215+ The outputs of a single derivation can retain references to each other, but note that circular references are not allowed. (And each strongly-connected component would act as a single output anyway.)
309216 </para>
310217 </listitem>
311218 <listitem>
312219 <para>
313− Most of split packages contain their core functionality in libraries.
314− These libraries tend to refer to various kind of data that typically gets
315− into <varname>out</varname>, e.g. locale strings, so there is often no
316− advantage in separating the libraries into <varname>lib</varname>, as
317− keeping them in <varname>out</varname> is easier.
220+ Most of split packages contain their core functionality in libraries. These libraries tend to refer to various kind of data that typically gets into <varname>out</varname>, e.g. locale strings, so there is often no advantage in separating the libraries into <varname>lib</varname>, as keeping them in <varname>out</varname> is easier.
318221 </para>
319222 </listitem>
320223 <listitem>
321224 <para>
322− Some packages have hidden assumptions on install paths, which complicates
323− splitting.
225+ Some packages have hidden assumptions on install paths, which complicates splitting.
324226 </para>
325227 </listitem>
326228 </itemizedlist>
doc/overlays.xml+19−74
@@ -3,47 +3,32 @@
33 xml:id="chap-overlays">
44 <title>Overlays</title>
55 <para>
6− This chapter describes how to extend and change Nixpkgs using overlays.
7− Overlays are used to add layers in the fixed-point used by Nixpkgs to compose
8− the set of all packages.
6+ This chapter describes how to extend and change Nixpkgs using overlays. Overlays are used to add layers in the fixed-point used by Nixpkgs to compose the set of all packages.
97 </para>
108 <para>
11− Nixpkgs can be configured with a list of overlays, which are applied in
12− order. This means that the order of the overlays can be significant if
13− multiple layers override the same package.
9+ Nixpkgs can be configured with a list of overlays, which are applied in order. This means that the order of the overlays can be significant if multiple layers override the same package.
1410 </para>
1511<!--============================================================-->
1612 <section xml:id="sec-overlays-install">
1713 <title>Installing overlays</title>
1814
1915 <para>
20− The list of overlays can be set either explicitly in a Nix expression, or
21− through <literal>&lt;nixpkgs-overlays></literal> or user configuration
22− files.
16+ The list of overlays can be set either explicitly in a Nix expression, or through <literal>&lt;nixpkgs-overlays></literal> or user configuration files.
2317 </para>
2418
2519 <section xml:id="sec-overlays-argument">
2620 <title>Set overlays in NixOS or Nix expressions</title>
2721
2822 <para>
29− On a NixOS system the value of the <literal>nixpkgs.overlays</literal>
30− option, if present, is passed to the system Nixpkgs directly as an
31− argument. Note that this does not affect the overlays for non-NixOS
32− operations (e.g. <literal>nix-env</literal>), which are
33− <link xlink:href="#sec-overlays-lookup">looked</link> up independently.
23+ On a NixOS system the value of the <literal>nixpkgs.overlays</literal> option, if present, is passed to the system Nixpkgs directly as an argument. Note that this does not affect the overlays for non-NixOS operations (e.g. <literal>nix-env</literal>), which are <link xlink:href="#sec-overlays-lookup">looked</link> up independently.
3424 </para>
3525
3626 <para>
37− The list of overlays can be passed explicitly when importing nixpkgs, for
38− example <literal>import &lt;nixpkgs> { overlays = [ overlay1 overlay2 ];
39− }</literal>.
27+ The list of overlays can be passed explicitly when importing nixpkgs, for example <literal>import &lt;nixpkgs> { overlays = [ overlay1 overlay2 ]; }</literal>.
4028 </para>
4129
4230 <para>
43− Further overlays can be added by calling the <literal>pkgs.extend</literal>
44− or <literal>pkgs.appendOverlays</literal>, although it is often preferable
45− to avoid these functions, because they recompute the Nixpkgs fixpoint,
46− which is somewhat expensive to do.
31+ Further overlays can be added by calling the <literal>pkgs.extend</literal> or <literal>pkgs.appendOverlays</literal>, although it is often preferable to avoid these functions, because they recompute the Nixpkgs fixpoint, which is somewhat expensive to do.
4732 </para>
4833 </section>
4934
@@ -58,30 +43,20 @@
5843 <orderedlist>
5944 <listitem>
6045 <para>
61− First, if an
62− <link xlink:href="#sec-overlays-argument"><varname>overlays</varname>
63− argument</link> to the Nixpkgs function itself is given, then that is
64− used and no path lookup will be performed.
46+ First, if an <link xlink:href="#sec-overlays-argument"><varname>overlays</varname> argument</link> to the Nixpkgs function itself is given, then that is used and no path lookup will be performed.
6547 </para>
6648 </listitem>
6749 <listitem>
6850 <para>
69− Otherwise, if the Nix path entry
70− <literal>&lt;nixpkgs-overlays></literal> exists, we look for overlays at
71− that path, as described below.
51+ Otherwise, if the Nix path entry <literal>&lt;nixpkgs-overlays></literal> exists, we look for overlays at that path, as described below.
7252 </para>
7353 <para>
74− See the section on <literal>NIX_PATH</literal> in the Nix manual for
75− more details on how to set a value for
76− <literal>&lt;nixpkgs-overlays>.</literal>
54+ See the section on <literal>NIX_PATH</literal> in the Nix manual for more details on how to set a value for <literal>&lt;nixpkgs-overlays>.</literal>
7755 </para>
7856 </listitem>
7957 <listitem>
8058 <para>
81− If one of <filename>~/.config/nixpkgs/overlays.nix</filename> and
82− <filename>~/.config/nixpkgs/overlays/</filename> exists, then we look
83− for overlays at that path, as described below. It is an error if both
84− exist.
59+ If one of <filename>~/.config/nixpkgs/overlays.nix</filename> and <filename>~/.config/nixpkgs/overlays/</filename> exists, then we look for overlays at that path, as described below. It is an error if both exist.
8560 </para>
8661 </listitem>
8762 </orderedlist>
@@ -92,15 +67,12 @@
9267 <itemizedlist>
9368 <listitem>
9469 <para>
95− If the path is a file, then the file is imported as a Nix expression and
96− used as the list of overlays.
70+ If the path is a file, then the file is imported as a Nix expression and used as the list of overlays.
9771 </para>
9872 </listitem>
9973 <listitem>
10074 <para>
101− If the path is a directory, then we take the content of the directory,
102− order it lexicographically, and attempt to interpret each as an overlay
103− by:
75+ If the path is a directory, then we take the content of the directory, order it lexicographically, and attempt to interpret each as an overlay by:
10476 <itemizedlist>
10577 <listitem>
10678 <para>
@@ -109,8 +81,7 @@
10981 </listitem>
11082 <listitem>
11183 <para>
112− Importing a top-level <filename>default.nix</filename> file, if it is
113− a directory.
84+ Importing a top-level <filename>default.nix</filename> file, if it is a directory.
11485 </para>
11586 </listitem>
11687 </itemizedlist>
@@ -120,12 +91,7 @@
12091 </para>
12192
12293 <para>
123− Because overlays that are set in NixOS configuration do not affect
124− non-NixOS operations such as <literal>nix-env</literal>, the
125− <filename>overlays.nix</filename> option provides a convenient way to use
126− the same overlays for a NixOS system configuration and user configuration:
127− the same file can be used as <filename>overlays.nix</filename> and imported
128− as the value of <literal>nixpkgs.overlays</literal>.
94+ Because overlays that are set in NixOS configuration do not affect non-NixOS operations such as <literal>nix-env</literal>, the <filename>overlays.nix</filename> option provides a convenient way to use the same overlays for a NixOS system configuration and user configuration: the same file can be used as <filename>overlays.nix</filename> and imported as the value of <literal>nixpkgs.overlays</literal>.
12995 </para>
13096
13197<!-- TODO: Example of sharing overlays between NixOS configuration
@@ -139,9 +105,7 @@
139105 <title>Defining overlays</title>
140106
141107 <para>
142− Overlays are Nix functions which accept two arguments, conventionally called
143− <varname>self</varname> and <varname>super</varname>, and return a set of
144− packages. For example, the following is a valid overlay.
108+ Overlays are Nix functions which accept two arguments, conventionally called <varname>self</varname> and <varname>super</varname>, and return a set of packages. For example, the following is a valid overlay.
145109 </para>
146110
147111<programlisting>
@@ -158,38 +122,19 @@ self: super:
158122</programlisting>
159123
160124 <para>
161− The first argument (<varname>self</varname>) corresponds to the final
162− package set. You should use this set for the dependencies of all packages
163− specified in your overlay. For example, all the dependencies of
164− <varname>rr</varname> in the example above come from
165− <varname>self</varname>, as well as the overridden dependencies used in the
166− <varname>boost</varname> override.
125+ The first argument (<varname>self</varname>) corresponds to the final package set. You should use this set for the dependencies of all packages specified in your overlay. For example, all the dependencies of <varname>rr</varname> in the example above come from <varname>self</varname>, as well as the overridden dependencies used in the <varname>boost</varname> override.
167126 </para>
168127
169128 <para>
170− The second argument (<varname>super</varname>) corresponds to the result of
171− the evaluation of the previous stages of Nixpkgs. It does not contain any of
172− the packages added by the current overlay, nor any of the following
173− overlays. This set should be used either to refer to packages you wish to
174− override, or to access functions defined in Nixpkgs. For example, the
175− original recipe of <varname>boost</varname> in the above example, comes from
176− <varname>super</varname>, as well as the <varname>callPackage</varname>
177− function.
129+ The second argument (<varname>super</varname>) corresponds to the result of the evaluation of the previous stages of Nixpkgs. It does not contain any of the packages added by the current overlay, nor any of the following overlays. This set should be used either to refer to packages you wish to override, or to access functions defined in Nixpkgs. For example, the original recipe of <varname>boost</varname> in the above example, comes from <varname>super</varname>, as well as the <varname>callPackage</varname> function.
178130 </para>
179131
180132 <para>
181− The value returned by this function should be a set similar to
182− <filename>pkgs/top-level/all-packages.nix</filename>, containing overridden
183− and/or new packages.
133+ The value returned by this function should be a set similar to <filename>pkgs/top-level/all-packages.nix</filename>, containing overridden and/or new packages.
184134 </para>
185135
186136 <para>
187− Overlays are similar to other methods for customizing Nixpkgs, in particular
188− the <literal>packageOverrides</literal> attribute described in
189− <xref linkend="sec-modify-via-packageOverrides"/>. Indeed,
190− <literal>packageOverrides</literal> acts as an overlay with only the
191− <varname>super</varname> argument. It is therefore appropriate for basic
192− use, but overlays are more powerful and easier to distribute.
137+ Overlays are similar to other methods for customizing Nixpkgs, in particular the <literal>packageOverrides</literal> attribute described in <xref linkend="sec-modify-via-packageOverrides"/>. Indeed, <literal>packageOverrides</literal> acts as an overlay with only the <varname>super</varname> argument. It is therefore appropriate for basic use, but overlays are more powerful and easier to distribute.
193138 </para>
194139 </section>
195140</chapter>
doc/package-notes.xml+47−215
@@ -3,38 +3,23 @@
33 xml:id="chap-package-notes">
44 <title>Package Notes</title>
55 <para>
6− This chapter contains information about how to use and maintain the Nix
7− expressions for a number of specific packages, such as the Linux kernel or
8− X.org.
6+ This chapter contains information about how to use and maintain the Nix expressions for a number of specific packages, such as the Linux kernel or X.org.
97 </para>
108<!--============================================================-->
119 <section xml:id="sec-linux-kernel">
1210 <title>Linux kernel</title>
1311
1412 <para>
15− The Nix expressions to build the Linux kernel are in
16− <link
13+ The Nix expressions to build the Linux kernel are in <link
1714xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel"><filename>pkgs/os-specific/linux/kernel</filename></link>.
1815 </para>
1916
2017 <para>
21− The function that builds the kernel has an argument
22− <varname>kernelPatches</varname> which should be a list of <literal>{name,
23− patch, extraConfig}</literal> attribute sets, where <varname>name</varname>
24− is the name of the patch (which is included in the kernel’s
25− <varname>meta.description</varname> attribute), <varname>patch</varname> is
26− the patch itself (possibly compressed), and <varname>extraConfig</varname>
27− (optional) is a string specifying extra options to be concatenated to the
28− kernel configuration file (<filename>.config</filename>).
18+ The function that builds the kernel has an argument <varname>kernelPatches</varname> which should be a list of <literal>{name, patch, extraConfig}</literal> attribute sets, where <varname>name</varname> is the name of the patch (which is included in the kernel’s <varname>meta.description</varname> attribute), <varname>patch</varname> is the patch itself (possibly compressed), and <varname>extraConfig</varname> (optional) is a string specifying extra options to be concatenated to the kernel configuration file (<filename>.config</filename>).
2919 </para>
3020
3121 <para>
32− The kernel derivation exports an attribute <varname>features</varname>
33− specifying whether optional functionality is or isn’t enabled. This is
34− used in NixOS to implement kernel-specific behaviour. For instance, if the
35− kernel has the <varname>iwlwifi</varname> feature (i.e. has built-in support
36− for Intel wireless chipsets), then NixOS doesn’t have to build the
37− external <varname>iwlwifi</varname> package:
22+ The kernel derivation exports an attribute <varname>features</varname> specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the <varname>iwlwifi</varname> feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external <varname>iwlwifi</varname> package:
3823<programlisting>
3924modulesTree = [kernel]
4025 ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi
@@ -47,45 +32,31 @@ modulesTree = [kernel]
4732 <orderedlist>
4833 <listitem>
4934 <para>
50− Copy the old Nix expression (e.g. <filename>linux-2.6.21.nix</filename>)
51− to the new one (e.g. <filename>linux-2.6.22.nix</filename>) and update
52− it.
35+ Copy the old Nix expression (e.g. <filename>linux-2.6.21.nix</filename>) to the new one (e.g. <filename>linux-2.6.22.nix</filename>) and update it.
5336 </para>
5437 </listitem>
5538 <listitem>
5639 <para>
57− Add the new kernel to <filename>all-packages.nix</filename> (e.g., create
58− an attribute <varname>kernel_2_6_22</varname>).
40+ Add the new kernel to <filename>all-packages.nix</filename> (e.g., create an attribute <varname>kernel_2_6_22</varname>).
5941 </para>
6042 </listitem>
6143 <listitem>
6244 <para>
63− Now we’re going to update the kernel configuration. First unpack the
64− kernel. Then for each supported platform (<literal>i686</literal>,
65− <literal>x86_64</literal>, <literal>uml</literal>) do the following:
45+ Now we’re going to update the kernel configuration. First unpack the kernel. Then for each supported platform (<literal>i686</literal>, <literal>x86_64</literal>, <literal>uml</literal>) do the following:
6646 <orderedlist>
6747 <listitem>
6848 <para>
69− Make an copy from the old config (e.g.
70− <filename>config-2.6.21-i686-smp</filename>) to the new one (e.g.
71− <filename>config-2.6.22-i686-smp</filename>).
49+ Make an copy from the old config (e.g. <filename>config-2.6.21-i686-smp</filename>) to the new one (e.g. <filename>config-2.6.22-i686-smp</filename>).
7250 </para>
7351 </listitem>
7452 <listitem>
7553 <para>
76− Copy the config file for this platform (e.g.
77− <filename>config-2.6.22-i686-smp</filename>) to
78− <filename>.config</filename> in the kernel source tree.
54+ Copy the config file for this platform (e.g. <filename>config-2.6.22-i686-smp</filename>) to <filename>.config</filename> in the kernel source tree.
7955 </para>
8056 </listitem>
8157 <listitem>
8258 <para>
83− Run <literal>make oldconfig
84− ARCH=<replaceable>{i386,x86_64,um}</replaceable></literal> and answer
85− all questions. (For the uml configuration, also add
86− <literal>SHELL=bash</literal>.) Make sure to keep the configuration
87− consistent between platforms (i.e. don’t enable some feature on
88− <literal>i686</literal> and disable it on <literal>x86_64</literal>).
59+ Run <literal>make oldconfig ARCH=<replaceable>{i386,x86_64,um}</replaceable></literal> and answer all questions. (For the uml configuration, also add <literal>SHELL=bash</literal>.) Make sure to keep the configuration consistent between platforms (i.e. don’t enable some feature on <literal>i686</literal> and disable it on <literal>x86_64</literal>).
8960 </para>
9061 </listitem>
9162 <listitem>
@@ -99,8 +70,7 @@ modulesTree = [kernel]
9970 </listitem>
10071 <listitem>
10172 <para>
102− Copy <filename>.config</filename> over the new config file (e.g.
103− <filename>config-2.6.22-i686-smp</filename>).
73+ Copy <filename>.config</filename> over the new config file (e.g. <filename>config-2.6.22-i686-smp</filename>).
10474 </para>
10575 </listitem>
10676 </orderedlist>
@@ -108,18 +78,12 @@ modulesTree = [kernel]
10878 </listitem>
10979 <listitem>
11080 <para>
111− Test building the kernel: <literal>nix-build -A kernel_2_6_22</literal>.
112− If it compiles, ship it! For extra credit, try booting NixOS with it.
81+ Test building the kernel: <literal>nix-build -A kernel_2_6_22</literal>. If it compiles, ship it! For extra credit, try booting NixOS with it.
11382 </para>
11483 </listitem>
11584 <listitem>
11685 <para>
117− It may be that the new kernel requires updating the external kernel
118− modules and kernel-dependent packages listed in the
119− <varname>linuxPackagesFor</varname> function in
120− <filename>all-packages.nix</filename> (such as the NVIDIA drivers, AUFS,
121− etc.). If the updated packages aren’t backwards compatible with older
122− kernels, you may need to keep the older versions around.
86+ It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the <varname>linuxPackagesFor</varname> function in <filename>all-packages.nix</filename> (such as the NVIDIA drivers, AUFS, etc.). If the updated packages aren’t backwards compatible with older kernels, you may need to keep the older versions around.
12387 </para>
12488 </listitem>
12589 </orderedlist>
@@ -130,13 +94,7 @@ modulesTree = [kernel]
13094 <title>X.org</title>
13195
13296 <para>
133− The Nix expressions for the X.org packages reside in
134− <filename>pkgs/servers/x11/xorg/default.nix</filename>. This file is
135− automatically generated from lists of tarballs in an X.org release. As such
136− it should not be modified directly; rather, you should modify the lists, the
137− generator script or the file
138− <filename>pkgs/servers/x11/xorg/overrides.nix</filename>, in which you can
139− override or add to the derivations produced by the generator.
97+ The Nix expressions for the X.org packages reside in <filename>pkgs/servers/x11/xorg/default.nix</filename>. This file is automatically generated from lists of tarballs in an X.org release. As such it should not be modified directly; rather, you should modify the lists, the generator script or the file <filename>pkgs/servers/x11/xorg/overrides.nix</filename>, in which you can override or add to the derivations produced by the generator.
14098 </para>
14199
142100 <para>
@@ -146,37 +104,22 @@ modulesTree = [kernel]
146104<prompt>$ </prompt>cat tarballs-7.5.list extra.list old.list \
147105 | perl ./generate-expr-from-tarballs.pl
148106</screen>
149− For each of the tarballs in the <filename>.list</filename> files, the script
150− downloads it, unpacks it, and searches its <filename>configure.ac</filename>
151− and <filename>*.pc.in</filename> files for dependencies. This information is
152− used to generate <filename>default.nix</filename>. The generator caches
153− downloaded tarballs between runs. Pay close attention to the <literal>NOT
154− FOUND: <replaceable>name</replaceable></literal> messages at the end of the
155− run, since they may indicate missing dependencies. (Some might be optional
156− dependencies, however.)
107+ For each of the tarballs in the <filename>.list</filename> files, the script downloads it, unpacks it, and searches its <filename>configure.ac</filename> and <filename>*.pc.in</filename> files for dependencies. This information is used to generate <filename>default.nix</filename>. The generator caches downloaded tarballs between runs. Pay close attention to the <literal>NOT FOUND: <replaceable>name</replaceable></literal> messages at the end of the run, since they may indicate missing dependencies. (Some might be optional dependencies, however.)
157108 </para>
158109
159110 <para>
160− A file like <filename>tarballs-7.5.list</filename> contains all tarballs in
161− a X.org release. It can be generated like this:
111+ A file like <filename>tarballs-7.5.list</filename> contains all tarballs in a X.org release. It can be generated like this:
162112<screen>
163113<prompt>$ </prompt>export i="mirror://xorg/X11R7.4/src/everything/"
164114<prompt>$ </prompt>cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
165115 | perl -e 'while (&lt;>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \
166116 | sort > tarballs-7.4.list
167117</screen>
168− <filename>extra.list</filename> contains libraries that aren’t part of
169− X.org proper, but are closely related to it, such as
170− <literal>libxcb</literal>. <filename>old.list</filename> contains some
171− packages that were removed from X.org, but are still needed by some people
172− or by other packages (such as <varname>imake</varname>).
118+ <filename>extra.list</filename> contains libraries that aren’t part of X.org proper, but are closely related to it, such as <literal>libxcb</literal>. <filename>old.list</filename> contains some packages that were removed from X.org, but are still needed by some people or by other packages (such as <varname>imake</varname>).
173119 </para>
174120
175121 <para>
176− If the expression for a package requires derivation attributes that the
177− generator cannot figure out automatically (say, <varname>patches</varname>
178− or a <varname>postInstall</varname> hook), you should modify
179− <filename>pkgs/servers/x11/xorg/overrides.nix</filename>.
122+ If the expression for a package requires derivation attributes that the generator cannot figure out automatically (say, <varname>patches</varname> or a <varname>postInstall</varname> hook), you should modify <filename>pkgs/servers/x11/xorg/overrides.nix</filename>.
180123 </para>
181124 </section>
182125<!--============================================================-->
@@ -199,41 +142,19 @@ modulesTree = [kernel]
199142 <title>Eclipse</title>
200143
201144 <para>
202− The Nix expressions related to the Eclipse platform and IDE are in
203− <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/eclipse"><filename>pkgs/applications/editors/eclipse</filename></link>.
145+ The Nix expressions related to the Eclipse platform and IDE are in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/eclipse"><filename>pkgs/applications/editors/eclipse</filename></link>.
204146 </para>
205147
206148 <para>
207− Nixpkgs provides a number of packages that will install Eclipse in its
208− various forms. These range from the bare-bones Eclipse Platform to the more
209− fully featured Eclipse SDK or Scala-IDE packages and multiple version are
210− often available. It is possible to list available Eclipse packages by
211− issuing the command:
149+ Nixpkgs provides a number of packages that will install Eclipse in its various forms. These range from the bare-bones Eclipse Platform to the more fully featured Eclipse SDK or Scala-IDE packages and multiple version are often available. It is possible to list available Eclipse packages by issuing the command:
212150<screen>
213151<prompt>$ </prompt>nix-env -f '&lt;nixpkgs&gt;' -qaP -A eclipses --description
214152</screen>
215− Once an Eclipse variant is installed it can be run using the
216− <command>eclipse</command> command, as expected. From within Eclipse it is
217− then possible to install plugins in the usual manner by either manually
218− specifying an Eclipse update site or by installing the Marketplace Client
219− plugin and using it to discover and install other plugins. This installation
220− method provides an Eclipse installation that closely resemble a manually
221− installed Eclipse.
153+ Once an Eclipse variant is installed it can be run using the <command>eclipse</command> command, as expected. From within Eclipse it is then possible to install plugins in the usual manner by either manually specifying an Eclipse update site or by installing the Marketplace Client plugin and using it to discover and install other plugins. This installation method provides an Eclipse installation that closely resemble a manually installed Eclipse.
222154 </para>
223155
224156 <para>
225− If you prefer to install plugins in a more declarative manner then Nixpkgs
226− also offer a number of Eclipse plugins that can be installed in an
227− <emphasis>Eclipse environment</emphasis>. This type of environment is
228− created using the function <varname>eclipseWithPlugins</varname> found
229− inside the <varname>nixpkgs.eclipses</varname> attribute set. This function
230− takes as argument <literal>{ eclipse, plugins ? [], jvmArgs ? [] }</literal>
231− where <varname>eclipse</varname> is a one of the Eclipse packages described
232− above, <varname>plugins</varname> is a list of plugin derivations, and
233− <varname>jvmArgs</varname> is a list of arguments given to the JVM running
234− the Eclipse. For example, say you wish to install the latest Eclipse
235− Platform with the popular Eclipse Color Theme plugin and also allow Eclipse
236− to use more RAM. You could then add
157+ If you prefer to install plugins in a more declarative manner then Nixpkgs also offer a number of Eclipse plugins that can be installed in an <emphasis>Eclipse environment</emphasis>. This type of environment is created using the function <varname>eclipseWithPlugins</varname> found inside the <varname>nixpkgs.eclipses</varname> attribute set. This function takes as argument <literal>{ eclipse, plugins ? [], jvmArgs ? [] }</literal> where <varname>eclipse</varname> is a one of the Eclipse packages described above, <varname>plugins</varname> is a list of plugin derivations, and <varname>jvmArgs</varname> is a list of arguments given to the JVM running the Eclipse. For example, say you wish to install the latest Eclipse Platform with the popular Eclipse Color Theme plugin and also allow Eclipse to use more RAM. You could then add
237158<screen>
238159packageOverrides = pkgs: {
239160 myEclipse = with pkgs.eclipses; eclipseWithPlugins {
@@ -243,38 +164,18 @@ packageOverrides = pkgs: {
243164 };
244165}
245166</screen>
246− to your Nixpkgs configuration
247− (<filename>~/.config/nixpkgs/config.nix</filename>) and install it by
248− running <command>nix-env -f '&lt;nixpkgs&gt;' -iA myEclipse</command> and
249− afterward run Eclipse as usual. It is possible to find out which plugins are
250− available for installation using <varname>eclipseWithPlugins</varname> by
251− running
167+ to your Nixpkgs configuration (<filename>~/.config/nixpkgs/config.nix</filename>) and install it by running <command>nix-env -f '&lt;nixpkgs&gt;' -iA myEclipse</command> and afterward run Eclipse as usual. It is possible to find out which plugins are available for installation using <varname>eclipseWithPlugins</varname> by running
252168<screen>
253169<prompt>$ </prompt>nix-env -f '&lt;nixpkgs&gt;' -qaP -A eclipses.plugins --description
254170</screen>
255171 </para>
256172
257173 <para>
258− If there is a need to install plugins that are not available in Nixpkgs then
259− it may be possible to define these plugins outside Nixpkgs using the
260− <varname>buildEclipseUpdateSite</varname> and
261− <varname>buildEclipsePlugin</varname> functions found in the
262− <varname>nixpkgs.eclipses.plugins</varname> attribute set. Use the
263− <varname>buildEclipseUpdateSite</varname> function to install a plugin
264− distributed as an Eclipse update site. This function takes <literal>{ name,
265− src }</literal> as argument where <literal>src</literal> indicates the
266− Eclipse update site archive. All Eclipse features and plugins within the
267− downloaded update site will be installed. When an update site archive is not
268− available then the <varname>buildEclipsePlugin</varname> function can be
269− used to install a plugin that consists of a pair of feature and plugin JARs.
270− This function takes an argument <literal>{ name, srcFeature, srcPlugin
271− }</literal> where <literal>srcFeature</literal> and
272− <literal>srcPlugin</literal> are the feature and plugin JARs, respectively.
174+ If there is a need to install plugins that are not available in Nixpkgs then it may be possible to define these plugins outside Nixpkgs using the <varname>buildEclipseUpdateSite</varname> and <varname>buildEclipsePlugin</varname> functions found in the <varname>nixpkgs.eclipses.plugins</varname> attribute set. Use the <varname>buildEclipseUpdateSite</varname> function to install a plugin distributed as an Eclipse update site. This function takes <literal>{ name, src }</literal> as argument where <literal>src</literal> indicates the Eclipse update site archive. All Eclipse features and plugins within the downloaded update site will be installed. When an update site archive is not available then the <varname>buildEclipsePlugin</varname> function can be used to install a plugin that consists of a pair of feature and plugin JARs. This function takes an argument <literal>{ name, srcFeature, srcPlugin }</literal> where <literal>srcFeature</literal> and <literal>srcPlugin</literal> are the feature and plugin JARs, respectively.
273175 </para>
274176
275177 <para>
276− Expanding the previous example with two plugins using the above functions we
277− have
178+ Expanding the previous example with two plugins using the above functions we have
278179<screen>
279180packageOverrides = pkgs: {
280181 myEclipse = with pkgs.eclipses; eclipseWithPlugins {
@@ -311,19 +212,15 @@ packageOverrides = pkgs: {
311212 <title>Elm</title>
312213
313214 <para>
314− To start a development environment do <command>nix-shell -p elmPackages.elm
315− elmPackages.elm-format</command>
215+ To start a development environment do <command>nix-shell -p elmPackages.elm elmPackages.elm-format</command>
316216 </para>
317217
318218 <para>
319− To update Elm compiler, see
320− <filename>nixpkgs/pkgs/development/compilers/elm/README.md</filename>.
219+ To update Elm compiler, see <filename>nixpkgs/pkgs/development/compilers/elm/README.md</filename>.
321220 </para>
322221
323222 <para>
324− To package Elm applications,
325− <link xlink:href="https://github.com/hercules-ci/elm2nix#elm2nix">read about
326− elm2nix</link>.
223+ To package Elm applications, <link xlink:href="https://github.com/hercules-ci/elm2nix#elm2nix">read about elm2nix</link>.
327224 </para>
328225 </section>
329226 <section xml:id="sec-kakoune">
@@ -342,11 +239,7 @@ packageOverrides = pkgs: {
342239 <title>Interactive shell helpers</title>
343240
344241 <para>
345− Some packages provide the shell integration to be more useful. But unlike
346− other systems, nix doesn't have a standard share directory location. This is
347− why a bunch <command>PACKAGE-share</command> scripts are shipped that print
348− the location of the corresponding shared folder. Current list of such
349− packages is as following:
242+ Some packages provide the shell integration to be more useful. But unlike other systems, nix doesn't have a standard share directory location. This is why a bunch <command>PACKAGE-share</command> scripts are shipped that print the location of the corresponding shared folder. Current list of such packages is as following:
350243 <itemizedlist>
351244 <listitem>
352245 <para>
@@ -369,31 +262,20 @@ packageOverrides = pkgs: {
369262 <title>Weechat</title>
370263
371264 <para>
372− Weechat can be configured to include your choice of plugins, reducing its
373− closure size from the default configuration which includes all available
374− plugins. To make use of this functionality, install an expression that
375− overrides its configuration such as
265+ Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as
376266<programlisting>weechat.override {configure = {availablePlugins, ...}: {
377267 plugins = with availablePlugins; [ python perl ];
378268 }
379269}</programlisting>
380− If the <literal>configure</literal> function returns an attrset without the
381− <literal>plugins</literal> attribute, <literal>availablePlugins</literal>
382− will be used automatically.
270+ If the <literal>configure</literal> function returns an attrset without the <literal>plugins</literal> attribute, <literal>availablePlugins</literal> will be used automatically.
383271 </para>
384272
385273 <para>
386− The plugins currently available are <literal>python</literal>,
387− <literal>perl</literal>, <literal>ruby</literal>, <literal>guile</literal>,
388− <literal>tcl</literal> and <literal>lua</literal>.
274+ The plugins currently available are <literal>python</literal>, <literal>perl</literal>, <literal>ruby</literal>, <literal>guile</literal>, <literal>tcl</literal> and <literal>lua</literal>.
389275 </para>
390276
391277 <para>
392− The python and perl plugins allows the addition of extra libraries. For
393− instance, the <literal>inotify.py</literal> script in weechat-scripts
394− requires D-Bus or libnotify, and the <literal>fish.py</literal> script
395− requires pycrypto. To use these scripts, use the plugin's
396− <literal>withPackages</literal> attribute:
278+ The python and perl plugins allows the addition of extra libraries. For instance, the <literal>inotify.py</literal> script in weechat-scripts requires D-Bus or libnotify, and the <literal>fish.py</literal> script requires pycrypto. To use these scripts, use the plugin's <literal>withPackages</literal> attribute:
397279<programlisting>weechat.override { configure = {availablePlugins, ...}: {
398280 plugins = with availablePlugins; [
399281 (python.withPackages (ps: with ps; [ pycrypto python-dbus ]))
@@ -404,8 +286,7 @@ packageOverrides = pkgs: {
404286 </para>
405287
406288 <para>
407− In order to also keep all default plugins installed, it is possible to use
408− the following method:
289+ In order to also keep all default plugins installed, it is possible to use the following method:
409290<programlisting>weechat.override { configure = { availablePlugins, ... }: {
410291 plugins = builtins.attrValues (availablePlugins // {
411292 python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]);
@@ -415,9 +296,7 @@ packageOverrides = pkgs: {
415296 </para>
416297
417298 <para>
418− WeeChat allows to set defaults on startup using the
419− <literal>--run-command</literal>. The <literal>configure</literal> method
420− can be used to pass commands to the program:
299+ WeeChat allows to set defaults on startup using the <literal>--run-command</literal>. The <literal>configure</literal> method can be used to pass commands to the program:
421300<programlisting>weechat.override {
422301 configure = { availablePlugins, ... }: {
423302 init = ''
@@ -426,14 +305,11 @@ packageOverrides = pkgs: {
426305 '';
427306 };
428307}</programlisting>
429− Further values can be added to the list of commands when running
430− <literal>weechat --run-command "your-commands"</literal>.
308+ Further values can be added to the list of commands when running <literal>weechat --run-command "your-commands"</literal>.
431309 </para>
432310
433311 <para>
434− Additionally it's possible to specify scripts to be loaded when starting
435− <literal>weechat</literal>. These will be loaded before the commands from
436− <literal>init</literal>:
312+ Additionally it's possible to specify scripts to be loaded when starting <literal>weechat</literal>. These will be loaded before the commands from <literal>init</literal>:
437313<programlisting>weechat.override {
438314 configure = { availablePlugins, ... }: {
439315 scripts = with pkgs.weechatScripts; [
@@ -447,11 +323,7 @@ packageOverrides = pkgs: {
447323 </para>
448324
449325 <para>
450− In <literal>nixpkgs</literal> there's a subpackage which contains
451− derivations for WeeChat scripts. Such derivations expect a
452− <literal>passthru.scripts</literal> attribute which contains a list of all
453− scripts inside the store path. Furthermore all scripts have to live in
454− <literal>$out/share</literal>. An exemplary derivation looks like this:
326+ In <literal>nixpkgs</literal> there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a <literal>passthru.scripts</literal> attribute which contains a list of all scripts inside the store path. Furthermore all scripts have to live in <literal>$out/share</literal>. An exemplary derivation looks like this:
455327<programlisting>{ stdenv, fetchurl }:
456328
457329stdenv.mkDerivation {
@@ -480,18 +352,11 @@ stdenv.mkDerivation {
480352 <title>Activating the engine</title>
481353
482354 <para>
483− IBus needs to be configured accordingly to activate
484− <literal>typing-booster</literal>. The configuration depends on the desktop
485− manager in use. For detailed instructions, please refer to the
486− <link xlink:href="https://mike-fabian.github.io/ibus-typing-booster/documentation.html">upstream
487− docs</link>.
355+ IBus needs to be configured accordingly to activate <literal>typing-booster</literal>. The configuration depends on the desktop manager in use. For detailed instructions, please refer to the <link xlink:href="https://mike-fabian.github.io/ibus-typing-booster/documentation.html">upstream docs</link>.
488356 </para>
489357
490358 <para>
491− On NixOS you need to explicitly enable <literal>ibus</literal> with given
492− engines before customizing your desktop to use
493− <literal>typing-booster</literal>. This can be achieved using the
494− <literal>ibus</literal> module:
359+ On NixOS you need to explicitly enable <literal>ibus</literal> with given engines before customizing your desktop to use <literal>typing-booster</literal>. This can be achieved using the <literal>ibus</literal> module:
495360<programlisting>{ pkgs, ... }: {
496361 i18n.inputMethod = {
497362 enabled = "ibus";
@@ -505,21 +370,14 @@ stdenv.mkDerivation {
505370 <title>Using custom hunspell dictionaries</title>
506371
507372 <para>
508− The IBus engine is based on <literal>hunspell</literal> to support
509− completion in many languages. By default the dictionaries
510− <literal>de-de</literal>, <literal>en-us</literal>,
511− <literal>fr-moderne</literal> <literal>es-es</literal>,
512− <literal>it-it</literal>, <literal>sv-se</literal> and
513− <literal>sv-fi</literal> are in use. To add another dictionary, the package
514− can be overridden like this:
373+ The IBus engine is based on <literal>hunspell</literal> to support completion in many languages. By default the dictionaries <literal>de-de</literal>, <literal>en-us</literal>, <literal>fr-moderne</literal> <literal>es-es</literal>, <literal>it-it</literal>, <literal>sv-se</literal> and <literal>sv-fi</literal> are in use. To add another dictionary, the package can be overridden like this:
515374<programlisting>ibus-engines.typing-booster.override {
516375 langs = [ "de-at" "en-gb" ];
517376}</programlisting>
518377 </para>
519378
520379 <para>
521− <emphasis>Note: each language passed to <literal>langs</literal> must be an
522− attribute name in <literal>pkgs.hunspellDicts</literal>.</emphasis>
380+ <emphasis>Note: each language passed to <literal>langs</literal> must be an attribute name in <literal>pkgs.hunspellDicts</literal>.</emphasis>
523381 </para>
524382 </section>
525383
@@ -527,10 +385,7 @@ stdenv.mkDerivation {
527385 <title>Built-in emoji picker</title>
528386
529387 <para>
530− The <literal>ibus-engines.typing-booster</literal> package contains a
531− program named <literal>emoji-picker</literal>. To display all emojis
532− correctly, a special font such as <literal>noto-fonts-emoji</literal> is
533− needed:
388+ The <literal>ibus-engines.typing-booster</literal> package contains a program named <literal>emoji-picker</literal>. To display all emojis correctly, a special font such as <literal>noto-fonts-emoji</literal> is needed:
534389 </para>
535390
536391 <para>
@@ -545,45 +400,22 @@ stdenv.mkDerivation {
545400 <title>Nginx</title>
546401
547402 <para>
548− <link xlink:href="https://nginx.org/">Nginx</link> is a reverse proxy and
549− lightweight webserver.
403+ <link xlink:href="https://nginx.org/">Nginx</link> is a reverse proxy and lightweight webserver.
550404 </para>
551405
552406 <section xml:id="sec-nginx-etag">
553407 <title>ETags on static files served from the Nix store</title>
554408
555409 <para>
556− HTTP has a couple different mechanisms for caching to prevent clients from
557− having to download the same content repeatedly if a resource has not
558− changed since the last time it was requested. When nginx is used as a
559− server for static files, it implements the caching mechanism based on the
560− <link xlink:href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified"><literal>Last-Modified</literal></link>
561− response header automatically; unfortunately, it works by using filesystem
562− timestamps to determine the value of the <literal>Last-Modified</literal>
563− header. This doesn't give the desired behavior when the file is in the Nix
564− store, because all file timestamps are set to 0 (for reasons related to
565− build reproducibility).
410+ HTTP has a couple different mechanisms for caching to prevent clients from having to download the same content repeatedly if a resource has not changed since the last time it was requested. When nginx is used as a server for static files, it implements the caching mechanism based on the <link xlink:href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified"><literal>Last-Modified</literal></link> response header automatically; unfortunately, it works by using filesystem timestamps to determine the value of the <literal>Last-Modified</literal> header. This doesn't give the desired behavior when the file is in the Nix store, because all file timestamps are set to 0 (for reasons related to build reproducibility).
566411 </para>
567412
568413 <para>
569− Fortunately, HTTP supports an alternative (and more effective) caching
570− mechanism: the
571− <link xlink:href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag"><literal>ETag</literal></link>
572− response header. The value of the <literal>ETag</literal> header specifies
573− some identifier for the particular content that the server is sending (e.g.
574− a hash). When a client makes a second request for the same resource, it
575− sends that value back in an <literal>If-None-Match</literal> header. If the
576− ETag value is unchanged, then the server does not need to resend the
577− content.
414+ Fortunately, HTTP supports an alternative (and more effective) caching mechanism: the <link xlink:href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag"><literal>ETag</literal></link> response header. The value of the <literal>ETag</literal> header specifies some identifier for the particular content that the server is sending (e.g. a hash). When a client makes a second request for the same resource, it sends that value back in an <literal>If-None-Match</literal> header. If the ETag value is unchanged, then the server does not need to resend the content.
578415 </para>
579416
580417 <para>
581− As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when
582− nginx serves a file out of <filename>/nix/store</filename>, the hash in the
583− store path is used as the <literal>ETag</literal> header in the HTTP
584− response, thus providing proper caching functionality. This happens
585− automatically; you do not need to do modify any configuration to get this
586− behavior.
418+ As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when nginx serves a file out of <filename>/nix/store</filename>, the hash in the store path is used as the <literal>ETag</literal> header in the HTTP response, thus providing proper caching functionality. This happens automatically; you do not need to do modify any configuration to get this behavior.
587419 </para>
588420 </section>
589421 </section>
doc/package-specific-user-notes.xml+28−147
@@ -1,46 +1,24 @@
11<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="package-specific-user-notes">
22 <title>Package-specific usage notes</title>
33 <para>
4− These chapters includes some notes that apply to specific packages and should
5− answer some of the frequently asked questions related to Nixpkgs use. Some
6− useful information related to package use can be found in
7− <link linkend="chap-package-notes">package-specific development notes</link>.
4+ These chapters includes some notes that apply to specific packages and should answer some of the frequently asked questions related to Nixpkgs use. Some useful information related to package use can be found in <link linkend="chap-package-notes">package-specific development notes</link>.
85 </para>
96 <section xml:id="opengl">
107 <title>OpenGL</title>
118
129 <para>
13− Packages that use OpenGL have NixOS desktop as their primary target. The
14− current solution for loading the GPU-specific drivers is based on
15− <literal>libglvnd</literal> and looks for the driver implementation in
16− <literal>LD_LIBRARY_PATH</literal>. If you are using a non-NixOS
17− GNU/Linux/X11 desktop with free software video drivers, consider launching
18− OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of
19− <literal>libglvnd</literal> and <literal>mesa_drivers</literal> in
20− <literal>LD_LIBRARY_PATH</literal>. For proprietary video drivers you might
21− have luck with also adding the corresponding video driver package.
10+ Packages that use OpenGL have NixOS desktop as their primary target. The current solution for loading the GPU-specific drivers is based on <literal>libglvnd</literal> and looks for the driver implementation in <literal>LD_LIBRARY_PATH</literal>. If you are using a non-NixOS GNU/Linux/X11 desktop with free software video drivers, consider launching OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of <literal>libglvnd</literal> and <literal>mesa_drivers</literal> in <literal>LD_LIBRARY_PATH</literal>. For proprietary video drivers you might have luck with also adding the corresponding video driver package.
2211 </para>
2312 </section>
2413 <section xml:id="locales">
2514 <title>Locales</title>
2615
2716 <para>
28− To allow simultaneous use of packages linked against different versions of
29− <literal>glibc</literal> with different locale archive formats Nixpkgs
30− patches <literal>glibc</literal> to rely on
31− <literal>LOCALE_ARCHIVE</literal> environment variable.
17+ To allow simultaneous use of packages linked against different versions of <literal>glibc</literal> with different locale archive formats Nixpkgs patches <literal>glibc</literal> to rely on <literal>LOCALE_ARCHIVE</literal> environment variable.
3218 </para>
3319
3420 <para>
35− On non-NixOS distributions this variable is obviously not set. This can
36− cause regressions in language support or even crashes in some
37− Nixpkgs-provided programs. The simplest way to mitigate this problem is
38− exporting the <literal>LOCALE_ARCHIVE</literal> variable pointing to
39− <literal>${glibcLocales}/lib/locale/locale-archive</literal>. The drawback
40− (and the reason this is not the default) is the relatively large (a hundred
41− MiB) size of the full set of locales. It is possible to build a custom set
42− of locales by overriding parameters <literal>allLocales</literal> and
43− <literal>locales</literal> of the package.
21+ On non-NixOS distributions this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the <literal>LOCALE_ARCHIVE</literal> variable pointing to <literal>${glibcLocales}/lib/locale/locale-archive</literal>. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters <literal>allLocales</literal> and <literal>locales</literal> of the package.
4422 </para>
4523 </section>
4624 <section xml:id="sec-emacs">
@@ -50,15 +28,7 @@
5028 <title>Configuring Emacs</title>
5129
5230 <para>
53− The Emacs package comes with some extra helpers to make it easier to
54− configure. <varname>emacsWithPackages</varname> allows you to manage
55− packages from ELPA. This means that you will not have to install that
56− packages from within Emacs. For instance, if you wanted to use
57− <literal>company</literal>, <literal>counsel</literal>,
58− <literal>flycheck</literal>, <literal>ivy</literal>,
59− <literal>magit</literal>, <literal>projectile</literal>, and
60− <literal>use-package</literal> you could use this as a
61− <filename>~/.config/nixpkgs/config.nix</filename> override:
31+ The Emacs package comes with some extra helpers to make it easier to configure. <varname>emacsWithPackages</varname> allows you to manage packages from ELPA. This means that you will not have to install that packages from within Emacs. For instance, if you wanted to use <literal>company</literal>, <literal>counsel</literal>, <literal>flycheck</literal>, <literal>ivy</literal>, <literal>magit</literal>, <literal>projectile</literal>, and <literal>use-package</literal> you could use this as a <filename>~/.config/nixpkgs/config.nix</filename> override:
6232 </para>
6333
6434<screen>
@@ -78,15 +48,7 @@
7848</screen>
7949
8050 <para>
81− You can install it like any other packages via <command>nix-env -iA
82− myEmacs</command>. However, this will only install those packages. It will
83− not <literal>configure</literal> them for us. To do this, we need to
84− provide a configuration file. Luckily, it is possible to do this from
85− within Nix! By modifying the above example, we can make Emacs load a custom
86− config file. The key is to create a package that provide a
87− <filename>default.el</filename> file in
88− <filename>/share/emacs/site-start/</filename>. Emacs knows to load this
89− file automatically when it starts.
51+ You can install it like any other packages via <command>nix-env -iA myEmacs</command>. However, this will only install those packages. It will not <literal>configure</literal> them for us. To do this, we need to provide a configuration file. Luckily, it is possible to do this from within Nix! By modifying the above example, we can make Emacs load a custom config file. The key is to create a package that provide a <filename>default.el</filename> file in <filename>/share/emacs/site-start/</filename>. Emacs knows to load this file automatically when it starts.
9052 </para>
9153
9254<screen>
@@ -168,22 +130,11 @@ cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
168130</screen>
169131
170132 <para>
171− This provides a fairly full Emacs start file. It will load in addition to
172− the user's presonal config. You can always disable it by passing
173− <command>-q</command> to the Emacs command.
133+ This provides a fairly full Emacs start file. It will load in addition to the user's presonal config. You can always disable it by passing <command>-q</command> to the Emacs command.
174134 </para>
175135
176136 <para>
177− Sometimes <varname>emacsWithPackages</varname> is not enough, as this
178− package set has some priorities imposed on packages (with the lowest
179− priority assigned to Melpa Unstable, and the highest for packages manually
180− defined in <filename>pkgs/top-level/emacs-packages.nix</filename>). But you
181− can't control this priorities when some package is installed as a
182− dependency. You can override it on per-package-basis, providing all the
183− required dependencies manually - but it's tedious and there is always a
184− possibility that an unwanted dependency will sneak in through some other
185− package. To completely override such a package you can use
186− <varname>overrideScope'</varname>.
137+ Sometimes <varname>emacsWithPackages</varname> is not enough, as this package set has some priorities imposed on packages (with the lowest priority assigned to Melpa Unstable, and the highest for packages manually defined in <filename>pkgs/top-level/emacs-packages.nix</filename>). But you can't control this priorities when some package is installed as a dependency. You can override it on per-package-basis, providing all the required dependencies manually - but it's tedious and there is always a possibility that an unwanted dependency will sneak in through some other package. To completely override such a package you can use <varname>overrideScope'</varname>.
187138 </para>
188139
189140<screen>
@@ -203,23 +154,18 @@ overrides = self: super: rec {
203154 <title>DLib</title>
204155
205156 <para>
206− <link xlink:href="http://dlib.net/">DLib</link> is a modern, C++-based
207− toolkit which provides several machine learning algorithms.
157+ <link xlink:href="http://dlib.net/">DLib</link> is a modern, C++-based toolkit which provides several machine learning algorithms.
208158 </para>
209159
210160 <section xml:id="compiling-without-avx-support">
211161 <title>Compiling without AVX support</title>
212162
213163 <para>
214− Especially older CPUs don't support
215− <link xlink:href="https://en.wikipedia.org/wiki/Advanced_Vector_Extensions">AVX</link>
216− (<abbrev>Advanced Vector Extensions</abbrev>) instructions that are used by
217− DLib to optimize their algorithms.
164+ Especially older CPUs don't support <link xlink:href="https://en.wikipedia.org/wiki/Advanced_Vector_Extensions">AVX</link> (<abbrev>Advanced Vector Extensions</abbrev>) instructions that are used by DLib to optimize their algorithms.
218165 </para>
219166
220167 <para>
221− On the affected hardware errors like <literal>Illegal instruction</literal>
222− will occur. In those cases AVX support needs to be disabled:
168+ On the affected hardware errors like <literal>Illegal instruction</literal> will occur. In those cases AVX support needs to be disabled:
223169<programlisting>self: super: {
224170 dlib = super.dlib.override { avxSupport = false; };
225171}</programlisting>
@@ -230,22 +176,11 @@ overrides = self: super: rec {
230176 <title>Unfree software</title>
231177
232178 <para>
233− All users of Nixpkgs are free software users, and many users (and
234− developers) of Nixpkgs want to limit and tightly control their exposure to
235− unfree software. At the same time, many users need (or want) to run some
236− specific pieces of proprietary software. Nixpkgs includes some expressions
237− for unfree software packages. By default unfree software cannot be installed
238− and doesn’t show up in searches. To allow installing unfree software in a
239− single Nix invocation one can export
240− <literal>NIXPKGS_ALLOW_UNFREE=1</literal>. For a persistent solution, users
241− can set <literal>allowUnfree</literal> in the Nixpkgs configuration.
179+ All users of Nixpkgs are free software users, and many users (and developers) of Nixpkgs want to limit and tightly control their exposure to unfree software. At the same time, many users need (or want) to run some specific pieces of proprietary software. Nixpkgs includes some expressions for unfree software packages. By default unfree software cannot be installed and doesn’t show up in searches. To allow installing unfree software in a single Nix invocation one can export <literal>NIXPKGS_ALLOW_UNFREE=1</literal>. For a persistent solution, users can set <literal>allowUnfree</literal> in the Nixpkgs configuration.
242180 </para>
243181
244182 <para>
245− Fine-grained control is possible by defining
246− <literal>allowUnfreePredicate</literal> function in config; it takes the
247− <literal>mkDerivation</literal> parameter attrset and returns
248− <literal>true</literal> for unfree packages that should be allowed.
183+ Fine-grained control is possible by defining <literal>allowUnfreePredicate</literal> function in config; it takes the <literal>mkDerivation</literal> parameter attrset and returns <literal>true</literal> for unfree packages that should be allowed.
249184 </para>
250185 </section>
251186 <section xml:id="sec-steam">
@@ -255,13 +190,7 @@ overrides = self: super: rec {
255190 <title>Steam in Nix</title>
256191
257192 <para>
258− Steam is distributed as a <filename>.deb</filename> file, for now only as
259− an i686 package (the amd64 package only has documentation). When unpacked,
260− it has a script called <filename>steam</filename> that in Ubuntu (their
261− target distro) would go to <filename>/usr/bin </filename>. When run for the
262− first time, this script copies some files to the user's home, which include
263− another script that is the ultimate responsible for launching the steam
264− binary, which is also in $HOME.
193+ Steam is distributed as a <filename>.deb</filename> file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called <filename>steam</filename> that in Ubuntu (their target distro) would go to <filename>/usr/bin </filename>. When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in $HOME.
265194 </para>
266195
267196 <para>
@@ -269,8 +198,7 @@ overrides = self: super: rec {
269198 <itemizedlist>
270199 <listitem>
271200 <para>
272− We don't have <filename>/bin/bash</filename> and many scripts point
273− there. Similarly for <filename>/usr/bin/python</filename> .
201+ We don't have <filename>/bin/bash</filename> and many scripts point there. Similarly for <filename>/usr/bin/python</filename> .
274202 </para>
275203 </listitem>
276204 <listitem>
@@ -280,8 +208,7 @@ overrides = self: super: rec {
280208 </listitem>
281209 <listitem>
282210 <para>
283− The <filename>steam.sh</filename> script in $HOME can not be patched, as
284− it is checked and rewritten by steam.
211+ The <filename>steam.sh</filename> script in $HOME can not be patched, as it is checked and rewritten by steam.
285212 </para>
286213 </listitem>
287214 <listitem>
@@ -293,11 +220,7 @@ overrides = self: super: rec {
293220 </para>
294221
295222 <para>
296− The current approach to deploy Steam in NixOS is composing a FHS-compatible
297− chroot environment, as documented
298− <link xlink:href="http://sandervanderburg.blogspot.nl/2013/09/composing-fhs-compatible-chroot.html">here</link>.
299− This allows us to have binaries in the expected paths without disrupting
300− the system, and to avoid patching them to work in a non FHS environment.
223+ The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented <link xlink:href="http://sandervanderburg.blogspot.nl/2013/09/composing-fhs-compatible-chroot.html">here</link>. This allows us to have binaries in the expected paths without disrupting the system, and to avoid patching them to work in a non FHS environment.
301224 </para>
302225 </section>
303226
@@ -309,9 +232,7 @@ overrides = self: super: rec {
309232<programlisting>hardware.opengl.driSupport32Bit = true;</programlisting>
310233 in your <filename>/etc/nixos/configuration.nix</filename>. You'll also need
311234<programlisting>hardware.pulseaudio.support32Bit = true;</programlisting>
312− if you are using PulseAudio - this will enable 32bit ALSA apps integration.
313− To use the Steam controller or other Steam supported controllers such as
314− the DualShock 4 or Nintendo Switch Pro, you need to add
235+ if you are using PulseAudio - this will enable 32bit ALSA apps integration. To use the Steam controller or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro, you need to add
315236<programlisting>hardware.steam-hardware.enable = true;</programlisting>
316237 to your configuration.
317238 </para>
@@ -342,19 +263,14 @@ overrides = self: super: rec {
342263 <itemizedlist>
343264 <listitem>
344265 <para>
345− The <literal>newStdcpp</literal> parameter was removed since NixOS
346− 17.09 and should not be needed anymore.
266+ The <literal>newStdcpp</literal> parameter was removed since NixOS 17.09 and should not be needed anymore.
347267 </para>
348268 </listitem>
349269 <listitem>
350270 <para>
351− Steam ships statically linked with a version of libcrypto that
352− conflics with the one dynamically loaded by radeonsi_dri.so. If you
353− get the error
271+ Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error
354272<programlisting>steam.sh: line 713: 7842 Segmentation fault (core dumped)</programlisting>
355− have a look at
356− <link xlink:href="https://github.com/NixOS/nixpkgs/pull/20269">this
357− pull request</link>.
273+ have a look at <link xlink:href="https://github.com/NixOS/nixpkgs/pull/20269">this pull request</link>.
358274 </para>
359275 </listitem>
360276 </itemizedlist>
@@ -368,8 +284,7 @@ overrides = self: super: rec {
368284 <orderedlist>
369285 <listitem>
370286 <para>
371− There is no java in steam chrootenv by default. If you get a message
372− like
287+ There is no java in steam chrootenv by default. If you get a message like
373288<programlisting>/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found</programlisting>
374289 You need to add
375290<programlisting> steam.override { withJava = true; };</programlisting>
@@ -387,8 +302,7 @@ overrides = self: super: rec {
387302 <title>steam-run</title>
388303
389304 <para>
390− The FHS-compatible chroot used for steam can also be used to run other
391− linux games that expect a FHS environment. To do it, add
305+ The FHS-compatible chroot used for steam can also be used to run other linux games that expect a FHS environment. To do it, add
392306<programlisting>pkgs.(steam.override {
393307 nativeOnly = true;
394308 newStdcpp = true;
@@ -404,46 +318,23 @@ overrides = self: super: rec {
404318 <para>
405319 <note>
406320 <para>
407− Please note that the <literal>citrix_receiver</literal> package has been
408− deprecated since its development was
409− <link xlink:href="https://docs.citrix.com/en-us/citrix-workspace-app.html">discontinued
410− by upstream</link> and has been replaced by
411− <link xlink:href="https://www.citrix.com/products/workspace-app/">the
412− citrix workspace app</link>.
321+ Please note that the <literal>citrix_receiver</literal> package has been deprecated since its development was <link xlink:href="https://docs.citrix.com/en-us/citrix-workspace-app.html">discontinued by upstream</link> and has been replaced by <link xlink:href="https://www.citrix.com/products/workspace-app/">the citrix workspace app</link>.
413322 </para>
414323 </note>
415− <link xlink:href="https://www.citrix.com/products/receiver/">Citrix
416− Receiver</link> and
417− <link xlink:href="https://www.citrix.com/products/workspace-app/">Citrix
418− Workspace App</link> are a remote desktop viewers which provide access to
419− <link xlink:href="https://www.citrix.com/products/xenapp-xendesktop/">XenDesktop</link>
420− installations.
324+ <link xlink:href="https://www.citrix.com/products/receiver/">Citrix Receiver</link> and <link xlink:href="https://www.citrix.com/products/workspace-app/">Citrix Workspace App</link> are a remote desktop viewers which provide access to <link xlink:href="https://www.citrix.com/products/xenapp-xendesktop/">XenDesktop</link> installations.
421325 </para>
422326
423327 <section xml:id="sec-citrix-base">
424328 <title>Basic usage</title>
425329
426330 <para>
427− The tarball archive needs to be downloaded manually as the license
428− agreements of the vendor for
429− <link xlink:href="https://www.citrix.com/downloads/citrix-receiver/">Citrix
430− Receiver</link> or
431− <link xlink:href="https://www.citrix.de/downloads/workspace-app/linux/workspace-app-for-linux-latest.html">Citrix
432− Workspace</link> need to be accepted first. Then run
433− <command>nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz</command>.
434− With the archive available in the store the package can be built and
435− installed with Nix.
331+ The tarball archive needs to be downloaded manually as the license agreements of the vendor for <link xlink:href="https://www.citrix.com/downloads/citrix-receiver/">Citrix Receiver</link> or <link xlink:href="https://www.citrix.de/downloads/workspace-app/linux/workspace-app-for-linux-latest.html">Citrix Workspace</link> need to be accepted first. Then run <command>nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz</command>. With the archive available in the store the package can be built and installed with Nix.
436332 </para>
437333
438334 <warning>
439335 <title>Caution with <command>nix-shell</command> installs</title>
440336 <para>
441− It's recommended to install <literal>Citrix Receiver</literal> and/or
442− <literal>Citrix Workspace</literal> using <literal>nix-env -i</literal> or
443− globally to ensure that the <literal>.desktop</literal> files are
444− installed properly into <literal>$XDG_CONFIG_DIRS</literal>. Otherwise it
445− won't be possible to open <literal>.ica</literal> files automatically from
446− the browser to start a Citrix connection.
337+ It's recommended to install <literal>Citrix Receiver</literal> and/or <literal>Citrix Workspace</literal> using <literal>nix-env -i</literal> or globally to ensure that the <literal>.desktop</literal> files are installed properly into <literal>$XDG_CONFIG_DIRS</literal>. Otherwise it won't be possible to open <literal>.ica</literal> files automatically from the browser to start a Citrix connection.
447338 </para>
448339 </warning>
449340 </section>
@@ -452,17 +343,7 @@ overrides = self: super: rec {
452343 <title>Custom certificates</title>
453344
454345 <para>
455− The <literal>Citrix Workspace App</literal> in <literal>nixpkgs</literal>
456− trust several certificates
457− <link xlink:href="https://curl.haxx.se/docs/caextract.html">from the
458− Mozilla database</link> by default. However several companies using Citrix
459− might require their own corporate certificate. On distros with imperative
460− packaging these certs can be stored easily in
461− <link xlink:href="https://developer-docs.citrix.com/projects/receiver-for-linux-command-reference/en/13.7/"><literal>$ICAROOT</literal></link>,
462− however this directory is a store path in <literal>nixpkgs</literal>. In
463− order to work around this issue the package provides a simple mechanism to
464− add custom certificates without rebuilding the entire package using
465− <literal>symlinkJoin</literal>:
346+ The <literal>Citrix Workspace App</literal> in <literal>nixpkgs</literal> trust several certificates <link xlink:href="https://curl.haxx.se/docs/caextract.html">from the Mozilla database</link> by default. However several companies using Citrix might require their own corporate certificate. On distros with imperative packaging these certs can be stored easily in <link xlink:href="https://developer-docs.citrix.com/projects/receiver-for-linux-command-reference/en/13.7/"><literal>$ICAROOT</literal></link>, however this directory is a store path in <literal>nixpkgs</literal>. In order to work around this issue the package provides a simple mechanism to add custom certificates without rebuilding the entire package using <literal>symlinkJoin</literal>:
466347<programlisting>
467348<![CDATA[with import <nixpkgs> { config.allowUnfree = true; };
468349let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in
doc/platform-notes.xml+6−28
@@ -12,12 +12,7 @@
1212 <itemizedlist>
1313 <listitem>
1414 <para>
15− The Darwin <literal>stdenv</literal> uses clang instead of gcc. When
16− referring to the compiler <varname>$CC</varname> or <command>cc</command>
17− will work in both cases. Some builds hardcode gcc/g++ in their build
18− scripts, that can usually be fixed with using something like
19− <literal>makeFlags = [ "CC=cc" ];</literal> or by patching the build
20− scripts.
15+ The Darwin <literal>stdenv</literal> uses clang instead of gcc. When referring to the compiler <varname>$CC</varname> or <command>cc</command> will work in both cases. Some builds hardcode gcc/g++ in their build scripts, that can usually be fixed with using something like <literal>makeFlags = [ "CC=cc" ];</literal> or by patching the build scripts.
2116 </para>
2217<programlisting>
2318stdenv.mkDerivation {
@@ -31,12 +26,7 @@ stdenv.mkDerivation {
3126 </listitem>
3227 <listitem>
3328 <para>
34− On Darwin, libraries are linked using absolute paths, libraries are
35− resolved by their <literal>install_name</literal> at link time. Sometimes
36− packages won't set this correctly causing the library lookups to fail at
37− runtime. This can be fixed by adding extra linker flags or by running
38− <command>install_name_tool -id</command> during the
39− <function>fixupPhase</function>.
29+ On Darwin, libraries are linked using absolute paths, libraries are resolved by their <literal>install_name</literal> at link time. Sometimes packages won't set this correctly causing the library lookups to fail at runtime. This can be fixed by adding extra linker flags or by running <command>install_name_tool -id</command> during the <function>fixupPhase</function>.
4030 </para>
4131<programlisting>
4232stdenv.mkDerivation {
@@ -48,16 +38,10 @@ stdenv.mkDerivation {
4838 </listitem>
4939 <listitem>
5040 <para>
51− Even if the libraries are linked using absolute paths and resolved via
52− their <literal>install_name</literal> correctly, tests can sometimes fail
53− to run binaries. This happens because the <varname>checkPhase</varname>
54− runs before the libraries are installed.
41+ Even if the libraries are linked using absolute paths and resolved via their <literal>install_name</literal> correctly, tests can sometimes fail to run binaries. This happens because the <varname>checkPhase</varname> runs before the libraries are installed.
5542 </para>
5643 <para>
57− This can usually be solved by running the tests after the
58− <varname>installPhase</varname> or alternatively by using
59− <varname>DYLD_LIBRARY_PATH</varname>. More information about this variable
60− can be found in the <citerefentry>
44+ This can usually be solved by running the tests after the <varname>installPhase</varname> or alternatively by using <varname>DYLD_LIBRARY_PATH</varname>. More information about this variable can be found in the <citerefentry>
6145 <refentrytitle>dyld</refentrytitle>
6246 <manvolnum>1</manvolnum></citerefentry> manpage.
6347 </para>
@@ -78,11 +62,7 @@ stdenv.mkDerivation {
7862 </listitem>
7963 <listitem>
8064 <para>
81− Some packages assume xcode is available and use <command>xcrun</command>
82− to resolve build tools like <command>clang</command>, etc. This causes
83− errors like <code>xcode-select: error: no developer tools were found at
84− '/Applications/Xcode.app'</code> while the build doesn't actually depend
85− on xcode.
65+ Some packages assume xcode is available and use <command>xcrun</command> to resolve build tools like <command>clang</command>, etc. This causes errors like <code>xcode-select: error: no developer tools were found at '/Applications/Xcode.app'</code> while the build doesn't actually depend on xcode.
8666 </para>
8767<programlisting>
8868stdenv.mkDerivation {
@@ -95,9 +75,7 @@ stdenv.mkDerivation {
9575}
9676</programlisting>
9777 <para>
98− The package <literal>xcbuild</literal> can be used to build projects that
99− really depend on Xcode. However, this replacement is not 100% compatible
100− with Xcode and can occasionally cause issues.
78+ The package <literal>xcbuild</literal> can be used to build projects that really depend on Xcode. However, this replacement is not 100% compatible with Xcode and can occasionally cause issues.
10179 </para>
10280 </listitem>
10381 </itemizedlist>
doc/quick-start.xml+36−108
@@ -15,120 +15,75 @@
1515 </listitem>
1616 <listitem>
1717 <para>
18− Find a good place in the Nixpkgs tree to add the Nix expression for your
19− package. For instance, a library package typically goes into
20− <filename>pkgs/development/libraries/<replaceable>pkgname</replaceable></filename>,
21− while a web browser goes into
22− <filename>pkgs/applications/networking/browsers/<replaceable>pkgname</replaceable></filename>.
23− See <xref linkend="sec-organisation" /> for some hints on the tree
24− organisation. Create a directory for your package, e.g.
18+ Find a good place in the Nixpkgs tree to add the Nix expression for your package. For instance, a library package typically goes into <filename>pkgs/development/libraries/<replaceable>pkgname</replaceable></filename>, while a web browser goes into <filename>pkgs/applications/networking/browsers/<replaceable>pkgname</replaceable></filename>. See <xref linkend="sec-organisation" /> for some hints on the tree organisation. Create a directory for your package, e.g.
2519<screen>
2620<prompt>$ </prompt>mkdir pkgs/development/libraries/libfoo</screen>
2721 </para>
2822 </listitem>
2923 <listitem>
3024 <para>
31− In the package directory, create a Nix expression — a piece of code that
32− describes how to build the package. In this case, it should be a
33− <emphasis>function</emphasis> that is called with the package dependencies
34− as arguments, and returns a build of the package in the Nix store. The
35− expression should usually be called <filename>default.nix</filename>.
25+ In the package directory, create a Nix expression — a piece of code that describes how to build the package. In this case, it should be a <emphasis>function</emphasis> that is called with the package dependencies as arguments, and returns a build of the package in the Nix store. The expression should usually be called <filename>default.nix</filename>.
3626<screen>
3727<prompt>$ </prompt>emacs pkgs/development/libraries/libfoo/default.nix
3828<prompt>$ </prompt>git add pkgs/development/libraries/libfoo/default.nix</screen>
3929 </para>
4030 <para>
41− You can have a look at the existing Nix expressions under
42− <filename>pkgs/</filename> to see how it’s done. Here are some good
43− ones:
31+ You can have a look at the existing Nix expressions under <filename>pkgs/</filename> to see how it’s done. Here are some good ones:
4432 <itemizedlist>
4533 <listitem>
4634 <para>
47− GNU Hello:
48− <link
49− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hello/default.nix"><filename>pkgs/applications/misc/hello/default.nix</filename></link>.
50− Trivial package, which specifies some <varname>meta</varname>
51− attributes which is good practice.
35+ GNU Hello: <link
36+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hello/default.nix"><filename>pkgs/applications/misc/hello/default.nix</filename></link>. Trivial package, which specifies some <varname>meta</varname> attributes which is good practice.
5237 </para>
5338 </listitem>
5439 <listitem>
5540 <para>
56− GNU cpio:
57− <link
58− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/archivers/cpio/default.nix"><filename>pkgs/tools/archivers/cpio/default.nix</filename></link>.
59− Also a simple package. The generic builder in <varname>stdenv</varname>
60− does everything for you. It has no dependencies beyond
61− <varname>stdenv</varname>.
41+ GNU cpio: <link
42+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/archivers/cpio/default.nix"><filename>pkgs/tools/archivers/cpio/default.nix</filename></link>. Also a simple package. The generic builder in <varname>stdenv</varname> does everything for you. It has no dependencies beyond <varname>stdenv</varname>.
6243 </para>
6344 </listitem>
6445 <listitem>
6546 <para>
66− GNU Multiple Precision arithmetic library (GMP):
67− <link
68− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix"><filename>pkgs/development/libraries/gmp/5.1.x.nix</filename></link>.
69− Also done by the generic builder, but has a dependency on
70− <varname>m4</varname>.
47+ GNU Multiple Precision arithmetic library (GMP): <link
48+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix"><filename>pkgs/development/libraries/gmp/5.1.x.nix</filename></link>. Also done by the generic builder, but has a dependency on <varname>m4</varname>.
7149 </para>
7250 </listitem>
7351 <listitem>
7452 <para>
75− Pan, a GTK-based newsreader:
76− <link
77− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix"><filename>pkgs/applications/networking/newsreaders/pan/default.nix</filename></link>.
78− Has an optional dependency on <varname>gtkspell</varname>, which is
79− only built if <varname>spellCheck</varname> is <literal>true</literal>.
53+ Pan, a GTK-based newsreader: <link
54+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix"><filename>pkgs/applications/networking/newsreaders/pan/default.nix</filename></link>. Has an optional dependency on <varname>gtkspell</varname>, which is only built if <varname>spellCheck</varname> is <literal>true</literal>.
8055 </para>
8156 </listitem>
8257 <listitem>
8358 <para>
84− Apache HTTPD:
85− <link
86− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/2.4.nix"><filename>pkgs/servers/http/apache-httpd/2.4.nix</filename></link>.
87− A bunch of optional features, variable substitutions in the configure
88− flags, a post-install hook, and miscellaneous hackery.
59+ Apache HTTPD: <link
60+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/2.4.nix"><filename>pkgs/servers/http/apache-httpd/2.4.nix</filename></link>. A bunch of optional features, variable substitutions in the configure flags, a post-install hook, and miscellaneous hackery.
8961 </para>
9062 </listitem>
9163 <listitem>
9264 <para>
93− Thunderbird:
94− <link
95− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix"><filename>pkgs/applications/networking/mailreaders/thunderbird/default.nix</filename></link>.
96− Lots of dependencies.
65+ Thunderbird: <link
66+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix"><filename>pkgs/applications/networking/mailreaders/thunderbird/default.nix</filename></link>. Lots of dependencies.
9767 </para>
9868 </listitem>
9969 <listitem>
10070 <para>
101− JDiskReport, a Java utility:
102− <link
103− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix"><filename>pkgs/tools/misc/jdiskreport/default.nix</filename></link>
104− (and the
105− <link
106− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/builder.sh">builder</link>).
107− Nixpkgs doesn’t have a decent <varname>stdenv</varname> for Java yet
108− so this is pretty ad-hoc.
71+ JDiskReport, a Java utility: <link
72+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix"><filename>pkgs/tools/misc/jdiskreport/default.nix</filename></link> (and the <link
73+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/builder.sh">builder</link>). Nixpkgs doesn’t have a decent <varname>stdenv</varname> for Java yet so this is pretty ad-hoc.
10974 </para>
11075 </listitem>
11176 <listitem>
11277 <para>
113− XML::Simple, a Perl module:
114− <link
115− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix"><filename>pkgs/top-level/perl-packages.nix</filename></link>
116− (search for the <varname>XMLSimple</varname> attribute). Most Perl
117− modules are so simple to build that they are defined directly in
118− <filename>perl-packages.nix</filename>; no need to make a separate file
119− for them.
78+ XML::Simple, a Perl module: <link
79+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix"><filename>pkgs/top-level/perl-packages.nix</filename></link> (search for the <varname>XMLSimple</varname> attribute). Most Perl modules are so simple to build that they are defined directly in <filename>perl-packages.nix</filename>; no need to make a separate file for them.
12080 </para>
12181 </listitem>
12282 <listitem>
12383 <para>
124− Adobe Reader:
125− <link
126− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/default.nix"><filename>pkgs/applications/misc/adobe-reader/default.nix</filename></link>.
127− Shows how binary-only packages can be supported. In particular the
128− <link
129− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/builder.sh">builder</link>
130− uses <command>patchelf</command> to set the RUNPATH and ELF interpreter
131− of the executables so that the right libraries are found at runtime.
84+ Adobe Reader: <link
85+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/default.nix"><filename>pkgs/applications/misc/adobe-reader/default.nix</filename></link>. Shows how binary-only packages can be supported. In particular the <link
86+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/builder.sh">builder</link> uses <command>patchelf</command> to set the RUNPATH and ELF interpreter of the executables so that the right libraries are found at runtime.
13287 </para>
13388 </listitem>
13489 </itemizedlist>
@@ -138,67 +93,45 @@
13893 <itemizedlist>
13994 <listitem>
14095 <para>
141− All <varname linkend="chap-meta">meta</varname> attributes are
142− optional, but it’s still a good idea to provide at least the
143− <varname>description</varname>, <varname>homepage</varname> and
144− <varname
96+ All <varname linkend="chap-meta">meta</varname> attributes are optional, but it’s still a good idea to provide at least the <varname>description</varname>, <varname>homepage</varname> and <varname
14597 linkend="sec-meta-license">license</varname>.
14698 </para>
14799 </listitem>
148100 <listitem>
149101 <para>
150− You can use <command>nix-prefetch-url</command>
151− <replaceable>url</replaceable> to get the SHA-256 hash of source
152− distributions. There are similar commands as
153− <command>nix-prefetch-git</command> and
154− <command>nix-prefetch-hg</command> available in
155− <literal>nix-prefetch-scripts</literal> package.
102+ You can use <command>nix-prefetch-url</command> <replaceable>url</replaceable> to get the SHA-256 hash of source distributions. There are similar commands as <command>nix-prefetch-git</command> and <command>nix-prefetch-hg</command> available in <literal>nix-prefetch-scripts</literal> package.
156103 </para>
157104 </listitem>
158105 <listitem>
159106 <para>
160− A list of schemes for <literal>mirror://</literal> URLs can be found in
161− <link
107+ A list of schemes for <literal>mirror://</literal> URLs can be found in <link
162108 xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/mirrors.nix"><filename>pkgs/build-support/fetchurl/mirrors.nix</filename></link>.
163109 </para>
164110 </listitem>
165111 </itemizedlist>
166112 </para>
167113 <para>
168− The exact syntax and semantics of the Nix expression language, including
169− the built-in function, are described in the Nix manual in the
170− <link
171− xlink:href="http://hydra.nixos.org/job/nix/trunk/tarball/latest/download-by-type/doc/manual/#chap-writing-nix-expressions">chapter
172− on writing Nix expressions</link>.
114+ The exact syntax and semantics of the Nix expression language, including the built-in function, are described in the Nix manual in the <link
115+ xlink:href="http://hydra.nixos.org/job/nix/trunk/tarball/latest/download-by-type/doc/manual/#chap-writing-nix-expressions">chapter on writing Nix expressions</link>.
173116 </para>
174117 </listitem>
175118 <listitem>
176119 <para>
177− Add a call to the function defined in the previous step to
178− <link
179− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix"><filename>pkgs/top-level/all-packages.nix</filename></link>
180− with some descriptive name for the variable, e.g.
181− <varname>libfoo</varname>.
120+ Add a call to the function defined in the previous step to <link
121+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix"><filename>pkgs/top-level/all-packages.nix</filename></link> with some descriptive name for the variable, e.g. <varname>libfoo</varname>.
182122<screen>
183123<prompt>$ </prompt>emacs pkgs/top-level/all-packages.nix</screen>
184124 </para>
185125 <para>
186− The attributes in that file are sorted by category (like “Development /
187− Libraries”) that more-or-less correspond to the directory structure of
188− Nixpkgs, and then by attribute name.
126+ The attributes in that file are sorted by category (like “Development / Libraries”) that more-or-less correspond to the directory structure of Nixpkgs, and then by attribute name.
189127 </para>
190128 </listitem>
191129 <listitem>
192130 <para>
193− To test whether the package builds, run the following command from the
194− root of the nixpkgs source tree:
131+ To test whether the package builds, run the following command from the root of the nixpkgs source tree:
195132<screen>
196133<prompt>$ </prompt>nix-build -A libfoo</screen>
197− where <varname>libfoo</varname> should be the variable name defined in the
198− previous step. You may want to add the flag <option>-K</option> to keep
199− the temporary build directory in case something fails. If the build
200− succeeds, a symlink <filename>./result</filename> to the package in the
201− Nix store is created.
134+ where <varname>libfoo</varname> should be the variable name defined in the previous step. You may want to add the flag <option>-K</option> to keep the temporary build directory in case something fails. If the build succeeds, a symlink <filename>./result</filename> to the package in the Nix store is created.
202135 </para>
203136 </listitem>
204137 <listitem>
@@ -210,14 +143,9 @@
210143 </listitem>
211144 <listitem>
212145 <para>
213− Optionally commit the new package and open a pull request
214− <link
215− xlink:href="https://github.com/NixOS/nixpkgs/pulls">to
216− nixpkgs</link>, or use
217− <link
218− xlink:href="https://discourse.nixos.org/t/about-the-patches-category/477">
219− the Patches category</link> on Discourse for sending a patch without a
220− GitHub account.
146+ Optionally commit the new package and open a pull request <link
147+ xlink:href="https://github.com/NixOS/nixpkgs/pulls">to nixpkgs</link>, or use <link
148+ xlink:href="https://discourse.nixos.org/t/about-the-patches-category/477"> the Patches category</link> on Discourse for sending a patch without a GitHub account.
221149 </para>
222150 </listitem>
223151 </orderedlist>
doc/release-notes.xml+55−205
@@ -6,15 +6,11 @@
66 <title>Release 0.14 (June 4, 2012)</title>
77
88 <para>
9− In preparation for the switch from Subversion to Git, this release is mainly
10− the prevent the Nixpkgs version number from going backwards. (This would
11− happen because prerelease version numbers produced for the Git repository
12− are lower than those for the Subversion repository.)
9+ In preparation for the switch from Subversion to Git, this release is mainly the prevent the Nixpkgs version number from going backwards. (This would happen because prerelease version numbers produced for the Git repository are lower than those for the Subversion repository.)
1310 </para>
1411
1512 <para>
16− Since the last release, there have been thousands of changes and new
17− packages by numerous contributors. For details, see the commit logs.
13+ Since the last release, there have been thousands of changes and new packages by numerous contributors. For details, see the commit logs.
1814 </para>
1915 </section>
2016 <section xml:id="release-notes-0.13">
@@ -55,14 +51,11 @@
5551 <title>Release 0.12 (April 24, 2009)</title>
5652
5753 <para>
58− There are way too many additions to Nixpkgs since the last release to list
59− here: for example, the number of packages on Linux has increased from 1002
60− to 2159. However, some specific improvements are worth listing:
54+ There are way too many additions to Nixpkgs since the last release to list here: for example, the number of packages on Linux has increased from 1002 to 2159. However, some specific improvements are worth listing:
6155 <itemizedlist>
6256 <listitem>
6357 <para>
64− Nixpkgs now has a manual. In particular, it describes the standard build
65− environment in detail.
58+ Nixpkgs now has a manual. In particular, it describes the standard build environment in detail.
6659 </para>
6760 </listitem>
6861 <listitem>
@@ -122,9 +115,7 @@
122115 </listitem>
123116 <listitem>
124117 <para>
125− Support for building derivations in a virtual machine, including RPM and
126− Debian builds in automatically generated VM images. See
127− <filename>pkgs/build-support/vm/default.nix</filename> for details.
118+ Support for building derivations in a virtual machine, including RPM and Debian builds in automatically generated VM images. See <filename>pkgs/build-support/vm/default.nix</filename> for details.
128119 </para>
129120 </listitem>
130121 <listitem>
@@ -136,13 +127,7 @@
136127 </para>
137128
138129 <para>
139− The following people contributed to this release: Andres Löh, Arie
140− Middelkoop, Armijn Hemel, Eelco Dolstra, Lluís Batlle, Ludovic Courtès,
141− Marc Weber, Mart Kolthof, Martin Bravenboer, Michael Raskin, Nicolas
142− Pierron, Peter Simons, Pjotr Prins, Rob Vermaas, Sander van der Burg, Tobias
143− Hammerschmidt, Valentin David, Wouter den Breejen and Yury G. Kudryashov. In
144− addition, several people contributed patches on the
145− <literal>nix-dev</literal> mailing list.
130+ The following people contributed to this release: Andres Löh, Arie Middelkoop, Armijn Hemel, Eelco Dolstra, Lluís Batlle, Ludovic Courtès, Marc Weber, Mart Kolthof, Martin Bravenboer, Michael Raskin, Nicolas Pierron, Peter Simons, Pjotr Prins, Rob Vermaas, Sander van der Burg, Tobias Hammerschmidt, Valentin David, Wouter den Breejen and Yury G. Kudryashov. In addition, several people contributed patches on the <literal>nix-dev</literal> mailing list.
146131 </para>
147132 </section>
148133 <section xml:id="release-notes-0.11">
@@ -153,25 +138,12 @@
153138 <itemizedlist>
154139 <listitem>
155140 <para>
156− The standard build environment (<literal>stdenv</literal>) is now pure on
157− the <literal>x86_64-linux</literal> and <literal>powerpc-linux</literal>
158− platforms, just as on <literal>i686-linux</literal>. (Purity means that
159− building and using the standard environment has no dependencies outside
160− of the Nix store. For instance, it doesn’t require an external C
161− compiler such as <filename>/usr/bin/gcc</filename>.) Also, the statically
162− linked binaries used in the bootstrap process are now automatically
163− reproducible, making it easy to update the bootstrap tools and to add
164− support for other Linux platforms. See
165− <filename>pkgs/stdenv/linux/make-bootstrap-tools.nix</filename> for
166− details.
141+ The standard build environment (<literal>stdenv</literal>) is now pure on the <literal>x86_64-linux</literal> and <literal>powerpc-linux</literal> platforms, just as on <literal>i686-linux</literal>. (Purity means that building and using the standard environment has no dependencies outside of the Nix store. For instance, it doesn’t require an external C compiler such as <filename>/usr/bin/gcc</filename>.) Also, the statically linked binaries used in the bootstrap process are now automatically reproducible, making it easy to update the bootstrap tools and to add support for other Linux platforms. See <filename>pkgs/stdenv/linux/make-bootstrap-tools.nix</filename> for details.
167142 </para>
168143 </listitem>
169144 <listitem>
170145 <para>
171− Hook variables in the generic builder are now executed using the
172− <function>eval</function> shell command. This has a major advantage: you
173− can write hooks directly in Nix expressions. For instance, rather than
174− writing a builder like this:
146+ Hook variables in the generic builder are now executed using the <function>eval</function> shell command. This has a major advantage: you can write hooks directly in Nix expressions. For instance, rather than writing a builder like this:
175147<programlisting>
176148source $stdenv/setup
177149
@@ -182,91 +154,57 @@ postInstall() {
182154}
183155
184156genericBuild</programlisting>
185− (the <literal>gzip</literal> builder), you can just add this attribute to
186− the derivation:
157+ (the <literal>gzip</literal> builder), you can just add this attribute to the derivation:
187158<programlisting>
188159postInstall = "ln -sf gzip $out/bin/gunzip; ln -sf gzip $out/bin/zcat";</programlisting>
189− and so a separate build script becomes unnecessary. This should allow us
190− to get rid of most builders in Nixpkgs.
160+ and so a separate build script becomes unnecessary. This should allow us to get rid of most builders in Nixpkgs.
191161 </para>
192162 </listitem>
193163 <listitem>
194164 <para>
195− It is now possible to have the generic builder pass arguments to
196− <command>configure</command> and <command>make</command> that contain
197− whitespace. Previously, for example, you could say in a builder,
165+ It is now possible to have the generic builder pass arguments to <command>configure</command> and <command>make</command> that contain whitespace. Previously, for example, you could say in a builder,
198166<programlisting>
199167configureFlags="CFLAGS=-O0"</programlisting>
200168 but not
201169<programlisting>
202170configureFlags="CFLAGS=-O0 -g"</programlisting>
203− since the <literal>-g</literal> would be interpreted as a separate
204− argument to <command>configure</command>. Now you can say
171+ since the <literal>-g</literal> would be interpreted as a separate argument to <command>configure</command>. Now you can say
205172<programlisting>
206173configureFlagsArray=("CFLAGS=-O0 -g")</programlisting>
207174 or similarly
208175<programlisting>
209176configureFlagsArray=("CFLAGS=-O0 -g" "LDFLAGS=-L/foo -L/bar")</programlisting>
210− which does the right thing. Idem for <literal>makeFlags</literal>,
211− <literal>installFlags</literal>, <literal>checkFlags</literal> and
212− <literal>distFlags</literal>.
177+ which does the right thing. Idem for <literal>makeFlags</literal>, <literal>installFlags</literal>, <literal>checkFlags</literal> and <literal>distFlags</literal>.
213178 </para>
214179 <para>
215− Unfortunately you can't pass arrays to Bash through the environment, so
216− you can't put the array above in a Nix expression, e.g.,
180+ Unfortunately you can't pass arrays to Bash through the environment, so you can't put the array above in a Nix expression, e.g.,
217181<programlisting>
218182configureFlagsArray = ["CFLAGS=-O0 -g"];</programlisting>
219− since it would just be flattened to a since string. However, you
220− <emphasis>can</emphasis> use the inline hooks described above:
183+ since it would just be flattened to a since string. However, you <emphasis>can</emphasis> use the inline hooks described above:
221184<programlisting>
222185preConfigure = "configureFlagsArray=(\"CFLAGS=-O0 -g\")";</programlisting>
223186 </para>
224187 </listitem>
225188 <listitem>
226189 <para>
227− The function <function>fetchurl</function> now has support for two
228− different kinds of mirroring of files. First, it has support for
229− <emphasis>content-addressable mirrors</emphasis>. For example, given the
230− <function>fetchurl</function> call
190+ The function <function>fetchurl</function> now has support for two different kinds of mirroring of files. First, it has support for <emphasis>content-addressable mirrors</emphasis>. For example, given the <function>fetchurl</function> call
231191<programlisting>
232192fetchurl {
233193 url = http://releases.mozilla.org/<replaceable>...</replaceable>/firefox-2.0.0.6-source.tar.bz2;
234194 sha1 = "eb72f55e4a8bf08e8c6ef227c0ade3d068ba1082";
235195}</programlisting>
236− <function>fetchurl</function> will first try to download this file from
237− <link
238− xlink:href="http://tarballs.nixos.org/sha1/eb72f55e4a8bf08e8c6ef227c0ade3d068ba1082"/>.
239− If that file doesn’t exist, it will try the original URL. In general,
240− the “content-addressed” location is
241− <replaceable>mirror</replaceable><literal>/</literal><replaceable>hash-type</replaceable><literal>/</literal><replaceable>hash</replaceable>.
242− There is currently only one content-addressable mirror
243− (<link
244− xlink:href="http://tarballs.nixos.org"/>), but more can be
245− specified in the <varname>hashedMirrors</varname> attribute in
246− <filename>pkgs/build-support/fetchurl/mirrors.nix</filename>, or by
247− setting the <envar>NIX_HASHED_MIRRORS</envar> environment variable to a
248− whitespace-separated list of URLs.
196+ <function>fetchurl</function> will first try to download this file from <link
197+ xlink:href="http://tarballs.nixos.org/sha1/eb72f55e4a8bf08e8c6ef227c0ade3d068ba1082"/>. If that file doesn’t exist, it will try the original URL. In general, the “content-addressed” location is <replaceable>mirror</replaceable><literal>/</literal><replaceable>hash-type</replaceable><literal>/</literal><replaceable>hash</replaceable>. There is currently only one content-addressable mirror (<link
198+ xlink:href="http://tarballs.nixos.org"/>), but more can be specified in the <varname>hashedMirrors</varname> attribute in <filename>pkgs/build-support/fetchurl/mirrors.nix</filename>, or by setting the <envar>NIX_HASHED_MIRRORS</envar> environment variable to a whitespace-separated list of URLs.
249199 </para>
250200 <para>
251− Second, <function>fetchurl</function> has support for widely-mirrored
252− distribution sites such as SourceForge or the Linux kernel archives.
253− Given a URL of the form
254− <literal>mirror://<replaceable>site</replaceable>/<replaceable>path</replaceable></literal>,
255− it will try to download <replaceable>path</replaceable> from a
256− configurable list of mirrors for <replaceable>site</replaceable>. (This
257− idea was borrowed from Gentoo Linux.) Example:
201+ Second, <function>fetchurl</function> has support for widely-mirrored distribution sites such as SourceForge or the Linux kernel archives. Given a URL of the form <literal>mirror://<replaceable>site</replaceable>/<replaceable>path</replaceable></literal>, it will try to download <replaceable>path</replaceable> from a configurable list of mirrors for <replaceable>site</replaceable>. (This idea was borrowed from Gentoo Linux.) Example:
258202<programlisting>
259203fetchurl {
260204 url = mirror://gnu/gcc/gcc-4.2.0/gcc-core-4.2.0.tar.bz2;
261205 sha256 = "0ykhzxhr8857dr97z0j9wyybfz1kjr71xk457cfapfw5fjas4ny1";
262206}</programlisting>
263− Currently <replaceable>site</replaceable> can be
264− <literal>sourceforge</literal>, <literal>gnu</literal> and
265− <literal>kernel</literal>. The list of mirrors is defined in
266− <filename>pkgs/build-support/fetchurl/mirrors.nix</filename>. You can
267− override the list of mirrors for a particular site by setting the
268− environment variable
269− <envar>NIX_MIRRORS_<replaceable>site</replaceable></envar>, e.g.
207+ Currently <replaceable>site</replaceable> can be <literal>sourceforge</literal>, <literal>gnu</literal> and <literal>kernel</literal>. The list of mirrors is defined in <filename>pkgs/build-support/fetchurl/mirrors.nix</filename>. You can override the list of mirrors for a particular site by setting the environment variable <envar>NIX_MIRRORS_<replaceable>site</replaceable></envar>, e.g.
270208<programlisting>
271209export NIX_MIRRORS_sourceforge=http://osdn.dl.sourceforge.net/sourceforge/</programlisting>
272210 </para>
@@ -339,9 +277,7 @@ export NIX_MIRRORS_sourceforge=http://osdn.dl.sourceforge.net/sourceforge/</prog
339277 </para>
340278
341279 <para>
342− The following people contributed to this release: Andres Löh, Arie
343− Middelkoop, Armijn Hemel, Eelco Dolstra, Marc Weber, Mart Kolthof, Martin
344− Bravenboer, Michael Raskin, Wouter den Breejen and Yury G. Kudryashov.
280+ The following people contributed to this release: Andres Löh, Arie Middelkoop, Armijn Hemel, Eelco Dolstra, Marc Weber, Mart Kolthof, Martin Bravenboer, Michael Raskin, Wouter den Breejen and Yury G. Kudryashov.
345281 </para>
346282 </section>
347283 <section xml:id="release-notes-0.10">
@@ -349,10 +285,8 @@ export NIX_MIRRORS_sourceforge=http://osdn.dl.sourceforge.net/sourceforge/</prog
349285
350286 <note>
351287 <para>
352− This release of Nixpkgs requires
353− <link
354−xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10</link>
355− or higher.
288+ This release of Nixpkgs requires <link
289+xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10</link> or higher.
356290 </para>
357291 </note>
358292
@@ -363,32 +297,15 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10</link>
363297 <itemizedlist>
364298 <listitem>
365299 <para>
366− <filename>pkgs/system/all-packages-generic.nix</filename> is gone, we now
367− just have <filename>pkgs/top-level/all-packages.nix</filename> that
368− contains all available packages. This should cause much less confusion
369− with users. <filename>all-packages.nix</filename> is a function that by
370− default returns packages for the current platform, but you can override
371− this by specifying a different <varname>system</varname> argument.
300+ <filename>pkgs/system/all-packages-generic.nix</filename> is gone, we now just have <filename>pkgs/top-level/all-packages.nix</filename> that contains all available packages. This should cause much less confusion with users. <filename>all-packages.nix</filename> is a function that by default returns packages for the current platform, but you can override this by specifying a different <varname>system</varname> argument.
372301 </para>
373302 </listitem>
374303 <listitem>
375304 <para>
376− Certain packages in Nixpkgs are now user-configurable through a
377− configuration file, i.e., without having to edit the Nix expressions in
378− Nixpkgs. For instance, the Firefox provided in the Nixpkgs channel is
379− built without the RealPlayer plugin (for legal reasons). Previously, you
380− could easily enable RealPlayer support by editing the call to the Firefox
381− function in <filename>all-packages.nix</filename>, but such changes are
382− not respected when Firefox is subsequently updated through the Nixpkgs
383− channel.
305+ Certain packages in Nixpkgs are now user-configurable through a configuration file, i.e., without having to edit the Nix expressions in Nixpkgs. For instance, the Firefox provided in the Nixpkgs channel is built without the RealPlayer plugin (for legal reasons). Previously, you could easily enable RealPlayer support by editing the call to the Firefox function in <filename>all-packages.nix</filename>, but such changes are not respected when Firefox is subsequently updated through the Nixpkgs channel.
384306 </para>
385307 <para>
386− The Nixpkgs configuration file (found in
387− <filename>~/.nixpkgs/config.nix</filename> or through the
388− <envar>NIXPKGS_CONFIG</envar> environment variable) is an attribute set
389− that contains configuration options that
390− <filename>all-packages.nix</filename> reads and uses for certain packages.
391− For instance, the following configuration file:
308+ The Nixpkgs configuration file (found in <filename>~/.nixpkgs/config.nix</filename> or through the <envar>NIXPKGS_CONFIG</envar> environment variable) is an attribute set that contains configuration options that <filename>all-packages.nix</filename> reads and uses for certain packages. For instance, the following configuration file:
392309<programlisting>
393310{
394311 firefox = {
@@ -398,9 +315,7 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10</link>
398315 persistently enables RealPlayer support in the Firefox build.
399316 </para>
400317 <para>
401− (Actually, <literal>firefox.enableRealPlayer</literal> is the
402− <emphasis>only</emphasis> configuration option currently available, but
403− more are sure to be added.)
318+ (Actually, <literal>firefox.enableRealPlayer</literal> is the <emphasis>only</emphasis> configuration option currently available, but more are sure to be added.)
404319 </para>
405320 </listitem>
406321 <listitem>
@@ -409,17 +324,8 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10</link>
409324 <itemizedlist>
410325 <listitem>
411326 <para>
412− <literal>i686-cygwin</literal>, i.e., Windows (using
413− <link xlink:href="http://www.cygwin.com/">Cygwin</link>). The standard
414− environment on <literal>i686-cygwin</literal> by default builds
415− binaries for the Cygwin environment (i.e., it uses Cygwin tools and
416− produces executables that use the Cygwin library). However, there is
417− also a standard environment that produces binaries that use
418− <link
419− xlink:href="http://www.mingw.org/">MinGW</link>. You can
420− use it by calling <filename>all-package.nix</filename> with the
421− <varname>stdenvType</varname> argument set to
422− <literal>"i686-mingw"</literal>.
327+ <literal>i686-cygwin</literal>, i.e., Windows (using <link xlink:href="http://www.cygwin.com/">Cygwin</link>). The standard environment on <literal>i686-cygwin</literal> by default builds binaries for the Cygwin environment (i.e., it uses Cygwin tools and produces executables that use the Cygwin library). However, there is also a standard environment that produces binaries that use <link
328+ xlink:href="http://www.mingw.org/">MinGW</link>. You can use it by calling <filename>all-package.nix</filename> with the <varname>stdenvType</varname> argument set to <literal>"i686-mingw"</literal>.
423329 </para>
424330 </listitem>
425331 <listitem>
@@ -434,9 +340,7 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10</link>
434340 </listitem>
435341 <listitem>
436342 <para>
437− <literal>x86_64-linux</literal>, i.e., Linux on 64-bit AMD/Intel CPUs.
438− Unlike <literal>i686-linux</literal>, this platform doesn’t have a
439− pure <literal>stdenv</literal> yet.
343+ <literal>x86_64-linux</literal>, i.e., Linux on 64-bit AMD/Intel CPUs. Unlike <literal>i686-linux</literal>, this platform doesn’t have a pure <literal>stdenv</literal> yet.
440344 </para>
441345 </listitem>
442346 </itemizedlist>
@@ -472,21 +376,10 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10</link>
472376 </listitem>
473377 <listitem>
474378 <para>
475− It is now <emphasis>much</emphasis> easier to override the default C
476− compiler and other tools in <literal>stdenv</literal> for specific
477− packages. <filename>all-packages.nix</filename> provides two utility
478− functions for this purpose: <function>overrideGCC</function> and
479− <function>overrideInStdenv</function>. Both take a
480− <literal>stdenv</literal> and return an augmented
481− <literal>stdenv</literal>; the formed changes the C compiler, and the
482− latter adds additional packages to the front of
483− <literal>stdenv</literal>’s initial <envar>PATH</envar>, allowing tools
484− to be overridden.
379+ It is now <emphasis>much</emphasis> easier to override the default C compiler and other tools in <literal>stdenv</literal> for specific packages. <filename>all-packages.nix</filename> provides two utility functions for this purpose: <function>overrideGCC</function> and <function>overrideInStdenv</function>. Both take a <literal>stdenv</literal> and return an augmented <literal>stdenv</literal>; the formed changes the C compiler, and the latter adds additional packages to the front of <literal>stdenv</literal>’s initial <envar>PATH</envar>, allowing tools to be overridden.
485380 </para>
486381 <para>
487− For instance, the package <varname>strategoxt</varname> doesn’t build
488− with the GNU Make in <literal>stdenv</literal> (version 3.81), so we call
489− it with an augmented <literal>stdenv</literal> that uses GNU Make 3.80:
382+ For instance, the package <varname>strategoxt</varname> doesn’t build with the GNU Make in <literal>stdenv</literal> (version 3.81), so we call it with an augmented <literal>stdenv</literal> that uses GNU Make 3.80:
490383<programlisting>
491384strategoxt = (import ../development/compilers/strategoxt) {
492385 inherit fetchurl pkgconfig sdf aterm;
@@ -494,8 +387,7 @@ strategoxt = (import ../development/compilers/strategoxt) {
494387};
495388
496389gnumake380 = <replaceable>...</replaceable>;</programlisting>
497− Likewise, there are many packages that don’t compile with the default
498− GCC (4.1.1), but that’s easily fixed:
390+ Likewise, there are many packages that don’t compile with the default GCC (4.1.1), but that’s easily fixed:
499391<programlisting>
500392exult = import ../games/exult {
501393 inherit fetchurl SDL SDL_mixer zlib libpng unzip;
@@ -505,13 +397,7 @@ exult = import ../games/exult {
505397 </listitem>
506398 <listitem>
507399 <para>
508− It has also become much easier to experiment with changes to the
509− <literal>stdenv</literal> setup script (which notably contains the generic
510− builder). Since edits to <filename>pkgs/stdenv/generic/setup.sh</filename>
511− trigger a rebuild of <emphasis>everything</emphasis>, this was formerly
512− quite painful. But now <literal>stdenv</literal> contains a function to
513− “regenerate” <literal>stdenv</literal> with a different setup script,
514− allowing the use of a different setup script for specific packages:
400+ It has also become much easier to experiment with changes to the <literal>stdenv</literal> setup script (which notably contains the generic builder). Since edits to <filename>pkgs/stdenv/generic/setup.sh</filename> trigger a rebuild of <emphasis>everything</emphasis>, this was formerly quite painful. But now <literal>stdenv</literal> contains a function to “regenerate” <literal>stdenv</literal> with a different setup script, allowing the use of a different setup script for specific packages:
515401<programlisting>
516402pkg = import <replaceable>...</replaceable> {
517403 stdenv = stdenv.regenerate ./my-setup.sh;
@@ -521,10 +407,7 @@ pkg = import <replaceable>...</replaceable> {
521407 </listitem>
522408 <listitem>
523409 <para>
524− Packages can now have a human-readable <emphasis>description</emphasis>
525− field. Package descriptions are shown by <literal>nix-env -qa
526− --description</literal>. In addition, they’re shown on the Nixpkgs
527− release page. A description can be added to a package as follows:
410+ Packages can now have a human-readable <emphasis>description</emphasis> field. Package descriptions are shown by <literal>nix-env -qa --description</literal>. In addition, they’re shown on the Nixpkgs release page. A description can be added to a package as follows:
528411<programlisting>
529412stdenv.mkDerivation {
530413 name = "exult-1.2";
@@ -533,34 +416,26 @@ stdenv.mkDerivation {
533416 description = "A reimplementation of the Ultima VII game engine";
534417 };
535418}</programlisting>
536− The <varname>meta</varname> attribute is not passed to the builder, so
537− changes to the description do not trigger a rebuild. Additional
538− <varname>meta</varname> attributes may be defined in the future (such as
539− the URL of the package’s homepage, the license, etc.).
419+ The <varname>meta</varname> attribute is not passed to the builder, so changes to the description do not trigger a rebuild. Additional <varname>meta</varname> attributes may be defined in the future (such as the URL of the package’s homepage, the license, etc.).
540420 </para>
541421 </listitem>
542422 </itemizedlist>
543423
544424 <para>
545− The following people contributed to this release: Andres Löh, Armijn Hemel,
546− Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof, Martin
547− Bravenboer, Merijn de Jonge, Rob Vermaas and Roy van den Broek.
425+ The following people contributed to this release: Andres Löh, Armijn Hemel, Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof, Martin Bravenboer, Merijn de Jonge, Rob Vermaas and Roy van den Broek.
548426 </para>
549427 </section>
550428 <section xml:id="release-notes-0.9">
551429 <title>Release 0.9 (January 31, 2006)</title>
552430
553431 <para>
554− There have been zillions of changes since the last release of Nixpkgs. Many
555− packages have been added or updated. The following are some of the more
556− notable changes:
432+ There have been zillions of changes since the last release of Nixpkgs. Many packages have been added or updated. The following are some of the more notable changes:
557433 </para>
558434
559435 <itemizedlist>
560436 <listitem>
561437 <para>
562− Distribution files have been moved to
563− <link
438+ Distribution files have been moved to <link
564439 xlink:href="http://nixos.org/" />.
565440 </para>
566441 </listitem>
@@ -576,24 +451,17 @@ stdenv.mkDerivation {
576451 </listitem>
577452 <listitem>
578453 <para>
579− The old, unofficial Xlibs has been replaced by the official modularised
580− X11 distribution from X.org, i.e., X11R7.0. X11R7.0 consists of 287 (!)
581− packages, all of which are in Nixpkgs though not all have been tested. It
582− is now possible to build a working X server (previously we only had X
583− client libraries). We use a fully Nixified X server on NixOS.
454+ The old, unofficial Xlibs has been replaced by the official modularised X11 distribution from X.org, i.e., X11R7.0. X11R7.0 consists of 287 (!) packages, all of which are in Nixpkgs though not all have been tested. It is now possible to build a working X server (previously we only had X client libraries). We use a fully Nixified X server on NixOS.
584455 </para>
585456 </listitem>
586457 <listitem>
587458 <para>
588− The Sun JDK 5 has been purified, i.e., it doesn’t require any non-Nix
589− components such as <filename>/lib/ld-linux.so.2</filename>. This means
590− that Java applications such as Eclipse and Azureus can run on NixOS.
459+ The Sun JDK 5 has been purified, i.e., it doesn’t require any non-Nix components such as <filename>/lib/ld-linux.so.2</filename>. This means that Java applications such as Eclipse and Azureus can run on NixOS.
591460 </para>
592461 </listitem>
593462 <listitem>
594463 <para>
595− Hardware-accelerated OpenGL support, used by games like Quake 3 (which is
596− now built from source).
464+ Hardware-accelerated OpenGL support, used by games like Quake 3 (which is now built from source).
597465 </para>
598466 </listitem>
599467 <listitem>
@@ -608,8 +476,7 @@ stdenv.mkDerivation {
608476 </listitem>
609477 <listitem>
610478 <para>
611− Some support for cross-compilation: cross-compiling builds of GCC and
612− Binutils, and cross-compiled builds of the C library uClibc.
479+ Some support for cross-compilation: cross-compiling builds of GCC and Binutils, and cross-compiled builds of the C library uClibc.
613480 </para>
614481 </listitem>
615482 <listitem>
@@ -618,8 +485,7 @@ stdenv.mkDerivation {
618485 <itemizedlist>
619486 <listitem>
620487 <para>
621− teTeX, including support for building LaTeX documents using Nix (with
622− automatic dependency determination).
488+ teTeX, including support for building LaTeX documents using Nix (with automatic dependency determination).
623489 </para>
624490 </listitem>
625491 <listitem>
@@ -629,14 +495,12 @@ stdenv.mkDerivation {
629495 </listitem>
630496 <listitem>
631497 <para>
632− System-level packages to support NixOS, e.g. Grub, GNU
633− <literal>parted</literal> and so on.
498+ System-level packages to support NixOS, e.g. Grub, GNU <literal>parted</literal> and so on.
634499 </para>
635500 </listitem>
636501 <listitem>
637502 <para>
638− <literal>ecj</literal>, the Eclipse Compiler for Java, so we finally
639− have a freely distributable compiler that supports Java 5.0.
503+ <literal>ecj</literal>, the Eclipse Compiler for Java, so we finally have a freely distributable compiler that supports Java 5.0.
640504 </para>
641505 </listitem>
642506 <listitem>
@@ -661,8 +525,7 @@ stdenv.mkDerivation {
661525 </listitem>
662526 <listitem>
663527 <para>
664− <literal>kdelibs</literal>. This allows us to add KDE-based packages
665− (such as <literal>kcachegrind</literal>).
528+ <literal>kdelibs</literal>. This allows us to add KDE-based packages (such as <literal>kcachegrind</literal>).
666529 </para>
667530 </listitem>
668531 </itemizedlist>
@@ -671,17 +534,14 @@ stdenv.mkDerivation {
671534 </itemizedlist>
672535
673536 <para>
674− The following people contributed to this release: Andres Löh, Armijn Hemel,
675− Bogdan Dumitriu, Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof,
676− Martin Bravenboer, Rob Vermaas and Roy van den Broek.
537+ The following people contributed to this release: Andres Löh, Armijn Hemel, Bogdan Dumitriu, Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof, Martin Bravenboer, Rob Vermaas and Roy van den Broek.
677538 </para>
678539 </section>
679540 <section xml:id="release-notes-0.8">
680541 <title>Release 0.8 (April 11, 2005)</title>
681542
682543 <para>
683− This release is mostly to remain synchronised with the changed hashing
684− scheme in Nix 0.8.
544+ This release is mostly to remain synchronised with the changed hashing scheme in Nix 0.8.
685545 </para>
686546
687547 <para>
@@ -706,16 +566,10 @@ stdenv.mkDerivation {
706566 <itemizedlist>
707567 <listitem>
708568 <para>
709− The bootstrap process for the standard build environment on Linux
710− (stdenv-linux) has been improved. It is no longer dependent in its initial
711− bootstrap stages on the system Glibc, GCC, and other tools. Rather,
712− Nixpkgs contains a statically linked bash and curl, and uses that to
713− download other statically linked tools. These are then used to build a
714− Glibc and dynamically linked versions of all other tools.
569+ The bootstrap process for the standard build environment on Linux (stdenv-linux) has been improved. It is no longer dependent in its initial bootstrap stages on the system Glibc, GCC, and other tools. Rather, Nixpkgs contains a statically linked bash and curl, and uses that to download other statically linked tools. These are then used to build a Glibc and dynamically linked versions of all other tools.
715570 </para>
716571 <para>
717− This change also makes the bootstrap process faster. For instance, GCC is
718− built only once instead of three times.
572+ This change also makes the bootstrap process faster. For instance, GCC is built only once instead of three times.
719573 </para>
720574 <para>
721575 (Contributed by Armijn Hemel.)
@@ -723,17 +577,13 @@ stdenv.mkDerivation {
723577 </listitem>
724578 <listitem>
725579 <para>
726− Tarballs used by Nixpkgs are now obtained from the same server that hosts
727− Nixpkgs (<link
728− xlink:href="http://catamaran.labs.cs.uu.nl/" />). This
729− reduces the risk of packages being unbuildable due to moved or deleted
730− files on various servers.
580+ Tarballs used by Nixpkgs are now obtained from the same server that hosts Nixpkgs (<link
581+ xlink:href="http://catamaran.labs.cs.uu.nl/" />). This reduces the risk of packages being unbuildable due to moved or deleted files on various servers.
731582 </para>
732583 </listitem>
733584 <listitem>
734585 <para>
735− There now is a generic mechanism for building Perl modules. See the
736− various Perl modules defined in pkgs/system/all-packages-generic.nix.
586+ There now is a generic mechanism for building Perl modules. See the various Perl modules defined in pkgs/system/all-packages-generic.nix.
737587 </para>
738588 </listitem>
739589 <listitem>
doc/reviewing-contributions.xml+42−118
@@ -6,68 +6,40 @@
66 <title>Reviewing contributions</title>
77 <warning>
88 <para>
9− The following section is a draft, and the policy for reviewing is still
10− being discussed in issues such as
11− <link
12− xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166
13− </link> and
14− <link
15− xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836
16− </link>.
9+ The following section is a draft, and the policy for reviewing is still being discussed in issues such as <link
10+ xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link
11+ xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>.
1712 </para>
1813 </warning>
1914 <para>
20− The Nixpkgs project receives a fairly high number of contributions via GitHub
21− pull requests. Reviewing and approving these is an important task and a way
22− to contribute to the project.
15+ The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project.
2316 </para>
2417 <para>
25− The high change rate of Nixpkgs makes any pull request that remains open for
26− too long subject to conflicts that will require extra work from the submitter
27− or the merger. Reviewing pull requests in a timely manner and being
28− responsive to the comments is the key to avoid this issue. GitHub provides
29− sort filters that can be used to see the
30− <link
31− xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most
32− recently</link> and the
33− <link
34− xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least
35− recently</link> updated pull requests. We highly encourage looking at
36− <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone">
37− this list of ready to merge, unreviewed pull requests</link>.
18+ The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the <link
19+ xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most recently</link> and the <link
20+ xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least recently</link> updated pull requests. We highly encourage looking at <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone"> this list of ready to merge, unreviewed pull requests</link>.
3821 </para>
3922 <para>
40− When reviewing a pull request, please always be nice and polite.
41− Controversial changes can lead to controversial opinions, but it is important
42− to respect every community member and their work.
23+ When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work.
4324 </para>
4425 <para>
45− GitHub provides reactions as a simple and quick way to provide feedback to
46− pull requests or any comments. The thumb-down reaction should be used with
47− care and if possible accompanied with some explanation so the submitter has
48− directions to improve their contribution.
26+ GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution.
4927 </para>
5028 <para>
51− pull request reviews should include a list of what has been reviewed in a
52− comment, so other reviewers and mergers can know the state of the review.
29+ pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review.
5330 </para>
5431 <para>
55− All the review template samples provided in this section are generic and
56− meant as examples. Their usage is optional and the reviewer is free to adapt
57− them to their liking.
32+ All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking.
5833 </para>
5934 <section xml:id="reviewing-contributions-package-updates">
6035 <title>Package updates</title>
6136
6237 <para>
63− A package update is the most trivial and common type of pull request. These
64− pull requests mainly consist of updating the version part of the package
65− name and the source hash.
38+ A package update is the most trivial and common type of pull request. These pull requests mainly consist of updating the version part of the package name and the source hash.
6639 </para>
6740
6841 <para>
69− It can happen that non-trivial updates include patches or more complex
70− changes.
42+ It can happen that non-trivial updates include patches or more complex changes.
7143 </para>
7244
7345 <para>
@@ -82,8 +54,7 @@
8254 <itemizedlist>
8355 <listitem>
8456 <para>
85− <literal>8.has: package (update)</literal> and any topic label that fit
86− the updated package.
57+ <literal>8.has: package (update)</literal> and any topic label that fit the updated package.
8758 </para>
8859 </listitem>
8960 </itemizedlist>
@@ -105,9 +76,7 @@
10576 <itemizedlist>
10677 <listitem>
10778 <para>
108− <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link>
109− will make GitHub notify users based on the submitted changes, but it can
110− happen that it misses some of the package maintainers.
79+ <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
11180 </para>
11281 </listitem>
11382 </itemizedlist>
@@ -119,15 +88,12 @@
11988 <itemizedlist>
12089 <listitem>
12190 <para>
122− License can change with version updates, so it should be checked to
123− match the upstream license.
91+ License can change with version updates, so it should be checked to match the upstream license.
12492 </para>
12593 </listitem>
12694 <listitem>
12795 <para>
128− If the package has no maintainer, a maintainer must be set. This can be
129− the update submitter or a community member that accepts to take
130− maintainership of the package.
96+ If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package.
13197 </para>
13298 </listitem>
13399 </itemizedlist>
@@ -144,14 +110,10 @@
144110 <itemizedlist>
145111 <listitem>
146112 <para>
147− pull requests are often targeted to the master or staging branch, and
148− building the pull request locally when it is submitted can trigger many
149− source builds.
113+ pull requests are often targeted to the master or staging branch, and building the pull request locally when it is submitted can trigger many source builds.
150114 </para>
151115 <para>
152− It is possible to rebase the changes on nixos-unstable or
153− nixpkgs-unstable for easier review by running the following commands
154− from a nixpkgs clone.
116+ It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone.
155117<screen>
156118<prompt>$ </prompt>git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co
157119 xml:id='reviewing-rebase-1' />
@@ -163,8 +125,7 @@
163125 <calloutlist>
164126 <callout arearefs='reviewing-rebase-1'>
165127 <para>
166− This should be done only once to be able to fetch channel branches
167− from the nixpkgs-channels repository.
128+ This should be done only once to be able to fetch channel branches from the nixpkgs-channels repository.
168129 </para>
169130 </callout>
170131 <callout arearefs='reviewing-rebase-2'>
@@ -174,9 +135,7 @@
174135 </callout>
175136 <callout arearefs='reviewing-rebase-3'>
176137 <para>
177− Fetching the pull request changes, <varname>PRNUMBER</varname> is the
178− number at the end of the pull request title and
179− <varname>BASEBRANCH</varname> the base branch of the pull request.
138+ Fetching the pull request changes, <varname>PRNUMBER</varname> is the number at the end of the pull request title and <varname>BASEBRANCH</varname> the base branch of the pull request.
180139 </para>
181140 </callout>
182141 <callout arearefs='reviewing-rebase-4'>
@@ -189,12 +148,7 @@
189148 </listitem>
190149 <listitem>
191150 <para>
192− The
193− <link xlink:href="https://github.com/Mic92/nix-review">nix-review</link>
194− tool can be used to review a pull request content in a single command.
195− <varname>PRNUMBER</varname> should be replaced by the number at the end
196− of the pull request title. You can also provide the full github pull
197− request url.
151+ The <link xlink:href="https://github.com/Mic92/nix-review">nix-review</link> tool can be used to review a pull request content in a single command. <varname>PRNUMBER</varname> should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url.
198152 </para>
199153<screen>
200154<prompt>$ </prompt>nix-shell -p nix-review --run "nix-review pr PRNUMBER"
@@ -231,8 +185,7 @@
231185 <title>New packages</title>
232186
233187 <para>
234− New packages are a common type of pull requests. These pull requests
235− consists in adding a new nix-expression for a package.
188+ New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
236189 </para>
237190
238191 <para>
@@ -247,8 +200,7 @@
247200 <itemizedlist>
248201 <listitem>
249202 <para>
250− <literal>8.has: package (new)</literal> and any topic label that fit the
251− new package.
203+ <literal>8.has: package (new)</literal> and any topic label that fit the new package.
252204 </para>
253205 </listitem>
254206 </itemizedlist>
@@ -280,8 +232,7 @@
280232 </listitem>
281233 <listitem>
282234 <para>
283− A maintainer must be set. This can be the package submitter or a
284− community member that accepts to take maintainership of the package.
235+ A maintainer must be set. This can be the package submitter or a community member that accepts to take maintainership of the package.
285236 </para>
286237 </listitem>
287238 </itemizedlist>
@@ -303,8 +254,7 @@
303254 </listitem>
304255 <listitem>
305256 <para>
306− The most appropriate function should be used (e.g. packages from GitHub
307− should use <literal>fetchFromGitHub</literal>).
257+ The most appropriate function should be used (e.g. packages from GitHub should use <literal>fetchFromGitHub</literal>).
308258 </para>
309259 </listitem>
310260 </itemizedlist>
@@ -351,8 +301,7 @@
351301 <title>Module updates</title>
352302
353303 <para>
354− Module updates are submissions changing modules in some ways. These often
355− contains changes to the options or introduce new options.
304+ Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
356305 </para>
357306
358307 <para>
@@ -367,8 +316,7 @@
367316 <itemizedlist>
368317 <listitem>
369318 <para>
370− <literal>8.has: module (update)</literal> and any topic label that fit
371− the module.
319+ <literal>8.has: module (update)</literal> and any topic label that fit the module.
372320 </para>
373321 </listitem>
374322 </itemizedlist>
@@ -380,9 +328,7 @@
380328 <itemizedlist>
381329 <listitem>
382330 <para>
383− <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link>
384− will make GitHub notify users based on the submitted changes, but it can
385− happen that it misses some of the package maintainers.
331+ <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
386332 </para>
387333 </listitem>
388334 </itemizedlist>
@@ -399,9 +345,7 @@
399345 <itemizedlist>
400346 <listitem>
401347 <para>
402− Type should be appropriate (string related types differs in their
403− merging capabilities, <literal>optionSet</literal> and
404− <literal>string</literal> types are deprecated).
348+ Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
405349 </para>
406350 </listitem>
407351 <listitem>
@@ -418,23 +362,19 @@
418362 <itemizedlist>
419363 <listitem>
420364 <para>
421− <literal>mkRenamedOptionModule</literal> and
422− <literal>mkAliasOptionModule</literal> functions provide way to make
423− option changes backward compatible.
365+ <literal>mkRenamedOptionModule</literal> and <literal>mkAliasOptionModule</literal> functions provide way to make option changes backward compatible.
424366 </para>
425367 </listitem>
426368 </itemizedlist>
427369 </listitem>
428370 <listitem>
429371 <para>
430− Ensure that removed options are declared with
431− <literal>mkRemovedOptionModule</literal>
372+ Ensure that removed options are declared with <literal>mkRemovedOptionModule</literal>
432373 </para>
433374 </listitem>
434375 <listitem>
435376 <para>
436− Ensure that changes that are not backward compatible are mentioned in
437− release notes.
377+ Ensure that changes that are not backward compatible are mentioned in release notes.
438378 </para>
439379 </listitem>
440380 <listitem>
@@ -480,8 +420,7 @@
480420 <itemizedlist>
481421 <listitem>
482422 <para>
483− <literal>8.has: module (new)</literal> and any topic label that fit the
484− module.
423+ <literal>8.has: module (new)</literal> and any topic label that fit the module.
485424 </para>
486425 </listitem>
487426 </itemizedlist>
@@ -498,9 +437,7 @@
498437 <itemizedlist>
499438 <listitem>
500439 <para>
501− Type should be appropriate (string related types differs in their
502− merging capabilities, <literal>optionSet</literal> and
503− <literal>string</literal> types are deprecated).
440+ Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
504441 </para>
505442 </listitem>
506443 <listitem>
@@ -522,8 +459,7 @@
522459 </listitem>
523460 <listitem>
524461 <para>
525− Module documentation should be declared with
526− <literal>meta.doc</literal>.
462+ Module documentation should be declared with <literal>meta.doc</literal>.
527463 </para>
528464 </listitem>
529465 </itemizedlist>
@@ -535,8 +471,7 @@
535471 <itemizedlist>
536472 <listitem>
537473 <para>
538− For example, enabling a module should not open firewall ports by
539− default.
474+ For example, enabling a module should not open firewall ports by default.
540475 </para>
541476 </listitem>
542477 </itemizedlist>
@@ -573,25 +508,18 @@
573508 </para>
574509
575510 <para>
576− If you consider having enough knowledge and experience in a topic and would
577− like to be a long-term reviewer for related submissions, please contact the
578− current reviewers for that topic. They will give you information about the
579− reviewing process. The main reviewers for a topic can be hard to find as
580− there is no list, but checking past pull requests to see who reviewed or
581− git-blaming the code to see who committed to that topic can give some hints.
511+ If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints.
582512 </para>
583513
584514 <para>
585− Container system, boot system and library changes are some examples of the
586− pull requests fitting this category.
515+ Container system, boot system and library changes are some examples of the pull requests fitting this category.
587516 </para>
588517 </section>
589518 <section xml:id="reviewing-contributions--merging-pull-requests">
590519 <title>Merging pull requests</title>
591520
592521 <para>
593− It is possible for community members that have enough knowledge and
594− experience on a special topic to contribute by merging pull requests.
522+ It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
595523 </para>
596524
597525 <para>
@@ -608,12 +536,8 @@ policy.
608536-->
609537
610538 <para>
611− In a case a contributor definitively leaves the Nix community, they should
612− create an issue or post on
613− <link
614− xlink:href="https://discourse.nixos.org">Discourse</link> with
615− references of packages and modules they maintain so the maintainership can
616− be taken over by other contributors.
539+ In a case a contributor definitively leaves the Nix community, they should create an issue or post on <link
540+ xlink:href="https://discourse.nixos.org">Discourse</link> with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
617541 </para>
618542 </section>
619543</chapter>
doc/stdenv.xml+238−1061
@@ -3,22 +3,13 @@
33 xml:id="chap-stdenv">
44 <title>The Standard Environment</title>
55 <para>
6− The standard build environment in the Nix Packages collection provides an
7− environment for building Unix packages that does a lot of common build tasks
8− automatically. In fact, for Unix packages that use the standard
9− <literal>./configure; make; make install</literal> build interface, you
10− don’t need to write a build script at all; the standard environment does
11− everything automatically. If <literal>stdenv</literal> doesn’t do what you
12− need automatically, you can easily customise or override the various build
13− phases.
6+ The standard build environment in the Nix Packages collection provides an environment for building Unix packages that does a lot of common build tasks automatically. In fact, for Unix packages that use the standard <literal>./configure; make; make install</literal> build interface, you don’t need to write a build script at all; the standard environment does everything automatically. If <literal>stdenv</literal> doesn’t do what you need automatically, you can easily customise or override the various build phases.
147 </para>
158 <section xml:id="sec-using-stdenv">
169 <title>Using <literal>stdenv</literal></title>
1710
1811 <para>
19− To build a package with the standard environment, you use the function
20− <varname>stdenv.mkDerivation</varname>, instead of the primitive built-in
21− function <varname>derivation</varname>, e.g.
12+ To build a package with the standard environment, you use the function <varname>stdenv.mkDerivation</varname>, instead of the primitive built-in function <varname>derivation</varname>, e.g.
2213<programlisting>
2314stdenv.mkDerivation {
2415 name = "libfoo-1.2.3";
@@ -27,17 +18,7 @@ stdenv.mkDerivation {
2718 sha256 = "0x2g1jqygyr5wiwg4ma1nd7w4ydpy82z9gkcv8vh2v8dn3y58v5m";
2819 };
2920}</programlisting>
30− (<varname>stdenv</varname> needs to be in scope, so if you write this in a
31− separate Nix expression from <filename>pkgs/all-packages.nix</filename>, you
32− need to pass it as a function argument.) Specifying a
33− <varname>name</varname> and a <varname>src</varname> is the absolute minimum
34− Nix requires. For convenience, you can also use <varname>pname</varname> and
35− <varname>version</varname> attributes and <literal>mkDerivation</literal>
36− will automatically set <varname>name</varname> to
37− <literal>"${pname}-${version}"</literal> by default. Since
38− <link xlink:href="https://github.com/NixOS/rfcs/pull/35">RFC 0035</link>,
39− this is preferred for packages in Nixpkgs, as it allows us to reuse the
40− version easily:
21+ (<varname>stdenv</varname> needs to be in scope, so if you write this in a separate Nix expression from <filename>pkgs/all-packages.nix</filename>, you need to pass it as a function argument.) Specifying a <varname>name</varname> and a <varname>src</varname> is the absolute minimum Nix requires. For convenience, you can also use <varname>pname</varname> and <varname>version</varname> attributes and <literal>mkDerivation</literal> will automatically set <varname>name</varname> to <literal>"${pname}-${version}"</literal> by default. Since <link xlink:href="https://github.com/NixOS/rfcs/pull/35">RFC 0035</link>, this is preferred for packages in Nixpkgs, as it allows us to reuse the version easily:
4122<programlisting>
4223stdenv.mkDerivation rec {
4324 pname = "libfoo";
@@ -50,31 +31,18 @@ stdenv.mkDerivation rec {
5031 </para>
5132
5233 <para>
53− Many packages have dependencies that are not provided in the standard
54− environment. It’s usually sufficient to specify those dependencies in the
55− <varname>buildInputs</varname> attribute:
34+ Many packages have dependencies that are not provided in the standard environment. It’s usually sufficient to specify those dependencies in the <varname>buildInputs</varname> attribute:
5635<programlisting>
5736stdenv.mkDerivation {
5837 name = "libfoo-1.2.3";
5938 ...
6039 buildInputs = [libbar perl ncurses];
6140}</programlisting>
62− This attribute ensures that the <filename>bin</filename> subdirectories of
63− these packages appear in the <envar>PATH</envar> environment variable during
64− the build, that their <filename>include</filename> subdirectories are
65− searched by the C compiler, and so on. (See
66− <xref linkend="ssec-setup-hooks"/> for details.)
41+ This attribute ensures that the <filename>bin</filename> subdirectories of these packages appear in the <envar>PATH</envar> environment variable during the build, that their <filename>include</filename> subdirectories are searched by the C compiler, and so on. (See <xref linkend="ssec-setup-hooks"/> for details.)
6742 </para>
6843
6944 <para>
70− Often it is necessary to override or modify some aspect of the build. To
71− make this easier, the standard environment breaks the package build into a
72− number of <emphasis>phases</emphasis>, all of which can be overridden or
73− modified individually: unpacking the sources, applying patches, configuring,
74− building, and installing. (There are some others; see
75− <xref linkend="sec-stdenv-phases"/>.) For instance, a package that doesn’t
76− supply a makefile but instead has to be compiled “manually” could be
77− handled like this:
45+ Often it is necessary to override or modify some aspect of the build. To make this easier, the standard environment breaks the package build into a number of <emphasis>phases</emphasis>, all of which can be overridden or modified individually: unpacking the sources, applying patches, configuring, building, and installing. (There are some others; see <xref linkend="sec-stdenv-phases"/>.) For instance, a package that doesn’t supply a makefile but instead has to be compiled “manually” could be handled like this:
7846<programlisting>
7947stdenv.mkDerivation {
8048 name = "fnord-4.5";
@@ -87,20 +55,15 @@ stdenv.mkDerivation {
8755 cp foo $out/bin
8856 '';
8957}</programlisting>
90− (Note the use of <literal>''</literal>-style string literals, which are very
91− convenient for large multi-line script fragments because they don’t need
92− escaping of <literal>"</literal> and <literal>\</literal>, and because
93− indentation is intelligently removed.)
58+ (Note the use of <literal>''</literal>-style string literals, which are very convenient for large multi-line script fragments because they don’t need escaping of <literal>"</literal> and <literal>\</literal>, and because indentation is intelligently removed.)
9459 </para>
9560
9661 <para>
97− There are many other attributes to customise the build. These are listed in
98− <xref linkend="ssec-stdenv-attributes"/>.
62+ There are many other attributes to customise the build. These are listed in <xref linkend="ssec-stdenv-attributes"/>.
9963 </para>
10064
10165 <para>
102− While the standard environment provides a generic builder, you can still
103− supply your own build script:
66+ While the standard environment provides a generic builder, you can still supply your own build script:
10467<programlisting>
10568stdenv.mkDerivation {
10669 name = "libfoo-1.2.3";
@@ -111,9 +74,7 @@ stdenv.mkDerivation {
11174<programlisting>
11275source $stdenv/setup
11376</programlisting>
114− to let <literal>stdenv</literal> set up the environment (e.g., process the
115− <varname>buildInputs</varname>). If you want, you can still use
116− <literal>stdenv</literal>’s generic builder:
77+ to let <literal>stdenv</literal> set up the environment (e.g., process the <varname>buildInputs</varname>). If you want, you can still use <literal>stdenv</literal>’s generic builder:
11778<programlisting>
11879source $stdenv/setup
11980
@@ -179,23 +140,17 @@ genericBuild
179140 </listitem>
180141 <listitem>
181142 <para>
182− <command>gzip</command>, <command>bzip2</command> and
183− <command>xz</command>.
143+ <command>gzip</command>, <command>bzip2</command> and <command>xz</command>.
184144 </para>
185145 </listitem>
186146 <listitem>
187147 <para>
188− GNU Make. It has been patched to provide <quote>nested</quote> output
189− that can be fed into the <command>nix-log2xml</command> command and
190− <command>log2html</command> stylesheet to create a structured, readable
191− output of the build steps performed by Make.
148+ GNU Make. It has been patched to provide <quote>nested</quote> output that can be fed into the <command>nix-log2xml</command> command and <command>log2html</command> stylesheet to create a structured, readable output of the build steps performed by Make.
192149 </para>
193150 </listitem>
194151 <listitem>
195152 <para>
196− Bash. This is the shell used for all builders in the Nix Packages
197− collection. Not using <command>/bin/sh</command> removes a large source
198− of portability problems.
153+ Bash. This is the shell used for all builders in the Nix Packages collection. Not using <command>/bin/sh</command> removes a large source of portability problems.
199154 </para>
200155 </listitem>
201156 <listitem>
@@ -207,108 +162,52 @@ genericBuild
207162 </para>
208163
209164 <para>
210− On Linux, <literal>stdenv</literal> also includes the
211− <command>patchelf</command> utility.
165+ On Linux, <literal>stdenv</literal> also includes the <command>patchelf</command> utility.
212166 </para>
213167 </section>
214168 <section xml:id="ssec-stdenv-dependencies">
215169 <title>Specifying dependencies</title>
216170
217171 <para>
218− As described in the Nix manual, almost any <filename>*.drv</filename> store
219− path in a derivation's attribute set will induce a dependency on that
220− derivation. <varname>mkDerivation</varname>, however, takes a few attributes
221− intended to, between them, include all the dependencies of a package. This
222− is done both for structure and consistency, but also so that certain other
223− setup can take place. For example, certain dependencies need their bin
224− directories added to the <envar>PATH</envar>. That is built-in, but other
225− setup is done via a pluggable mechanism that works in conjunction with these
226− dependency attributes. See <xref linkend="ssec-setup-hooks"/> for details.
172+ As described in the Nix manual, almost any <filename>*.drv</filename> store path in a derivation's attribute set will induce a dependency on that derivation. <varname>mkDerivation</varname>, however, takes a few attributes intended to, between them, include all the dependencies of a package. This is done both for structure and consistency, but also so that certain other setup can take place. For example, certain dependencies need their bin directories added to the <envar>PATH</envar>. That is built-in, but other setup is done via a pluggable mechanism that works in conjunction with these dependency attributes. See <xref linkend="ssec-setup-hooks"/> for details.
227173 </para>
228174
229175 <para>
230− Dependencies can be broken down along three axes: their host and target
231− platforms relative to the new derivation's, and whether they are propagated.
232− The platform distinctions are motivated by cross compilation; see
233− <xref linkend="chap-cross"/> for exactly what each platform means.
176+ Dependencies can be broken down along three axes: their host and target platforms relative to the new derivation's, and whether they are propagated. The platform distinctions are motivated by cross compilation; see <xref linkend="chap-cross"/> for exactly what each platform means.
234177 <footnote xml:id="footnote-stdenv-ignored-build-platform">
235178 <para>
236− The build platform is ignored because it is a mere implementation detail
237− of the package satisfying the dependency: As a general programming
238− principle, dependencies are always <emphasis>specified</emphasis> as
239− interfaces, not concrete implementation.
179+ The build platform is ignored because it is a mere implementation detail of the package satisfying the dependency: As a general programming principle, dependencies are always <emphasis>specified</emphasis> as interfaces, not concrete implementation.
240180 </para>
241181 </footnote>
242− But even if one is not cross compiling, the platforms imply whether or not
243− the dependency is needed at run-time or build-time, a concept that makes
244− perfect sense outside of cross compilation. By default, the
245− run-time/build-time distinction is just a hint for mental clarity, but with
246− <varname>strictDeps</varname> set it is mostly enforced even in the native
247− case.
182+ But even if one is not cross compiling, the platforms imply whether or not the dependency is needed at run-time or build-time, a concept that makes perfect sense outside of cross compilation. By default, the run-time/build-time distinction is just a hint for mental clarity, but with <varname>strictDeps</varname> set it is mostly enforced even in the native case.
248183 </para>
249184
250185 <para>
251− The extension of <envar>PATH</envar> with dependencies, alluded to above,
252− proceeds according to the relative platforms alone. The process is carried
253− out only for dependencies whose host platform matches the new derivation's
254− build platform i.e. dependencies which run on the platform where the new
255− derivation will be built.
186+ The extension of <envar>PATH</envar> with dependencies, alluded to above, proceeds according to the relative platforms alone. The process is carried out only for dependencies whose host platform matches the new derivation's build platform i.e. dependencies which run on the platform where the new derivation will be built.
256187 <footnote xml:id="footnote-stdenv-native-dependencies-in-path">
257188 <para>
258− Currently, this means for native builds all dependencies are put on the
259− <envar>PATH</envar>. But in the future that may not be the case for sake
260− of matching cross: the platforms would be assumed to be unique for native
261− and cross builds alike, so only the <varname>depsBuild*</varname> and
262− <varname>nativeBuildInputs</varname> would be added to the
263− <envar>PATH</envar>.
189+ Currently, this means for native builds all dependencies are put on the <envar>PATH</envar>. But in the future that may not be the case for sake of matching cross: the platforms would be assumed to be unique for native and cross builds alike, so only the <varname>depsBuild*</varname> and <varname>nativeBuildInputs</varname> would be added to the <envar>PATH</envar>.
264190 </para>
265191 </footnote>
266− For each dependency <replaceable>dep</replaceable> of those dependencies,
267− <filename><replaceable>dep</replaceable>/bin</filename>, if present, is
268− added to the <envar>PATH</envar> environment variable.
192+ For each dependency <replaceable>dep</replaceable> of those dependencies, <filename><replaceable>dep</replaceable>/bin</filename>, if present, is added to the <envar>PATH</envar> environment variable.
269193 </para>
270194
271195 <para>
272− The dependency is propagated when it forces some of its other-transitive
273− (non-immediate) downstream dependencies to also take it on as an immediate
274− dependency. Nix itself already takes a package's transitive dependencies
275− into account, but this propagation ensures nixpkgs-specific infrastructure
276− like setup hooks (mentioned above) also are run as if the propagated
277− dependency.
196+ The dependency is propagated when it forces some of its other-transitive (non-immediate) downstream dependencies to also take it on as an immediate dependency. Nix itself already takes a package's transitive dependencies into account, but this propagation ensures nixpkgs-specific infrastructure like setup hooks (mentioned above) also are run as if the propagated dependency.
278197 </para>
279198
280199 <para>
281− It is important to note that dependencies are not necessarily propagated as
282− the same sort of dependency that they were before, but rather as the
283− corresponding sort so that the platform rules still line up. The exact rules
284− for dependency propagation can be given by assigning to each dependency two
285− integers based one how its host and target platforms are offset from the
286− depending derivation's platforms. Those offsets are given below in the
287− descriptions of each dependency list attribute. Algorithmically, we traverse
288− propagated inputs, accumulating every propagated dependency's propagated
289− dependencies and adjusting them to account for the "shift in perspective"
290− described by the current dependency's platform offsets. This results in sort
291− a transitive closure of the dependency relation, with the offsets being
292− approximately summed when two dependency links are combined. We also prune
293− transitive dependencies whose combined offsets go out-of-bounds, which can
294− be viewed as a filter over that transitive closure removing dependencies
295− that are blatantly absurd.
200+ It is important to note that dependencies are not necessarily propagated as the same sort of dependency that they were before, but rather as the corresponding sort so that the platform rules still line up. The exact rules for dependency propagation can be given by assigning to each dependency two integers based one how its host and target platforms are offset from the depending derivation's platforms. Those offsets are given below in the descriptions of each dependency list attribute. Algorithmically, we traverse propagated inputs, accumulating every propagated dependency's propagated dependencies and adjusting them to account for the "shift in perspective" described by the current dependency's platform offsets. This results in sort a transitive closure of the dependency relation, with the offsets being approximately summed when two dependency links are combined. We also prune transitive dependencies whose combined offsets go out-of-bounds, which can be viewed as a filter over that transitive closure removing dependencies that are blatantly absurd.
296201 </para>
297202
298203 <para>
299− We can define the process precisely with
300− <link xlink:href="https://en.wikipedia.org/wiki/Natural_deduction">Natural
301− Deduction</link> using the inference rules. This probably seems a bit
302− obtuse, but so is the bash code that actually implements it!
204+ We can define the process precisely with <link xlink:href="https://en.wikipedia.org/wiki/Natural_deduction">Natural Deduction</link> using the inference rules. This probably seems a bit obtuse, but so is the bash code that actually implements it!
303205 <footnote xml:id="footnote-stdenv-find-inputs-location">
304206 <para>
305− The <function>findInputs</function> function, currently residing in
306− <filename>pkgs/stdenv/generic/setup.sh</filename>, implements the
307− propagation logic.
207+ The <function>findInputs</function> function, currently residing in <filename>pkgs/stdenv/generic/setup.sh</filename>, implements the propagation logic.
308208 </para>
309209 </footnote>
310− They're confusing in very different ways so... hopefully if something
311− doesn't make sense in one presentation, it will in the other!
210+ They're confusing in very different ways so... hopefully if something doesn't make sense in one presentation, it will in the other!
312211<programlisting>
313212let mapOffset(h, t, i) = i + (if i &lt;= 0 then h else t - 1)
314213
@@ -335,50 +234,22 @@ propagated-dep(mapOffset(h0, t0, h1),
335234propagated-dep(h, t, A, B)
336235----------------------------- Propagated dependencies count as dependencies
337236dep(h, t, A, B)</programlisting>
338− Some explanation of this monstrosity is in order. In the common case, the
339− target offset of a dependency is the successor to the target offset:
340− <literal>t = h + 1</literal>. That means that:
237+ Some explanation of this monstrosity is in order. In the common case, the target offset of a dependency is the successor to the target offset: <literal>t = h + 1</literal>. That means that:
341238<programlisting>
342239let f(h, t, i) = i + (if i &lt;= 0 then h else t - 1)
343240let f(h, h + 1, i) = i + (if i &lt;= 0 then h else (h + 1) - 1)
344241let f(h, h + 1, i) = i + (if i &lt;= 0 then h else h)
345242let f(h, h + 1, i) = i + h
346243</programlisting>
347− This is where "sum-like" comes in from above: We can just sum all of the
348− host offsets to get the host offset of the transitive dependency. The target
349− offset is the transitive dependency is simply the host offset + 1, just as
350− it was with the dependencies composed to make this transitive one; it can be
351− ignored as it doesn't add any new information.
244+ This is where "sum-like" comes in from above: We can just sum all of the host offsets to get the host offset of the transitive dependency. The target offset is the transitive dependency is simply the host offset + 1, just as it was with the dependencies composed to make this transitive one; it can be ignored as it doesn't add any new information.
352245 </para>
353246
354247 <para>
355− Because of the bounds checks, the uncommon cases are <literal>h =
356− t</literal> and <literal>h + 2 = t</literal>. In the former case, the
357− motivation for <function>mapOffset</function> is that since its host and
358− target platforms are the same, no transitive dependency of it should be able
359− to "discover" an offset greater than its reduced target offsets.
360− <function>mapOffset</function> effectively "squashes" all its transitive
361− dependencies' offsets so that none will ever be greater than the target
362− offset of the original <literal>h = t</literal> package. In the other case,
363− <literal>h + 1</literal> is skipped over between the host and target
364− offsets. Instead of squashing the offsets, we need to "rip" them apart so no
365− transitive dependencies' offset is that one.
248+ Because of the bounds checks, the uncommon cases are <literal>h = t</literal> and <literal>h + 2 = t</literal>. In the former case, the motivation for <function>mapOffset</function> is that since its host and target platforms are the same, no transitive dependency of it should be able to "discover" an offset greater than its reduced target offsets. <function>mapOffset</function> effectively "squashes" all its transitive dependencies' offsets so that none will ever be greater than the target offset of the original <literal>h = t</literal> package. In the other case, <literal>h + 1</literal> is skipped over between the host and target offsets. Instead of squashing the offsets, we need to "rip" them apart so no transitive dependencies' offset is that one.
366249 </para>
367250
368251 <para>
369− Overall, the unifying theme here is that propagation shouldn't be
370− introducing transitive dependencies involving platforms the depending
371− package is unaware of. [One can imagine the dependending package asking for
372− dependencies with the platforms it knows about; other platforms it doesn't
373− know how to ask for. The platform description in that scenario is a kind of
374− unforagable capability.] The offset bounds checking and definition of
375− <function>mapOffset</function> together ensure that this is the case.
376− Discovering a new offset is discovering a new platform, and since those
377− platforms weren't in the derivation "spec" of the needing package, they
378− cannot be relevant. From a capability perspective, we can imagine that the
379− host and target platforms of a package are the capabilities a package
380− requires, and the depending package must provide the capability to the
381− dependency.
252+ Overall, the unifying theme here is that propagation shouldn't be introducing transitive dependencies involving platforms the depending package is unaware of. [One can imagine the dependending package asking for dependencies with the platforms it knows about; other platforms it doesn't know how to ask for. The platform description in that scenario is a kind of unforagable capability.] The offset bounds checking and definition of <function>mapOffset</function> together ensure that this is the case. Discovering a new offset is discovering a new platform, and since those platforms weren't in the derivation "spec" of the needing package, they cannot be relevant. From a capability perspective, we can imagine that the host and target platforms of a package are the capabilities a package requires, and the depending package must provide the capability to the dependency.
382253 </para>
383254
384255 <variablelist>
@@ -389,23 +260,10 @@ let f(h, h + 1, i) = i + h
389260 </term>
390261 <listitem>
391262 <para>
392− A list of dependencies whose host and target platforms are the new
393− derivation's build platform. This means a <literal>-1</literal> host and
394− <literal>-1</literal> target offset from the new derivation's platforms.
395− These are programs and libraries used at build time that produce programs
396− and libraries also used at build time. If the dependency doesn't care
397− about the target platform (i.e. isn't a compiler or similar tool), put it
398− in <varname>nativeBuildInputs</varname> instead. The most common use of
399− this <literal>buildPackages.stdenv.cc</literal>, the default C compiler
400− for this role. That example crops up more than one might think in old
401− commonly used C libraries.
263+ A list of dependencies whose host and target platforms are the new derivation's build platform. This means a <literal>-1</literal> host and <literal>-1</literal> target offset from the new derivation's platforms. These are programs and libraries used at build time that produce programs and libraries also used at build time. If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it in <varname>nativeBuildInputs</varname> instead. The most common use of this <literal>buildPackages.stdenv.cc</literal>, the default C compiler for this role. That example crops up more than one might think in old commonly used C libraries.
402264 </para>
403265 <para>
404− Since these packages are able to be run at build-time, they are always
405− added to the <envar>PATH</envar>, as described above. But since these
406− packages are only guaranteed to be able to run then, they shouldn't
407− persist as run-time dependencies. This isn't currently enforced, but
408− could be in the future.
266+ Since these packages are able to be run at build-time, they are always added to the <envar>PATH</envar>, as described above. But since these packages are only guaranteed to be able to run then, they shouldn't persist as run-time dependencies. This isn't currently enforced, but could be in the future.
409267 </para>
410268 </listitem>
411269 </varlistentry>
@@ -415,24 +273,10 @@ let f(h, h + 1, i) = i + h
415273 </term>
416274 <listitem>
417275 <para>
418− A list of dependencies whose host platform is the new derivation's build
419− platform, and target platform is the new derivation's host platform. This
420− means a <literal>-1</literal> host offset and <literal>0</literal> target
421− offset from the new derivation's platforms. These are programs and
422− libraries used at build-time that, if they are a compiler or similar
423− tool, produce code to run at run-time—i.e. tools used to build the new
424− derivation. If the dependency doesn't care about the target platform
425− (i.e. isn't a compiler or similar tool), put it here, rather than in
426− <varname>depsBuildBuild</varname> or <varname>depsBuildTarget</varname>.
427− This could be called <varname>depsBuildHost</varname> but
428− <varname>nativeBuildInputs</varname> is used for historical continuity.
429− </para>
430− <para>
431− Since these packages are able to be run at build-time, they are added to
432− the <envar>PATH</envar>, as described above. But since these packages are
433− only guaranteed to be able to run then, they shouldn't persist as
434− run-time dependencies. This isn't currently enforced, but could be in the
435− future.
276+ A list of dependencies whose host platform is the new derivation's build platform, and target platform is the new derivation's host platform. This means a <literal>-1</literal> host offset and <literal>0</literal> target offset from the new derivation's platforms. These are programs and libraries used at build-time that, if they are a compiler or similar tool, produce code to run at run-time—i.e. tools used to build the new derivation. If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it here, rather than in <varname>depsBuildBuild</varname> or <varname>depsBuildTarget</varname>. This could be called <varname>depsBuildHost</varname> but <varname>nativeBuildInputs</varname> is used for historical continuity.
277+ </para>
278+ <para>
279+ Since these packages are able to be run at build-time, they are added to the <envar>PATH</envar>, as described above. But since these packages are only guaranteed to be able to run then, they shouldn't persist as run-time dependencies. This isn't currently enforced, but could be in the future.
436280 </para>
437281 </listitem>
438282 </varlistentry>
@@ -442,39 +286,13 @@ let f(h, h + 1, i) = i + h
442286 </term>
443287 <listitem>
444288 <para>
445− A list of dependencies whose host platform is the new derivation's build
446− platform, and target platform is the new derivation's target platform.
447− This means a <literal>-1</literal> host offset and <literal>1</literal>
448− target offset from the new derivation's platforms. These are programs
449− used at build time that produce code to run with code produced by the
450− depending package. Most commonly, these are tools used to build the
451− runtime or standard library that the currently-being-built compiler will
452− inject into any code it compiles. In many cases, the
453− currently-being-built-compiler is itself employed for that task, but when
454− that compiler won't run (i.e. its build and host platform differ) this is
455− not possible. Other times, the compiler relies on some other tool, like
456− binutils, that is always built separately so that the dependency is
457− unconditional.
458− </para>
459− <para>
460− This is a somewhat confusing concept to wrap one’s head around, and for
461− good reason. As the only dependency type where the platform offsets are
462− not adjacent integers, it requires thinking of a bootstrapping stage
463− <emphasis>two</emphasis> away from the current one. It and its use-case
464− go hand in hand and are both considered poor form: try to not need this
465− sort of dependency, and try to avoid building standard libraries and
466− runtimes in the same derivation as the compiler produces code using them.
467− Instead strive to build those like a normal library, using the
468− newly-built compiler just as a normal library would. In short, do not use
469− this attribute unless you are packaging a compiler and are sure it is
470− needed.
471− </para>
472− <para>
473− Since these packages are able to run at build time, they are added to the
474− <envar>PATH</envar>, as described above. But since these packages are
475− only guaranteed to be able to run then, they shouldn't persist as
476− run-time dependencies. This isn't currently enforced, but could be in the
477− future.
289+ A list of dependencies whose host platform is the new derivation's build platform, and target platform is the new derivation's target platform. This means a <literal>-1</literal> host offset and <literal>1</literal> target offset from the new derivation's platforms. These are programs used at build time that produce code to run with code produced by the depending package. Most commonly, these are tools used to build the runtime or standard library that the currently-being-built compiler will inject into any code it compiles. In many cases, the currently-being-built-compiler is itself employed for that task, but when that compiler won't run (i.e. its build and host platform differ) this is not possible. Other times, the compiler relies on some other tool, like binutils, that is always built separately so that the dependency is unconditional.
290+ </para>
291+ <para>
292+ This is a somewhat confusing concept to wrap one’s head around, and for good reason. As the only dependency type where the platform offsets are not adjacent integers, it requires thinking of a bootstrapping stage <emphasis>two</emphasis> away from the current one. It and its use-case go hand in hand and are both considered poor form: try to not need this sort of dependency, and try to avoid building standard libraries and runtimes in the same derivation as the compiler produces code using them. Instead strive to build those like a normal library, using the newly-built compiler just as a normal library would. In short, do not use this attribute unless you are packaging a compiler and are sure it is needed.
293+ </para>
294+ <para>
295+ Since these packages are able to run at build time, they are added to the <envar>PATH</envar>, as described above. But since these packages are only guaranteed to be able to run then, they shouldn't persist as run-time dependencies. This isn't currently enforced, but could be in the future.
478296 </para>
479297 </listitem>
480298 </varlistentry>
@@ -484,16 +302,7 @@ let f(h, h + 1, i) = i + h
484302 </term>
485303 <listitem>
486304 <para>
487− A list of dependencies whose host and target platforms match the new
488− derivation's host platform. This means a <literal>0</literal> host offset
489− and <literal>0</literal> target offset from the new derivation's host
490− platform. These are packages used at run-time to generate code also used
491− at run-time. In practice, this would usually be tools used by compilers
492− for macros or a metaprogramming system, or libraries used by the macros
493− or metaprogramming code itself. It's always preferable to use a
494− <varname>depsBuildBuild</varname> dependency in the derivation being
495− built over a <varname>depsHostHost</varname> on the tool doing the
496− building for this purpose.
305+ A list of dependencies whose host and target platforms match the new derivation's host platform. This means a <literal>0</literal> host offset and <literal>0</literal> target offset from the new derivation's host platform. These are packages used at run-time to generate code also used at run-time. In practice, this would usually be tools used by compilers for macros or a metaprogramming system, or libraries used by the macros or metaprogramming code itself. It's always preferable to use a <varname>depsBuildBuild</varname> dependency in the derivation being built over a <varname>depsHostHost</varname> on the tool doing the building for this purpose.
497306 </para>
498307 </listitem>
499308 </varlistentry>
@@ -503,21 +312,10 @@ let f(h, h + 1, i) = i + h
503312 </term>
504313 <listitem>
505314 <para>
506− A list of dependencies whose host platform and target platform match the
507− new derivation's. This means a <literal>0</literal> host offset and a
508− <literal>1</literal> target offset from the new derivation's host
509− platform. This would be called <varname>depsHostTarget</varname> but for
510− historical continuity. If the dependency doesn't care about the target
511− platform (i.e. isn't a compiler or similar tool), put it here, rather
512− than in <varname>depsBuildBuild</varname>.
315+ A list of dependencies whose host platform and target platform match the new derivation's. This means a <literal>0</literal> host offset and a <literal>1</literal> target offset from the new derivation's host platform. This would be called <varname>depsHostTarget</varname> but for historical continuity. If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it here, rather than in <varname>depsBuildBuild</varname>.
513316 </para>
514317 <para>
515− These are often programs and libraries used by the new derivation at
516− <emphasis>run</emphasis>-time, but that isn't always the case. For
517− example, the machine code in a statically-linked library is only used at
518− run-time, but the derivation containing the library is only needed at
519− build-time. Even in the dynamic case, the library may also be needed at
520− build-time to appease the linker.
318+ These are often programs and libraries used by the new derivation at <emphasis>run</emphasis>-time, but that isn't always the case. For example, the machine code in a statically-linked library is only used at run-time, but the derivation containing the library is only needed at build-time. Even in the dynamic case, the library may also be needed at build-time to appease the linker.
521319 </para>
522320 </listitem>
523321 </varlistentry>
@@ -527,14 +325,7 @@ let f(h, h + 1, i) = i + h
527325 </term>
528326 <listitem>
529327 <para>
530− A list of dependencies whose host platform matches the new derivation's
531− target platform. This means a <literal>1</literal> offset from the new
532− derivation's platforms. These are packages that run on the target
533− platform, e.g. the standard library or run-time deps of standard library
534− that a compiler insists on knowing about. It's poor form in almost all
535− cases for a package to depend on another from a future stage [future
536− stage corresponding to positive offset]. Do not use this attribute unless
537− you are packaging a compiler and are sure it is needed.
328+ A list of dependencies whose host platform matches the new derivation's target platform. This means a <literal>1</literal> offset from the new derivation's platforms. These are packages that run on the target platform, e.g. the standard library or run-time deps of standard library that a compiler insists on knowing about. It's poor form in almost all cases for a package to depend on another from a future stage [future stage corresponding to positive offset]. Do not use this attribute unless you are packaging a compiler and are sure it is needed.
538329 </para>
539330 </listitem>
540331 </varlistentry>
@@ -544,9 +335,7 @@ let f(h, h + 1, i) = i + h
544335 </term>
545336 <listitem>
546337 <para>
547− The propagated equivalent of <varname>depsBuildBuild</varname>. This
548− perhaps never ought to be used, but it is included for consistency [see
549− below for the others].
338+ The propagated equivalent of <varname>depsBuildBuild</varname>. This perhaps never ought to be used, but it is included for consistency [see below for the others].
550339 </para>
551340 </listitem>
552341 </varlistentry>
@@ -556,18 +345,7 @@ let f(h, h + 1, i) = i + h
556345 </term>
557346 <listitem>
558347 <para>
559− The propagated equivalent of <varname>nativeBuildInputs</varname>. This
560− would be called <varname>depsBuildHostPropagated</varname> but for
561− historical continuity. For example, if package <varname>Y</varname> has
562− <literal>propagatedNativeBuildInputs = [X]</literal>, and package
563− <varname>Z</varname> has <literal>buildInputs = [Y]</literal>, then
564− package <varname>Z</varname> will be built as if it included package
565− <varname>X</varname> in its <varname>nativeBuildInputs</varname>. If
566− instead, package <varname>Z</varname> has <literal>nativeBuildInputs =
567− [Y]</literal>, then <varname>Z</varname> will be built as if it included
568− <varname>X</varname> in the <varname>depsBuildBuild</varname> of package
569− <varname>Z</varname>, because of the sum of the two <literal>-1</literal>
570− host offsets.
348+ The propagated equivalent of <varname>nativeBuildInputs</varname>. This would be called <varname>depsBuildHostPropagated</varname> but for historical continuity. For example, if package <varname>Y</varname> has <literal>propagatedNativeBuildInputs = [X]</literal>, and package <varname>Z</varname> has <literal>buildInputs = [Y]</literal>, then package <varname>Z</varname> will be built as if it included package <varname>X</varname> in its <varname>nativeBuildInputs</varname>. If instead, package <varname>Z</varname> has <literal>nativeBuildInputs = [Y]</literal>, then <varname>Z</varname> will be built as if it included <varname>X</varname> in the <varname>depsBuildBuild</varname> of package <varname>Z</varname>, because of the sum of the two <literal>-1</literal> host offsets.
571349 </para>
572350 </listitem>
573351 </varlistentry>
@@ -577,8 +355,7 @@ let f(h, h + 1, i) = i + h
577355 </term>
578356 <listitem>
579357 <para>
580− The propagated equivalent of <varname>depsBuildTarget</varname>. This is
581− prefixed for the same reason of alerting potential users.
358+ The propagated equivalent of <varname>depsBuildTarget</varname>. This is prefixed for the same reason of alerting potential users.
582359 </para>
583360 </listitem>
584361 </varlistentry>
@@ -598,9 +375,7 @@ let f(h, h + 1, i) = i + h
598375 </term>
599376 <listitem>
600377 <para>
601− The propagated equivalent of <varname>buildInputs</varname>. This would
602− be called <varname>depsHostTargetPropagated</varname> but for historical
603− continuity.
378+ The propagated equivalent of <varname>buildInputs</varname>. This would be called <varname>depsHostTargetPropagated</varname> but for historical continuity.
604379 </para>
605380 </listitem>
606381 </varlistentry>
@@ -610,8 +385,7 @@ let f(h, h + 1, i) = i + h
610385 </term>
611386 <listitem>
612387 <para>
613− The propagated equivalent of <varname>depsTargetTarget</varname>. This is
614− prefixed for the same reason of alerting potential users.
388+ The propagated equivalent of <varname>depsTargetTarget</varname>. This is prefixed for the same reason of alerting potential users.
615389 </para>
616390 </listitem>
617391 </varlistentry>
@@ -628,15 +402,7 @@ let f(h, h + 1, i) = i + h
628402 </term>
629403 <listitem>
630404 <para>
631− A natural number indicating how much information to log. If set to 1 or
632− higher, <literal>stdenv</literal> will print moderate debugging
633− information during the build. In particular, the <command>gcc</command>
634− and <command>ld</command> wrapper scripts will print out the complete
635− command line passed to the wrapped tools. If set to 6 or higher, the
636− <literal>stdenv</literal> setup script will be run with <literal>set
637− -x</literal> tracing. If set to 7 or higher, the <command>gcc</command>
638− and <command>ld</command> wrapper scripts will also be run with
639− <literal>set -x</literal> tracing.
405+ A natural number indicating how much information to log. If set to 1 or higher, <literal>stdenv</literal> will print moderate debugging information during the build. In particular, the <command>gcc</command> and <command>ld</command> wrapper scripts will print out the complete command line passed to the wrapped tools. If set to 6 or higher, the <literal>stdenv</literal> setup script will be run with <literal>set -x</literal> tracing. If set to 7 or higher, the <command>gcc</command> and <command>ld</command> wrapper scripts will also be run with <literal>set -x</literal> tracing.
640406 </para>
641407 </listitem>
642408 </varlistentry>
@@ -650,15 +416,10 @@ let f(h, h + 1, i) = i + h
650416 </term>
651417 <listitem>
652418 <para>
653− If set to <literal>true</literal>, <literal>stdenv</literal> will pass
654− specific flags to <literal>make</literal> and other build tools to enable
655− parallel building with up to <literal>build-cores</literal> workers.
419+ If set to <literal>true</literal>, <literal>stdenv</literal> will pass specific flags to <literal>make</literal> and other build tools to enable parallel building with up to <literal>build-cores</literal> workers.
656420 </para>
657421 <para>
658− Unless set to <literal>false</literal>, some build systems with good
659− support for parallel building including <literal>cmake</literal>,
660− <literal>meson</literal>, and <literal>qmake</literal> will set it to
661− <literal>true</literal>.
422+ Unless set to <literal>false</literal>, some build systems with good support for parallel building including <literal>cmake</literal>, <literal>meson</literal>, and <literal>qmake</literal> will set it to <literal>true</literal>.
662423 </para>
663424 </listitem>
664425 </varlistentry>
@@ -672,8 +433,7 @@ let f(h, h + 1, i) = i + h
672433 </term>
673434 <listitem>
674435 <para>
675− This is an attribute set which can be filled with arbitrary values. For
676− example:
436+ This is an attribute set which can be filled with arbitrary values. For example:
677437<programlisting>
678438passthru = {
679439 foo = "bar";
@@ -685,17 +445,7 @@ passthru = {
685445</programlisting>
686446 </para>
687447 <para>
688− Values inside it are not passed to the builder, so you can change them
689− without triggering a rebuild. However, they can be accessed outside of a
690− derivation directly, as if they were set inside a derivation itself, e.g.
691− <literal>hello.baz.value1</literal>. We don't specify any usage or schema
692− of <literal>passthru</literal> - it is meant for values that would be
693− useful outside the derivation in other parts of a Nix expression (e.g. in
694− other derivations). An example would be to convey some specific
695− dependency of your derivation which contains a program with plugins
696− support. Later, others who make derivations with plugins can use
697− passed-through dependency to ensure that their plugin would be
698− binary-compatible with built program.
448+ Values inside it are not passed to the builder, so you can change them without triggering a rebuild. However, they can be accessed outside of a derivation directly, as if they were set inside a derivation itself, e.g. <literal>hello.baz.value1</literal>. We don't specify any usage or schema of <literal>passthru</literal> - it is meant for values that would be useful outside the derivation in other parts of a Nix expression (e.g. in other derivations). An example would be to convey some specific dependency of your derivation which contains a program with plugins support. Later, others who make derivations with plugins can use passed-through dependency to ensure that their plugin would be binary-compatible with built program.
699449 </para>
700450 </listitem>
701451 </varlistentry>
@@ -705,9 +455,7 @@ passthru = {
705455 </term>
706456 <listitem>
707457 <para>
708− A script to be run by <filename>maintainers/scripts/update.nix</filename>
709− when the package is matched. It needs to be an executable file, either on
710− the file system:
458+ A script to be run by <filename>maintainers/scripts/update.nix</filename> when the package is matched. It needs to be an executable file, either on the file system:
711459<programlisting>
712460passthru.updateScript = ./update.sh;
713461</programlisting>
@@ -723,21 +471,16 @@ passthru.updateScript = writeScript "update-zoom-us" ''
723471 update-source-version zoom-us "$version"
724472'';
725473</programlisting>
726− The attribute can also contain a list, a script followed by arguments to
727− be passed to it:
474+ The attribute can also contain a list, a script followed by arguments to be passed to it:
728475<programlisting>
729476passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ];
730477</programlisting>
731478 </para>
732479 <para>
733− The script will be usually run from the root of the Nixpkgs repository
734− but you should not rely on that. Also note that the update scripts will
735− be run in parallel by default; you should avoid running <command>git
736− commit</command> or any other commands that cannot handle that.
480+ The script will be usually run from the root of the Nixpkgs repository but you should not rely on that. Also note that the update scripts will be run in parallel by default; you should avoid running <command>git commit</command> or any other commands that cannot handle that.
737481 </para>
738482 <para>
739− For information about how to run the updates, execute <command>nix-shell
740− maintainers/scripts/update.nix</command>.
483+ For information about how to run the updates, execute <command>nix-shell maintainers/scripts/update.nix</command>.
741484 </para>
742485 </listitem>
743486 </varlistentry>
@@ -747,33 +490,18 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
747490 <title>Phases</title>
748491
749492 <para>
750− The generic builder has a number of <emphasis>phases</emphasis>. Package
751− builds are split into phases to make it easier to override specific parts of
752− the build (e.g., unpacking the sources or installing the binaries).
753− Furthermore, it allows a nicer presentation of build logs in the Nix build
754− farm.
493+ The generic builder has a number of <emphasis>phases</emphasis>. Package builds are split into phases to make it easier to override specific parts of the build (e.g., unpacking the sources or installing the binaries). Furthermore, it allows a nicer presentation of build logs in the Nix build farm.
755494 </para>
756495
757496 <para>
758− Each phase can be overridden in its entirety either by setting the
759− environment variable <varname><replaceable>name</replaceable>Phase</varname>
760− to a string containing some shell commands to be executed, or by redefining
761− the shell function <varname><replaceable>name</replaceable>Phase</varname>.
762− The former is convenient to override a phase from the derivation, while the
763− latter is convenient from a build script. However, typically one only wants
764− to <emphasis>add</emphasis> some commands to a phase, e.g. by defining
765− <literal>postInstall</literal> or <literal>preFixup</literal>, as skipping
766− some of the default actions may have unexpected consequences. The default
767− script for each phase is defined in the file
768− <filename>pkgs/stdenv/generic/setup.sh</filename>.
497+ Each phase can be overridden in its entirety either by setting the environment variable <varname><replaceable>name</replaceable>Phase</varname> to a string containing some shell commands to be executed, or by redefining the shell function <varname><replaceable>name</replaceable>Phase</varname>. The former is convenient to override a phase from the derivation, while the latter is convenient from a build script. However, typically one only wants to <emphasis>add</emphasis> some commands to a phase, e.g. by defining <literal>postInstall</literal> or <literal>preFixup</literal>, as skipping some of the default actions may have unexpected consequences. The default script for each phase is defined in the file <filename>pkgs/stdenv/generic/setup.sh</filename>.
769498 </para>
770499
771500 <section xml:id="ssec-controlling-phases">
772501 <title>Controlling phases</title>
773502
774503 <para>
775− There are a number of variables that control what phases are executed and
776− in what order:
504+ There are a number of variables that control what phases are executed and in what order:
777505 <variablelist>
778506 <title>Variables affecting phase control</title>
779507 <varlistentry>
@@ -782,19 +510,10 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
782510 </term>
783511 <listitem>
784512 <para>
785− Specifies the phases. You can change the order in which phases are
786− executed, or add new phases, by setting this variable. If it’s not
787− set, the default value is used, which is <literal>$prePhases
788− unpackPhase patchPhase $preConfigurePhases configurePhase
789− $preBuildPhases buildPhase checkPhase $preInstallPhases installPhase
790− fixupPhase installCheckPhase $preDistPhases distPhase
791− $postPhases</literal>.
513+ Specifies the phases. You can change the order in which phases are executed, or add new phases, by setting this variable. If it’s not set, the default value is used, which is <literal>$prePhases unpackPhase patchPhase $preConfigurePhases configurePhase $preBuildPhases buildPhase checkPhase $preInstallPhases installPhase fixupPhase installCheckPhase $preDistPhases distPhase $postPhases</literal>.
792514 </para>
793515 <para>
794− Usually, if you just want to add a few phases, it’s more convenient
795− to set one of the variables below (such as
796− <varname>preInstallPhases</varname>), as you then don’t specify all
797− the normal phases.
516+ Usually, if you just want to add a few phases, it’s more convenient to set one of the variables below (such as <varname>preInstallPhases</varname>), as you then don’t specify all the normal phases.
798517 </para>
799518 </listitem>
800519 </varlistentry>
@@ -876,11 +595,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
876595 <title>The unpack phase</title>
877596
878597 <para>
879− The unpack phase is responsible for unpacking the source code of the
880− package. The default implementation of <function>unpackPhase</function>
881− unpacks the source files listed in the <envar>src</envar> environment
882− variable to the current directory. It supports the following files by
883− default:
598+ The unpack phase is responsible for unpacking the source code of the package. The default implementation of <function>unpackPhase</function> unpacks the source files listed in the <envar>src</envar> environment variable to the current directory. It supports the following files by default:
884599 <variablelist>
885600 <varlistentry>
886601 <term>
@@ -888,13 +603,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
888603 </term>
889604 <listitem>
890605 <para>
891− These can optionally be compressed using <command>gzip</command>
892− (<filename>.tar.gz</filename>, <filename>.tgz</filename> or
893− <filename>.tar.Z</filename>), <command>bzip2</command>
894− (<filename>.tar.bz2</filename>, <filename>.tbz2</filename> or
895− <filename>.tbz</filename>) or <command>xz</command>
896− (<filename>.tar.xz</filename>, <filename>.tar.lzma</filename> or
897− <filename>.txz</filename>).
606+ These can optionally be compressed using <command>gzip</command> (<filename>.tar.gz</filename>, <filename>.tgz</filename> or <filename>.tar.Z</filename>), <command>bzip2</command> (<filename>.tar.bz2</filename>, <filename>.tbz2</filename> or <filename>.tbz</filename>) or <command>xz</command> (<filename>.tar.xz</filename>, <filename>.tar.lzma</filename> or <filename>.txz</filename>).
898607 </para>
899608 </listitem>
900609 </varlistentry>
@@ -904,9 +613,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
904613 </term>
905614 <listitem>
906615 <para>
907− Zip files are unpacked using <command>unzip</command>. However,
908− <command>unzip</command> is not in the standard environment, so you
909− should add it to <varname>nativeBuildInputs</varname> yourself.
616+ Zip files are unpacked using <command>unzip</command>. However, <command>unzip</command> is not in the standard environment, so you should add it to <varname>nativeBuildInputs</varname> yourself.
910617 </para>
911618 </listitem>
912619 </varlistentry>
@@ -916,16 +623,12 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
916623 </term>
917624 <listitem>
918625 <para>
919− These are simply copied to the current directory. The hash part of the
920− file name is stripped, e.g.
921− <filename>/nix/store/1wydxgby13cz...-my-sources</filename> would be
922− copied to <filename>my-sources</filename>.
626+ These are simply copied to the current directory. The hash part of the file name is stripped, e.g. <filename>/nix/store/1wydxgby13cz...-my-sources</filename> would be copied to <filename>my-sources</filename>.
923627 </para>
924628 </listitem>
925629 </varlistentry>
926630 </variablelist>
927− Additional file types can be supported by setting the
928− <varname>unpackCmd</varname> variable (see below).
631+ Additional file types can be supported by setting the <varname>unpackCmd</varname> variable (see below).
929632 </para>
930633
931634 <para></para>
@@ -938,8 +641,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
938641 </term>
939642 <listitem>
940643 <para>
941− The list of source files or directories to be unpacked or copied. One of
942− these must be set.
644+ The list of source files or directories to be unpacked or copied. One of these must be set.
943645 </para>
944646 </listitem>
945647 </varlistentry>
@@ -949,10 +651,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
949651 </term>
950652 <listitem>
951653 <para>
952− After running <function>unpackPhase</function>, the generic builder
953− changes the current directory to the directory created by unpacking the
954− sources. If there are multiple source directories, you should set
955− <varname>sourceRoot</varname> to the name of the intended directory.
654+ After running <function>unpackPhase</function>, the generic builder changes the current directory to the directory created by unpacking the sources. If there are multiple source directories, you should set <varname>sourceRoot</varname> to the name of the intended directory.
956655 </para>
957656 </listitem>
958657 </varlistentry>
@@ -962,10 +661,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
962661 </term>
963662 <listitem>
964663 <para>
965− Alternatively to setting <varname>sourceRoot</varname>, you can set
966− <varname>setSourceRoot</varname> to a shell command to be evaluated by
967− the unpack phase after the sources have been unpacked. This command must
968− set <varname>sourceRoot</varname>.
664+ Alternatively to setting <varname>sourceRoot</varname>, you can set <varname>setSourceRoot</varname> to a shell command to be evaluated by the unpack phase after the sources have been unpacked. This command must set <varname>sourceRoot</varname>.
969665 </para>
970666 </listitem>
971667 </varlistentry>
@@ -1005,10 +701,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1005701 </term>
1006702 <listitem>
1007703 <para>
1008− If set to <literal>1</literal>, the unpacked sources are
1009− <emphasis>not</emphasis> made writable. By default, they are made
1010− writable to prevent problems with read-only sources. For example, copied
1011− store directories would be read-only without this.
704+ If set to <literal>1</literal>, the unpacked sources are <emphasis>not</emphasis> made writable. By default, they are made writable to prevent problems with read-only sources. For example, copied store directories would be read-only without this.
1012705 </para>
1013706 </listitem>
1014707 </varlistentry>
@@ -1018,9 +711,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1018711 </term>
1019712 <listitem>
1020713 <para>
1021− The unpack phase evaluates the string <literal>$unpackCmd</literal> for
1022− any unrecognised file. The path to the current source file is contained
1023− in the <varname>curSrc</varname> variable.
714+ The unpack phase evaluates the string <literal>$unpackCmd</literal> for any unrecognised file. The path to the current source file is contained in the <varname>curSrc</varname> variable.
1024715 </para>
1025716 </listitem>
1026717 </varlistentry>
@@ -1031,8 +722,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1031722 <title>The patch phase</title>
1032723
1033724 <para>
1034− The patch phase applies the list of patches defined in the
1035− <varname>patches</varname> variable.
725+ The patch phase applies the list of patches defined in the <varname>patches</varname> variable.
1036726 </para>
1037727
1038728 <variablelist>
@@ -1043,11 +733,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1043733 </term>
1044734 <listitem>
1045735 <para>
1046− The list of patches. They must be in the format accepted by the
1047− <command>patch</command> command, and may optionally be compressed using
1048− <command>gzip</command> (<filename>.gz</filename>),
1049− <command>bzip2</command> (<filename>.bz2</filename>) or
1050− <command>xz</command> (<filename>.xz</filename>).
736+ The list of patches. They must be in the format accepted by the <command>patch</command> command, and may optionally be compressed using <command>gzip</command> (<filename>.gz</filename>), <command>bzip2</command> (<filename>.bz2</filename>) or <command>xz</command> (<filename>.xz</filename>).
1051737 </para>
1052738 </listitem>
1053739 </varlistentry>
@@ -1057,9 +743,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1057743 </term>
1058744 <listitem>
1059745 <para>
1060− Flags to be passed to <command>patch</command>. If not set, the argument
1061− <option>-p1</option> is used, which causes the leading directory
1062− component to be stripped from the file names in each patch.
746+ Flags to be passed to <command>patch</command>. If not set, the argument <option>-p1</option> is used, which causes the leading directory component to be stripped from the file names in each patch.
1063747 </para>
1064748 </listitem>
1065749 </varlistentry>
@@ -1090,9 +774,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1090774 <title>The configure phase</title>
1091775
1092776 <para>
1093− The configure phase prepares the source tree for building. The default
1094− <function>configurePhase</function> runs <filename>./configure</filename>
1095− (typically an Autoconf-generated script) if it exists.
777+ The configure phase prepares the source tree for building. The default <function>configurePhase</function> runs <filename>./configure</filename> (typically an Autoconf-generated script) if it exists.
1096778 </para>
1097779
1098780 <variablelist>
@@ -1103,10 +785,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1103785 </term>
1104786 <listitem>
1105787 <para>
1106− The name of the configure script. It defaults to
1107− <filename>./configure</filename> if it exists; otherwise, the configure
1108− phase is skipped. This can actually be a command (like <literal>perl
1109− ./Configure.pl</literal>).
788+ The name of the configure script. It defaults to <filename>./configure</filename> if it exists; otherwise, the configure phase is skipped. This can actually be a command (like <literal>perl ./Configure.pl</literal>).
1110789 </para>
1111790 </listitem>
1112791 </varlistentry>
@@ -1116,8 +795,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1116795 </term>
1117796 <listitem>
1118797 <para>
1119− A list of strings passed as additional arguments to the configure
1120− script.
798+ A list of strings passed as additional arguments to the configure script.
1121799 </para>
1122800 </listitem>
1123801 </varlistentry>
@@ -1137,9 +815,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1137815 </term>
1138816 <listitem>
1139817 <para>
1140− A shell array containing additional arguments passed to the configure
1141− script. You must use this instead of <varname>configureFlags</varname>
1142− if the arguments contain spaces.
818+ A shell array containing additional arguments passed to the configure script. You must use this instead of <varname>configureFlags</varname> if the arguments contain spaces.
1143819 </para>
1144820 </listitem>
1145821 </varlistentry>
@@ -1149,8 +825,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1149825 </term>
1150826 <listitem>
1151827 <para>
1152− By default, the flag <literal>--prefix=$prefix</literal> is added to the
1153− configure flags. If this is undesirable, set this variable to true.
828+ By default, the flag <literal>--prefix=$prefix</literal> is added to the configure flags. If this is undesirable, set this variable to true.
1154829 </para>
1155830 </listitem>
1156831 </varlistentry>
@@ -1160,9 +835,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1160835 </term>
1161836 <listitem>
1162837 <para>
1163− The prefix under which the package must be installed, passed via the
1164− <option>--prefix</option> option to the configure script. It defaults to
1165− <option>$out</option>.
838+ The prefix under which the package must be installed, passed via the <option>--prefix</option> option to the configure script. It defaults to <option>$out</option>.
1166839 </para>
1167840 </listitem>
1168841 </varlistentry>
@@ -1172,8 +845,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1172845 </term>
1173846 <listitem>
1174847 <para>
1175− The key to use when specifying the prefix. By default, this is set to
1176− <option>--prefix=</option> as that is used by the majority of packages.
848+ The key to use when specifying the prefix. By default, this is set to <option>--prefix=</option> as that is used by the majority of packages.
1177849 </para>
1178850 </listitem>
1179851 </varlistentry>
@@ -1183,9 +855,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1183855 </term>
1184856 <listitem>
1185857 <para>
1186− By default, the flag <literal>--disable-dependency-tracking</literal> is
1187− added to the configure flags to speed up Automake-based builds. If this
1188− is undesirable, set this variable to true.
858+ By default, the flag <literal>--disable-dependency-tracking</literal> is added to the configure flags to speed up Automake-based builds. If this is undesirable, set this variable to true.
1189859 </para>
1190860 </listitem>
1191861 </varlistentry>
@@ -1195,15 +865,10 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1195865 </term>
1196866 <listitem>
1197867 <para>
1198− By default, the configure phase applies some special hackery to all
1199− files called <filename>ltmain.sh</filename> before running the configure
1200− script in order to improve the purity of Libtool-based packages
868+ By default, the configure phase applies some special hackery to all files called <filename>ltmain.sh</filename> before running the configure script in order to improve the purity of Libtool-based packages
1201869 <footnote xml:id="footnote-stdenv-sys-lib-search-path">
1202870 <para>
1203− It clears the
1204− <varname>sys_lib_<replaceable>*</replaceable>search_path</varname>
1205− variables in the Libtool script to prevent Libtool from using
1206− libraries in <filename>/usr/lib</filename> and such.
871+ It clears the <varname>sys_lib_<replaceable>*</replaceable>search_path</varname> variables in the Libtool script to prevent Libtool from using libraries in <filename>/usr/lib</filename> and such.
1207872 </para>
1208873 </footnote>
1209874 . If this is undesirable, set this variable to true.
@@ -1216,9 +881,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1216881 </term>
1217882 <listitem>
1218883 <para>
1219− By default, when the configure script has
1220− <option>--enable-static</option>, the option
1221− <option>--disable-static</option> is added to the configure flags.
884+ By default, when the configure script has <option>--enable-static</option>, the option <option>--disable-static</option> is added to the configure flags.
1222885 </para>
1223886 <para>
1224887 If this is undesirable, set this variable to true.
@@ -1231,16 +894,10 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1231894 </term>
1232895 <listitem>
1233896 <para>
1234− By default, when cross compiling, the configure script has
1235− <option>--build=...</option> and <option>--host=...</option> passed.
1236− Packages can instead pass <literal>[ "build" "host" "target" ]</literal>
1237− or a subset to control exactly which platform flags are passed.
1238− Compilers and other tools can use this to also pass the target platform.
897+ By default, when cross compiling, the configure script has <option>--build=...</option> and <option>--host=...</option> passed. Packages can instead pass <literal>[ "build" "host" "target" ]</literal> or a subset to control exactly which platform flags are passed. Compilers and other tools can use this to also pass the target platform.
1239898 <footnote xml:id="footnote-stdenv-build-time-guessing-impurity">
1240899 <para>
1241− Eventually these will be passed building natively as well, to improve
1242− determinism: build-time guessing, as is done today, is a risk of
1243− impurity.
900+ Eventually these will be passed building natively as well, to improve determinism: build-time guessing, as is done today, is a risk of impurity.
1244901 </para>
1245902 </footnote>
1246903 </para>
@@ -1273,12 +930,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1273930 <title>The build phase</title>
1274931
1275932 <para>
1276− The build phase is responsible for actually building the package (e.g.
1277− compiling it). The default <function>buildPhase</function> simply calls
1278− <command>make</command> if a file named <filename>Makefile</filename>,
1279− <filename>makefile</filename> or <filename>GNUmakefile</filename> exists in
1280− the current directory (or the <varname>makefile</varname> is explicitly
1281− set); otherwise it does nothing.
933+ The build phase is responsible for actually building the package (e.g. compiling it). The default <function>buildPhase</function> simply calls <command>make</command> if a file named <filename>Makefile</filename>, <filename>makefile</filename> or <filename>GNUmakefile</filename> exists in the current directory (or the <varname>makefile</varname> is explicitly set); otherwise it does nothing.
1282934 </para>
1283935
1284936 <variablelist>
@@ -1309,17 +961,13 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
1309961 </term>
1310962 <listitem>
1311963 <para>
1312− A list of strings passed as additional flags to <command>make</command>.
1313− These flags are also used by the default install and check phase. For
1314− setting make flags specific to the build phase, use
1315− <varname>buildFlags</varname> (see below).
964+ A list of strings passed as additional flags to <command>make</command>. These flags are also used by the default install and check phase. For setting make flags specific to the build phase, use <varname>buildFlags</varname> (see below).
1316965<programlisting>
1317966makeFlags = [ "PREFIX=$(out)" ];
1318967</programlisting>
1319968 <note>
1320969 <para>
1321− The flags are quoted in bash, but environment variables can be
1322− specified by using the make syntax.
970+ The flags are quoted in bash, but environment variables can be specified by using the make syntax.
1323971 </para>
1324972 </note>
1325973 </para>
@@ -1331,18 +979,13 @@ makeFlags = [ "PREFIX=$(out)" ];
1331979 </term>
1332980 <listitem>
1333981 <para>
1334− A shell array containing additional arguments passed to
1335− <command>make</command>. You must use this instead of
1336− <varname>makeFlags</varname> if the arguments contain spaces, e.g.
982+ A shell array containing additional arguments passed to <command>make</command>. You must use this instead of <varname>makeFlags</varname> if the arguments contain spaces, e.g.
1337983<programlisting>
1338984preBuild = ''
1339985 makeFlagsArray+=(CFLAGS="-O0 -g" LDFLAGS="-lfoo -lbar")
1340986'';
1341987</programlisting>
1342− Note that shell arrays cannot be passed through environment variables,
1343− so you cannot set <varname>makeFlagsArray</varname> in a derivation
1344− attribute (because those are passed through environment variables): you
1345− have to define them in shell code.
988+ Note that shell arrays cannot be passed through environment variables, so you cannot set <varname>makeFlagsArray</varname> in a derivation attribute (because those are passed through environment variables): you have to define them in shell code.
1346989 </para>
1347990 </listitem>
1348991 </varlistentry>
@@ -1352,9 +995,7 @@ preBuild = ''
1352995 </term>
1353996 <listitem>
1354997 <para>
1355− A list of strings passed as additional flags to <command>make</command>.
1356− Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>,
1357− but only used by the build phase.
998+ A list of strings passed as additional flags to <command>make</command>. Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>, but only used by the build phase.
1358999 </para>
13591000 </listitem>
13601001 </varlistentry>
@@ -1381,14 +1022,11 @@ preBuild = ''
13811022 </variablelist>
13821023
13831024 <para>
1384− You can set flags for <command>make</command> through the
1385− <varname>makeFlags</varname> variable.
1025+ You can set flags for <command>make</command> through the <varname>makeFlags</varname> variable.
13861026 </para>
13871027
13881028 <para>
1389− Before and after running <command>make</command>, the hooks
1390− <varname>preBuild</varname> and <varname>postBuild</varname> are called,
1391− respectively.
1029+ Before and after running <command>make</command>, the hooks <varname>preBuild</varname> and <varname>postBuild</varname> are called, respectively.
13921030 </para>
13931031 </section>
13941032
@@ -1396,10 +1034,7 @@ preBuild = ''
13961034 <title>The check phase</title>
13971035
13981036 <para>
1399− The check phase checks whether the package was built correctly by running
1400− its test suite. The default <function>checkPhase</function> calls
1401− <command>make check</command>, but only if the <varname>doCheck</varname>
1402− variable is enabled.
1037+ The check phase checks whether the package was built correctly by running its test suite. The default <function>checkPhase</function> calls <command>make check</command>, but only if the <varname>doCheck</varname> variable is enabled.
14031038 </para>
14041039
14051040 <variablelist>
@@ -1410,14 +1045,9 @@ preBuild = ''
14101045 </term>
14111046 <listitem>
14121047 <para>
1413− Controls whether the check phase is executed. By default it is skipped,
1414− but if <varname>doCheck</varname> is set to true, the check phase is
1415− usually executed. Thus you should set
1048+ Controls whether the check phase is executed. By default it is skipped, but if <varname>doCheck</varname> is set to true, the check phase is usually executed. Thus you should set
14161049<programlisting>doCheck = true;</programlisting>
1417− in the derivation to enable checks. The exception is cross compilation.
1418− Cross compiled builds never run tests, no matter how
1419− <varname>doCheck</varname> is set, as the newly-built program won't run
1420− on the platform used to build it.
1050+ in the derivation to enable checks. The exception is cross compilation. Cross compiled builds never run tests, no matter how <varname>doCheck</varname> is set, as the newly-built program won't run on the platform used to build it.
14211051 </para>
14221052 </listitem>
14231053 </varlistentry>
@@ -1437,8 +1067,7 @@ preBuild = ''
14371067 </term>
14381068 <listitem>
14391069 <para>
1440− The make target that runs the tests. Defaults to
1441− <literal>check</literal>.
1070+ The make target that runs the tests. Defaults to <literal>check</literal>.
14421071 </para>
14431072 </listitem>
14441073 </varlistentry>
@@ -1448,9 +1077,7 @@ preBuild = ''
14481077 </term>
14491078 <listitem>
14501079 <para>
1451− A list of strings passed as additional flags to <command>make</command>.
1452− Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>,
1453− but only used by the check phase.
1080+ A list of strings passed as additional flags to <command>make</command>. Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>, but only used by the check phase.
14541081 </para>
14551082 </listitem>
14561083 </varlistentry>
@@ -1460,9 +1087,7 @@ preBuild = ''
14601087 </term>
14611088 <listitem>
14621089 <para>
1463− A list of dependencies used by the phase. This gets included in
1464− <varname>nativeBuildInputs</varname> when <varname>doCheck</varname> is
1465− set.
1090+ A list of dependencies used by the phase. This gets included in <varname>nativeBuildInputs</varname> when <varname>doCheck</varname> is set.
14661091 </para>
14671092 </listitem>
14681093 </varlistentry>
@@ -1493,10 +1118,7 @@ preBuild = ''
14931118 <title>The install phase</title>
14941119
14951120 <para>
1496− The install phase is responsible for installing the package in the Nix
1497− store under <envar>out</envar>. The default
1498− <function>installPhase</function> creates the directory
1499− <literal>$out</literal> and calls <command>make install</command>.
1121+ The install phase is responsible for installing the package in the Nix store under <envar>out</envar>. The default <function>installPhase</function> creates the directory <literal>$out</literal> and calls <command>make install</command>.
15001122 </para>
15011123
15021124 <variablelist>
@@ -1517,8 +1139,7 @@ preBuild = ''
15171139 </term>
15181140 <listitem>
15191141 <para>
1520− The make targets that perform the installation. Defaults to
1521− <literal>install</literal>. Example:
1142+ The make targets that perform the installation. Defaults to <literal>install</literal>. Example:
15221143<programlisting>
15231144installTargets = "install-bin install-doc";</programlisting>
15241145 </para>
@@ -1530,9 +1151,7 @@ installTargets = "install-bin install-doc";</programlisting>
15301151 </term>
15311152 <listitem>
15321153 <para>
1533− A list of strings passed as additional flags to <command>make</command>.
1534− Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>,
1535− but only used by the install phase.
1154+ A list of strings passed as additional flags to <command>make</command>. Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>, but only used by the install phase.
15361155 </para>
15371156 </listitem>
15381157 </varlistentry>
@@ -1563,15 +1182,11 @@ installTargets = "install-bin install-doc";</programlisting>
15631182 <title>The fixup phase</title>
15641183
15651184 <para>
1566− The fixup phase performs some (Nix-specific) post-processing actions on the
1567− files installed under <filename>$out</filename> by the install phase. The
1568− default <function>fixupPhase</function> does the following:
1185+ The fixup phase performs some (Nix-specific) post-processing actions on the files installed under <filename>$out</filename> by the install phase. The default <function>fixupPhase</function> does the following:
15691186 <itemizedlist>
15701187 <listitem>
15711188 <para>
1572− It moves the <filename>man/</filename>, <filename>doc/</filename> and
1573− <filename>info/</filename> subdirectories of <envar>$out</envar> to
1574− <filename>share/</filename>.
1189+ It moves the <filename>man/</filename>, <filename>doc/</filename> and <filename>info/</filename> subdirectories of <envar>$out</envar> to <filename>share/</filename>.
15751190 </para>
15761191 </listitem>
15771192 <listitem>
@@ -1581,19 +1196,12 @@ installTargets = "install-bin install-doc";</programlisting>
15811196 </listitem>
15821197 <listitem>
15831198 <para>
1584− On Linux, it applies the <command>patchelf</command> command to ELF
1585− executables and libraries to remove unused directories from the
1586− <literal>RPATH</literal> in order to prevent unnecessary runtime
1587− dependencies.
1199+ On Linux, it applies the <command>patchelf</command> command to ELF executables and libraries to remove unused directories from the <literal>RPATH</literal> in order to prevent unnecessary runtime dependencies.
15881200 </para>
15891201 </listitem>
15901202 <listitem>
15911203 <para>
1592− It rewrites the interpreter paths of shell scripts to paths found in
1593− <envar>PATH</envar>. E.g., <filename>/usr/bin/perl</filename> will be
1594− rewritten to
1595− <filename>/nix/store/<replaceable>some-perl</replaceable>/bin/perl</filename>
1596− found in <envar>PATH</envar>.
1204+ It rewrites the interpreter paths of shell scripts to paths found in <envar>PATH</envar>. E.g., <filename>/usr/bin/perl</filename> will be rewritten to <filename>/nix/store/<replaceable>some-perl</replaceable>/bin/perl</filename> found in <envar>PATH</envar>.
15971205 </para>
15981206 </listitem>
15991207 </itemizedlist>
@@ -1617,8 +1225,7 @@ installTargets = "install-bin install-doc";</programlisting>
16171225 </term>
16181226 <listitem>
16191227 <para>
1620− If set, libraries and executables are not stripped. By default, they
1621− are.
1228+ If set, libraries and executables are not stripped. By default, they are.
16221229 </para>
16231230 </listitem>
16241231 </varlistentry>
@@ -1628,10 +1235,7 @@ installTargets = "install-bin install-doc";</programlisting>
16281235 </term>
16291236 <listitem>
16301237 <para>
1631− Like <varname>dontStrip</varname>, but only affects the
1632− <command>strip</command> command targetting the package's host platform.
1633− Useful when supporting cross compilation, but otherwise feel free to
1634− ignore.
1238+ Like <varname>dontStrip</varname>, but only affects the <command>strip</command> command targetting the package's host platform. Useful when supporting cross compilation, but otherwise feel free to ignore.
16351239 </para>
16361240 </listitem>
16371241 </varlistentry>
@@ -1641,10 +1245,7 @@ installTargets = "install-bin install-doc";</programlisting>
16411245 </term>
16421246 <listitem>
16431247 <para>
1644− Like <varname>dontStrip</varname>, but only affects the
1645− <command>strip</command> command targetting the packages' target
1646− platform. Useful when supporting cross compilation, but otherwise feel
1647− free to ignore.
1248+ Like <varname>dontStrip</varname>, but only affects the <command>strip</command> command targetting the packages' target platform. Useful when supporting cross compilation, but otherwise feel free to ignore.
16481249 </para>
16491250 </listitem>
16501251 </varlistentry>
@@ -1654,8 +1255,7 @@ installTargets = "install-bin install-doc";</programlisting>
16541255 </term>
16551256 <listitem>
16561257 <para>
1657− If set, files in <filename>$out/sbin</filename> are not moved to
1658− <filename>$out/bin</filename>. By default, they are.
1258+ If set, files in <filename>$out/sbin</filename> are not moved to <filename>$out/bin</filename>. By default, they are.
16591259 </para>
16601260 </listitem>
16611261 </varlistentry>
@@ -1665,10 +1265,7 @@ installTargets = "install-bin install-doc";</programlisting>
16651265 </term>
16661266 <listitem>
16671267 <para>
1668− List of directories to search for libraries and executables from which
1669− <emphasis>all</emphasis> symbols should be stripped. By default, it’s
1670− empty. Stripping all symbols is risky, since it may remove not just
1671− debug symbols but also ELF information necessary for normal execution.
1268+ List of directories to search for libraries and executables from which <emphasis>all</emphasis> symbols should be stripped. By default, it’s empty. Stripping all symbols is risky, since it may remove not just debug symbols but also ELF information necessary for normal execution.
16721269 </para>
16731270 </listitem>
16741271 </varlistentry>
@@ -1678,9 +1275,7 @@ installTargets = "install-bin install-doc";</programlisting>
16781275 </term>
16791276 <listitem>
16801277 <para>
1681− Flags passed to the <command>strip</command> command applied to the
1682− files in the directories listed in <varname>stripAllList</varname>.
1683− Defaults to <option>-s</option> (i.e. <option>--strip-all</option>).
1278+ Flags passed to the <command>strip</command> command applied to the files in the directories listed in <varname>stripAllList</varname>. Defaults to <option>-s</option> (i.e. <option>--strip-all</option>).
16841279 </para>
16851280 </listitem>
16861281 </varlistentry>
@@ -1690,9 +1285,7 @@ installTargets = "install-bin install-doc";</programlisting>
16901285 </term>
16911286 <listitem>
16921287 <para>
1693− List of directories to search for libraries and executables from which
1694− only debugging-related symbols should be stripped. It defaults to
1695− <literal>lib bin sbin</literal>.
1288+ List of directories to search for libraries and executables from which only debugging-related symbols should be stripped. It defaults to <literal>lib bin sbin</literal>.
16961289 </para>
16971290 </listitem>
16981291 </varlistentry>
@@ -1702,9 +1295,7 @@ installTargets = "install-bin install-doc";</programlisting>
17021295 </term>
17031296 <listitem>
17041297 <para>
1705− Flags passed to the <command>strip</command> command applied to the
1706− files in the directories listed in <varname>stripDebugList</varname>.
1707− Defaults to <option>-S</option> (i.e. <option>--strip-debug</option>).
1298+ Flags passed to the <command>strip</command> command applied to the files in the directories listed in <varname>stripDebugList</varname>. Defaults to <option>-S</option> (i.e. <option>--strip-debug</option>).
17081299 </para>
17091300 </listitem>
17101301 </varlistentry>
@@ -1714,8 +1305,7 @@ installTargets = "install-bin install-doc";</programlisting>
17141305 </term>
17151306 <listitem>
17161307 <para>
1717− If set, the <command>patchelf</command> command is not used to remove
1718− unnecessary <literal>RPATH</literal> entries. Only applies to Linux.
1308+ If set, the <command>patchelf</command> command is not used to remove unnecessary <literal>RPATH</literal> entries. Only applies to Linux.
17191309 </para>
17201310 </listitem>
17211311 </varlistentry>
@@ -1725,8 +1315,7 @@ installTargets = "install-bin install-doc";</programlisting>
17251315 </term>
17261316 <listitem>
17271317 <para>
1728− If set, scripts starting with <literal>#!</literal> do not have their
1729− interpreter paths rewritten to paths in the Nix store.
1318+ If set, scripts starting with <literal>#!</literal> do not have their interpreter paths rewritten to paths in the Nix store.
17301319 </para>
17311320 </listitem>
17321321 </varlistentry>
@@ -1736,9 +1325,7 @@ installTargets = "install-bin install-doc";</programlisting>
17361325 </term>
17371326 <listitem>
17381327 <para>
1739− If set, libtool <literal>.la</literal> files associated with shared
1740− libraries won't have their <literal>dependency_libs</literal> field
1741− cleared.
1328+ If set, libtool <literal>.la</literal> files associated with shared libraries won't have their <literal>dependency_libs</literal> field cleared.
17421329 </para>
17431330 </listitem>
17441331 </varlistentry>
@@ -1748,9 +1335,7 @@ installTargets = "install-bin install-doc";</programlisting>
17481335 </term>
17491336 <listitem>
17501337 <para>
1751− The list of directories that must be moved from
1752− <filename>$out</filename> to <filename>$out/share</filename>. Defaults
1753− to <literal>man doc info</literal>.
1338+ The list of directories that must be moved from <filename>$out</filename> to <filename>$out/share</filename>. Defaults to <literal>man doc info</literal>.
17541339 </para>
17551340 </listitem>
17561341 </varlistentry>
@@ -1760,11 +1345,7 @@ installTargets = "install-bin install-doc";</programlisting>
17601345 </term>
17611346 <listitem>
17621347 <para>
1763− A package can export a <link linkend="ssec-setup-hooks">setup
1764− hook</link> by setting this variable. The setup hook, if defined, is
1765− copied to <filename>$out/nix-support/setup-hook</filename>. Environment
1766− variables are then substituted in it using
1767− <function
1348+ A package can export a <link linkend="ssec-setup-hooks">setup hook</link> by setting this variable. The setup hook, if defined, is copied to <filename>$out/nix-support/setup-hook</filename>. Environment variables are then substituted in it using <function
17681349 linkend="fun-substituteAll">substituteAll</function>.
17691350 </para>
17701351 </listitem>
@@ -1795,25 +1376,14 @@ installTargets = "install-bin install-doc";</programlisting>
17951376 </term>
17961377 <listitem>
17971378 <para>
1798− If set to <literal>true</literal>, the standard environment will enable
1799− debug information in C/C++ builds. After installation, the debug
1800− information will be separated from the executables and stored in the
1801− output named <literal>debug</literal>. (This output is enabled
1802− automatically; you don’t need to set the <varname>outputs</varname>
1803− attribute explicitly.) To be precise, the debug information is stored in
1804− <filename><replaceable>debug</replaceable>/lib/debug/.build-id/<replaceable>XX</replaceable>/<replaceable>YYYY…</replaceable></filename>,
1805− where <replaceable>XXYYYY…</replaceable> is the <replaceable>build
1806− ID</replaceable> of the binary — a SHA-1 hash of the contents of the
1807− binary. Debuggers like GDB use the build ID to look up the separated
1808− debug information.
1379+ If set to <literal>true</literal>, the standard environment will enable debug information in C/C++ builds. After installation, the debug information will be separated from the executables and stored in the output named <literal>debug</literal>. (This output is enabled automatically; you don’t need to set the <varname>outputs</varname> attribute explicitly.) To be precise, the debug information is stored in <filename><replaceable>debug</replaceable>/lib/debug/.build-id/<replaceable>XX</replaceable>/<replaceable>YYYY…</replaceable></filename>, where <replaceable>XXYYYY…</replaceable> is the <replaceable>build ID</replaceable> of the binary — a SHA-1 hash of the contents of the binary. Debuggers like GDB use the build ID to look up the separated debug information.
18091380 </para>
18101381 <para>
18111382 For example, with GDB, you can add
18121383<programlisting>
18131384set debug-file-directory ~/.nix-profile/lib/debug
18141385</programlisting>
1815− to <filename>~/.gdbinit</filename>. GDB will then be able to find debug
1816− information installed via <literal>nix-env -i</literal>.
1386+ to <filename>~/.gdbinit</filename>. GDB will then be able to find debug information installed via <literal>nix-env -i</literal>.
18171387 </para>
18181388 </listitem>
18191389 </varlistentry>
@@ -1824,10 +1394,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
18241394 <title>The installCheck phase</title>
18251395
18261396 <para>
1827− The installCheck phase checks whether the package was installed correctly
1828− by running its test suite against the installed directories. The default
1829− <function>installCheck</function> calls <command>make
1830− installcheck</command>.
1397+ The installCheck phase checks whether the package was installed correctly by running its test suite against the installed directories. The default <function>installCheck</function> calls <command>make installcheck</command>.
18311398 </para>
18321399
18331400 <variablelist>
@@ -1838,14 +1405,9 @@ set debug-file-directory ~/.nix-profile/lib/debug
18381405 </term>
18391406 <listitem>
18401407 <para>
1841− Controls whether the installCheck phase is executed. By default it is
1842− skipped, but if <varname>doInstallCheck</varname> is set to true, the
1843− installCheck phase is usually executed. Thus you should set
1408+ Controls whether the installCheck phase is executed. By default it is skipped, but if <varname>doInstallCheck</varname> is set to true, the installCheck phase is usually executed. Thus you should set
18441409<programlisting>doInstallCheck = true;</programlisting>
1845− in the derivation to enable install checks. The exception is cross
1846− compilation. Cross compiled builds never run tests, no matter how
1847− <varname>doInstallCheck</varname> is set, as the newly-built program
1848− won't run on the platform used to build it.
1410+ in the derivation to enable install checks. The exception is cross compilation. Cross compiled builds never run tests, no matter how <varname>doInstallCheck</varname> is set, as the newly-built program won't run on the platform used to build it.
18491411 </para>
18501412 </listitem>
18511413 </varlistentry>
@@ -1855,8 +1417,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
18551417 </term>
18561418 <listitem>
18571419 <para>
1858− The make target that runs the install tests. Defaults to
1859− <literal>installcheck</literal>.
1420+ The make target that runs the install tests. Defaults to <literal>installcheck</literal>.
18601421 </para>
18611422 </listitem>
18621423 </varlistentry>
@@ -1866,9 +1427,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
18661427 </term>
18671428 <listitem>
18681429 <para>
1869− A list of strings passed as additional flags to <command>make</command>.
1870− Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>,
1871− but only used by the installCheck phase.
1430+ A list of strings passed as additional flags to <command>make</command>. Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>, but only used by the installCheck phase.
18721431 </para>
18731432 </listitem>
18741433 </varlistentry>
@@ -1878,9 +1437,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
18781437 </term>
18791438 <listitem>
18801439 <para>
1881− A list of dependencies used by the phase. This gets included in
1882− <varname>nativeBuildInputs</varname> when
1883− <varname>doInstallCheck</varname> is set.
1440+ A list of dependencies used by the phase. This gets included in <varname>nativeBuildInputs</varname> when <varname>doInstallCheck</varname> is set.
18841441 </para>
18851442 </listitem>
18861443 </varlistentry>
@@ -1911,11 +1468,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
19111468 <title>The distribution phase</title>
19121469
19131470 <para>
1914− The distribution phase is intended to produce a source distribution of the
1915− package. The default <function>distPhase</function> first calls
1916− <command>make dist</command>, then it copies the resulting source tarballs
1917− to <filename>$out/tarballs/</filename>. This phase is only executed if the
1918− attribute <varname>doDist</varname> is set.
1471+ The distribution phase is intended to produce a source distribution of the package. The default <function>distPhase</function> first calls <command>make dist</command>, then it copies the resulting source tarballs to <filename>$out/tarballs/</filename>. This phase is only executed if the attribute <varname>doDist</varname> is set.
19191472 </para>
19201473
19211474 <variablelist>
@@ -1926,8 +1479,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
19261479 </term>
19271480 <listitem>
19281481 <para>
1929− The make target that produces the distribution. Defaults to
1930− <literal>dist</literal>.
1482+ The make target that produces the distribution. Defaults to <literal>dist</literal>.
19311483 </para>
19321484 </listitem>
19331485 </varlistentry>
@@ -1947,9 +1499,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
19471499 </term>
19481500 <listitem>
19491501 <para>
1950− The names of the source distribution files to be copied to
1951− <filename>$out/tarballs/</filename>. It can contain shell wildcards. The
1952− default is <filename>*.tar.gz</filename>.
1502+ The names of the source distribution files to be copied to <filename>$out/tarballs/</filename>. It can contain shell wildcards. The default is <filename>*.tar.gz</filename>.
19531503 </para>
19541504 </listitem>
19551505 </varlistentry>
@@ -2000,8 +1550,7 @@ set debug-file-directory ~/.nix-profile/lib/debug
20001550 </term>
20011551 <listitem>
20021552 <para>
2003− Constructs a wrapper for a program with various possible arguments. For
2004− example:
1553+ Constructs a wrapper for a program with various possible arguments. For example:
20051554<programlisting>
20061555# adds `FOOBAR=baz` to `$out/bin/foo`’s environment
20071556makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
@@ -2011,12 +1560,10 @@ makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
20111560# (via string replacements or in `configurePhase`).
20121561makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]}
20131562</programlisting>
2014− There’s many more kinds of arguments, they are documented in
2015− <literal>nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh</literal>.
1563+ There’s many more kinds of arguments, they are documented in <literal>nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh</literal>.
20161564 </para>
20171565 <para>
2018− <literal>wrapProgram</literal> is a convenience function you probably
2019− want to use most of the time.
1566+ <literal>wrapProgram</literal> is a convenience function you probably want to use most of the time.
20201567 </para>
20211568 </listitem>
20221569 </varlistentry>
@@ -2026,10 +1573,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello
20261573 </term>
20271574 <listitem>
20281575 <para>
2029− Performs string substitution on the contents of
2030− <replaceable>infile</replaceable>, writing the result to
2031− <replaceable>outfile</replaceable>. The substitutions in
2032− <replaceable>subs</replaceable> are of the following form:
1576+ Performs string substitution on the contents of <replaceable>infile</replaceable>, writing the result to <replaceable>outfile</replaceable>. The substitutions in <replaceable>subs</replaceable> are of the following form:
20331577 <variablelist>
20341578 <varlistentry>
20351579 <term>
@@ -2037,8 +1581,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello
20371581 </term>
20381582 <listitem>
20391583 <para>
2040− Replace every occurrence of the string <replaceable>s1</replaceable>
2041− by <replaceable>s2</replaceable>.
1584+ Replace every occurrence of the string <replaceable>s1</replaceable> by <replaceable>s2</replaceable>.
20421585 </para>
20431586 </listitem>
20441587 </varlistentry>
@@ -2048,13 +1591,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello
20481591 </term>
20491592 <listitem>
20501593 <para>
2051− Replace every occurrence of
2052− <literal>@<replaceable>varName</replaceable>@</literal> by the
2053− contents of the environment variable
2054− <replaceable>varName</replaceable>. This is useful for generating
2055− files from templates, using
2056− <literal>@<replaceable>...</replaceable>@</literal> in the template
2057− as placeholders.
1594+ Replace every occurrence of <literal>@<replaceable>varName</replaceable>@</literal> by the contents of the environment variable <replaceable>varName</replaceable>. This is useful for generating files from templates, using <literal>@<replaceable>...</replaceable>@</literal> in the template as placeholders.
20581595 </para>
20591596 </listitem>
20601597 </varlistentry>
@@ -2064,9 +1601,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello
20641601 </term>
20651602 <listitem>
20661603 <para>
2067− Replace every occurrence of
2068− <literal>@<replaceable>varName</replaceable>@</literal> by the string
2069− <replaceable>s</replaceable>.
1604+ Replace every occurrence of <literal>@<replaceable>varName</replaceable>@</literal> by the string <replaceable>s</replaceable>.
20701605 </para>
20711606 </listitem>
20721607 </varlistentry>
@@ -2082,14 +1617,8 @@ substitute ./foo.in ./foo.out \
20821617</programlisting>
20831618 </para>
20841619 <para>
2085− <function>substitute</function> is implemented using the
2086− <command
2087− xlink:href="http://replace.richardlloyd.org.uk/">replace</command>
2088− command. Unlike with the <command>sed</command> command, you don’t have
2089− to worry about escaping special characters. It supports performing
2090− substitutions on binary files (such as executables), though there
2091− you’ll probably want to make sure that the replacement string is as
2092− long as the replaced string.
1620+ <function>substitute</function> is implemented using the <command
1621+ xlink:href="http://replace.richardlloyd.org.uk/">replace</command> command. Unlike with the <command>sed</command> command, you don’t have to worry about escaping special characters. It supports performing substitutions on binary files (such as executables), though there you’ll probably want to make sure that the replacement string is as long as the replaced string.
20931622 </para>
20941623 </listitem>
20951624 </varlistentry>
@@ -2099,8 +1628,7 @@ substitute ./foo.in ./foo.out \
20991628 </term>
21001629 <listitem>
21011630 <para>
2102− Like <function>substitute</function>, but performs the substitutions in
2103− place on the file <replaceable>file</replaceable>.
1631+ Like <function>substitute</function>, but performs the substitutions in place on the file <replaceable>file</replaceable>.
21041632 </para>
21051633 </listitem>
21061634 </varlistentry>
@@ -2110,22 +1638,13 @@ substitute ./foo.in ./foo.out \
21101638 </term>
21111639 <listitem>
21121640 <para>
2113− Replaces every occurrence of
2114− <literal>@<replaceable>varName</replaceable>@</literal>, where
2115− <replaceable>varName</replaceable> is any environment variable, in
2116− <replaceable>infile</replaceable>, writing the result to
2117− <replaceable>outfile</replaceable>. For instance, if
2118− <replaceable>infile</replaceable> has the contents
1641+ Replaces every occurrence of <literal>@<replaceable>varName</replaceable>@</literal>, where <replaceable>varName</replaceable> is any environment variable, in <replaceable>infile</replaceable>, writing the result to <replaceable>outfile</replaceable>. For instance, if <replaceable>infile</replaceable> has the contents
21191642<programlisting>
21201643#! @bash@/bin/sh
21211644PATH=@coreutils@/bin
21221645echo @foo@
21231646</programlisting>
2124− and the environment contains
2125− <literal>bash=/nix/store/bmwp0q28cf21...-bash-3.2-p39</literal> and
2126− <literal>coreutils=/nix/store/68afga4khv0w...-coreutils-6.12</literal>,
2127− but does not contain the variable <varname>foo</varname>, then the output
2128− will be
1647+ and the environment contains <literal>bash=/nix/store/bmwp0q28cf21...-bash-3.2-p39</literal> and <literal>coreutils=/nix/store/68afga4khv0w...-coreutils-6.12</literal>, but does not contain the variable <varname>foo</varname>, then the output will be
21291648<programlisting>
21301649#! /nix/store/bmwp0q28cf21...-bash-3.2-p39/bin/sh
21311650PATH=/nix/store/68afga4khv0w...-coreutils-6.12/bin
@@ -2134,13 +1653,7 @@ echo @foo@
21341653 That is, no substitution is performed for undefined variables.
21351654 </para>
21361655 <para>
2137− Environment variables that start with an uppercase letter or an
2138− underscore are filtered out, to prevent global variables (like
2139− <literal>HOME</literal>) or private variables (like
2140− <literal>__ETC_PROFILE_DONE</literal>) from accidentally getting
2141− substituted. The variables also have to be valid bash “names”, as
2142− defined in the bash manpage (alphanumeric or <literal>_</literal>, must
2143− not start with a number).
1656+ Environment variables that start with an uppercase letter or an underscore are filtered out, to prevent global variables (like <literal>HOME</literal>) or private variables (like <literal>__ETC_PROFILE_DONE</literal>) from accidentally getting substituted. The variables also have to be valid bash “names”, as defined in the bash manpage (alphanumeric or <literal>_</literal>, must not start with a number).
21441657 </para>
21451658 </listitem>
21461659 </varlistentry>
@@ -2150,8 +1663,7 @@ echo @foo@
21501663 </term>
21511664 <listitem>
21521665 <para>
2153− Like <function>substituteAll</function>, but performs the substitutions
2154− in place on the file <replaceable>file</replaceable>.
1666+ Like <function>substituteAll</function>, but performs the substitutions in place on the file <replaceable>file</replaceable>.
21551667 </para>
21561668 </listitem>
21571669 </varlistentry>
@@ -2161,14 +1673,12 @@ echo @foo@
21611673 </term>
21621674 <listitem>
21631675 <para>
2164− Strips the directory and hash part of a store path, outputting the name
2165− part to <literal>stdout</literal>. For example:
1676+ Strips the directory and hash part of a store path, outputting the name part to <literal>stdout</literal>. For example:
21661677<programlisting>
21671678# prints coreutils-8.24
21681679stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
21691680</programlisting>
2170− If you wish to store the result in another variable, then the following
2171− idiom may be useful:
1681+ If you wish to store the result in another variable, then the following idiom may be useful:
21721682<programlisting>
21731683name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
21741684someVar=$(stripHash $name)
@@ -2182,13 +1692,10 @@ someVar=$(stripHash $name)
21821692 </term>
21831693 <listitem>
21841694 <para>
2185− Convenience function for <literal>makeWrapper</literal> that
2186− automatically creates a sane wrapper file It takes all the same arguments
2187− as <literal>makeWrapper</literal>, except for <literal>--argv0</literal>.
1695+ Convenience function for <literal>makeWrapper</literal> that automatically creates a sane wrapper file It takes all the same arguments as <literal>makeWrapper</literal>, except for <literal>--argv0</literal>.
21881696 </para>
21891697 <para>
2190− It cannot be applied multiple times, since it will overwrite the wrapper
2191− file.
1698+ It cannot be applied multiple times, since it will overwrite the wrapper file.
21921699 </para>
21931700 </listitem>
21941701 </varlistentry>
@@ -2198,85 +1705,34 @@ someVar=$(stripHash $name)
21981705 <title>Package setup hooks</title>
21991706
22001707 <para>
2201− Nix itself considers a build-time dependency as merely something that should
2202− previously be built and accessible at build time—packages themselves are
2203− on their own to perform any additional setup. In most cases, that is fine,
2204− and the downstream derivation can deal with its own dependencies. But for a
2205− few common tasks, that would result in almost every package doing the same
2206− sort of setup work—depending not on the package itself, but entirely on
2207− which dependencies were used.
1708+ Nix itself considers a build-time dependency as merely something that should previously be built and accessible at build time—packages themselves are on their own to perform any additional setup. In most cases, that is fine, and the downstream derivation can deal with its own dependencies. But for a few common tasks, that would result in almost every package doing the same sort of setup work—depending not on the package itself, but entirely on which dependencies were used.
22081709 </para>
22091710
22101711 <para>
2211− In order to alleviate this burden, the <firstterm>setup hook</firstterm>
2212− mechanism was written, where any package can include a shell script that [by
2213− convention rather than enforcement by Nix], any downstream
2214− reverse-dependency will source as part of its build process. That allows the
2215− downstream dependency to merely specify its dependencies, and lets those
2216− dependencies effectively initialize themselves. No boilerplate mirroring the
2217− list of dependencies is needed.
1712+ In order to alleviate this burden, the <firstterm>setup hook</firstterm> mechanism was written, where any package can include a shell script that [by convention rather than enforcement by Nix], any downstream reverse-dependency will source as part of its build process. That allows the downstream dependency to merely specify its dependencies, and lets those dependencies effectively initialize themselves. No boilerplate mirroring the list of dependencies is needed.
22181713 </para>
22191714
22201715 <para>
2221− The setup hook mechanism is a bit of a sledgehammer though: a powerful
2222− feature with a broad and indiscriminate area of effect. The combination of
2223− its power and implicit use may be expedient, but isn't without costs. Nix
2224− itself is unchanged, but the spirit of added dependencies being effect-free
2225− is violated even if the letter isn't. For example, if a derivation path is
2226− mentioned more than once, Nix itself doesn't care and simply makes sure the
2227− dependency derivation is already built just the same—depending is just
2228− needing something to exist, and needing is idempotent. However, a dependency
2229− specified twice will have its setup hook run twice, and that could easily
2230− change the build environment (though a well-written setup hook will
2231− therefore strive to be idempotent so this is in fact not observable). More
2232− broadly, setup hooks are anti-modular in that multiple dependencies, whether
2233− the same or different, should not interfere and yet their setup hooks may
2234− well do so.
1716+ The setup hook mechanism is a bit of a sledgehammer though: a powerful feature with a broad and indiscriminate area of effect. The combination of its power and implicit use may be expedient, but isn't without costs. Nix itself is unchanged, but the spirit of added dependencies being effect-free is violated even if the letter isn't. For example, if a derivation path is mentioned more than once, Nix itself doesn't care and simply makes sure the dependency derivation is already built just the same—depending is just needing something to exist, and needing is idempotent. However, a dependency specified twice will have its setup hook run twice, and that could easily change the build environment (though a well-written setup hook will therefore strive to be idempotent so this is in fact not observable). More broadly, setup hooks are anti-modular in that multiple dependencies, whether the same or different, should not interfere and yet their setup hooks may well do so.
22351717 </para>
22361718
22371719 <para>
2238− The most typical use of the setup hook is actually to add other hooks which
2239− are then run (i.e. after all the setup hooks) on each dependency. For
2240− example, the C compiler wrapper's setup hook feeds itself flags for each
2241− dependency that contains relevant libraries and headers. This is done by
2242− defining a bash function, and appending its name to one of
2243− <envar>envBuildBuildHooks</envar>`, <envar>envBuildHostHooks</envar>`,
2244− <envar>envBuildTargetHooks</envar>`, <envar>envHostHostHooks</envar>`,
2245− <envar>envHostTargetHooks</envar>`, or <envar>envTargetTargetHooks</envar>`.
2246− These 6 bash variables correspond to the 6 sorts of dependencies by platform
2247− (there's 12 total but we ignore the propagated/non-propagated axis).
1720+ The most typical use of the setup hook is actually to add other hooks which are then run (i.e. after all the setup hooks) on each dependency. For example, the C compiler wrapper's setup hook feeds itself flags for each dependency that contains relevant libraries and headers. This is done by defining a bash function, and appending its name to one of <envar>envBuildBuildHooks</envar>`, <envar>envBuildHostHooks</envar>`, <envar>envBuildTargetHooks</envar>`, <envar>envHostHostHooks</envar>`, <envar>envHostTargetHooks</envar>`, or <envar>envTargetTargetHooks</envar>`. These 6 bash variables correspond to the 6 sorts of dependencies by platform (there's 12 total but we ignore the propagated/non-propagated axis).
22481721 </para>
22491722
22501723 <para>
2251− Packages adding a hook should not hard code a specific hook, but rather
2252− choose a variable <emphasis>relative</emphasis> to how they are included.
2253− Returning to the C compiler wrapper example, if the wrapper itself is an
2254− <literal>n</literal> dependency, then it only wants to accumulate flags from
2255− <literal>n + 1</literal> dependencies, as only those ones match the
2256− compiler's target platform. The <envar>hostOffset</envar> variable is
2257− defined with the current dependency's host offset
2258− <envar>targetOffset</envar> with its target offset, before its setup hook is
2259− sourced. Additionally, since most environment hooks don't care about the
2260− target platform, that means the setup hook can append to the right bash
2261− array by doing something like
1724+ Packages adding a hook should not hard code a specific hook, but rather choose a variable <emphasis>relative</emphasis> to how they are included. Returning to the C compiler wrapper example, if the wrapper itself is an <literal>n</literal> dependency, then it only wants to accumulate flags from <literal>n + 1</literal> dependencies, as only those ones match the compiler's target platform. The <envar>hostOffset</envar> variable is defined with the current dependency's host offset <envar>targetOffset</envar> with its target offset, before its setup hook is sourced. Additionally, since most environment hooks don't care about the target platform, that means the setup hook can append to the right bash array by doing something like
22621725<programlisting language="bash">
22631726addEnvHooks "$hostOffset" myBashFunction
22641727</programlisting>
22651728 </para>
22661729
22671730 <para>
2268− The <emphasis>existence</emphasis> of setups hooks has long been documented
2269− and packages inside Nixpkgs are free to use this mechanism. Other packages,
2270− however, should not rely on these mechanisms not changing between Nixpkgs
2271− versions. Because of the existing issues with this system, there's little
2272− benefit from mandating it be stable for any period of time.
1731+ The <emphasis>existence</emphasis> of setups hooks has long been documented and packages inside Nixpkgs are free to use this mechanism. Other packages, however, should not rely on these mechanisms not changing between Nixpkgs versions. Because of the existing issues with this system, there's little benefit from mandating it be stable for any period of time.
22731732 </para>
22741733
22751734 <para>
2276− First, let’s cover some setup hooks that are part of Nixpkgs default
2277− stdenv. This means that they are run for every package built using
2278− <function>stdenv.mkDerivation</function>. Some of these are platform
2279− specific, so they may run on Linux but not Darwin or vice-versa.
1735+ First, let’s cover some setup hooks that are part of Nixpkgs default stdenv. This means that they are run for every package built using <function>stdenv.mkDerivation</function>. Some of these are platform specific, so they may run on Linux but not Darwin or vice-versa.
22801736 <variablelist>
22811737 <varlistentry>
22821738 <term>
@@ -2284,10 +1740,7 @@ addEnvHooks "$hostOffset" myBashFunction
22841740 </term>
22851741 <listitem>
22861742 <para>
2287− This setup hook moves any installed documentation to the
2288− <literal>/share</literal> subdirectory directory. This includes the man,
2289− doc and info directories. This is needed for legacy programs that do not
2290− know how to use the <literal>share</literal> subdirectory.
1743+ This setup hook moves any installed documentation to the <literal>/share</literal> subdirectory directory. This includes the man, doc and info directories. This is needed for legacy programs that do not know how to use the <literal>share</literal> subdirectory.
22911744 </para>
22921745 </listitem>
22931746 </varlistentry>
@@ -2297,9 +1750,7 @@ addEnvHooks "$hostOffset" myBashFunction
22971750 </term>
22981751 <listitem>
22991752 <para>
2300− This setup hook compresses any man pages that have been installed. The
2301− compression is done using the gzip program. This helps to reduce the
2302− installed size of packages.
1753+ This setup hook compresses any man pages that have been installed. The compression is done using the gzip program. This helps to reduce the installed size of packages.
23031754 </para>
23041755 </listitem>
23051756 </varlistentry>
@@ -2309,9 +1760,7 @@ addEnvHooks "$hostOffset" myBashFunction
23091760 </term>
23101761 <listitem>
23111762 <para>
2312− This runs the strip command on installed binaries and libraries. This
2313− removes unnecessary information like debug symbols when they are not
2314− needed. This also helps to reduce the installed size of packages.
1763+ This runs the strip command on installed binaries and libraries. This removes unnecessary information like debug symbols when they are not needed. This also helps to reduce the installed size of packages.
23151764 </para>
23161765 </listitem>
23171766 </varlistentry>
@@ -2321,12 +1770,7 @@ addEnvHooks "$hostOffset" myBashFunction
23211770 </term>
23221771 <listitem>
23231772 <para>
2324− This setup hook patches installed scripts to use the full path to the
2325− shebang interpreter. A shebang interpreter is the first commented line
2326− of a script telling the operating system which program will run the
2327− script (e.g <literal>#!/bin/bash</literal>). In Nix, we want an exact
2328− path to that interpreter to be used. This often replaces
2329− <literal>/bin/sh</literal> with a path in the Nix store.
1773+ This setup hook patches installed scripts to use the full path to the shebang interpreter. A shebang interpreter is the first commented line of a script telling the operating system which program will run the script (e.g <literal>#!/bin/bash</literal>). In Nix, we want an exact path to that interpreter to be used. This often replaces <literal>/bin/sh</literal> with a path in the Nix store.
23301774 </para>
23311775 </listitem>
23321776 </varlistentry>
@@ -2336,10 +1780,7 @@ addEnvHooks "$hostOffset" myBashFunction
23361780 </term>
23371781 <listitem>
23381782 <para>
2339− This verifies that no references are left from the install binaries to
2340− the directory used to build those binaries. This ensures that the
2341− binaries do not need things outside the Nix store. This is currently
2342− supported in Linux only.
1783+ This verifies that no references are left from the install binaries to the directory used to build those binaries. This ensures that the binaries do not need things outside the Nix store. This is currently supported in Linux only.
23431784 </para>
23441785 </listitem>
23451786 </varlistentry>
@@ -2349,12 +1790,7 @@ addEnvHooks "$hostOffset" myBashFunction
23491790 </term>
23501791 <listitem>
23511792 <para>
2352− This setup hook adds configure flags that tell packages to install files
2353− into any one of the proper outputs listed in <literal>outputs</literal>.
2354− This behavior can be turned off by setting
2355− <literal>setOutputFlags</literal> to false in the derivation
2356− environment. See <xref linkend="chap-multiple-output"/> for more
2357− information.
1793+ This setup hook adds configure flags that tell packages to install files into any one of the proper outputs listed in <literal>outputs</literal>. This behavior can be turned off by setting <literal>setOutputFlags</literal> to false in the derivation environment. See <xref linkend="chap-multiple-output"/> for more information.
23581794 </para>
23591795 </listitem>
23601796 </varlistentry>
@@ -2364,9 +1800,7 @@ addEnvHooks "$hostOffset" myBashFunction
23641800 </term>
23651801 <listitem>
23661802 <para>
2367− This setup hook moves any binaries installed in the sbin subdirectory
2368− into bin. In addition, a link is provided from sbin to bin for
2369− compatibility.
1803+ This setup hook moves any binaries installed in the sbin subdirectory into bin. In addition, a link is provided from sbin to bin for compatibility.
23701804 </para>
23711805 </listitem>
23721806 </varlistentry>
@@ -2376,9 +1810,7 @@ addEnvHooks "$hostOffset" myBashFunction
23761810 </term>
23771811 <listitem>
23781812 <para>
2379− This setup hook moves any libraries installed in the lib64 subdirectory
2380− into lib. In addition, a link is provided from lib64 to lib for
2381− compatibility.
1813+ This setup hook moves any libraries installed in the lib64 subdirectory into lib. In addition, a link is provided from lib64 to lib for compatibility.
23821814 </para>
23831815 </listitem>
23841816 </varlistentry>
@@ -2388,8 +1820,7 @@ addEnvHooks "$hostOffset" myBashFunction
23881820 </term>
23891821 <listitem>
23901822 <para>
2391− This sets <literal>SOURCE_DATE_EPOCH</literal> to the modification time
2392− of the most recent file.
1823+ This sets <literal>SOURCE_DATE_EPOCH</literal> to the modification time of the most recent file.
23931824 </para>
23941825 </listitem>
23951826 </varlistentry>
@@ -2399,70 +1830,22 @@ addEnvHooks "$hostOffset" myBashFunction
23991830 </term>
24001831 <listitem>
24011832 <para>
2402− The Bintools Wrapper wraps the binary utilities for a bunch of
2403− miscellaneous purposes. These are GNU Binutils when targetting Linux,
2404− and a mix of cctools and GNU binutils for Darwin. [The "Bintools" name
2405− is supposed to be a compromise between "Binutils" and "cctools" not
2406− denoting any specific implementation.] Specifically, the underlying
2407− bintools package, and a C standard library (glibc or Darwin's libSystem,
2408− just for the dynamic loader) are all fed in, and dependency finding,
2409− hardening (see below), and purity checks for each are handled by the
2410− Bintools Wrapper. Packages typically depend on CC Wrapper, which in turn
2411− (at run time) depends on the Bintools Wrapper.
2412− </para>
2413− <para>
2414− The Bintools Wrapper was only just recently split off from CC Wrapper,
2415− so the division of labor is still being worked out. For example, it
2416− shouldn't care about the C standard library, but just take a derivation
2417− with the dynamic loader (which happens to be the glibc on linux).
2418− Dependency finding however is a task both wrappers will continue to need
2419− to share, and probably the most important to understand. It is currently
2420− accomplished by collecting directories of host-platform dependencies
2421− (i.e. <varname>buildInputs</varname> and
2422− <varname>nativeBuildInputs</varname>) in environment variables. The
2423− Bintools Wrapper's setup hook causes any <filename>lib</filename> and
2424− <filename>lib64</filename> subdirectories to be added to
2425− <envar>NIX_LDFLAGS</envar>. Since the CC Wrapper and the Bintools
2426− Wrapper use the same strategy, most of the Bintools Wrapper code is
2427− sparsely commented and refers to the CC Wrapper. But the CC Wrapper's
2428− code, by contrast, has quite lengthy comments. The Bintools Wrapper
2429− merely cites those, rather than repeating them, to avoid falling out of
2430− sync.
2431− </para>
2432− <para>
2433− A final task of the setup hook is defining a number of standard
2434− environment variables to tell build systems which executables fulfill
2435− which purpose. They are defined to just be the base name of the tools,
2436− under the assumption that the Bintools Wrapper's binaries will be on the
2437− path. Firstly, this helps poorly-written packages, e.g. ones that look
2438− for just <command>gcc</command> when <envar>CC</envar> isn't defined yet
2439− <command>clang</command> is to be used. Secondly, this helps packages
2440− not get confused when cross-compiling, in which case multiple Bintools
2441− Wrappers may simultaneously be in use.
1833+ The Bintools Wrapper wraps the binary utilities for a bunch of miscellaneous purposes. These are GNU Binutils when targetting Linux, and a mix of cctools and GNU binutils for Darwin. [The "Bintools" name is supposed to be a compromise between "Binutils" and "cctools" not denoting any specific implementation.] Specifically, the underlying bintools package, and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by the Bintools Wrapper. Packages typically depend on CC Wrapper, which in turn (at run time) depends on the Bintools Wrapper.
1834+ </para>
1835+ <para>
1836+ The Bintools Wrapper was only just recently split off from CC Wrapper, so the division of labor is still being worked out. For example, it shouldn't care about the C standard library, but just take a derivation with the dynamic loader (which happens to be the glibc on linux). Dependency finding however is a task both wrappers will continue to need to share, and probably the most important to understand. It is currently accomplished by collecting directories of host-platform dependencies (i.e. <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname>) in environment variables. The Bintools Wrapper's setup hook causes any <filename>lib</filename> and <filename>lib64</filename> subdirectories to be added to <envar>NIX_LDFLAGS</envar>. Since the CC Wrapper and the Bintools Wrapper use the same strategy, most of the Bintools Wrapper code is sparsely commented and refers to the CC Wrapper. But the CC Wrapper's code, by contrast, has quite lengthy comments. The Bintools Wrapper merely cites those, rather than repeating them, to avoid falling out of sync.
1837+ </para>
1838+ <para>
1839+ A final task of the setup hook is defining a number of standard environment variables to tell build systems which executables fulfill which purpose. They are defined to just be the base name of the tools, under the assumption that the Bintools Wrapper's binaries will be on the path. Firstly, this helps poorly-written packages, e.g. ones that look for just <command>gcc</command> when <envar>CC</envar> isn't defined yet <command>clang</command> is to be used. Secondly, this helps packages not get confused when cross-compiling, in which case multiple Bintools Wrappers may simultaneously be in use.
24421840 <footnote xml:id="footnote-stdenv-per-platform-wrapper">
24431841 <para>
2444− Each wrapper targets a single platform, so if binaries for multiple
2445− platforms are needed, the underlying binaries must be wrapped multiple
2446− times. As this is a property of the wrapper itself, the multiple
2447− wrappings are needed whether or not the same underlying binaries can
2448− target multiple platforms.
1842+ Each wrapper targets a single platform, so if binaries for multiple platforms are needed, the underlying binaries must be wrapped multiple times. As this is a property of the wrapper itself, the multiple wrappings are needed whether or not the same underlying binaries can target multiple platforms.
24491843 </para>
24501844 </footnote>
2451− <envar>BUILD_</envar>- and <envar>TARGET_</envar>-prefixed versions of
2452− the normal environment variable are defined for additional Bintools
2453− Wrappers, properly disambiguating them.
1845+ <envar>BUILD_</envar>- and <envar>TARGET_</envar>-prefixed versions of the normal environment variable are defined for additional Bintools Wrappers, properly disambiguating them.
24541846 </para>
24551847 <para>
2456− A problem with this final task is that the Bintools Wrapper is honest
2457− and defines <envar>LD</envar> as <command>ld</command>. Most packages,
2458− however, firstly use the C compiler for linking, secondly use
2459− <envar>LD</envar> anyways, defining it as the C compiler, and thirdly,
2460− only so define <envar>LD</envar> when it is undefined as a fallback.
2461− This triple-threat means Bintools Wrapper will break those packages, as
2462− LD is already defined as the actual linker which the package won't
2463− override yet doesn't want to use. The workaround is to define, just for
2464− the problematic package, <envar>LD</envar> as the C compiler. A good way
2465− to do this would be <command>preConfigure = "LD=$CC"</command>.
1848+ A problem with this final task is that the Bintools Wrapper is honest and defines <envar>LD</envar> as <command>ld</command>. Most packages, however, firstly use the C compiler for linking, secondly use <envar>LD</envar> anyways, defining it as the C compiler, and thirdly, only so define <envar>LD</envar> when it is undefined as a fallback. This triple-threat means Bintools Wrapper will break those packages, as LD is already defined as the actual linker which the package won't override yet doesn't want to use. The workaround is to define, just for the problematic package, <envar>LD</envar> as the C compiler. A good way to do this would be <command>preConfigure = "LD=$CC"</command>.
24661849 </para>
24671850 </listitem>
24681851 </varlistentry>
@@ -2472,31 +1855,13 @@ addEnvHooks "$hostOffset" myBashFunction
24721855 </term>
24731856 <listitem>
24741857 <para>
2475− The CC Wrapper wraps a C toolchain for a bunch of miscellaneous
2476− purposes. Specifically, a C compiler (GCC or Clang), wrapped binary
2477− tools, and a C standard library (glibc or Darwin's libSystem, just for
2478− the dynamic loader) are all fed in, and dependency finding, hardening
2479− (see below), and purity checks for each are handled by the CC Wrapper.
2480− Packages typically depend on the CC Wrapper, which in turn (at run-time)
2481− depends on the Bintools Wrapper.
1858+ The CC Wrapper wraps a C toolchain for a bunch of miscellaneous purposes. Specifically, a C compiler (GCC or Clang), wrapped binary tools, and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by the CC Wrapper. Packages typically depend on the CC Wrapper, which in turn (at run-time) depends on the Bintools Wrapper.
24821859 </para>
24831860 <para>
2484− Dependency finding is undoubtedly the main task of the CC Wrapper. This
2485− works just like the Bintools Wrapper, except that any
2486− <filename>include</filename> subdirectory of any relevant dependency is
2487− added to <envar>NIX_CFLAGS_COMPILE</envar>. The setup hook itself
2488− contains some lengthy comments describing the exact convoluted mechanism
2489− by which this is accomplished.
1861+ Dependency finding is undoubtedly the main task of the CC Wrapper. This works just like the Bintools Wrapper, except that any <filename>include</filename> subdirectory of any relevant dependency is added to <envar>NIX_CFLAGS_COMPILE</envar>. The setup hook itself contains some lengthy comments describing the exact convoluted mechanism by which this is accomplished.
24901862 </para>
24911863 <para>
2492− Similarly, the CC Wrapper follows the Bintools Wrapper in defining
2493− standard environment variables with the names of the tools it wraps, for
2494− the same reasons described above. Importantly, while it includes a
2495− <command>cc</command> symlink to the c compiler for portability, the
2496− <envar>CC</envar> will be defined using the compiler's "real name" (i.e.
2497− <command>gcc</command> or <command>clang</command>). This helps lousy
2498− build systems that inspect on the name of the compiler rather than run
2499− it.
1864+ Similarly, the CC Wrapper follows the Bintools Wrapper in defining standard environment variables with the names of the tools it wraps, for the same reasons described above. Importantly, while it includes a <command>cc</command> symlink to the c compiler for portability, the <envar>CC</envar> will be defined using the compiler's "real name" (i.e. <command>gcc</command> or <command>clang</command>). This helps lousy build systems that inspect on the name of the compiler rather than run it.
25001865 </para>
25011866 </listitem>
25021867 </varlistentry>
@@ -2504,9 +1869,7 @@ addEnvHooks "$hostOffset" myBashFunction
25041869 </para>
25051870
25061871 <para>
2507− Here are some more packages that provide a setup hook. Since the list of
2508− hooks is extensible, this is not an exhaustive list the mechanism is only to
2509− be used as a last resort, it might cover most uses.
1872+ Here are some more packages that provide a setup hook. Since the list of hooks is extensible, this is not an exhaustive list the mechanism is only to be used as a last resort, it might cover most uses.
25101873 <variablelist>
25111874 <varlistentry>
25121875 <term>
@@ -2514,11 +1877,7 @@ addEnvHooks "$hostOffset" myBashFunction
25141877 </term>
25151878 <listitem>
25161879 <para>
2517− Adds the <filename>lib/site_perl</filename> subdirectory of each build
2518− input to the <envar>PERL5LIB</envar> environment variable. For instance,
2519− if <varname>buildInputs</varname> contains Perl, then the
2520− <filename>lib/site_perl</filename> subdirectory of each input is added
2521− to the <envar>PERL5LIB</envar> environment variable.
1880+ Adds the <filename>lib/site_perl</filename> subdirectory of each build input to the <envar>PERL5LIB</envar> environment variable. For instance, if <varname>buildInputs</varname> contains Perl, then the <filename>lib/site_perl</filename> subdirectory of each input is added to the <envar>PERL5LIB</envar> environment variable.
25221881 </para>
25231882 </listitem>
25241883 </varlistentry>
@@ -2528,9 +1887,7 @@ addEnvHooks "$hostOffset" myBashFunction
25281887 </term>
25291888 <listitem>
25301889 <para>
2531− Adds the <filename>lib/${python.libPrefix}/site-packages</filename>
2532− subdirectory of each build input to the <envar>PYTHONPATH</envar>
2533− environment variable.
1890+ Adds the <filename>lib/${python.libPrefix}/site-packages</filename> subdirectory of each build input to the <envar>PYTHONPATH</envar> environment variable.
25341891 </para>
25351892 </listitem>
25361893 </varlistentry>
@@ -2540,9 +1897,7 @@ addEnvHooks "$hostOffset" myBashFunction
25401897 </term>
25411898 <listitem>
25421899 <para>
2543− Adds the <filename>lib/pkgconfig</filename> and
2544− <filename>share/pkgconfig</filename> subdirectories of each build input
2545− to the <envar>PKG_CONFIG_PATH</envar> environment variable.
1900+ Adds the <filename>lib/pkgconfig</filename> and <filename>share/pkgconfig</filename> subdirectories of each build input to the <envar>PKG_CONFIG_PATH</envar> environment variable.
25461901 </para>
25471902 </listitem>
25481903 </varlistentry>
@@ -2552,8 +1907,7 @@ addEnvHooks "$hostOffset" myBashFunction
25521907 </term>
25531908 <listitem>
25541909 <para>
2555− Adds the <filename>share/aclocal</filename> subdirectory of each build
2556− input to the <envar>ACLOCAL_PATH</envar> environment variable.
1910+ Adds the <filename>share/aclocal</filename> subdirectory of each build input to the <envar>ACLOCAL_PATH</envar> environment variable.
25571911 </para>
25581912 </listitem>
25591913 </varlistentry>
@@ -2563,12 +1917,7 @@ addEnvHooks "$hostOffset" myBashFunction
25631917 </term>
25641918 <listitem>
25651919 <para>
2566− The <varname>autoreconfHook</varname> derivation adds
2567− <varname>autoreconfPhase</varname>, which runs autoreconf, libtoolize
2568− and automake, essentially preparing the configure script in
2569− autotools-based builds. Most autotools-based packages come with the
2570− configure script pre-generated, but this hook is necessary for a few
2571− packages and when you need to patch the package’s configure scripts.
1920+ The <varname>autoreconfHook</varname> derivation adds <varname>autoreconfPhase</varname>, which runs autoreconf, libtoolize and automake, essentially preparing the configure script in autotools-based builds. Most autotools-based packages come with the configure script pre-generated, but this hook is necessary for a few packages and when you need to patch the package’s configure scripts.
25721921 </para>
25731922 </listitem>
25741923 </varlistentry>
@@ -2578,10 +1927,7 @@ addEnvHooks "$hostOffset" myBashFunction
25781927 </term>
25791928 <listitem>
25801929 <para>
2581− Adds every file named <filename>catalog.xml</filename> found under the
2582− <filename>xml/dtd</filename> and <filename>xml/xsl</filename>
2583− subdirectories of each build input to the
2584− <envar>XML_CATALOG_FILES</envar> environment variable.
1930+ Adds every file named <filename>catalog.xml</filename> found under the <filename>xml/dtd</filename> and <filename>xml/xsl</filename> subdirectories of each build input to the <envar>XML_CATALOG_FILES</envar> environment variable.
25851931 </para>
25861932 </listitem>
25871933 </varlistentry>
@@ -2591,8 +1937,7 @@ addEnvHooks "$hostOffset" myBashFunction
25911937 </term>
25921938 <listitem>
25931939 <para>
2594− Adds the <filename>share/texmf-nix</filename> subdirectory of each build
2595− input to the <envar>TEXINPUTS</envar> environment variable.
1940+ Adds the <filename>share/texmf-nix</filename> subdirectory of each build input to the <envar>TEXINPUTS</envar> environment variable.
25961941 </para>
25971942 </listitem>
25981943 </varlistentry>
@@ -2612,9 +1957,7 @@ addEnvHooks "$hostOffset" myBashFunction
26121957 </term>
26131958 <listitem>
26141959 <para>
2615− Exports <envar>GDK_PIXBUF_MODULE_FILE</envar> environment variable to
2616− the builder. Add librsvg package to <varname>buildInputs</varname> to
2617− get svg support.
1960+ Exports <envar>GDK_PIXBUF_MODULE_FILE</envar> environment variable to the builder. Add librsvg package to <varname>buildInputs</varname> to get svg support.
26181961 </para>
26191962 </listitem>
26201963 </varlistentry>
@@ -2624,8 +1967,7 @@ addEnvHooks "$hostOffset" myBashFunction
26241967 </term>
26251968 <listitem>
26261969 <para>
2627− Creates a temporary package database and registers every Haskell build
2628− input in it (TODO: how?).
1970+ Creates a temporary package database and registers every Haskell build input in it (TODO: how?).
26291971 </para>
26301972 </listitem>
26311973 </varlistentry>
@@ -2635,8 +1977,7 @@ addEnvHooks "$hostOffset" myBashFunction
26351977 </term>
26361978 <listitem>
26371979 <para>
2638− Hooks related to GNOME platform and related libraries like GLib, GTK and
2639− GStreamer are described in <xref linkend="sec-language-gnome" />.
1980+ Hooks related to GNOME platform and related libraries like GLib, GTK and GStreamer are described in <xref linkend="sec-language-gnome" />.
26401981 </para>
26411982 </listitem>
26421983 </varlistentry>
@@ -2646,15 +1987,10 @@ addEnvHooks "$hostOffset" myBashFunction
26461987 </term>
26471988 <listitem>
26481989 <para>
2649− This is a special setup hook which helps in packaging proprietary
2650− software in that it automatically tries to find missing shared library
2651− dependencies of ELF files based on the given
2652− <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname>.
1990+ This is a special setup hook which helps in packaging proprietary software in that it automatically tries to find missing shared library dependencies of ELF files based on the given <varname>buildInputs</varname> and <varname>nativeBuildInputs</varname>.
26531991 </para>
26541992 <para>
2655− You can also specify a <envar>runtimeDependencies</envar> environment
2656− variable which lists dependencies that are unconditionally added to all
2657− executables.
1993+ You can also specify a <envar>runtimeDependencies</envar> environment variable which lists dependencies that are unconditionally added to all executables.
26581994 </para>
26591995 <para>
26601996 This is useful for programs that use <citerefentry>
@@ -2662,16 +1998,10 @@ addEnvHooks "$hostOffset" myBashFunction
26621998 <manvolnum>3</manvolnum> </citerefentry> to load libraries at runtime.
26631999 </para>
26642000 <para>
2665− In certain situations you may want to run the main command
2666− (<command>autoPatchelf</command>) of the setup hook on a file or a set
2667− of directories instead of unconditionally patching all outputs. This can
2668− be done by setting the <envar>dontAutoPatchelf</envar> environment
2669− variable to a non-empty value.
2001+ In certain situations you may want to run the main command (<command>autoPatchelf</command>) of the setup hook on a file or a set of directories instead of unconditionally patching all outputs. This can be done by setting the <envar>dontAutoPatchelf</envar> environment variable to a non-empty value.
26702002 </para>
26712003 <para>
2672− The <command>autoPatchelf</command> command also recognizes a
2673− <parameter class="command">--no-recurse</parameter> command line flag,
2674− which prevents it from recursing into subdirectories.
2004+ The <command>autoPatchelf</command> command also recognizes a <parameter class="command">--no-recurse</parameter> command line flag, which prevents it from recursing into subdirectories.
26752005 </para>
26762006 </listitem>
26772007 </varlistentry>
@@ -2681,36 +2011,16 @@ addEnvHooks "$hostOffset" myBashFunction
26812011 </term>
26822012 <listitem>
26832013 <para>
2684− This hook will make a build pause instead of stopping when a failure
2685− happens. It prevents nix from cleaning up the build environment
2686− immediately and allows the user to attach to a build environment using
2687− the <command>cntr</command> command. Upon build error it will print
2688− instructions on how to use <command>cntr</command>, which can be used to
2689− enter the environment for debugging. Installing cntr and running the
2690− command will provide shell access to the build sandbox of failed build.
2691− At <filename>/var/lib/cntr</filename> the sandboxed filesystem is
2692− mounted. All commands and files of the system are still accessible
2693− within the shell. To execute commands from the sandbox use the cntr exec
2694− subcommand. <command>cntr</command> is only supported on Linux-based
2695− platforms. To use it first add <literal>cntr</literal> to your
2696− <literal>environment.systemPackages</literal> on NixOS or alternatively
2697− to the root user on non-NixOS systems. Then in the package that is
2698− supposed to be inspected, add <literal>breakpointHook</literal> to
2699− <literal>nativeBuildInputs</literal>.
2014+ This hook will make a build pause instead of stopping when a failure happens. It prevents nix from cleaning up the build environment immediately and allows the user to attach to a build environment using the <command>cntr</command> command. Upon build error it will print instructions on how to use <command>cntr</command>, which can be used to enter the environment for debugging. Installing cntr and running the command will provide shell access to the build sandbox of failed build. At <filename>/var/lib/cntr</filename> the sandboxed filesystem is mounted. All commands and files of the system are still accessible within the shell. To execute commands from the sandbox use the cntr exec subcommand. <command>cntr</command> is only supported on Linux-based platforms. To use it first add <literal>cntr</literal> to your <literal>environment.systemPackages</literal> on NixOS or alternatively to the root user on non-NixOS systems. Then in the package that is supposed to be inspected, add <literal>breakpointHook</literal> to <literal>nativeBuildInputs</literal>.
27002015<programlisting>
27012016nativeBuildInputs = [ breakpointHook ];
27022017</programlisting>
2703− When a build failure happens there will be an instruction printed that
2704− shows how to attach with <literal>cntr</literal> to the build sandbox.
2018+ When a build failure happens there will be an instruction printed that shows how to attach with <literal>cntr</literal> to the build sandbox.
27052019 </para>
27062020 <note>
27072021 <title>Caution with remote builds</title>
27082022 <para>
2709− This won't work with remote builds as the build environment is on a
2710− different machine and can't be accessed by <command>cntr</command>.
2711− Remote builds can be turned off by setting <literal>--option builders
2712− ''</literal> for <command>nix-build</command> or <literal>--builders
2713− ''</literal> for <command>nix build</command>.
2023+ This won't work with remote builds as the build environment is on a different machine and can't be accessed by <command>cntr</command>. Remote builds can be turned off by setting <literal>--option builders ''</literal> for <command>nix-build</command> or <literal>--builders ''</literal> for <command>nix build</command>.
27142024 </para>
27152025 </note>
27162026 </listitem>
@@ -2721,28 +2031,13 @@ nativeBuildInputs = [ breakpointHook ];
27212031 </term>
27222032 <listitem>
27232033 <para>
2724− This hook helps with installing manpages and shell completion files. It
2725− exposes 2 shell functions <literal>installManPage</literal> and
2726− <literal>installShellCompletion</literal> that can be used from your
2727− <literal>postInstall</literal> hook.
2034+ This hook helps with installing manpages and shell completion files. It exposes 2 shell functions <literal>installManPage</literal> and <literal>installShellCompletion</literal> that can be used from your <literal>postInstall</literal> hook.
27282035 </para>
27292036 <para>
2730− The <literal>installManPage</literal> function takes one or more paths
2731− to manpages to install. The manpages must have a section suffix, and may
2732− optionally be compressed (with <literal>.gz</literal> suffix). This
2733− function will place them into the correct directory.
2037+ The <literal>installManPage</literal> function takes one or more paths to manpages to install. The manpages must have a section suffix, and may optionally be compressed (with <literal>.gz</literal> suffix). This function will place them into the correct directory.
27342038 </para>
27352039 <para>
2736− The <literal>installShellCompletion</literal> function takes one or more
2737− paths to shell completion files. By default it will autodetect the shell
2738− type from the completion file extension, but you may also specify it by
2739− passing one of <literal>--bash</literal>, <literal>--fish</literal>, or
2740− <literal>--zsh</literal>. These flags apply to all paths listed after
2741− them (up until another shell flag is given). Each path may also have a
2742− custom installation name provided by providing a flag <literal>--name
2743− NAME</literal> before the path. If this flag is not provided, zsh
2744− completions will be renamed automatically such that
2745− <literal>foobar.zsh</literal> becomes <literal>_foobar</literal>.
2040+ The <literal>installShellCompletion</literal> function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of <literal>--bash</literal>, <literal>--fish</literal>, or <literal>--zsh</literal>. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag <literal>--name NAME</literal> before the path. If this flag is not provided, zsh completions will be renamed automatically such that <literal>foobar.zsh</literal> becomes <literal>_foobar</literal>.
27462041<programlisting>
27472042nativeBuildInputs = [ installShellFiles ];
27482043postInstall = ''
@@ -2764,13 +2059,7 @@ postInstall = ''
27642059 </term>
27652060 <listitem>
27662061 <para>
2767− A few libraries automatically add to <literal>NIX_LDFLAGS</literal>
2768− their library, making their symbols automatically available to the
2769− linker. This includes libiconv and libintl (gettext). This is done to
2770− provide compatibility between GNU Linux, where libiconv and libintl are
2771− bundled in, and other systems where that might not be the case.
2772− Sometimes, this behavior is not desired. To disable this behavior, set
2773− <literal>dontAddExtraLibs</literal>.
2062+ A few libraries automatically add to <literal>NIX_LDFLAGS</literal> their library, making their symbols automatically available to the linker. This includes libiconv and libintl (gettext). This is done to provide compatibility between GNU Linux, where libiconv and libintl are bundled in, and other systems where that might not be the case. Sometimes, this behavior is not desired. To disable this behavior, set <literal>dontAddExtraLibs</literal>.
27742063 </para>
27752064 </listitem>
27762065 </varlistentry>
@@ -2780,16 +2069,7 @@ postInstall = ''
27802069 </term>
27812070 <listitem>
27822071 <para>
2783− Overrides the default configure phase to run the CMake command. By
2784− default, we use the Make generator of CMake. In addition, dependencies
2785− are added automatically to CMAKE_PREFIX_PATH so that packages are
2786− correctly detected by CMake. Some additional flags are passed in to give
2787− similar behavior to configure-based packages. You can disable this
2788− hook’s behavior by setting configurePhase to a custom value, or by
2789− setting dontUseCmakeConfigure. cmakeFlags controls flags passed only to
2790− CMake. By default, parallel building is enabled as CMake supports
2791− parallel building almost everywhere. When Ninja is also in use, CMake
2792− will detect that and use the ninja generator.
2072+ Overrides the default configure phase to run the CMake command. By default, we use the Make generator of CMake. In addition, dependencies are added automatically to CMAKE_PREFIX_PATH so that packages are correctly detected by CMake. Some additional flags are passed in to give similar behavior to configure-based packages. You can disable this hook’s behavior by setting configurePhase to a custom value, or by setting dontUseCmakeConfigure. cmakeFlags controls flags passed only to CMake. By default, parallel building is enabled as CMake supports parallel building almost everywhere. When Ninja is also in use, CMake will detect that and use the ninja generator.
27932073 </para>
27942074 </listitem>
27952075 </varlistentry>
@@ -2799,11 +2079,7 @@ postInstall = ''
27992079 </term>
28002080 <listitem>
28012081 <para>
2802− Overrides the build and install phases to run the “xcbuild” command.
2803− This hook is needed when a project only comes with build files for the
2804− XCode build system. You can disable this behavior by setting buildPhase
2805− and configurePhase to a custom value. xcbuildFlags controls flags passed
2806− only to xcbuild.
2082+ Overrides the build and install phases to run the “xcbuild” command. This hook is needed when a project only comes with build files for the XCode build system. You can disable this behavior by setting buildPhase and configurePhase to a custom value. xcbuildFlags controls flags passed only to xcbuild.
28072083 </para>
28082084 </listitem>
28092085 </varlistentry>
@@ -2813,10 +2089,7 @@ postInstall = ''
28132089 </term>
28142090 <listitem>
28152091 <para>
2816− Overrides the configure phase to run meson to generate Ninja files. To
2817− run these files, you should accompany Meson with ninja. By default,
2818− <varname>enableParallelBuilding</varname> is enabled as Meson supports
2819− parallel building almost everywhere.
2092+ Overrides the configure phase to run meson to generate Ninja files. To run these files, you should accompany Meson with ninja. By default, <varname>enableParallelBuilding</varname> is enabled as Meson supports parallel building almost everywhere.
28202093 </para>
28212094 <variablelist>
28222095 <title>Variables controlling Meson</title>
@@ -2836,10 +2109,8 @@ postInstall = ''
28362109 </term>
28372110 <listitem>
28382111 <para>
2839− Which
2840− <link
2841− xlink:href="https://mesonbuild.com/Builtin-options.html#core-options"><command>--buildtype</command></link>
2842− to pass to Meson. We default to <literal>plain</literal>.
2112+ Which <link
2113+ xlink:href="https://mesonbuild.com/Builtin-options.html#core-options"><command>--buildtype</command></link> to pass to Meson. We default to <literal>plain</literal>.
28432114 </para>
28442115 </listitem>
28452116 </varlistentry>
@@ -2849,10 +2120,8 @@ postInstall = ''
28492120 </term>
28502121 <listitem>
28512122 <para>
2852− What value to set
2853− <link
2854− xlink:href="https://mesonbuild.com/Builtin-options.html#core-options"><command>-Dauto_features=</command></link>
2855− to. We default to <command>enabled</command>.
2123+ What value to set <link
2124+ xlink:href="https://mesonbuild.com/Builtin-options.html#core-options"><command>-Dauto_features=</command></link> to. We default to <command>enabled</command>.
28562125 </para>
28572126 </listitem>
28582127 </varlistentry>
@@ -2862,11 +2131,8 @@ postInstall = ''
28622131 </term>
28632132 <listitem>
28642133 <para>
2865− What value to set
2866− <link
2867− xlink:href="https://mesonbuild.com/Builtin-options.html#core-options"><command>-Dwrap_mode=</command></link>
2868− to. We default to <command>nodownload</command> as we disallow
2869− network access.
2134+ What value to set <link
2135+ xlink:href="https://mesonbuild.com/Builtin-options.html#core-options"><command>-Dwrap_mode=</command></link> to. We default to <command>nodownload</command> as we disallow network access.
28702136 </para>
28712137 </listitem>
28722138 </varlistentry>
@@ -2889,10 +2155,7 @@ postInstall = ''
28892155 </term>
28902156 <listitem>
28912157 <para>
2892− Overrides the build, install, and check phase to run ninja instead of
2893− make. You can disable this behavior with the dontUseNinjaBuild,
2894− dontUseNinjaInstall, and dontUseNinjaCheck, respectively. Parallel
2895− building is enabled by default in Ninja.
2158+ Overrides the build, install, and check phase to run ninja instead of make. You can disable this behavior with the dontUseNinjaBuild, dontUseNinjaInstall, and dontUseNinjaCheck, respectively. Parallel building is enabled by default in Ninja.
28962159 </para>
28972160 </listitem>
28982161 </varlistentry>
@@ -2902,8 +2165,7 @@ postInstall = ''
29022165 </term>
29032166 <listitem>
29042167 <para>
2905− This setup hook will allow you to unzip .zip files specified in $src.
2906− There are many similar packages like unrar, undmg, etc.
2168+ This setup hook will allow you to unzip .zip files specified in $src. There are many similar packages like unrar, undmg, etc.
29072169 </para>
29082170 </listitem>
29092171 </varlistentry>
@@ -2913,10 +2175,7 @@ postInstall = ''
29132175 </term>
29142176 <listitem>
29152177 <para>
2916− Overrides the configure, build, and install phases. This will run the
2917− "waf" script used by many projects. If wafPath (default ./waf) doesn’t
2918− exist, it will copy the version of waf available in Nixpkgs. wafFlags
2919− can be used to pass flags to the waf script.
2178+ Overrides the configure, build, and install phases. This will run the "waf" script used by many projects. If wafPath (default ./waf) doesn’t exist, it will copy the version of waf available in Nixpkgs. wafFlags can be used to pass flags to the waf script.
29202179 </para>
29212180 </listitem>
29222181 </varlistentry>
@@ -2926,9 +2185,7 @@ postInstall = ''
29262185 </term>
29272186 <listitem>
29282187 <para>
2929− Overrides the build, install, and check phases. This uses the scons
2930− build system as a replacement for make. scons does not provide a
2931− configure phase, so everything is managed at build and install time.
2188+ Overrides the build, install, and check phases. This uses the scons build system as a replacement for make. scons does not provide a configure phase, so everything is managed at build and install time.
29322189 </para>
29332190 </listitem>
29342191 </varlistentry>
@@ -2939,40 +2196,26 @@ postInstall = ''
29392196 <title>Purity in Nixpkgs</title>
29402197
29412198 <para>
2942− [measures taken to prevent dependencies on packages outside the store, and
2943− what you can do to prevent them]
2199+ [measures taken to prevent dependencies on packages outside the store, and what you can do to prevent them]
29442200 </para>
29452201
29462202 <para>
2947− GCC doesn't search in locations such as <filename>/usr/include</filename>.
2948− In fact, attempts to add such directories through the <option>-I</option>
2949− flag are filtered out. Likewise, the linker (from GNU binutils) doesn't
2950− search in standard locations such as <filename>/usr/lib</filename>. Programs
2951− built on Linux are linked against a GNU C Library that likewise doesn't
2952− search in the default system locations.
2203+ GCC doesn't search in locations such as <filename>/usr/include</filename>. In fact, attempts to add such directories through the <option>-I</option> flag are filtered out. Likewise, the linker (from GNU binutils) doesn't search in standard locations such as <filename>/usr/lib</filename>. Programs built on Linux are linked against a GNU C Library that likewise doesn't search in the default system locations.
29532204 </para>
29542205 </section>
29552206 <section xml:id="sec-hardening-in-nixpkgs">
29562207 <title>Hardening in Nixpkgs</title>
29572208
29582209 <para>
2959− There are flags available to harden packages at compile or link-time. These
2960− can be toggled using the <varname>stdenv.mkDerivation</varname> parameters
2961− <varname>hardeningDisable</varname> and <varname>hardeningEnable</varname>.
2210+ There are flags available to harden packages at compile or link-time. These can be toggled using the <varname>stdenv.mkDerivation</varname> parameters <varname>hardeningDisable</varname> and <varname>hardeningEnable</varname>.
29622211 </para>
29632212
29642213 <para>
2965− Both parameters take a list of flags as strings. The special
2966− <varname>"all"</varname> flag can be passed to
2967− <varname>hardeningDisable</varname> to turn off all hardening. These flags
2968− can also be used as environment variables for testing or development
2969− purposes.
2214+ Both parameters take a list of flags as strings. The special <varname>"all"</varname> flag can be passed to <varname>hardeningDisable</varname> to turn off all hardening. These flags can also be used as environment variables for testing or development purposes.
29702215 </para>
29712216
29722217 <para>
2973− The following flags are enabled by default and might require disabling with
2974− <varname>hardeningDisable</varname> if the program to package is
2975− incompatible.
2218+ The following flags are enabled by default and might require disabling with <varname>hardeningDisable</varname> if the program to package is incompatible.
29762219 </para>
29772220
29782221 <variablelist>
@@ -2982,13 +2225,7 @@ postInstall = ''
29822225 </term>
29832226 <listitem>
29842227 <para>
2985− Adds the <option>-Wformat -Wformat-security
2986− -Werror=format-security</option> compiler options. At present, this warns
2987− about calls to <varname>printf</varname> and <varname>scanf</varname>
2988− functions where the format string is not a string literal and there are
2989− no format arguments, as in <literal>printf(foo);</literal>. This may be a
2990− security hole if the format string came from untrusted input and contains
2991− <literal>%n</literal>.
2228+ Adds the <option>-Wformat -Wformat-security -Werror=format-security</option> compiler options. At present, this warns about calls to <varname>printf</varname> and <varname>scanf</varname> functions where the format string is not a string literal and there are no format arguments, as in <literal>printf(foo);</literal>. This may be a security hole if the format string came from untrusted input and contains <literal>%n</literal>.
29922229 </para>
29932230 <para>
29942231 This needs to be turned off or fixed for errors similar to:
@@ -3007,12 +2244,7 @@ cc1plus: some warnings being treated as errors
30072244 </term>
30082245 <listitem>
30092246 <para>
3010− Adds the <option>-fstack-protector-strong --param
3011− ssp-buffer-size=4</option> compiler options. This adds safety checks
3012− against stack overwrites rendering many potential code injection attacks
3013− into aborting situations. In the best case this turns code injection
3014− vulnerabilities into denial of service or into non-issues (depending on
3015− the application).
2247+ Adds the <option>-fstack-protector-strong --param ssp-buffer-size=4</option> compiler options. This adds safety checks against stack overwrites rendering many potential code injection attacks into aborting situations. In the best case this turns code injection vulnerabilities into denial of service or into non-issues (depending on the application).
30162248 </para>
30172249 <para>
30182250 This needs to be turned off or fixed for errors similar to:
@@ -3029,19 +2261,10 @@ bin/blib.a(bios_console.o): In function `bios_handle_cup':
30292261 </term>
30302262 <listitem>
30312263 <para>
3032− Adds the <option>-O2 -D_FORTIFY_SOURCE=2</option> compiler options.
3033− During code generation the compiler knows a great deal of information
3034− about buffer sizes (where possible), and attempts to replace insecure
3035− unlimited length buffer function calls with length-limited ones. This is
3036− especially useful for old, crufty code. Additionally, format strings in
3037− writable memory that contain '%n' are blocked. If an application depends
3038− on such a format string, it will need to be worked around.
2264+ Adds the <option>-O2 -D_FORTIFY_SOURCE=2</option> compiler options. During code generation the compiler knows a great deal of information about buffer sizes (where possible), and attempts to replace insecure unlimited length buffer function calls with length-limited ones. This is especially useful for old, crufty code. Additionally, format strings in writable memory that contain '%n' are blocked. If an application depends on such a format string, it will need to be worked around.
30392265 </para>
30402266 <para>
3041− Additionally, some warnings are enabled which might trigger build
3042− failures if compiler warnings are treated as errors in the package build.
3043− In this case, set <option>NIX_CFLAGS_COMPILE</option> to
3044− <option>-Wno-error=warning-type</option>.
2267+ Additionally, some warnings are enabled which might trigger build failures if compiler warnings are treated as errors in the package build. In this case, set <option>NIX_CFLAGS_COMPILE</option> to <option>-Wno-error=warning-type</option>.
30452268 </para>
30462269 <para>
30472270 This needs to be turned off or fixed for errors similar to:
@@ -3070,15 +2293,10 @@ fcntl2.h:50:4: error: call to '__open_missing_mode' declared with attribute erro
30702293 </term>
30712294 <listitem>
30722295 <para>
3073− Adds the <option>-fPIC</option> compiler options. This options adds
3074− support for position independent code in shared libraries and thus making
3075− ASLR possible.
2296+ Adds the <option>-fPIC</option> compiler options. This options adds support for position independent code in shared libraries and thus making ASLR possible.
30762297 </para>
30772298 <para>
3078− Most notably, the Linux kernel, kernel modules and other code not running
3079− in an operating system environment like boot loaders won't build with PIC
3080− enabled. The compiler will is most cases complain that PIC is not
3081− supported for a specific build.
2299+ Most notably, the Linux kernel, kernel modules and other code not running in an operating system environment like boot loaders won't build with PIC enabled. The compiler will is most cases complain that PIC is not supported for a specific build.
30822300 </para>
30832301 <para>
30842302 This needs to be turned off or fixed for assembler errors similar to:
@@ -3095,13 +2313,7 @@ ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_le
30952313 </term>
30962314 <listitem>
30972315 <para>
3098− Signed integer overflow is undefined behaviour according to the C
3099− standard. If it happens, it is an error in the program as it should check
3100− for overflow before it can happen, not afterwards. GCC provides built-in
3101− functions to perform arithmetic with overflow checking, which are correct
3102− and faster than any custom implementation. As a workaround, the option
3103− <option>-fno-strict-overflow</option> makes gcc behave as if signed
3104− integer overflows were defined.
2316+ Signed integer overflow is undefined behaviour according to the C standard. If it happens, it is an error in the program as it should check for overflow before it can happen, not afterwards. GCC provides built-in functions to perform arithmetic with overflow checking, which are correct and faster than any custom implementation. As a workaround, the option <option>-fno-strict-overflow</option> makes gcc behave as if signed integer overflows were defined.
31052317 </para>
31062318 <para>
31072319 This flag should not trigger any build or runtime errors.
@@ -3114,18 +2326,10 @@ ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_le
31142326 </term>
31152327 <listitem>
31162328 <para>
3117− Adds the <option>-z relro</option> linker option. During program load,
3118− several ELF memory sections need to be written to by the linker, but can
3119− be turned read-only before turning over control to the program. This
3120− prevents some GOT (and .dtors) overwrite attacks, but at least the part
3121− of the GOT used by the dynamic linker (.got.plt) is still vulnerable.
2329+ Adds the <option>-z relro</option> linker option. During program load, several ELF memory sections need to be written to by the linker, but can be turned read-only before turning over control to the program. This prevents some GOT (and .dtors) overwrite attacks, but at least the part of the GOT used by the dynamic linker (.got.plt) is still vulnerable.
31222330 </para>
31232331 <para>
3124− This flag can break dynamic shared object loading. For instance, the
3125− module systems of Xorg and OpenCV are incompatible with this flag. In
3126− almost all cases the <varname>bindnow</varname> flag must also be
3127− disabled and incompatible programs typically fail with similar errors at
3128− runtime.
2332+ This flag can break dynamic shared object loading. For instance, the module systems of Xorg and OpenCV are incompatible with this flag. In almost all cases the <varname>bindnow</varname> flag must also be disabled and incompatible programs typically fail with similar errors at runtime.
31292333 </para>
31302334 </listitem>
31312335 </varlistentry>
@@ -3135,18 +2339,10 @@ ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_le
31352339 </term>
31362340 <listitem>
31372341 <para>
3138− Adds the <option>-z bindnow</option> linker option. During program load,
3139− all dynamic symbols are resolved, allowing for the complete GOT to be
3140− marked read-only (due to <varname>relro</varname>). This prevents GOT
3141− overwrite attacks. For very large applications, this can incur some
3142− performance loss during initial load while symbols are resolved, but this
3143− shouldn't be an issue for daemons.
2342+ Adds the <option>-z bindnow</option> linker option. During program load, all dynamic symbols are resolved, allowing for the complete GOT to be marked read-only (due to <varname>relro</varname>). This prevents GOT overwrite attacks. For very large applications, this can incur some performance loss during initial load while symbols are resolved, but this shouldn't be an issue for daemons.
31442343 </para>
31452344 <para>
3146− This flag can break dynamic shared object loading. For instance, the
3147− module systems of Xorg and PHP are incompatible with this flag. Programs
3148− incompatible with this flag often fail at runtime due to missing symbols,
3149− like:
2345+ This flag can break dynamic shared object loading. For instance, the module systems of Xorg and PHP are incompatible with this flag. Programs incompatible with this flag often fail at runtime due to missing symbols, like:
31502346 </para>
31512347<programlisting>
31522348intel_drv.so: undefined symbol: vgaHWFreeHWRec
@@ -3156,9 +2352,7 @@ intel_drv.so: undefined symbol: vgaHWFreeHWRec
31562352 </variablelist>
31572353
31582354 <para>
3159− The following flags are disabled by default and should be enabled with
3160− <varname>hardeningEnable</varname> for packages that take untrusted input
3161− like network services.
2355+ The following flags are disabled by default and should be enabled with <varname>hardeningEnable</varname> for packages that take untrusted input like network services.
31622356 </para>
31632357
31642358 <variablelist>
@@ -3168,31 +2362,14 @@ intel_drv.so: undefined symbol: vgaHWFreeHWRec
31682362 </term>
31692363 <listitem>
31702364 <para>
3171− Adds the <option>-fPIE</option> compiler and <option>-pie</option> linker
3172− options. Position Independent Executables are needed to take advantage of
3173− Address Space Layout Randomization, supported by modern kernel versions.
3174− While ASLR can already be enforced for data areas in the stack and heap
3175− (brk and mmap), the code areas must be compiled as position-independent.
3176− Shared libraries already do this with the <varname>pic</varname> flag, so
3177− they gain ASLR automatically, but binary .text regions need to be build
3178− with <varname>pie</varname> to gain ASLR. When this happens, ROP attacks
3179− are much harder since there are no static locations to bounce off of
3180− during a memory corruption attack.
2365+ Adds the <option>-fPIE</option> compiler and <option>-pie</option> linker options. Position Independent Executables are needed to take advantage of Address Space Layout Randomization, supported by modern kernel versions. While ASLR can already be enforced for data areas in the stack and heap (brk and mmap), the code areas must be compiled as position-independent. Shared libraries already do this with the <varname>pic</varname> flag, so they gain ASLR automatically, but binary .text regions need to be build with <varname>pie</varname> to gain ASLR. When this happens, ROP attacks are much harder since there are no static locations to bounce off of during a memory corruption attack.
31812366 </para>
31822367 </listitem>
31832368 </varlistentry>
31842369 </variablelist>
31852370
31862371 <para>
3187− For more in-depth information on these hardening flags and hardening in
3188− general, refer to the
3189− <link xlink:href="https://wiki.debian.org/Hardening">Debian Wiki</link>,
3190− <link xlink:href="https://wiki.ubuntu.com/Security/Features">Ubuntu
3191− Wiki</link>,
3192− <link xlink:href="https://wiki.gentoo.org/wiki/Project:Hardened">Gentoo
3193− Wiki</link>, and the
3194− <link xlink:href="https://wiki.archlinux.org/index.php/DeveloperWiki:Security">
3195− Arch Wiki</link>.
2372+ For more in-depth information on these hardening flags and hardening in general, refer to the <link xlink:href="https://wiki.debian.org/Hardening">Debian Wiki</link>, <link xlink:href="https://wiki.ubuntu.com/Security/Features">Ubuntu Wiki</link>, <link xlink:href="https://wiki.gentoo.org/wiki/Project:Hardened">Gentoo Wiki</link>, and the <link xlink:href="https://wiki.archlinux.org/index.php/DeveloperWiki:Security"> Arch Wiki</link>.
31962373 </para>
31972374 </section>
31982375</chapter>
doc/submitting-changes.xml+39−132
@@ -8,8 +8,7 @@
88 <itemizedlist>
99 <listitem>
1010 <para>
11− Read <link xlink:href="https://nixos.org/nixpkgs/manual/">Manual (How to
12− write packages for Nix)</link>.
11+ Read <link xlink:href="https://nixos.org/nixpkgs/manual/">Manual (How to write packages for Nix)</link>.
1312 </para>
1413 </listitem>
1514 <listitem>
@@ -23,15 +22,11 @@
2322 <itemizedlist>
2423 <listitem>
2524 <para>
26− You can make branch from a commit of your local
27− <command>nixos-version</command>. That will help you to avoid
28− additional local compilations. Because you will receive packages from
29− binary cache.
25+ You can make branch from a commit of your local <command>nixos-version</command>. That will help you to avoid additional local compilations. Because you will receive packages from binary cache.
3026 <itemizedlist>
3127 <listitem>
3228 <para>
33− For example: <command>nixos-version</command> returns
34− <command>15.05.git.0998212 (Dingo)</command>. So you can do:
29+ For example: <command>nixos-version</command> returns <command>15.05.git.0998212 (Dingo)</command>. So you can do:
3530 </para>
3631 </listitem>
3732 </itemizedlist>
@@ -55,9 +50,7 @@
5550 <itemizedlist>
5651 <listitem>
5752 <para>
58− If you removed pkgs, made some major NixOS changes etc., write about
59− them in
60− <command>nixos/doc/manual/release-notes/rl-unstable.xml</command>.
53+ If you removed pkgs, made some major NixOS changes etc., write about them in <command>nixos/doc/manual/release-notes/rl-unstable.xml</command>.
6154 </para>
6255 </listitem>
6356 </itemizedlist>
@@ -65,8 +58,7 @@
6558 </listitem>
6659 <listitem>
6760 <para>
68− Check for unnecessary whitespace with <command>git diff --check</command>
69− before committing.
61+ Check for unnecessary whitespace with <command>git diff --check</command> before committing.
7062 </para>
7163 </listitem>
7264 <listitem>
@@ -121,8 +113,7 @@ Additional information.
121113 <itemizedlist>
122114 <listitem>
123115 <para>
124− <command>nix-env -i pkg-name -f &lt;path to your local nixpkgs
125− folder&gt;</command>
116+ <command>nix-env -i pkg-name -f &lt;path to your local nixpkgs folder&gt;</command>
126117 </para>
127118 </listitem>
128119 </itemizedlist>
@@ -134,14 +125,12 @@ Additional information.
134125 <itemizedlist>
135126 <listitem>
136127 <para>
137− Make sure it's in
138− <command>pkgs/top-level/all-packages.nix</command>
128+ Make sure it's in <command>pkgs/top-level/all-packages.nix</command>
139129 </para>
140130 </listitem>
141131 <listitem>
142132 <para>
143− <command>nix-env -i pkg-name -f &lt;path to your local nixpkgs
144− folder&gt;</command>
133+ <command>nix-env -i pkg-name -f &lt;path to your local nixpkgs folder&gt;</command>
145134 </para>
146135 </listitem>
147136 </itemizedlist>
@@ -149,15 +138,11 @@ Additional information.
149138 </listitem>
150139 <listitem>
151140 <para>
152− <emphasis>If you don't want to install pkg in you
153− profile</emphasis>.
141+ <emphasis>If you don't want to install pkg in you profile</emphasis>.
154142 <itemizedlist>
155143 <listitem>
156144 <para>
157− <command>nix-build -A pkg-attribute-name &lt;path to your local
158− nixpkgs folder&gt;/default.nix</command> and check results in the
159− folder <command>result</command>. It will appear in the same
160− directory where you did <command>nix-build</command>.
145+ <command>nix-build -A pkg-attribute-name &lt;path to your local nixpkgs folder&gt;/default.nix</command> and check results in the folder <command>result</command>. It will appear in the same directory where you did <command>nix-build</command>.
161146 </para>
162147 </listitem>
163148 </itemizedlist>
@@ -165,9 +150,7 @@ Additional information.
165150 </listitem>
166151 <listitem>
167152 <para>
168− If you did <command>nix-env -i pkg-name</command> you can do
169− <command>nix-env -e pkg-name</command> to uninstall it from your
170− system.
153+ If you did <command>nix-env -i pkg-name</command> you can do <command>nix-env -e pkg-name</command> to uninstall it from your system.
171154 </para>
172155 </listitem>
173156 </itemizedlist>
@@ -179,10 +162,7 @@ Additional information.
179162 <itemizedlist>
180163 <listitem>
181164 <para>
182− You can add new module to your NixOS configuration file (usually
183− it's <command>/etc/nixos/configuration.nix</command>). And do
184− <command>sudo nixos-rebuild test -I nixpkgs=&lt;path to your local
185− nixpkgs folder&gt; --fast</command>.
165+ You can add new module to your NixOS configuration file (usually it's <command>/etc/nixos/configuration.nix</command>). And do <command>sudo nixos-rebuild test -I nixpkgs=&lt;path to your local nixpkgs folder&gt; --fast</command>.
186166 </para>
187167 </listitem>
188168 </itemizedlist>
@@ -193,9 +173,7 @@ Additional information.
193173 </listitem>
194174 <listitem>
195175 <para>
196− If you have commits <command>pkg-name: oh, forgot to insert
197− whitespace</command>: squash commits in this case. Use <command>git rebase
198− -i</command>.
176+ If you have commits <command>pkg-name: oh, forgot to insert whitespace</command>: squash commits in this case. Use <command>git rebase -i</command>.
199177 </para>
200178 </listitem>
201179 <listitem>
@@ -220,8 +198,7 @@ Additional information.
220198 <itemizedlist>
221199 <listitem>
222200 <para>
223− Write the title in format <command>(pkg-name | nixos/&lt;module>):
224− improvement</command>.
201+ Write the title in format <command>(pkg-name | nixos/&lt;module>): improvement</command>.
225202 <itemizedlist>
226203 <listitem>
227204 <para>
@@ -233,8 +210,7 @@ Additional information.
233210 </listitem>
234211 <listitem>
235212 <para>
236− Write in comment if you have tested your patch. Do not rely much on
237− <command>TravisCI</command>.
213+ Write in comment if you have tested your patch. Do not rely much on <command>TravisCI</command>.
238214 </para>
239215 </listitem>
240216 <listitem>
@@ -244,8 +220,7 @@ Additional information.
244220 </listitem>
245221 <listitem>
246222 <para>
247− Notify maintainers of the package. For example add to the message:
248− <command>cc @jagajaga @domenkozar</command>.
223+ Notify maintainers of the package. For example add to the message: <command>cc @jagajaga @domenkozar</command>.
249224 </para>
250225 </listitem>
251226 </itemizedlist>
@@ -257,64 +232,39 @@ Additional information.
257232 <title>Pull Request Template</title>
258233
259234 <para>
260− The pull request template helps determine what steps have been made for a
261− contribution so far, and will help guide maintainers on the status of a
262− change. The motivation section of the PR should include any extra details
263− the title does not address and link any existing issues related to the pull
264− request.
235+ The pull request template helps determine what steps have been made for a contribution so far, and will help guide maintainers on the status of a change. The motivation section of the PR should include any extra details the title does not address and link any existing issues related to the pull request.
265236 </para>
266237
267238 <para>
268− When a PR is created, it will be pre-populated with some checkboxes detailed
269− below:
239+ When a PR is created, it will be pre-populated with some checkboxes detailed below:
270240 </para>
271241
272242 <section xml:id="submitting-changes-tested-with-sandbox">
273243 <title>Tested using sandboxing</title>
274244
275245 <para>
276− When sandbox builds are enabled, Nix will setup an isolated environment for
277− each build process. It is used to remove further hidden dependencies set by
278− the build environment to improve reproducibility. This includes access to
279− the network during the build outside of <function>fetch*</function>
280− functions and files outside the Nix store. Depending on the operating
281− system access to other resources are blocked as well (ex. inter process
282− communication is isolated on Linux); see
283− <link
284− xlink:href="https://nixos.org/nix/manual/#description-45">build-use-sandbox</link>
285− in Nix manual for details.
246+ When sandbox builds are enabled, Nix will setup an isolated environment for each build process. It is used to remove further hidden dependencies set by the build environment to improve reproducibility. This includes access to the network during the build outside of <function>fetch*</function> functions and files outside the Nix store. Depending on the operating system access to other resources are blocked as well (ex. inter process communication is isolated on Linux); see <link
247+ xlink:href="https://nixos.org/nix/manual/#description-45">build-use-sandbox</link> in Nix manual for details.
286248 </para>
287249
288250 <para>
289− Sandboxing is not enabled by default in Nix due to a small performance hit
290− on each build. In pull requests for
291− <link
292− xlink:href="https://github.com/NixOS/nixpkgs/">nixpkgs</link>
293− people are asked to test builds with sandboxing enabled (see
294− <literal>Tested using sandboxing</literal> in the pull request template)
295− because
296− in<link
297− xlink:href="https://nixos.org/hydra/">https://nixos.org/hydra/</link>
298− sandboxing is also used.
251+ Sandboxing is not enabled by default in Nix due to a small performance hit on each build. In pull requests for <link
252+ xlink:href="https://github.com/NixOS/nixpkgs/">nixpkgs</link> people are asked to test builds with sandboxing enabled (see <literal>Tested using sandboxing</literal> in the pull request template) because in<link
253+ xlink:href="https://nixos.org/hydra/">https://nixos.org/hydra/</link> sandboxing is also used.
299254 </para>
300255
301256 <para>
302− Depending if you use NixOS or other platforms you can use one of the
303− following methods to enable sandboxing
304− <emphasis role="bold">before</emphasis> building the package:
257+ Depending if you use NixOS or other platforms you can use one of the following methods to enable sandboxing <emphasis role="bold">before</emphasis> building the package:
305258 <itemizedlist>
306259 <listitem>
307260 <para>
308− <emphasis role="bold">Globally enable sandboxing on NixOS</emphasis>:
309− add the following to <filename>configuration.nix</filename>
261+ <emphasis role="bold">Globally enable sandboxing on NixOS</emphasis>: add the following to <filename>configuration.nix</filename>
310262<screen>nix.useSandbox = true;</screen>
311263 </para>
312264 </listitem>
313265 <listitem>
314266 <para>
315− <emphasis role="bold">Globally enable sandboxing on non-NixOS
316− platforms</emphasis>: add the following to:
317− <filename>/etc/nix/nix.conf</filename>
267+ <emphasis role="bold">Globally enable sandboxing on non-NixOS platforms</emphasis>: add the following to: <filename>/etc/nix/nix.conf</filename>
318268<screen>build-use-sandbox = true</screen>
319269 </para>
320270 </listitem>
@@ -326,11 +276,7 @@ Additional information.
326276 <title>Built on platform(s)</title>
327277
328278 <para>
329− Many Nix packages are designed to run on multiple platforms. As such, it's
330− important to let the maintainer know which platforms your changes have been
331− tested on. It's not always practical to test a change on all platforms, and
332− is not required for a pull request to be merged. Only check the systems you
333− tested the build on in this section.
279+ Many Nix packages are designed to run on multiple platforms. As such, it's important to let the maintainer know which platforms your changes have been tested on. It's not always practical to test a change on all platforms, and is not required for a pull request to be merged. Only check the systems you tested the build on in this section.
334280 </para>
335281 </section>
336282
@@ -338,15 +284,8 @@ Additional information.
338284 <title>Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)</title>
339285
340286 <para>
341− Packages with automated tests are much more likely to be merged in a timely
342− fashion because it doesn't require as much manual testing by the maintainer
343− to verify the functionality of the package. If there are existing tests for
344− the package, they should be run to verify your changes do not break the
345− tests. Tests only apply to packages with NixOS modules defined and can only
346− be run on Linux. For more details on writing and running tests, see the
347− <link
348− xlink:href="https://nixos.org/nixos/manual/index.html#sec-nixos-tests">section
349− in the NixOS manual</link>.
287+ Packages with automated tests are much more likely to be merged in a timely fashion because it doesn't require as much manual testing by the maintainer to verify the functionality of the package. If there are existing tests for the package, they should be run to verify your changes do not break the tests. Tests only apply to packages with NixOS modules defined and can only be run on Linux. For more details on writing and running tests, see the <link
288+ xlink:href="https://nixos.org/nixos/manual/index.html#sec-nixos-tests">section in the NixOS manual</link>.
350289 </para>
351290 </section>
352291
@@ -354,11 +293,7 @@ Additional information.
354293 <title>Tested compilation of all pkgs that depend on this change using <command>nix-review</command></title>
355294
356295 <para>
357− If you are updating a package's version, you can use nix-review to make
358− sure all packages that depend on the updated package still compile
359− correctly. The <command>nix-review</command> utility can look for and build
360− all dependencies either based on uncommited changes with the
361− <literal>wip</literal> option or specifying a github pull request number.
296+ If you are updating a package's version, you can use nix-review to make sure all packages that depend on the updated package still compile correctly. The <command>nix-review</command> utility can look for and build all dependencies either based on uncommited changes with the <literal>wip</literal> option or specifying a github pull request number.
362297 </para>
363298
364299 <para>
@@ -376,13 +311,7 @@ Additional information.
376311 <title>Tested execution of all binary files (usually in <filename>./result/bin/</filename>)</title>
377312
378313 <para>
379− It's important to test any executables generated by a build when you change
380− or create a package in nixpkgs. This can be done by looking in
381− <filename>./result/bin</filename> and running any files in there, or at a
382− minimum, the main executable for the package. For example, if you make a
383− change to <package>texlive</package>, you probably would only check the
384− binaries associated with the change you made rather than testing all of
385− them.
314+ It's important to test any executables generated by a build when you change or create a package in nixpkgs. This can be done by looking in <filename>./result/bin</filename> and running any files in there, or at a minimum, the main executable for the package. For example, if you make a change to <package>texlive</package>, you probably would only check the binaries associated with the change you made rather than testing all of them.
386315 </para>
387316 </section>
388317
@@ -390,14 +319,8 @@ Additional information.
390319 <title>Meets Nixpkgs contribution standards</title>
391320
392321 <para>
393− The last checkbox is fits
394− <link
395− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md">CONTRIBUTING.md</link>.
396− The contributing document has detailed information on standards the Nix
397− community has for commit messages, reviews, licensing of contributions you
398− make to the project, etc... Everyone should read and understand the
399− standards the community has for contributing before submitting a pull
400− request.
322+ The last checkbox is fits <link
323+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md">CONTRIBUTING.md</link>. The contributing document has detailed information on standards the Nix community has for commit messages, reviews, licensing of contributions you make to the project, etc... Everyone should read and understand the standards the community has for contributing before submitting a pull request.
401324 </para>
402325 </section>
403326 </section>
@@ -435,22 +358,17 @@ Additional information.
435358 <itemizedlist>
436359 <listitem>
437360 <para>
438− Commits must be sufficiently tested before being merged, both for the
439− master and staging branches.
361+ Commits must be sufficiently tested before being merged, both for the master and staging branches.
440362 </para>
441363 </listitem>
442364 <listitem>
443365 <para>
444− Hydra builds for master and staging should not be used as testing
445− platform, it's a build farm for changes that have been already tested.
366+ Hydra builds for master and staging should not be used as testing platform, it's a build farm for changes that have been already tested.
446367 </para>
447368 </listitem>
448369 <listitem>
449370 <para>
450− When changing the bootloader installation process, extra care must be
451− taken. Grub installations cannot be rolled back, hence changes may break
452− people's installations forever. For any non-trivial change to the
453− bootloader please file a PR asking for review, especially from @edolstra.
371+ When changing the bootloader installation process, extra care must be taken. Grub installations cannot be rolled back, hence changes may break people's installations forever. For any non-trivial change to the bootloader please file a PR asking for review, especially from @edolstra.
454372 </para>
455373 </listitem>
456374 </itemizedlist>
@@ -473,20 +391,12 @@ Additional information.
473391 <itemizedlist>
474392 <listitem>
475393 <para>
476− It's only for non-breaking mass-rebuild commits. That means it's not to
477− be used for testing, and changes must have been well tested already.
478− <link xlink:href="https://web.archive.org/web/20160528180406/http://comments.gmane.org/gmane.linux.distributions.nixos/13447">Read
479− policy here</link>.
394+ It's only for non-breaking mass-rebuild commits. That means it's not to be used for testing, and changes must have been well tested already. <link xlink:href="https://web.archive.org/web/20160528180406/http://comments.gmane.org/gmane.linux.distributions.nixos/13447">Read policy here</link>.
480395 </para>
481396 </listitem>
482397 <listitem>
483398 <para>
484− If the branch is already in a broken state, please refrain from adding
485− extra new breakages. Stabilize it for a few days, merge into master, then
486− resume development on staging.
487− <link xlink:href="http://hydra.nixos.org/jobset/nixpkgs/staging#tabs-evaluations">Keep
488− an eye on the staging evaluations here</link>. If any fixes for staging
489− happen to be already in master, then master can be merged into staging.
399+ If the branch is already in a broken state, please refrain from adding extra new breakages. Stabilize it for a few days, merge into master, then resume development on staging. <link xlink:href="http://hydra.nixos.org/jobset/nixpkgs/staging#tabs-evaluations">Keep an eye on the staging evaluations here</link>. If any fixes for staging happen to be already in master, then master can be merged into staging.
490400 </para>
491401 </listitem>
492402 </itemizedlist>
@@ -498,10 +408,7 @@ Additional information.
498408 <itemizedlist>
499409 <listitem>
500410 <para>
501− If you're cherry-picking a commit to a stable release branch, always use
502− <command>git cherry-pick -xe</command> and ensure the message contains a
503− clear description about why this needs to be included in the stable
504− branch.
411+ If you're cherry-picking a commit to a stable release branch, always use <command>git cherry-pick -xe</command> and ensure the message contains a clear description about why this needs to be included in the stable branch.
505412 </para>
506413 <para>
507414 An example of a cherry-picked commit would look like this: