diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 395c1586a26b..5f1a22cee06f 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -10,14 +10,8 @@ let inherit (stdenv) hostPlatform; }; - makeOverlayable = mkDerivationSimple: - fnOrAttrs: - if builtins.isFunction fnOrAttrs - then makeDerivationExtensible mkDerivationSimple fnOrAttrs - else makeDerivationExtensibleConst mkDerivationSimple fnOrAttrs; - # Based off lib.makeExtensible, with modifications: - makeDerivationExtensible = mkDerivationSimple: rattrs: + makeDerivationExtensible = 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 @@ -48,14 +42,14 @@ let f0 self super else x; in - makeDerivationExtensible mkDerivationSimple + makeDerivationExtensible (self: let super = rattrs self; in super // f self super)) args; in finalPackage; # makeDerivationExtensibleConst == makeDerivationExtensible (_: attrs), # but pre-evaluated for a slight improvement in performance. - makeDerivationExtensibleConst = mkDerivationSimple: attrs: + makeDerivationExtensibleConst = attrs: mkDerivationSimple (f0: let @@ -67,12 +61,10 @@ let f0 self super else x; in - makeDerivationExtensible mkDerivationSimple (self: attrs // f self attrs)) + makeDerivationExtensible (self: attrs // f self attrs)) attrs; -in - -makeOverlayable (overrideAttrs: + mkDerivationSimple = overrideAttrs: # `mkDerivation` wraps the builtin `derivation` function to @@ -485,6 +477,10 @@ lib.extendDerivation # should be made available to Nix expressions using the # derivation (e.g., in assertions). passthru) - (derivation derivationArg) + (derivation derivationArg); -) +in + fnOrAttrs: + if builtins.isFunction fnOrAttrs + then makeDerivationExtensible fnOrAttrs + else makeDerivationExtensibleConst fnOrAttrs