at 18.09-beta 1.8 kB view raw
1<section xmlns="http://docbook.org/ns/docbook" 2 xmlns:xlink="http://www.w3.org/1999/xlink" 3 xmlns:xi="http://www.w3.org/2001/XInclude" 4 version="5.0" 5 xml:id="sec-meta-attributes"> 6 <title>Meta Attributes</title> 7 8 <para> 9 Like Nix packages, NixOS modules can declare meta-attributes to provide extra 10 information. Module meta attributes are defined in the 11 <filename 12 xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/misc/meta.nix">meta.nix</filename> 13 special module. 14 </para> 15 16 <para> 17 <literal>meta</literal> is a top level attribute like 18 <literal>options</literal> and <literal>config</literal>. Available 19 meta-attributes are <literal>maintainers</literal> and 20 <literal>doc</literal>. 21 </para> 22 23 <para> 24 Each of the meta-attributes must be defined at most once per module file. 25 </para> 26 27<programlisting> 28{ config, lib, pkgs, ... }: 29{ 30 options = { 31 ... 32 }; 33 34 config = { 35 ... 36 }; 37 38 meta = { 39 maintainers = with lib.maintainers; [ ericsagnes ]; <co 40 xml:id='modules-meta-1' /> 41 doc = ./default.xml; <co xml:id='modules-meta-2' /> 42 }; 43} 44</programlisting> 45 46 <calloutlist> 47 <callout arearefs='modules-meta-1'> 48 <para> 49 <varname>maintainers</varname> contains a list of the module maintainers. 50 </para> 51 </callout> 52 <callout arearefs='modules-meta-2'> 53 <para> 54 <varname>doc</varname> points to a valid DocBook file containing the module 55 documentation. Its contents is automatically added to 56 <xref 57 linkend="ch-configuration"/>. Changes to a module documentation 58 have to be checked to not break building the NixOS manual: 59 </para> 60<programlisting>$ nix-build nixos/release.nix -A manual</programlisting> 61 </callout> 62 </calloutlist> 63</section>