summary refs log tree commit diff
path: root/pkgs/build-support/build-bazel-package
diff options
context:
space:
mode:
authorWael M. Nasreddine <wael.nasreddine@gmail.com>2018-09-10 22:30:22 -0700
committerWael M. Nasreddine <wael.nasreddine@gmail.com>2018-09-29 13:28:12 -0700
commit18aa9b0b6509c516e6ce3dee82d225be26b154f8 (patch)
tree54553541f90bceb4d27c9e7647eb6da40e0cbc4e /pkgs/build-support/build-bazel-package
parente3654421d3bd9a52d263c37c26d02d388e3c2975 (diff)
downloadnixpkgs-18aa9b0b6509c516e6ce3dee82d225be26b154f8.tar
nixpkgs-18aa9b0b6509c516e6ce3dee82d225be26b154f8.tar.gz
nixpkgs-18aa9b0b6509c516e6ce3dee82d225be26b154f8.tar.bz2
nixpkgs-18aa9b0b6509c516e6ce3dee82d225be26b154f8.tar.lz
nixpkgs-18aa9b0b6509c516e6ce3dee82d225be26b154f8.tar.xz
nixpkgs-18aa9b0b6509c516e6ce3dee82d225be26b154f8.tar.zst
nixpkgs-18aa9b0b6509c516e6ce3dee82d225be26b154f8.zip
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
Diffstat (limited to 'pkgs/build-support/build-bazel-package')
-rw-r--r--pkgs/build-support/build-bazel-package/default.nix8
1 files changed, 7 insertions, 1 deletions
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
     '';