Merge pull request #120762 from sternenseemann/mkderivation-host-suffix-middle

pkgs/stdenv/make-derivation: move hostSuffix before the version

authored by

John Ericson and committed by
GitHub
8e4fe328 61fd1e15

+11 -4
+11 -4
pkgs/stdenv/generic/make-derivation.nix
··· 200 200 // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 201 201 name = 202 202 let 203 - staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static"; 204 - name' = attrs.name or 205 - "${attrs.pname}${staticMarker}-${attrs.version}"; 203 + # Indicate the host platform of the derivation if cross compiling. 206 204 # Fixed-output derivations like source tarballs shouldn't get a host 207 205 # suffix. But we have some weird ones with run-time deps that are 208 206 # just used for their side-affects. Those might as well since the ··· 210 208 hostSuffix = lib.optionalString 211 209 (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix) 212 210 "-${stdenv.hostPlatform.config}"; 213 - in name' + hostSuffix; 211 + # Disambiguate statically built packages. This was originally 212 + # introduce as a means to prevent nix-env to get confused between 213 + # nix and nixStatic. This should be also achieved by moving the 214 + # hostSuffix before the version, so we could contemplate removing 215 + # it again. 216 + staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static"; 217 + in 218 + if attrs ? name 219 + then attrs.name + hostSuffix 220 + else "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}"; 214 221 }) // { 215 222 builder = attrs.realBuilder or stdenv.shell; 216 223 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];