Skip to content

Commit

Permalink
nixpkgs docs: document recursivelyUpdate
Browse files Browse the repository at this point in the history
(cherry picked from commit 0eb3b93)
  • Loading branch information
grahamc committed Oct 12, 2018
1 parent c30b39c commit c834264
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions doc/functions/library/attrsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1671,4 +1671,61 @@ lib.attrsets.recursiveUpdateUntil (path: l: r: path == ["foo"])
]]></programlisting>
</example>
</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>

0 comments on commit c834264

Please sign in to comment.