diff options
author | John Ericson <git@JohnEricson.me> | 2021-04-26 15:14:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-26 15:14:03 -0400 |
commit | 8e4fe32876ca15e3d5eb3ecd3ca0b224417f5f17 (patch) | |
tree | 0013dcaeb835a95e427369ff6dcb586e3ad3307d | |
parent | 61fd1e15953be7059f1bf7a4a15ebfd684bf2cf0 (diff) | |
parent | b0c26d2c4038d2768b9b0191ddeed16377419f7b (diff) |
Merge pull request #120762 from sternenseemann/mkderivation-host-suffix-middle
pkgs/stdenv/make-derivation: move hostSuffix before the version
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index de1b1abd6155f..730c90c227c53 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)]; |