3
0
Fork 0
forked from mirrors/nixpkgs

nixpkgs docs: document recursivelyUpdate

This commit is contained in:
Graham Christensen 2018-10-12 16:53:50 -04:00
parent c100a456b1
commit 0eb3b93e1a
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -1671,4 +1671,61 @@ lib.attrsets.recursiveUpdateUntil (path: l: r: path == ["foo"])
]]></programlisting> ]]></programlisting>
</example> </example>
</section> </section>
<section xml:id="function-library-lib.attrsets.recursiveUpdate">
<title><function>lib.attrsets.recursiveUpdate</function></title>
<subtitle><literal>recursiveUpdate :: AttrSet -> AttrSet -> AttrSet</literal>
</subtitle>
<xi:include href="./locations.xml" xpointer="lib.attrsets.recursiveUpdate" />
<para>
A recursive variant of the update operator <literal>//</literal>. The
recursion stops when one of the attribute values is not an attribute set, in
which case the right hand side value takes precedence over the left hand
side value.
</para>
<variablelist>
<varlistentry>
<term>
<varname>lhs</varname>
</term>
<listitem>
<para>
The left hand attribute set of the merge.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<varname>rhs</varname>
</term>
<listitem>
<para>
The right hand attribute set of the merge.
</para>
</listitem>
</varlistentry>
</variablelist>
<example xml:id="function-library-lib.attrsets.recursiveUpdate-example">
<title>Recursively merging two attribute sets</title>
<programlisting><![CDATA[
recursiveUpdate
{
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/hda";
}
{
boot.loader.grub.device = "";
}
=> {
boot.loader.grub.enable = true;
boot.loader.grub.device = "";
}
]]></programlisting>
</example>
</section>
</section> </section>