11{
22 lib ,
3- bazel_6 ,
3+ bazel_7 ,
44 bazel-gazelle ,
55 buildBazelPackage ,
66 fetchFromGitHub ,
1616 jdk ,
1717 ninja ,
1818 patchelf ,
19- python3 ,
19+ python312 ,
2020 linuxHeaders ,
2121 nixosTests ,
2222 runCommandLocal ,
3434 # However, the version string is more useful for end-users.
3535 # These are contained in a attrset of their own to make it obvious that
3636 # people should update both.
37- version = "1.34.2 " ;
38- rev = "c657e59fac461e406c8fdbe57ced833ddc236ee1 " ;
39- hash = "sha256-f9JsgHEyOg1ZoEb7d3gy3+qoovpA3oOx6O8yL0U8mhI =" ;
37+ version = "1.35.1 " ;
38+ rev = "6e9539d0366baf85baf9acb3e618cb3384765f13 " ;
39+ hash = "sha256-c1c8j/BCRrvAEqjt4EQ/d7zsM1zUe4Qr5EHzpuGblIk =" ;
4040 } ;
4141
4242 # these need to be updated for any changes to fetchAttrs
4343 depsHash =
4444 {
45- x86_64-linux = "sha256-CczmVD/3tWR3LygXc3cTAyrMPZUTajqtRew85wBM5mY =" ;
46- aarch64-linux = "sha256-GemlfXHlaHPn1/aBxj2Ve9tuwsEdlQQCU1v57378Dgs =" ;
45+ x86_64-linux = "sha256-E6yUSd00ngmjaMds+9UVZLtcYhzeS8F9eSIkC1mZSps =" ;
46+ aarch64-linux = "sha256-ivboOrV/uORKVHRL3685aopcElGvzsxgVcUmYsBwzXY =" ;
4747 }
4848 . ${ stdenv . system } or ( throw "unsupported system ${ stdenv . system } " ) ;
4949
50+ python3 = python312 ;
51+
5052in
5153buildBazelPackage rec {
5254 pname = "envoy" ;
5355 inherit ( srcVer ) version ;
54- bazel = bazel_6 ;
56+ bazel = bazel_7 ;
5557
5658 src = applyPatches {
5759 src = fetchFromGitHub {
@@ -97,11 +99,11 @@ buildBazelPackage rec {
9799 --replace-fail 'crate_universe_dependencies()' 'crate_universe_dependencies(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc")' \
98100 --replace-fail 'crates_repository(' 'crates_repository(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc",'
99101
100- # patch rules_rust for envoy specifics, but also to support old Bazel
101- # (Bazel 6 doesn't have ctx.watch, but ctx.path is sufficient for our use)
102+ # patch rules_rust for envoy specifics
102103 cp ${ ./rules_rust.patch } bazel/rules_rust.patch
103104 substituteInPlace bazel/repositories.bzl \
104- --replace-fail ', "@envoy//bazel:rules_rust_ppc64le.patch"' ""
105+ --replace-fail ', "@envoy//bazel:rules_rust_ppc64le.patch"' "" \
106+ --replace-fail '"@envoy//bazel:emsdk.patch"' ""
105107
106108 substitute ${ ./rules_rust_extra.patch } bazel/nix/rules_rust_extra.patch \
107109 --subst-var-by bash "$(type -p bash)"
@@ -130,11 +132,23 @@ buildBazelPackage rec {
130132 postPatch = ''
131133 ${ postPatch }
132134
135+ echo "common --repository_cache=\"$bazelOut/external/repository_cache\"" >> .bazelrc
136+
133137 substituteInPlace bazel/dependency_imports.bzl \
134138 --replace-fail 'crate_universe_dependencies(' 'crate_universe_dependencies(bootstrap=True, ' \
135139 --replace-fail 'crates_repository(' 'crates_repository(generator="@@cargo_bazel_bootstrap//:cargo-bazel", '
136140 '' ;
137141 preInstall = ''
142+ mkdir $NIX_BUILD_TOP/empty
143+ pushd $NIX_BUILD_TOP/empty
144+ touch MODULE.bazel
145+ # Unfortunately, we need to fetch a lot of irrelevant junk to make this work.
146+ # This really bloats the size of the FOD.
147+ # TODO: lukegb - figure out how to make this suck less.
148+ bazel fetch --repository_cache="$bazelOut/external/repository_cache"
149+ bazel sync --repository_cache="$bazelOut/external/repository_cache"
150+ popd
151+
138152 # Strip out the path to the build location (by deleting the comment line).
139153 find $bazelOut/external -name requirements.bzl | while read requirements; do
140154 sed -i '/# Generated from /d' "$requirements"
@@ -151,7 +165,6 @@ buildBazelPackage rec {
151165 $bazelOut/external/rules_rust/util/process_wrapper/private/process_wrapper.sh \
152166 $bazelOut/external/rules_rust/crate_universe/src/metadata/cargo_tree_rustc_wrapper.sh
153167
154- rm -r $bazelOut/external/go_sdk
155168 rm -r $bazelOut/external/local_jdk
156169 rm -r $bazelOut/external/bazel_gazelle_go_repository_tools/bin
157170
@@ -175,7 +188,11 @@ buildBazelPackage rec {
175188 dontUseCmakeConfigure = true ;
176189 dontUseGnConfigure = true ;
177190 dontUseNinjaInstall = true ;
191+ bazel = null ;
178192 preConfigure = ''
193+ echo "common --repository_cache=\"$bazelOut/external/repository_cache\"" >> .bazelrc
194+ echo "common --repository_disable_download" >> .bazelrc
195+
179196 # Make executables work, for the most part.
180197 find $bazelOut/external -type f -executable | while read execbin; do
181198 file "$execbin" | grep -q ': ELF .*, dynamically linked,' || continue
@@ -211,6 +228,9 @@ buildBazelPackage rec {
211228 removeLocalConfigCc = true ;
212229 removeLocal = false ;
213230 bazelTargets = [ "//source/exe:envoy-static" ] ;
231+ bazelFlags = [
232+ "--repo_env=BAZEL_HTTP_RULES_URLS_AS_DEFAULT_CANONICAL_ID=0"
233+ ] ;
214234 bazelBuildFlags = [
215235 "-c opt"
216236 "--spawn_strategy=standalone"
0 commit comments