stdenv.mkDerivation: Always sanitize derivation name

This commit is contained in:
Robert Hensing 2022-03-30 10:20:44 +02:00
parent 6a079dad15
commit 7e0ef81015

View file

@ -219,9 +219,11 @@ else let
# it again.
staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static";
in
lib.strings.sanitizeDerivationName (
if attrs ? name
then attrs.name + hostSuffix
else "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}";
else "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}"
);
}) // {
builder = attrs.realBuilder or stdenv.shell;
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
@ -340,8 +342,9 @@ else let
# passed to the builder and is not a dependency. But since we
# include it in the result, it *is* available to nix-env for queries.
meta = {
# `name` above includes cross-compilation cruft (and is under assert),
# lets have a clean always accessible version here.
# `name` above includes cross-compilation cruft,
# is under assert, and is sanitized.
# Let's have a clean always accessible version here.
name = attrs.name or "${attrs.pname}-${attrs.version}";
# If the packager hasn't specified `outputsToInstall`, choose a default,