mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
Merge pull request #55053 from vbgl/mkderivation-lazy-name
mkDerivation: cleaner handling of the `name` argument
This commit is contained in:
commit
2c31b950e1
@ -28,7 +28,7 @@ let params =
|
||||
propagatedBuildInputs = [ coq-ext-lib simple-io ];
|
||||
};
|
||||
};
|
||||
param = params."${coq.coq-version}" or params."8.8";
|
||||
param = params."${coq.coq-version}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -20,7 +20,7 @@ let params =
|
||||
sha256 = "0l9885nxy0n955fj1gnijlxl55lyxiv9yjfmz8hmfrn9hl8vv1m2";
|
||||
};
|
||||
};
|
||||
param = params."${coq.coq-version}" or params."8.8";
|
||||
param = params."${coq.coq-version}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -18,7 +18,7 @@ let
|
||||
"8.7" = v20180709;
|
||||
"8.8" = v20181016;
|
||||
};
|
||||
param = params."${coq.coq-version}" or params."8.8";
|
||||
param = params."${coq.coq-version}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -26,7 +26,7 @@ let params =
|
||||
sha256 = "09dq1vvshhlhgjccrhqgbhnq2hrys15xryfszqq11rzpgvl2zgdv";
|
||||
};
|
||||
};
|
||||
param = params."${coq.coq-version}" or params."8.8";
|
||||
param = params."${coq.coq-version}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -14,7 +14,7 @@ let params =
|
||||
"8.8" = v_8_8;
|
||||
"8.9" = v_8_8;
|
||||
};
|
||||
param = params."${coq.coq-version}" or params."8.9"
|
||||
param = params."${coq.coq-version}"
|
||||
; in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -22,7 +22,7 @@ let params = {
|
||||
sha256 = "0qvar8gfbrcs9fmvkph5asqz4l5fi63caykx3bsn8zf0xllkwv0n";
|
||||
};
|
||||
};
|
||||
param = params."${coq.coq-version}" or params."8.8";
|
||||
param = params."${coq.coq-version}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
|
@ -26,7 +26,7 @@ let
|
||||
sha256 = "1sj7vyarmvp1w5kvbhgpgap1yd0yrj4n1jrla0wv70k0jrq5hhpz";
|
||||
};
|
||||
};
|
||||
param = params."${coq.coq-version}" or params."8.8";
|
||||
param = params."${coq.coq-version}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -12,7 +12,7 @@ rec {
|
||||
# * https://nixos.org/nix/manual/#ssec-derivation
|
||||
# Explanation about derivations in general
|
||||
mkDerivation =
|
||||
{ name ? ""
|
||||
{
|
||||
|
||||
# These types of dependencies are all exhaustively documented in
|
||||
# the "Specifying Dependencies" section of the "Standard
|
||||
@ -21,7 +21,7 @@ rec {
|
||||
# TODO(@Ericson2314): Stop using legacy dep attribute names
|
||||
|
||||
# host offset -> target offset
|
||||
, depsBuildBuild ? [] # -1 -> -1
|
||||
depsBuildBuild ? [] # -1 -> -1
|
||||
, depsBuildBuildPropagated ? [] # -1 -> -1
|
||||
, nativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name
|
||||
, propagatedNativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name
|
||||
@ -177,14 +177,14 @@ rec {
|
||||
"checkInputs" "installCheckInputs"
|
||||
"__impureHostDeps" "__propagatedImpureHostDeps"
|
||||
"sandboxProfile" "propagatedSandboxProfile"])
|
||||
// (lib.optionalAttrs (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
|
||||
# hash can't be the same. See #32986.
|
||||
name = "${if name != "" then name else "${attrs.pname}-${attrs.version}"}-${stdenv.hostPlatform.config}";
|
||||
name = "${attrs.name or "${attrs.pname}-${attrs.version}"}-${stdenv.hostPlatform.config}";
|
||||
} // {
|
||||
builder = attrs.realBuilder or stdenv.shell;
|
||||
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
|
||||
@ -274,7 +274,7 @@ rec {
|
||||
meta = {
|
||||
# `name` above includes cross-compilation cruft (and is under assert),
|
||||
# lets have a clean always accessible version here.
|
||||
name = if name != "" then name else "${attrs.pname}-${attrs.version}";
|
||||
name = attrs.name or "${attrs.pname}-${attrs.version}";
|
||||
|
||||
# If the packager hasn't specified `outputsToInstall`, choose a default,
|
||||
# which is the name of `p.bin or p.out or p`;
|
||||
|
Loading…
Reference in New Issue
Block a user