···200200 // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
201201 name =
202202 let
203203- staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static";
204204- name' = attrs.name or
205205- "${attrs.pname}${staticMarker}-${attrs.version}";
203203+ # Indicate the host platform of the derivation if cross compiling.
206204 # Fixed-output derivations like source tarballs shouldn't get a host
207205 # suffix. But we have some weird ones with run-time deps that are
208206 # just used for their side-affects. Those might as well since the
···210208 hostSuffix = lib.optionalString
211209 (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)
212210 "-${stdenv.hostPlatform.config}";
213213- in name' + hostSuffix;
211211+ # Disambiguate statically built packages. This was originally
212212+ # introduce as a means to prevent nix-env to get confused between
213213+ # nix and nixStatic. This should be also achieved by moving the
214214+ # hostSuffix before the version, so we could contemplate removing
215215+ # it again.
216216+ staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static";
217217+ in
218218+ if attrs ? name
219219+ then attrs.name + hostSuffix
220220+ else "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}";
214221 }) // {
215222 builder = attrs.realBuilder or stdenv.shell;
216223 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];