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>2021-04-27 00:15:12 +0000
committerGitHub <noreply@github.com>2021-04-27 00:15:12 +0000
commit489dda009032917d6b9e8cdf9ccc73e6b40fd292 (patch)
tree0cdf8a75f7679146b39484d2ed31674168512f2b /pkgs/stdenv
parent80d6d85deff8f33bf91bfdb432b9d3aa088d4ac8 (diff)
parent2b9663d530516888a66979dd2c5578a4aed855a0 (diff)
downloadnixpkgs-489dda009032917d6b9e8cdf9ccc73e6b40fd292.tar
nixpkgs-489dda009032917d6b9e8cdf9ccc73e6b40fd292.tar.gz
nixpkgs-489dda009032917d6b9e8cdf9ccc73e6b40fd292.tar.bz2
nixpkgs-489dda009032917d6b9e8cdf9ccc73e6b40fd292.tar.lz
nixpkgs-489dda009032917d6b9e8cdf9ccc73e6b40fd292.tar.xz
nixpkgs-489dda009032917d6b9e8cdf9ccc73e6b40fd292.tar.zst
nixpkgs-489dda009032917d6b9e8cdf9ccc73e6b40fd292.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index f7cddb19c47..4536024c511 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -200,9 +200,7 @@ in rec {
         // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
           name =
             let
-              staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static";
-              name' = attrs.name or
-                "${attrs.pname}${staticMarker}-${attrs.version}";
+              # Indicate the host platform of the derivation if cross compiling.
               # Fixed-output derivations like source tarballs shouldn't get a host
               # suffix. But we have some weird ones with run-time deps that are
               # just used for their side-affects. Those might as well since the
@@ -210,7 +208,16 @@ in rec {
               hostSuffix = lib.optionalString
                 (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)
                 "-${stdenv.hostPlatform.config}";
-            in name' + hostSuffix;
+              # Disambiguate statically built packages. This was originally
+              # introduce as a means to prevent nix-env to get confused between
+              # nix and nixStatic. This should be also achieved by moving the
+              # hostSuffix before the version, so we could contemplate removing
+              # it again.
+              staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static";
+            in
+              if attrs ? name
+              then attrs.name + hostSuffix
+              else "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}";
         }) // {
           builder = attrs.realBuilder or stdenv.shell;
           args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];