@@ -1,6 +1,6 @@
11<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="chap-packageconfig">
2+ xmlns:xlink="http://www.w3.org/1999/xlink"
3+ xml:id="chap-packageconfig">
44
55<title><filename>~/.nixpkgs/config.nix</filename>: global configuration</title>
66
@@ -9,62 +9,79 @@
99 </para>
1010
1111 <para>
12− To apply the configuration edit <filename>~/.nixpkgs/config.nix</filename>
13− and set it like
12+ To apply the configuration edit <filename>~/.nixpkgs/config.nix</filename>
13+ and set it like
1414<programlisting>{
1515 allowUnfree = true;
1616}</programlisting>
17− and will allow the Nix package manager to install unfree licensed packages.
17+ and will allow the Nix package manager to install unfree licensed packages.
1818
19− The configuration as listed also applies to NixOS under <option>nixpkgs.config</option> set.
19+ The configuration as listed also applies to NixOS under <option>nixpkgs.config</option> set.
2020 </para>
2121
2222 <itemizedlist>
23− <listitem>
24− <para>
25− Allow installing of packages that are distributed under unfree license by setting
26− <programlisting>allowUnfree = true;</programlisting>
27− or deny them by setting it to <literal>false</literal>.
28− </para>
29− <para>
30− Same can be achieved by setting the environment variable:
31− <programlisting>$ export NIXPKGS_ALLOW_UNFREE=1</programlisting>
32− </para>
33− </listitem>
23+ <listitem>
24+ <para>
25+ Allow installing of packages that are distributed under unfree license by setting
26+ <programlisting>allowUnfree = true;</programlisting>
27+ or deny them by setting it to <literal>false</literal>.
28+ </para>
29+ <para>
30+ Same can be achieved by setting the environment variable:
31+ <programlisting>$ export NIXPKGS_ALLOW_UNFREE=1</programlisting>
32+ </para>
33+ </listitem>
3434
35− <listitem>
36− <para>
37− Whenever unfree packages are not allowed, single packages can
38− still be allowed by a predicate function that accepts package
39− as an argument and should return a boolean:
40− <programlisting>allowUnfreePredicate = (pkg: ...);</programlisting>
35+ <listitem>
36+ <para>
37+ Whenever unfree packages are not allowed, single packages can
38+ still be allowed by a predicate function that accepts package
39+ as an argument and should return a boolean:
40+ <programlisting>allowUnfreePredicate = (pkg: ...);</programlisting>
4141
42− Example to allow flash player only:
43− <programlisting>allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);</programlisting>
44− </para>
45− </listitem>
42+ Example to allow flash player only:
43+ <programlisting>allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);</programlisting>
44+ </para>
45+ </listitem>
4646
47− <listitem>
48− <para>
49− Whenever unfree packages are not allowed, packages can still be
50− whitelisted by their license:
51− <programlisting>whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];</programlisting>
52− </para>
53− </listitem>
47+ <listitem>
48+ <para>
49+ Whenever unfree packages are not allowed, packages can still be
50+ whitelisted by their license:
51+ <programlisting>whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];</programlisting>
52+ </para>
53+ </listitem>
5454
55− <listitem>
56− <para>
57− In addition to whitelisting licenses which are denied by the
58− <literal>allowUnfree</literal> setting, you can also explicitely
59− deny installation of packages which have a certain license:
60− <programlisting>blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];</programlisting>
61− </para>
62− </listitem>
55+ <listitem>
56+ <para>
57+ In addition to whitelisting licenses which are denied by the
58+ <literal>allowUnfree</literal> setting, you can also explicitely
59+ deny installation of packages which have a certain license:
60+ <programlisting>blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];</programlisting>
61+ </para>
62+ </listitem>
6363 </itemizedlist>
6464
6565 <para>
66− A complete list of licenses can be found in the file
67− <filename>lib/licenses.nix</filename> of the nix package tree.
66+ A complete list of licenses can be found in the file
67+ <filename>lib/licenses.nix</filename> of the nix package tree.
6868 </para>
6969
70−</chapter>
70+<section><title>Modify packages via <literal>packageOverrides</literal></title>
71+
72+<para>
73+
74+ You can define a function called <varname>packageOverrides</varname>
75+ in your local <filename>~/.nixpkgs/config</filename> to overide nix
76+ packages. It must be a function that takes pkgs as an argument and
77+ return modified set of packages.
78+
79+ <programlisting>{
80+ packageOverrides = pkgs: rec {
81+ foo = pkgs.foo.override { ... };
82+ };
83+}</programlisting>
84+</para>
85+</section>
86+
87+</chapter>