summaryrefslogtreecommitdiffstats
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-01-11 09:07:58 +0100
committerRobert Hensing <robert@roberthensing.nl>2022-05-02 08:49:32 +0200
commit37ab5b43963f51f939b9c031a0dd824d82b41259 (patch)
tree0f25a71370aee3fc532a57c6c31d1cd06e733dc3 /pkgs/stdenv
parent1bbb5a14c89427241ec2d7d6c55724332dd59803 (diff)
mkDerivation: Add error hint for infinite recursion
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index afb6eed632a9..3e3a7aa790db 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -19,7 +19,14 @@ let
# Based off lib.makeExtensible, with modifications:
makeDerivationExtensible = mkDerivationSimple: rattrs:
let
+ # NOTE: The following is a hint that will be printed by the Nix cli when
+ # encountering an infinite recursion. It must not be formatted into
+ # separate lines, because Nix would only show the last line of the comment.
+
+ # An infinite recursion here can be caused by having the attribute names of expression `e` in `.overrideAttrs(finalAttrs: previousAttrs: e)` depend on `finalAttrs`. Only the attribute values of `e` can depend on `finalAttrs`.
args = rattrs (args // { inherit public; });
+ # ^^^^
+
public =
mkDerivationSimple
(f0: