2016-08-29 00:54:25 -07:00
<section xmlns= "http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="sec-meta-attributes">
2018-05-01 16:57:09 -07:00
<title > Meta Attributes</title>
2016-08-29 00:54:25 -07:00
2018-05-01 16:57:09 -07:00
<para >
2019-09-18 13:13:35 -07:00
Like Nix packages, NixOS modules can declare meta-attributes to provide extra information. Module meta attributes are defined in the <filename
xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/misc/meta.nix">meta.nix</filename> special module.
2018-05-01 16:57:09 -07:00
</para>
2016-08-29 00:54:25 -07:00
2018-05-01 16:57:09 -07:00
<para >
2019-09-18 13:13:35 -07:00
<literal > meta</literal> is a top level attribute like <literal > options</literal> and <literal > config</literal> . Available meta-attributes are <literal > maintainers</literal> and <literal > doc</literal> .
2018-05-01 16:57:09 -07:00
</para>
2016-08-29 00:54:25 -07:00
2018-05-01 16:57:09 -07:00
<para >
Each of the meta-attributes must be defined at most once per module file.
</para>
2016-08-29 00:54:25 -07:00
<programlisting >
{ config, lib, pkgs, ... }:
{
options = {
...
};
2016-08-29 02:34:24 -07:00
2016-08-29 00:54:25 -07:00
config = {
...
};
2016-08-29 02:34:24 -07:00
2016-08-29 00:54:25 -07:00
meta = {
2016-08-29 02:34:24 -07:00
maintainers = with lib.maintainers; [ ericsagnes ]; <co
2016-08-29 00:54:25 -07:00
xml:id='modules-meta-1' />
doc = ./default.xml; <co xml:id= 'modules-meta-2' />
};
}
</programlisting>
2018-05-01 16:57:09 -07:00
<calloutlist >
<callout arearefs= 'modules-meta-1' >
<para >
2016-08-29 00:54:25 -07:00
<varname > maintainers</varname> contains a list of the module maintainers.
2018-05-01 16:57:09 -07:00
</para>
</callout>
<callout arearefs= 'modules-meta-2' >
<para >
2019-09-18 13:13:35 -07:00
<varname > doc</varname> points to a valid DocBook file containing the module documentation. Its contents is automatically added to <xref
linkend="ch-configuration"/>. Changes to a module documentation have to be checked to not break building the NixOS manual:
2018-05-01 16:57:09 -07:00
</para>
<programlisting > $ nix-build nixos/release.nix -A manual</programlisting>
</callout>
</calloutlist>
2016-08-29 00:54:25 -07:00
</section>