summary refs log tree commit diff
path: root/doc/functions/library/attrsets.xml
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-10-12 16:53:50 -0400
committerGraham Christensen <graham@grahamc.com>2018-10-12 16:54:34 -0400
commit0eb3b93e1ae4ee6cea97768a1f24f90a88635753 (patch)
tree0af9154cb077f82c9c8915a28154f2da934184af /doc/functions/library/attrsets.xml
parentc100a456b1da162ea010e5880cded268aa68cec6 (diff)
downloadnixpkgs-0eb3b93e1ae4ee6cea97768a1f24f90a88635753.tar
nixpkgs-0eb3b93e1ae4ee6cea97768a1f24f90a88635753.tar.gz
nixpkgs-0eb3b93e1ae4ee6cea97768a1f24f90a88635753.tar.bz2
nixpkgs-0eb3b93e1ae4ee6cea97768a1f24f90a88635753.tar.lz
nixpkgs-0eb3b93e1ae4ee6cea97768a1f24f90a88635753.tar.xz
nixpkgs-0eb3b93e1ae4ee6cea97768a1f24f90a88635753.tar.zst
nixpkgs-0eb3b93e1ae4ee6cea97768a1f24f90a88635753.zip
nixpkgs docs: document recursivelyUpdate
Diffstat (limited to 'doc/functions/library/attrsets.xml')
-rw-r--r--doc/functions/library/attrsets.xml57
1 files changed, 57 insertions, 0 deletions
diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml
index a6fa2ea0e29..65d0b40e2e8 100644
--- a/doc/functions/library/attrsets.xml
+++ b/doc/functions/library/attrsets.xml
@@ -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>