summary refs log tree commit diff
path: root/doc/functions.xml
diff options
context:
space:
mode:
authorLuca Bruno <lethalman88@gmail.com>2015-07-30 17:56:16 +0200
committerLuca Bruno <lethalman88@gmail.com>2015-07-30 17:56:39 +0200
commit5dfb469faf199838b8c09e82b8778925e7fe307e (patch)
tree9273705239a7492018e99f4e8e02c16493a4fa33 /doc/functions.xml
parent97dd0dae7489cda16d8897aa289c3a9cd4f7ac56 (diff)
downloadnixpkgs-5dfb469faf199838b8c09e82b8778925e7fe307e.tar
nixpkgs-5dfb469faf199838b8c09e82b8778925e7fe307e.tar.gz
nixpkgs-5dfb469faf199838b8c09e82b8778925e7fe307e.tar.bz2
nixpkgs-5dfb469faf199838b8c09e82b8778925e7fe307e.tar.lz
nixpkgs-5dfb469faf199838b8c09e82b8778925e7fe307e.tar.xz
nixpkgs-5dfb469faf199838b8c09e82b8778925e7fe307e.tar.zst
nixpkgs-5dfb469faf199838b8c09e82b8778925e7fe307e.zip
doc: document .overrideDerivation
Diffstat (limited to 'doc/functions.xml')
-rw-r--r--doc/functions.xml38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/functions.xml b/doc/functions.xml
index 2aae3cfb2ae..aec8a57c21a 100644
--- a/doc/functions.xml
+++ b/doc/functions.xml
@@ -85,6 +85,44 @@ in ...</programlisting>
 
 </section>
 
+<section xml:id="sec-pkg-overrideDerivation">
+  <title>&lt;pkg&gt;.overrideDerivation</title>
+
+  <para>
+    The function <varname>overrideDerivation</varname> is usually available for all the
+    derivations in the nixpkgs expression (<varname>pkgs</varname>).
+  </para> 
+  <para>
+    It is used to create a new derivation by overriding the attributes of
+    the original derivation according to the given function.
+  </para>
+
+  <para>
+    Example usage:
+
+    <programlisting>mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
+  name = "sed-4.2.2-pre";
+  src = fetchurl {
+    url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2;
+    sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k";
+  };
+  patches = [];
+});</programlisting>
+  </para>
+
+  <para>
+    In the above example, the name, src and patches of the derivation
+    will be overridden, while all other attributes will be retained from the
+    original derivation.
+  </para>
+
+  <para>
+    The argument <varname>oldAttrs</varname> is used to refer to the attribute set of
+    the original derivation.
+  </para>
+
+</section>
+
 <section xml:id="sec-lib-makeOverridable">
   <title>lib.makeOverridable</title>