stdenv/make-derivation: unify logic for name modifications
Unify the logic for constructing the name from pname and version and modifying the name in case a host suffix needs to appended. This allows us to modify the construction of name from pname and version without having to duplicate it in two places.
This commit is contained in:
parent
74df3bb889
commit
fe0524cd7d
@ -193,15 +193,20 @@ in rec {
|
|||||||
"__darwinAllowLocalNetworking"
|
"__darwinAllowLocalNetworking"
|
||||||
"__impureHostDeps" "__propagatedImpureHostDeps"
|
"__impureHostDeps" "__propagatedImpureHostDeps"
|
||||||
"sandboxProfile" "propagatedSandboxProfile"])
|
"sandboxProfile" "propagatedSandboxProfile"])
|
||||||
// (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) {
|
// (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
|
||||||
name = "${attrs.pname}-${attrs.version}";
|
name =
|
||||||
} // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {
|
let
|
||||||
# Fixed-output derivations like source tarballs shouldn't get a host
|
name' = attrs.name or
|
||||||
# suffix. But we have some weird ones with run-time deps that are
|
"${attrs.pname}-${attrs.version}";
|
||||||
# just used for their side-affects. Those might as well since the
|
# Fixed-output derivations like source tarballs shouldn't get a host
|
||||||
# hash can't be the same. See #32986.
|
# suffix. But we have some weird ones with run-time deps that are
|
||||||
name = "${attrs.name or "${attrs.pname}-${attrs.version}"}-${stdenv.hostPlatform.config}";
|
# just used for their side-affects. Those might as well since the
|
||||||
} // {
|
# hash can't be the same. See #32986.
|
||||||
|
hostSuffix = lib.optionalString
|
||||||
|
(stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix)
|
||||||
|
"-${stdenv.hostPlatform.config}";
|
||||||
|
in name' + hostSuffix;
|
||||||
|
}) // {
|
||||||
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)];
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user