about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-06-05 18:01:45 +0000
committerGitHub <noreply@github.com>2022-06-05 18:01:45 +0000
commita1bbd60cb76b3fa12ded932d6fa8c1631b35be2b (patch)
treebd7f34afc7447d25f294c315ab383f389ac4b242 /pkgs/stdenv
parent5906c4f6fb0caac301153829c0ed5c7750f31293 (diff)
parenta9df2a4e701148a6ee32eeb5729f3b75d8e31400 (diff)
Merge staging-next into staging
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/adapters.nix10
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix26
2 files changed, 16 insertions, 20 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index 93184c4fc07cd..3e11f7c6c418f 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -21,7 +21,7 @@ let
 
   # Wrap the original `mkDerivation` providing extra args to it.
   extendMkDerivationArgs = old: f: withOldMkDerivation old (_: mkDerivationSuper: args:
-    mkDerivationSuper (args // f args));
+    (mkDerivationSuper args).overrideAttrs f);
 
   # Wrap the original `mkDerivation` transforming the result.
   overrideMkDerivationResult = old: f: withOldMkDerivation old (_: mkDerivationSuper: args:
@@ -60,10 +60,10 @@ rec {
       mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args:
       if stdenv.hostPlatform.isDarwin
       then throw "Cannot build fully static binaries on Darwin/macOS"
-      else mkDerivationSuper (args // {
-        NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static";
-      } // lib.optionalAttrs (!(args.dontAddStaticConfigureFlags or false)) {
-        configureFlags = (args.configureFlags or []) ++ [
+      else (mkDerivationSuper args).overrideAttrs(finalAttrs: {
+        NIX_CFLAGS_LINK = toString (finalAttrs.NIX_CFLAGS_LINK or "") + " -static";
+      } // lib.optionalAttrs (!(finalAttrs.dontAddStaticConfigureFlags or false)) {
+        configureFlags = (finalAttrs.configureFlags or []) ++ [
             "--disable-shared" # brrr...
           ];
       }));
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 395c1586a26b4..5f1a22cee06f3 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