git.iko.soy/typeable/nixpkgs
on master help sign in
Document about packageOverrides
commit8a78dcc00ff87dc985ad15305b0ebd6739863827 authorSebastian Jordan <sebastian.jordan.mail@googlemail.com> dateMon 20 Apr 2015, 17:54 (12 years ago) parent6bfc1f7
1 file changed+83−49
doc/packageconfig.xml+83−49
doc/packageconfig.xml+83−49
@@ -1,70 +1,104 @@
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
7+<section><title>Allow unfree software</title>
8+
79 <para>
810 Nix packages can be configured to allow or deny certain options.
911 </para>
1012
1113 <para>
12− To apply the configuration edit <filename>~/.nixpkgs/config.nix</filename>
13− and set it like
14+ To apply the configuration edit <filename>~/.nixpkgs/config.nix</filename>
15+ and set it like
1416<programlisting>{
1517 allowUnfree = true;
1618}</programlisting>
17− and will allow the Nix package manager to install unfree licensed packages.
19+ and will allow the Nix package manager to install unfree licensed packages.
1820
19− The configuration as listed also applies to NixOS under <option>nixpkgs.config</option> set.
21+ The configuration as listed also applies to NixOS under <option>nixpkgs.config</option> set.
2022 </para>
2123
2224 <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>
34−
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>
41−
42− Example to allow flash player only:
43− <programlisting>allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);</programlisting>
44− </para>
45− </listitem>
46−
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>
54−
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>
25+ <listitem>
26+ <para>
27+ Allow installing of packages that are distributed under unfree license by setting
28+ <programlisting>allowUnfree = true;</programlisting>
29+ or deny them by setting it to <literal>false</literal>.
30+ </para>
31+ <para>
32+ Same can be achieved by setting the environment variable:
33+ <programlisting>$ export NIXPKGS_ALLOW_UNFREE=1</programlisting>
34+ </para>
35+ </listitem>
36+
37+ <listitem>
38+ <para>
39+ Whenever unfree packages are not allowed, single packages can
40+ still be allowed by a predicate function that accepts package
41+ as an argument and should return a boolean:
42+ <programlisting>allowUnfreePredicate = (pkg: ...);</programlisting>
43+
44+ Example to allow flash player only:
45+ <programlisting>allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);</programlisting>
46+ </para>
47+ </listitem>
48+
49+ <listitem>
50+ <para>
51+ Whenever unfree packages are not allowed, packages can still be
52+ whitelisted by their license:
53+ <programlisting>whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];</programlisting>
54+ </para>
55+ </listitem>
56+
57+ <listitem>
58+ <para>
59+ In addition to whitelisting licenses which are denied by the
60+ <literal>allowUnfree</literal> setting, you can also explicitely
61+ deny installation of packages which have a certain license:
62+ <programlisting>blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];</programlisting>
63+ </para>
64+ </listitem>
6365 </itemizedlist>
6466
6567 <para>
66− A complete list of licenses can be found in the file
67− <filename>lib/licenses.nix</filename> of the nix package tree.
68+ A complete list of licenses can be found in the file
69+ <filename>lib/licenses.nix</filename> of the nix package tree.
6870 </para>
71+</section>
72+
73+<section><title>Overriding existing packages</title>
74+
75+<para>
76+ <filename>~/.nixpkgs/config.nix</filename> enables the user to
77+ override package names without creating a fork of the Nixpkgs.
78+ This is accomplished by defining a function called
79+ <varname>packageOverrides</varname>. It takes the set of
80+ packages, usually called <varname>pkgs</varname>, and returns a
81+ modified set of packages.
82+</para>
83+<para>
84+ Here is an example. Say we want to install
85+ <varname>xbmc</varname> but we want to use another Python
86+ version when running <varname>xbmc</varname>.
87+
88+<programlisting>
89+packageOverrides = pkgs: rec {
90+ xbmc = pkgs.xbmc.override {
91+ python = pkgs.python26;
92+ };
93+};
94+</programlisting>
95+
96+ Further information is available at the <command
97+ xlink:href="https://nixos.org/wiki/Nix_Modifying_Packages">Nix
98+ wiki</command>
99+
100+</para>
101+
102+</section>
69103
70−</chapter>
104+</chapter>