summary refs log tree commit diff
path: root/pkgs/build-support/build-bazel-package
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-11-29 01:14:45 +0100
committerWael Nasreddine <wael.nasreddine@gmail.com>2019-11-28 16:14:45 -0800
commita905fcb40de9de48a482eeaf1104f255d910abb7 (patch)
treeed8de8937bed828f20a84c5a26dfc5fdbb4e2691 /pkgs/build-support/build-bazel-package
parent64b9199b516a0fef8bb413f19e9808482160ff1c (diff)
downloadnixpkgs-a905fcb40de9de48a482eeaf1104f255d910abb7.tar
nixpkgs-a905fcb40de9de48a482eeaf1104f255d910abb7.tar.gz
nixpkgs-a905fcb40de9de48a482eeaf1104f255d910abb7.tar.bz2
nixpkgs-a905fcb40de9de48a482eeaf1104f255d910abb7.tar.lz
nixpkgs-a905fcb40de9de48a482eeaf1104f255d910abb7.tar.xz
nixpkgs-a905fcb40de9de48a482eeaf1104f255d910abb7.tar.zst
nixpkgs-a905fcb40de9de48a482eeaf1104f255d910abb7.zip
buildBazelPackage: set $USER environment variable (#74538)
tensorflow assumes $USER to be set to something, otherwise it complains
like this:

```
FATAL: $USER is not set, and unable to look up name of current user: (error: 0): Success
Traceback (most recent call last):
  File "./configure.py", line 1602, in <module>
    main()
  File "./configure.py", line 1399, in main
    _TF_MAX_BAZEL_VERSION)
  File "./configure.py", line 478, in check_bazel_version
    ['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
  File "./configure.py", line 156, in run_shell
    output = subprocess.check_output(cmd)
  File "/nix/store/drr8qcgiccfc5by09r5zc30flgwh1mbx-python3-3.7.5/lib/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/nix/store/drr8qcgiccfc5by09r5zc30flgwh1mbx-python3-3.7.5/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
```

Spotted while changing the hash of its fixed-output derivation on
purpose.

We could also set this in the tensorflow-specific part, but very likely,
other programs will fail as well.
Diffstat (limited to 'pkgs/build-support/build-bazel-package')
-rw-r--r--pkgs/build-support/build-bazel-package/default.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkgs/build-support/build-bazel-package/default.nix b/pkgs/build-support/build-bazel-package/default.nix
index d1a8983b209..8fa3cc55279 100644
--- a/pkgs/build-support/build-bazel-package/default.nix
+++ b/pkgs/build-support/build-bazel-package/default.nix
@@ -44,6 +44,7 @@ in stdenv.mkDerivation (fBuildAttrs // {
       export bazelOut="$(echo ''${NIX_BUILD_TOP}/output | sed -e 's,//,/,g')"
       export bazelUserRoot="$(echo ''${NIX_BUILD_TOP}/tmp | sed -e 's,//,/,g')"
       export HOME="$NIX_BUILD_TOP"
+      export USER="nix"
       # This is needed for git_repository with https remotes
       export GIT_SSL_CAINFO="${cacert}/etc/ssl/certs/ca-bundle.crt"
       # This is needed for Bazel fetchers that are themselves programs (e.g.