···1+diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
2+index 6fff2af..7e2877e 100644
3+--- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
4++++ b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
5+@@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider {
6+ Map<String, String> env, BinTools binTools, String fallbackTmpDir) {
7+ ImmutableMap.Builder<String, String> result = ImmutableMap.builder();
8+ result.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
9++
10++ // In case we are running on NixOS.
11++ // If bash is called with an unset PATH on this platform,
12++ // it will set it to /no-such-path and default tools will be missings.
13++ // See, https://github.com/NixOS/nixpkgs/issues/94222
14++ // So we ensure that minimal dependencies are present.
15++ if (!env.containsKey("PATH")){
16++ result.put("PATH", "@actionsPathPatch@");
17++ }
18++
19+ String p = clientEnv.get("TMPDIR");
20+ if (Strings.isNullOrEmpty(p)) {
21+ // Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
22+index 95642767c6..39d3c62461 100644
23+--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
24++++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
25+@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider {
26+27+ ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder();
28+ newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
29++
30++ // In case we are running on NixOS.
31++ // If bash is called with an unset PATH on this platform,
32++ // it will set it to /no-such-path and default tools will be missings.
33++ // See, https://github.com/NixOS/nixpkgs/issues/94222
34++ // So we ensure that minimal dependencies are present.
35++ if (!env.containsKey("PATH")){
36++ newEnvBuilder.put("PATH", "@actionsPathPatch@");
37++ }
38++
39+ String p = clientEnv.get("TMPDIR");
40+ if (Strings.isNullOrEmpty(p)) {
41+ // Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
···1+#!/usr/bin/env python3
2+import sys
3+import json
4+5+if len(sys.argv) != 2:
6+ print("usage: ./this-script src-deps.json < WORKSPACE", file=sys.stderr)
7+ print("Takes the bazel WORKSPACE file and reads all archives into a json dict (by evaling it as python code)", file=sys.stderr)
8+ print("Hail Eris.", file=sys.stderr)
9+ sys.exit(1)
10+11+http_archives = []
12+13+# just the kw args are the dict { name, sha256, urls … }
14+def http_archive(**kw):
15+ http_archives.append(kw)
16+# like http_file
17+def http_file(**kw):
18+ http_archives.append(kw)
19+20+# this is inverted from http_archive/http_file and bundles multiple archives
21+def _distdir_tar(**kw):
22+ for archive_name in kw['archives']:
23+ http_archives.append({
24+ "name": archive_name,
25+ "sha256": kw['sha256'][archive_name],
26+ "urls": kw['urls'][archive_name]
27+ })
28+29+# TODO?
30+def git_repository(**kw):
31+ print(json.dumps(kw, sort_keys=True, indent=4), file=sys.stderr)
32+ sys.exit(1)
33+34+# execute the WORKSPACE like it was python code in this module,
35+# using all the function stubs from above.
36+exec(sys.stdin.read())
37+38+# transform to a dict with the names as keys
39+d = { el['name']: el for el in http_archives }
40+41+def has_urls(el):
42+ return ('url' in el and el['url']) or ('urls' in el and el['urls'])
43+def has_sha256(el):
44+ return 'sha256' in el and el['sha256']
45+bad_archives = list(filter(lambda el: not has_urls(el) or not has_sha256(el), d.values()))
46+if bad_archives:
47+ print('Following bazel dependencies are missing url or sha256', file=sys.stderr)
48+ print('Check bazel sources for master or non-checksummed dependencies', file=sys.stderr)
49+ for el in bad_archives:
50+ print(json.dumps(el, sort_keys=True, indent=4), file=sys.stderr)
51+ sys.exit(1)
52+53+with open(sys.argv[1], "w") as f:
54+ print(json.dumps(d, sort_keys=True, indent=4), file=f)