2015-01-24 20:40:40 +01:00
|
|
|
<chapter xmlns="http://docbook.org/ns/docbook"
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
xml:id="chap-packageconfig">
|
|
|
|
|
2015-01-25 21:26:05 +01:00
|
|
|
<title>nixpkgs global configuration</title>
|
2015-01-24 20:40:40 +01:00
|
|
|
|
|
|
|
<para>
|
2015-01-25 21:26:05 +01:00
|
|
|
Nix packages can be configured to allow or deny certain
|
|
|
|
options.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To apply the configuration edit <filename>~/.nixpkgs/config.nix</filename>
|
|
|
|
and set it like
|
|
|
|
<programlisting>
|
|
|
|
{
|
|
|
|
allowUnfree = true;
|
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
and will allow the Nix package manager to install unfree licensed packages.
|
|
|
|
|
|
|
|
The configuration as listed also applies for NixOS under <option>nixpkgs.config</option> set.
|
2015-01-24 20:40:40 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2015-01-25 21:26:05 +01:00
|
|
|
Allow installing of packages that are distributed under unfree license by setting
|
2015-01-24 20:40:40 +01:00
|
|
|
<programlisting>
|
2015-01-25 21:26:05 +01:00
|
|
|
allowUnfree = true;
|
2015-01-24 20:40:40 +01:00
|
|
|
</programlisting>
|
|
|
|
or deny them by setting it to <literal>false</literal>.
|
|
|
|
</para>
|
|
|
|
<para>
|
2015-01-25 21:26:05 +01:00
|
|
|
Same can be achieved by setting the environment variable:
|
2015-01-24 20:40:40 +01:00
|
|
|
<programlisting>
|
|
|
|
export NIXPKGS_ALLOW_UNFREE=1
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Whenever unfree packages are not allowed, single packages can
|
2015-01-25 21:26:05 +01:00
|
|
|
still be allowed by a predicate function that accepts package
|
|
|
|
as an argument and should return a boolean:
|
2015-01-24 20:40:40 +01:00
|
|
|
<programlisting>
|
2015-01-25 21:26:05 +01:00
|
|
|
allowUnfreePredicate = (pkg: ...);
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
Example to allow flash player only:
|
|
|
|
<programlisting>
|
|
|
|
allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);
|
2015-01-24 20:40:40 +01:00
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Whenever unfree packages are not allowed, packages can still be
|
|
|
|
whitelisted by their license:
|
|
|
|
<programlisting>
|
2015-01-25 21:26:05 +01:00
|
|
|
whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
|
2015-01-24 20:40:40 +01:00
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
In addition to whitelisting licenses which are denied by the
|
|
|
|
<literal>allowUnfree</literal> setting, you can also explicitely
|
|
|
|
deny installation of packages which have a certain license:
|
|
|
|
<programlisting>
|
2015-01-25 21:26:05 +01:00
|
|
|
blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
|
2015-01-24 20:40:40 +01:00
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
2015-01-25 14:30:27 +01:00
|
|
|
<para>
|
|
|
|
A complete list of licenses can be found in the file
|
2015-01-25 21:26:05 +01:00
|
|
|
<filename>lib/licenses.nix</filename> of the nix package tree.
|
2015-01-25 14:30:27 +01:00
|
|
|
</para>
|
|
|
|
|
2015-01-24 20:40:40 +01:00
|
|
|
</chapter>
|