From 18aa9b0b6509c516e6ce3dee82d225be26b154f8 Mon Sep 17 00:00:00 2001 From: "Wael M. Nasreddine" Date: Mon, 10 Sep 2018 22:30:22 -0700 Subject: build-bazel-package: prefix bazel with the USER variable Bazel computes the default value of output_user_root before parsing the flag[0]. The computation of the default value involves getting the $USER from the environment. I don't have that variable when building with sandbox enabled. [0]: https://github.com/bazelbuild/bazel/blob/9323c57607d37f9c949b60e293b573584906da46/src/main/cpp/startup_options.cc#L123-L124 --- pkgs/build-support/build-bazel-package/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/build-bazel-package/default.nix b/pkgs/build-support/build-bazel-package/default.nix index 07d37451ddf..26f44b922cd 100644 --- a/pkgs/build-support/build-bazel-package/default.nix +++ b/pkgs/build-support/build-bazel-package/default.nix @@ -25,7 +25,13 @@ in stdenv.mkDerivation (fBuildAttrs // { buildPhase = fFetchAttrs.buildPhase or '' runHook preBuild - bazel --output_base="$bazelOut" --output_user_root="$bazelUserRoot" fetch $bazelFlags $bazelTarget + # Bazel computes the default value of output_user_root before parsing the + # flag. The computation of the default value involves getting the $USER + # from the environment. I don't have that variable when building with + # sandbox enabled. Code here + # https://github.com/bazelbuild/bazel/blob/9323c57607d37f9c949b60e293b573584906da46/src/main/cpp/startup_options.cc#L123-L124 + # + USER=homeless-shelter bazel --output_base="$bazelOut" --output_user_root="$bazelUserRoot" fetch $bazelFlags $bazelTarget runHook postBuild ''; -- cgit 1.4.1