1 <chapter xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
5 <title>Meta-attributes</title>
7 <para>Nix packages can declare <emphasis>meta-attributes</emphasis>
8 that contain information about a package such as a description, its
9 homepage, its license, and so on. For instance, the GNU Hello package
10 has a <varname>meta</varname> declaration like this:
14 description = "A program that produces a familiar, friendly greeting";
16 GNU Hello is a program that prints "Hello, world!" when you run it.
17 It is fully customizable.
19 homepage = http://www.gnu.org/software/hello/manual/;
26 <para>Meta-attributes are not passed to the builder of the package.
27 Thus, a change to a meta-attribute doesn’t trigger a recompilation of
28 the package. The value of a meta-attribute must a string.</para>
30 <para>The meta-attributes of a package can be queried from the
31 command-line using <command>nix-env</command>:
34 $ nix-env -qa hello --meta --xml
35 <?xml version='1.0' encoding='utf-8'?>
37 <item attrPath="hello" name="hello-2.3" system="i686-linux">
38 <meta name="description" value="A program that produces a familiar, friendly greeting" />
39 <meta name="homepage" value="http://www.gnu.org/software/hello/manual/" />
40 <meta name="license" value="GPLv3+" />
41 <meta name="longDescription" value="GNU Hello is a program that prints &quot;Hello, world!&quot; when you run it.&#xA;It is fully customizable.&#xA;" />
46 <command>nix-env</command> knows about the
47 <varname>description</varname> field specifically:
50 $ nix-env -qa hello --description
51 hello-2.3 A program that produces a familiar, friendly greeting
57 <section><title>Standard meta-attributes</title>
59 <para>The following meta-attributes have a standard
60 interpretation:</para>
65 <term><varname>description</varname></term>
66 <listitem><para>A short (one-line) description of the package.
67 This is shown by <command>nix-env -q --description</command> and
68 also on the Nixpkgs release pages.</para>
70 <para>Don’t include a period at the end. Don’t include newline
71 characters. Capitalise the first character. For brevity, don’t
72 repeat the name of package — just describe what it does.</para>
74 <para>Wrong: <literal>"libpng is a library that allows you to decode PNG images."</literal></para>
76 <para>Right: <literal>"A library for decoding PNG images"</literal></para>
82 <term><varname>longDescription</varname></term>
83 <listitem><para>An arbitrarily long description of the
84 package.</para></listitem>
88 <term><varname>homepage</varname></term>
89 <listitem><para>The package’s homepage. Example:
90 <literal>http://www.gnu.org/software/hello/manual/</literal></para></listitem>
94 <term><varname>license</varname></term>
95 <listitem><para>The license for the package. See below for the
96 allowed values.</para></listitem>
100 <term><varname>maintainers</varname></term>
101 <listitem><para>A list of names and e-mail addresses of the
102 maintainers of this Nix expression, e.g. <literal>["Alice
103 <alice@example.org>" "Bob <bob@example.com>"]</literal>. If
104 you are the maintainer of multiple packages, you may want to add
106 xlink:href="https://svn.nixos.org/repos/nix/nixpkgs/trunk/pkgs/lib/maintainers.nix"><filename>pkgs/lib/maintainers.nix</filename></link>
107 and write something like <literal>[stdenv.lib.maintainers.alice
108 stdenv.lib.maintainers.bob]</literal>.</para></listitem>
112 <term><varname>priority</varname></term>
113 <listitem><para>The <emphasis>priority</emphasis> of the package,
114 used by <command>nix-env</command> to resolve file name conflicts
115 between packages. See the Nix manual page for
116 <command>nix-env</command> for details. Example:
117 <literal>"10"</literal> (a low-priority
118 package).</para></listitem>
127 <section xml:id="sec-meta-license"><title>Licenses</title>
129 <note><para>This is just a first attempt at standardising the license
130 attribute.</para></note>
132 <para>The <varname>meta.license</varname> attribute must be one of the
138 <term><varname>GPL</varname></term>
139 <listitem><para>GNU General Public License; version not
140 specified.</para></listitem>
144 <term><varname>GPLv2</varname></term>
145 <listitem><para>GNU General Public License, version
150 <term><varname>GPLv2+</varname></term>
151 <listitem><para>GNU General Public License, version
152 2 or higher.</para></listitem>
156 <term><varname>GPLv3</varname></term>
157 <listitem><para>GNU General Public License, version
162 <term><varname>GPLv3+</varname></term>
163 <listitem><para>GNU General Public License, version
164 3 or higher.</para></listitem>
168 <term><varname>bsd</varname></term>
169 <listitem><para>Catch-all for licenses that are essentially
171 xlink:href="http://www.gnu.org/licenses/license-list.html#ModifiedBSD">the
172 original BSD license with the advertising clause removed</link>,
173 i.e. permissive non-copyleft free software licenses. This
175 xlink:href="http://www.gnu.org/licenses/license-list.html#X11License">X11
176 (“MIT”) License</link>.</para></listitem>
180 <term><varname>free</varname></term>
181 <listitem><para>Catch-all for free software licenses not listed
182 above.</para></listitem>
186 <term><varname>free-copyleft</varname></term>
187 <listitem><para>Catch-all for free, copyleft software licenses not
188 listed above.</para></listitem>
192 <term><varname>free-non-copyleft</varname></term>
193 <listitem><para>Catch-all for free, non-copyleft software licenses
194 not listed above.</para></listitem>
198 <term><varname>unfree-redistributable</varname></term>
199 <listitem><para>Unfree package that can be redistributed in binary
200 form. That is, it’s legal to redistribute the
201 <emphasis>output</emphasis> of the derivation. This means that
202 the package can be included in the Nixpkgs
205 <para>Sometimes proprietary software can only be redistributed
206 unmodified. Make sure the builder doesn’t actually modify the
207 original binaries; otherwise we’re breaking the license. For
208 instance, the NVIDIA X11 drivers can be redistributed unmodified,
209 but our builder applies <command>patchelf</command> to make them
210 work. Thus, its license is <varname>unfree</varname> and it
211 cannot be included in the Nixpkgs channel.</para></listitem>
215 <term><varname>unfree</varname></term>
216 <listitem><para>Unfree package that cannot be redistributed. You
217 can build it yourself, but you cannot redistribute the output of
218 the derivation. Thus it cannot be included in the Nixpkgs
219 channel.</para></listitem>
223 <term><varname>unfree-redistributable-firmware</varname></term>
224 <listitem><para>This package supplies unfree, redistributable
225 firmware. This is a separate value from
226 <varname>unfree-redistributable</varname> because not everybody
227 cares whether firmware is free.</para></listitem>