nixos/doc: Add docs for types.anything
This commit is contained in:
parent
6a7d250007
commit
310699319b
1 changed files with 40 additions and 0 deletions
|
@ -54,6 +54,46 @@
|
|||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<varname>types.anything</varname>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A type that accepts any value and recursively merges attribute sets together.
|
||||
This type is recommended when the option type is unknown.
|
||||
<example xml:id="ex-types-anything">
|
||||
<title><literal>types.anything</literal> Example</title>
|
||||
<para>
|
||||
Two definitions of this type like
|
||||
<programlisting>
|
||||
{
|
||||
str = lib.mkDefault "foo";
|
||||
pkg.hello = pkgs.hello;
|
||||
fun.fun = x: x + 1;
|
||||
}
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
{
|
||||
str = lib.mkIf true "bar";
|
||||
pkg.gcc = pkgs.gcc;
|
||||
fun.fun = lib.mkForce (x: x + 2);
|
||||
}
|
||||
</programlisting>
|
||||
will get merged to
|
||||
<programlisting>
|
||||
{
|
||||
str = "bar";
|
||||
pkg.gcc = pkgs.gcc;
|
||||
pkg.hello = pkgs.hello;
|
||||
fun.fun = x: x + 2;
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
</example>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<varname>types.attrs</varname>
|
||||
|
|
Loading…
Reference in a new issue