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 ];
|
propagatedBuildInputs = [ coq-ext-lib simple-io ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
param = params."${coq.coq-version}" or params."8.8";
|
param = params."${coq.coq-version}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -20,7 +20,7 @@ let params =
|
|||||||
sha256 = "0l9885nxy0n955fj1gnijlxl55lyxiv9yjfmz8hmfrn9hl8vv1m2";
|
sha256 = "0l9885nxy0n955fj1gnijlxl55lyxiv9yjfmz8hmfrn9hl8vv1m2";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
param = params."${coq.coq-version}" or params."8.8";
|
param = params."${coq.coq-version}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -18,7 +18,7 @@ let
|
|||||||
"8.7" = v20180709;
|
"8.7" = v20180709;
|
||||||
"8.8" = v20181016;
|
"8.8" = v20181016;
|
||||||
};
|
};
|
||||||
param = params."${coq.coq-version}" or params."8.8";
|
param = params."${coq.coq-version}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -26,7 +26,7 @@ let params =
|
|||||||
sha256 = "09dq1vvshhlhgjccrhqgbhnq2hrys15xryfszqq11rzpgvl2zgdv";
|
sha256 = "09dq1vvshhlhgjccrhqgbhnq2hrys15xryfszqq11rzpgvl2zgdv";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
param = params."${coq.coq-version}" or params."8.8";
|
param = params."${coq.coq-version}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -14,7 +14,7 @@ let params =
|
|||||||
"8.8" = v_8_8;
|
"8.8" = v_8_8;
|
||||||
"8.9" = v_8_8;
|
"8.9" = v_8_8;
|
||||||
};
|
};
|
||||||
param = params."${coq.coq-version}" or params."8.9"
|
param = params."${coq.coq-version}"
|
||||||
; in
|
; in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -22,7 +22,7 @@ let params = {
|
|||||||
sha256 = "0qvar8gfbrcs9fmvkph5asqz4l5fi63caykx3bsn8zf0xllkwv0n";
|
sha256 = "0qvar8gfbrcs9fmvkph5asqz4l5fi63caykx3bsn8zf0xllkwv0n";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
param = params."${coq.coq-version}" or params."8.8";
|
param = params."${coq.coq-version}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
|
@ -26,7 +26,7 @@ let
|
|||||||
sha256 = "1sj7vyarmvp1w5kvbhgpgap1yd0yrj4n1jrla0wv70k0jrq5hhpz";
|
sha256 = "1sj7vyarmvp1w5kvbhgpgap1yd0yrj4n1jrla0wv70k0jrq5hhpz";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
param = params."${coq.coq-version}" or params."8.8";
|
param = params."${coq.coq-version}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -12,7 +12,7 @@ rec {
|
|||||||
# * https://nixos.org/nix/manual/#ssec-derivation
|
# * https://nixos.org/nix/manual/#ssec-derivation
|
||||||
# Explanation about derivations in general
|
# Explanation about derivations in general
|
||||||
mkDerivation =
|
mkDerivation =
|
||||||
{ name ? ""
|
{
|
||||||
|
|
||||||
# These types of dependencies are all exhaustively documented in
|
# These types of dependencies are all exhaustively documented in
|
||||||
# the "Specifying Dependencies" section of the "Standard
|
# the "Specifying Dependencies" section of the "Standard
|
||||||
@ -21,7 +21,7 @@ rec {
|
|||||||
# TODO(@Ericson2314): Stop using legacy dep attribute names
|
# TODO(@Ericson2314): Stop using legacy dep attribute names
|
||||||
|
|
||||||
# host offset -> target offset
|
# host offset -> target offset
|
||||||
, depsBuildBuild ? [] # -1 -> -1
|
depsBuildBuild ? [] # -1 -> -1
|
||||||
, depsBuildBuildPropagated ? [] # -1 -> -1
|
, depsBuildBuildPropagated ? [] # -1 -> -1
|
||||||
, nativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name
|
, nativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name
|
||||||
, propagatedNativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name
|
, propagatedNativeBuildInputs ? [] # -1 -> 0 N.B. Legacy name
|
||||||
@ -177,14 +177,14 @@ rec {
|
|||||||
"checkInputs" "installCheckInputs"
|
"checkInputs" "installCheckInputs"
|
||||||
"__impureHostDeps" "__propagatedImpureHostDeps"
|
"__impureHostDeps" "__propagatedImpureHostDeps"
|
||||||
"sandboxProfile" "propagatedSandboxProfile"])
|
"sandboxProfile" "propagatedSandboxProfile"])
|
||||||
// (lib.optionalAttrs (name == "")) {
|
// (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) {
|
||||||
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
|
# Fixed-output derivations like source tarballs shouldn't get a host
|
||||||
# suffix. But we have some weird ones with run-time deps that are
|
# 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
|
# just used for their side-affects. Those might as well since the
|
||||||
# hash can't be the same. See #32986.
|
# 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;
|
builder = attrs.realBuilder or stdenv.shell;
|
||||||
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
|
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
|
||||||
@ -274,7 +274,7 @@ rec {
|
|||||||
meta = {
|
meta = {
|
||||||
# `name` above includes cross-compilation cruft (and is under assert),
|
# `name` above includes cross-compilation cruft (and is under assert),
|
||||||
# lets have a clean always accessible version here.
|
# 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,
|
# If the packager hasn't specified `outputsToInstall`, choose a default,
|
||||||
# which is the name of `p.bin or p.out or p`;
|
# which is the name of `p.bin or p.out or p`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user