summary refs log tree commit diff
path: root/doc/functions.xml
diff options
context:
space:
mode:
authorLuca Bruno <lethalman88@gmail.com>2015-06-30 11:26:14 +0200
committerLuca Bruno <lethalman88@gmail.com>2015-06-30 11:26:27 +0200
commit01ce5ce0501327d37aa123c0ded432a5b87cea4b (patch)
tree59b4b4314c140776ee1abd567039ee07aae25ce0 /doc/functions.xml
parentea925c72e7da38e0cd9956325746440196e7e75c (diff)
downloadnixlib-01ce5ce0501327d37aa123c0ded432a5b87cea4b.tar
nixlib-01ce5ce0501327d37aa123c0ded432a5b87cea4b.tar.gz
nixlib-01ce5ce0501327d37aa123c0ded432a5b87cea4b.tar.bz2
nixlib-01ce5ce0501327d37aa123c0ded432a5b87cea4b.tar.lz
nixlib-01ce5ce0501327d37aa123c0ded432a5b87cea4b.tar.xz
nixlib-01ce5ce0501327d37aa123c0ded432a5b87cea4b.tar.zst
nixlib-01ce5ce0501327d37aa123c0ded432a5b87cea4b.zip
doc: document .override
Diffstat (limited to 'doc/functions.xml')
-rw-r--r--doc/functions.xml31
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/functions.xml b/doc/functions.xml
index 16f4f262a25f..89f2fda0ad4b 100644
--- a/doc/functions.xml
+++ b/doc/functions.xml
@@ -54,4 +54,35 @@ in ...</programlisting>
 
 </section>
 
+<section xml:id="sec-pkg-override">
+  <title>&lt;pkg&gt;.override</title>
+
+  <para>
+    The function <varname>override</varname> is usually available for all the
+    derivations in the nixpkgs expression (<varname>pkgs</varname>).
+  </para>
+  <para>
+    It is used to override the arguments passed to a function.
+  </para>
+  <para>
+    Example usages:
+
+    <programlisting>pkgs.foo.override { arg1 = val1; arg2 = val2; ... }</programlisting>
+    <programlisting>pkgs.overridePackages (self: super: {
+  foo = super.foo.override { barSupport = true ; };
+})</programlisting>
+    <programlisting>mypkg = pkgs.callPackage ./mypkg.nix {
+  mydep = pkgs.mydep.override { ... };
+})</programlisting>
+  </para>
+
+  <para>
+    In the first example, <varname>pkgs.foo</varname> is the result of a function call
+    with some default arguments, usually a derivation.
+    Using <varname>pkgs.foo.override</varname> will call the same function with
+    the given new arguments.
+  </para>
+
+</section>
+
 </chapter>