buildBazelPackage: add flags for build and fetch

They sometimes take separate flags.
This commit is contained in:
Timo Kaufmann 2019-07-18 13:49:00 +02:00 committed by Nikolay Amiantov
parent 019c13616b
commit e458a34012

View File

@ -4,7 +4,7 @@
, lib
}:
args@{ name, bazelFlags ? [], bazelTarget, buildAttrs, fetchAttrs, ... }:
args@{ name, bazelFlags ? [], bazelBuildFlags ? [], bazelFetchFlags ? [], bazelTarget, buildAttrs, fetchAttrs, ... }:
let
fArgs = removeAttrs args [ "buildAttrs" "fetchAttrs" ];
@ -12,11 +12,11 @@ let
fFetchAttrs = fArgs // removeAttrs fetchAttrs [ "sha256" ];
in stdenv.mkDerivation (fBuildAttrs // {
inherit name bazelFlags bazelTarget;
inherit name bazelFlags bazelBuildFlags bazelFetchFlags bazelTarget;
deps = stdenv.mkDerivation (fFetchAttrs // {
name = "${name}-deps";
inherit bazelFlags bazelTarget;
inherit bazelFlags bazelBuildFlags bazelFetchFlags bazelTarget;
nativeBuildInputs = fFetchAttrs.nativeBuildInputs or [] ++ [ bazel ];
@ -49,6 +49,7 @@ in stdenv.mkDerivation (fBuildAttrs // {
fetch \
--loading_phase_threads=1 \
$bazelFlags \
$bazelFetchFlags \
$bazelTarget
runHook postBuild
@ -149,6 +150,7 @@ in stdenv.mkDerivation (fBuildAttrs // {
"''${host_linkopts[@]}" \
'' + ''
$bazelFlags \
$bazelBuildFlags \
$bazelTarget
runHook postBuild