@@ -99,9 +99,70 @@ in ...</programlisting>
9999
100100</section>
101101
102+<section xml:id="sec-pkg-overrideAttrs">
103+ <title><pkg>.overrideAttrs</title>
104+
105+ <para>
106+ The function <varname>overrideAttrs</varname> allows overriding the
107+ attribute set passed to a <varname>stdenv.mkDerivation</varname> call,
108+ producing a new derivation based on the original one.
109+ This function is available on all derivations produced by the
110+ <varname>stdenv.mkDerivation</varname> function, which is most packages
111+ in the nixpkgs expression <varname>pkgs</varname>.
112+ </para>
113+
114+ <para>
115+ Example usage:
116+
117+ <programlisting>helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec {
118+ separateDebugInfo = true;
119+});</programlisting>
120+ </para>
121+
122+ <para>
123+ In the above example, the <varname>separateDebugInfo</varname> attribute is
124+ overriden to be true, thus building debug info for
125+ <varname>helloWithDebug</varname>, while all other attributes will be
126+ retained from the original <varname>hello</varname> package.
127+ </para>
128+
129+ <para>
130+ The argument <varname>oldAttrs</varname> is conventionally used to refer to
131+ the attr set originally passed to <varname>stdenv.mkDerivation</varname>.
132+ </para>
133+
134+ <note>
135+ <para>
136+ Note that <varname>separateDebugInfo</varname> is processed only by the
137+ <varname>stdenv.mkDerivation</varname> function, not the generated, raw
138+ Nix derivation. Thus, using <varname>overrideDerivation</varname> will
139+ not work in this case, as it overrides only the attributes of the final
140+ derivation. It is for this reason that <varname>overrideAttrs</varname>
141+ should be preferred in (almost) all cases to
142+ <varname>overrideDerivation</varname>, i.e. to allow using
143+ <varname>sdenv.mkDerivation</varname> to process input arguments, as well
144+ as the fact that it is easier to use (you can use the same attribute
145+ names you see in your Nix code, instead of the ones generated (e.g.
146+ <varname>buildInputs</varname> vs <varname>nativeBuildInputs</varname>,
147+ and involves less typing.
148+ </para>
149+ </note>
150+
151+</section>
152+
153+
102154<section xml:id="sec-pkg-overrideDerivation">
103155 <title><pkg>.overrideDerivation</title>
104156
157+ <warning>
158+ <para>You should prefer <varname>overrideAttrs</varname> in almost all
159+ cases, see its documentation for the reasons why.
160+ <varname>overrideDerivation</varname> is not deprecated and will continue
161+ to work, but is less nice to use and does not have as many abilities as
162+ <varname>overrideAttrs</varname>.
163+ </para>
164+ </warning>
165+
105166 <warning>
106167 <para>Do not use this function in Nixpkgs as it evaluates a Derivation
107168 before modifying it, which breaks package abstraction and removes