Skip to content

Commit

Permalink
pkgs/make-derivation.nix: Refactor, hardcode mkDerivationSimple
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Jun 5, 2022
1 parent 7e3c80f commit cd88f86
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let
};

# 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
Expand Down Expand Up @@ -42,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
Expand All @@ -61,7 +61,7 @@ let
f0 self super
else x;
in
makeDerivationExtensible mkDerivationSimple (self: attrs // f self attrs))
makeDerivationExtensible (self: attrs // f self attrs))
attrs;

mkDerivationSimple = overrideAttrs:
Expand Down Expand Up @@ -482,5 +482,5 @@ lib.extendDerivation
in
fnOrAttrs:
if builtins.isFunction fnOrAttrs
then makeDerivationExtensible mkDerivationSimple fnOrAttrs
else makeDerivationExtensibleConst mkDerivationSimple fnOrAttrs
then makeDerivationExtensible fnOrAttrs
else makeDerivationExtensibleConst fnOrAttrs

0 comments on commit cd88f86

Please sign in to comment.