summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/functions.xml32
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/functions.xml b/doc/functions.xml
index 89f2fda0ad4b..2aae3cfb2aec 100644
--- a/doc/functions.xml
+++ b/doc/functions.xml
@@ -85,4 +85,36 @@ in ...</programlisting>
 
 </section>
 
+<section xml:id="sec-lib-makeOverridable">
+  <title>lib.makeOverridable</title>
+
+  <para>
+    The function <varname>lib.makeOverridable</varname> is used make the result
+    of a function easily customizable. This utility only makes sense for functions
+    that accept an argument set and return an attribute set.
+  </para>
+
+  <para>
+    Example usage:
+
+    <programlisting>f = { a, b }: { result = a+b; }
+c = lib.makeOverridable f { a = 1; b = 2; }</programlisting>
+
+  </para>
+
+  <para>
+    The variable <varname>c</varname> is the value of the <varname>f</varname> function
+    applied with some default arguments. Hence the value of <varname>c.result</varname>
+    is <literal>3</literal>, in this example.
+  </para>
+
+  <para>
+    The variable <varname>c</varname> however also has some additional functions, like
+    <link linkend="sec-pkg-override">c.override</link> which can be used to
+    override the default arguments. In this example the value of
+    <varname>(c.override { a = 4; }).result</varname> is 6.
+  </para>
+
+</section>
+
 </chapter>