trivial-builders: merge passAsFile with env in runCommand'
Previously it was awkward to use the runCommand-variants with passAsFile as a double definition of passAsFile would potentially break runCommand: passAsFile would overwrite the previous definition, defeating the purpose of setting it in runCommand in the first place. This is now fixed by concatenating the [ "buildCommand" ] list with one the one from env, if present. Adjust buildEnv where passAsFile = null; was passed in some cases, breaking evaluation since it'd evaluate to [ "buildCommand" ] ++ null.
This commit is contained in:
parent
9a48ca8027
commit
b398d00903
|
@ -74,7 +74,7 @@ runCommand name
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
allowSubstitutes = false;
|
allowSubstitutes = false;
|
||||||
# XXX: The size is somewhat arbitrary
|
# XXX: The size is somewhat arbitrary
|
||||||
passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else null;
|
passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
${buildPackages.perl}/bin/perl -w ${builder}
|
${buildPackages.perl}/bin/perl -w ${builder}
|
||||||
|
|
|
@ -6,13 +6,14 @@ let
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = lib.strings.sanitizeDerivationName name;
|
name = lib.strings.sanitizeDerivationName name;
|
||||||
inherit buildCommand;
|
inherit buildCommand;
|
||||||
passAsFile = [ "buildCommand" ];
|
passAsFile = [ "buildCommand" ]
|
||||||
|
++ (env.passAsFile or []);
|
||||||
}
|
}
|
||||||
// (lib.optionalAttrs runLocal {
|
// (lib.optionalAttrs runLocal {
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
allowSubstitutes = false;
|
allowSubstitutes = false;
|
||||||
})
|
})
|
||||||
// env);
|
// builtins.removeAttrs env [ "passAsFile" ]);
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue