make-derivation: only modify name when name is given

This preserves Nix’s native error handling of missing name:

  error: derivation name missing
wip/yesman
Matthew Bauer 5 years ago
parent 59949aa55c
commit c6f8f8d98d
  1. 4
      pkgs/stdenv/generic/make-derivation.nix

@ -177,9 +177,9 @@ rec {
"checkInputs" "installCheckInputs"
"__impureHostDeps" "__propagatedImpureHostDeps"
"sandboxProfile" "propagatedSandboxProfile"])
// (lib.optionalAttrs (!(attrs ? name))) {
// (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) {
name = "${attrs.pname}-${attrs.version}";
} // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)) {
} // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {
# 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

Loading…
Cancel
Save