summary refs log tree commit diff
path: root/doc/using
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2021-12-23 21:03:23 +0100
committerRobert Hensing <robert@roberthensing.nl>2022-05-02 08:49:31 +0200
commit1bbb5a14c89427241ec2d7d6c55724332dd59803 (patch)
treeb044b07a5d248d9b71e8b8413663980e6c26d124 /doc/using
parentd629ba27d963664282253e6bf32d0f1a38af796a (diff)
downloadnixpkgs-1bbb5a14c89427241ec2d7d6c55724332dd59803.tar
nixpkgs-1bbb5a14c89427241ec2d7d6c55724332dd59803.tar.gz
nixpkgs-1bbb5a14c89427241ec2d7d6c55724332dd59803.tar.bz2
nixpkgs-1bbb5a14c89427241ec2d7d6c55724332dd59803.tar.lz
nixpkgs-1bbb5a14c89427241ec2d7d6c55724332dd59803.tar.xz
nixpkgs-1bbb5a14c89427241ec2d7d6c55724332dd59803.tar.zst
nixpkgs-1bbb5a14c89427241ec2d7d6c55724332dd59803.zip
doc/using/overrides: Update for overlay style mkDerivation overrideAttrs
Diffstat (limited to 'doc/using')
-rw-r--r--doc/using/overrides.chapter.md8
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/using/overrides.chapter.md b/doc/using/overrides.chapter.md
index 66e5103531a..6e69423fe5f 100644
--- a/doc/using/overrides.chapter.md
+++ b/doc/using/overrides.chapter.md
@@ -39,14 +39,18 @@ The function `overrideAttrs` allows overriding the attribute set passed to a `st
 Example usage:
 
 ```nix
-helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec {
+helloWithDebug = pkgs.hello.overrideAttrs (finalAttrs: previousAttrs: {
   separateDebugInfo = true;
 });
 ```
 
 In the above example, the `separateDebugInfo` attribute is overridden to be true, thus building debug info for `helloWithDebug`, while all other attributes will be retained from the original `hello` package.
 
-The argument `oldAttrs` is conventionally used to refer to the attr set originally passed to `stdenv.mkDerivation`.
+The argument `previousAttrs` is conventionally used to refer to the attr set originally passed to `stdenv.mkDerivation`.
+
+The argument `finalAttrs` refers to the final attributes passed to `mkDerivation`, plus the `public` attribute which is the result of `mkDerivation` — the derivation or package.
+
+If only a one-argument function is written, the argument has the meaning of `previousAttrs`.
 
 ::: {.note}
 Note that `separateDebugInfo` is processed only by the `stdenv.mkDerivation` function, not the generated, raw Nix derivation. Thus, using `overrideDerivation` will not work in this case, as it overrides only the attributes of the final derivation. It is for this reason that `overrideAttrs` should be preferred in (almost) all cases to `overrideDerivation`, i.e. to allow using `stdenv.mkDerivation` to process input arguments, as well as the fact that it is easier to use (you can use the same attribute names you see in your Nix code, instead of the ones generated (e.g. `buildInputs` vs `nativeBuildInputs`), and it involves less typing).