stdenv.mkDerivation: check meta.mainProgram from original meta

We define a meta variable in the same let block as the result of
the `commonMeta` call. Avoiding evaluating the result of that call
until we need to is preferable.
This commit is contained in:
Eman Resu
2026-05-09 18:21:20 -04:00
parent ac796e9827
commit fde4f1c5a0

View File

@@ -866,7 +866,8 @@ let
);
let
env' = if meta ? mainProgram then env // { NIX_MAIN_PROGRAM = meta.mainProgram; } else env;
env' =
if attrs ? meta.mainProgram then env // { NIX_MAIN_PROGRAM = attrs.meta.mainProgram; } else env;
derivationArg = makeDerivationArgument (
removeAttrs attrs [