From 088e2329226cdaf798f31cc184c4f53bfb7002cf Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Tue, 19 Aug 2025 22:02:45 +0100 Subject: [PATCH] envoy: 1.34.2 -> 1.35.1 --- .../0001-nixpkgs-use-system-Python.patch | 8 +-- .../en/envoy/0002-nixpkgs-use-system-Go.patch | 4 +- ...03-nixpkgs-use-system-C-C-toolchains.patch | 14 ++--- ...04-nixpkgs-bump-rules_rust-to-0.60.0.patch | 6 +-- pkgs/by-name/en/envoy/package.nix | 44 +++++++++++----- pkgs/by-name/en/envoy/rules_rust.patch | 51 ------------------- 6 files changed, 48 insertions(+), 79 deletions(-) diff --git a/pkgs/by-name/en/envoy/0001-nixpkgs-use-system-Python.patch b/pkgs/by-name/en/envoy/0001-nixpkgs-use-system-Python.patch index a241949a0c99..7d4812daecfb 100644 --- a/pkgs/by-name/en/envoy/0001-nixpkgs-use-system-Python.patch +++ b/pkgs/by-name/en/envoy/0001-nixpkgs-use-system-Python.patch @@ -45,12 +45,12 @@ index 9867dc3a46dbe780eb3c02bad8f6a22a2c7fd97e..ff8685e0e437aee447218e912f1cf3e4 extra_pip_args = ["--require-hashes"], ) diff --git a/bazel/repositories_extra.bzl b/bazel/repositories_extra.bzl -index 7a9d3bbb53b567a8f398abaefe5ff044056d4d21..a5b75718de667883824e4320e2d563830b02f5d2 100644 +index 84e2a69c092fa4c824401a52b2c39a49f83d0837..e5afd5743613ad5fdbf7b28a99b6d1b5902566ac 100644 --- a/bazel/repositories_extra.bzl +++ b/bazel/repositories_extra.bzl -@@ -3,19 +3,11 @@ load("@bazel_features//:deps.bzl", "bazel_features_deps") - load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") +@@ -4,19 +4,11 @@ load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_baze load("@emsdk//:deps.bzl", emsdk_deps = "deps") + load("@envoy_examples//bazel:env.bzl", "envoy_examples_env") load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime/remote:crates.bzl", "crate_repositories") -load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") +load("@rules_python//python:repositories.bzl", "py_repositories") @@ -69,7 +69,7 @@ index 7a9d3bbb53b567a8f398abaefe5ff044056d4d21..a5b75718de667883824e4320e2d56383 ignore_root_user_error = False): bazel_features_deps() emsdk_deps() -@@ -23,13 +15,6 @@ def envoy_dependencies_extra( +@@ -24,13 +16,6 @@ def envoy_dependencies_extra( crate_repositories() py_repositories() diff --git a/pkgs/by-name/en/envoy/0002-nixpkgs-use-system-Go.patch b/pkgs/by-name/en/envoy/0002-nixpkgs-use-system-Go.patch index cb8c5d20b671..e4d7e0926092 100644 --- a/pkgs/by-name/en/envoy/0002-nixpkgs-use-system-Go.patch +++ b/pkgs/by-name/en/envoy/0002-nixpkgs-use-system-Go.patch @@ -10,10 +10,10 @@ Signed-off-by: Luke Granger-Brown 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl -index aef33aa103dc1136e63e165fb9ee6a267f52ba54..c5aefca14b729b548c4e90857202eb82576b507d 100644 +index 4615eed5c9ade5279f8174cf1bd3987a8b2d52f1..10be4b0b3f65e486c1dc8419337a5cf823431774 100644 --- a/bazel/dependency_imports.bzl +++ b/bazel/dependency_imports.bzl -@@ -22,7 +22,7 @@ load("@rules_rust//rust:defs.bzl", "rust_common") +@@ -24,7 +24,7 @@ load("@rules_rust//rust:defs.bzl", "rust_common") load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set") # go version for rules_go diff --git a/pkgs/by-name/en/envoy/0003-nixpkgs-use-system-C-C-toolchains.patch b/pkgs/by-name/en/envoy/0003-nixpkgs-use-system-C-C-toolchains.patch index 684e73b5c838..e8113b102ee7 100644 --- a/pkgs/by-name/en/envoy/0003-nixpkgs-use-system-C-C-toolchains.patch +++ b/pkgs/by-name/en/envoy/0003-nixpkgs-use-system-C-C-toolchains.patch @@ -10,18 +10,18 @@ Signed-off-by: Luke Granger-Brown 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl -index c5aefca14b729b548c4e90857202eb82576b507d..6938ce63abb53661e8d1fb71eaaab03ba0cc37c6 100644 +index 10be4b0b3f65e486c1dc8419337a5cf823431774..b0badb3ccab3b112043bd8616770f8014238d396 100644 --- a/bazel/dependency_imports.bzl +++ b/bazel/dependency_imports.bzl -@@ -30,7 +30,11 @@ YQ_VERSION = "4.24.4" - BUF_VERSION = "v1.50.0" - - def envoy_dependency_imports(go_version = GO_VERSION, jq_version = JQ_VERSION, yq_version = YQ_VERSION, buf_version = BUF_VERSION): +@@ -38,7 +38,11 @@ def envoy_dependency_imports( + yq_version = YQ_VERSION, + buf_sha = BUF_SHA, + buf_version = BUF_VERSION): - rules_foreign_cc_dependencies() + rules_foreign_cc_dependencies( + register_default_tools=False, # no prebuilt toolchains -+ register_built_tools=False, # nor from source -+ register_preinstalled_tools=True, # use host tools (default) ++ register_built_tools=False, # nor from source ++ register_preinstalled_tools=True, # use host tools (default) + ) go_rules_dependencies() go_register_toolchains(go_version) diff --git a/pkgs/by-name/en/envoy/0004-nixpkgs-bump-rules_rust-to-0.60.0.patch b/pkgs/by-name/en/envoy/0004-nixpkgs-bump-rules_rust-to-0.60.0.patch index 40b808952e3d..b9aac1e2252f 100644 --- a/pkgs/by-name/en/envoy/0004-nixpkgs-bump-rules_rust-to-0.60.0.patch +++ b/pkgs/by-name/en/envoy/0004-nixpkgs-bump-rules_rust-to-0.60.0.patch @@ -9,10 +9,10 @@ Signed-off-by: Luke Granger-Brown 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl -index 6904bc93bdda3ee2308f13d61e62295fa11d799b..e4574878a566cceb4dc2343f3cade0350ea5e5ff 100644 +index 1293e432c815071ed55721760e583ac0e9f40108..664f8c8e2bf4641e7862e9321fd6f91d162c3c17 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl -@@ -1465,8 +1465,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( +@@ -1528,8 +1528,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Bazel rust rules", project_desc = "Bazel rust rules (used by Wasm)", project_url = "https://github.com/bazelbuild/rules_rust", @@ -23,7 +23,7 @@ index 6904bc93bdda3ee2308f13d61e62295fa11d799b..e4574878a566cceb4dc2343f3cade035 # Note: rules_rust should point to the releases, not archive to avoid the hassle of bootstrapping in crate_universe. # This is described in https://bazelbuild.github.io/rules_rust/crate_universe.html#setup, otherwise bootstrap # is required which in turn requires a system CC toolchains, not the bazel controlled ones. -@@ -1477,7 +1477,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( +@@ -1540,7 +1540,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "dataplane_ext", ], extensions = ["envoy.wasm.runtime.wasmtime"], diff --git a/pkgs/by-name/en/envoy/package.nix b/pkgs/by-name/en/envoy/package.nix index e1ddae74bffe..37a5037e0c41 100644 --- a/pkgs/by-name/en/envoy/package.nix +++ b/pkgs/by-name/en/envoy/package.nix @@ -1,6 +1,6 @@ { lib, - bazel_6, + bazel_7, bazel-gazelle, buildBazelPackage, fetchFromGitHub, @@ -16,7 +16,7 @@ jdk, ninja, patchelf, - python3, + python312, linuxHeaders, nixosTests, runCommandLocal, @@ -34,24 +34,26 @@ let # However, the version string is more useful for end-users. # These are contained in a attrset of their own to make it obvious that # people should update both. - version = "1.34.2"; - rev = "c657e59fac461e406c8fdbe57ced833ddc236ee1"; - hash = "sha256-f9JsgHEyOg1ZoEb7d3gy3+qoovpA3oOx6O8yL0U8mhI="; + version = "1.35.1"; + rev = "6e9539d0366baf85baf9acb3e618cb3384765f13"; + hash = "sha256-c1c8j/BCRrvAEqjt4EQ/d7zsM1zUe4Qr5EHzpuGblIk="; }; # these need to be updated for any changes to fetchAttrs depsHash = { - x86_64-linux = "sha256-CczmVD/3tWR3LygXc3cTAyrMPZUTajqtRew85wBM5mY="; - aarch64-linux = "sha256-GemlfXHlaHPn1/aBxj2Ve9tuwsEdlQQCU1v57378Dgs="; + x86_64-linux = "sha256-E6yUSd00ngmjaMds+9UVZLtcYhzeS8F9eSIkC1mZSps="; + aarch64-linux = "sha256-ivboOrV/uORKVHRL3685aopcElGvzsxgVcUmYsBwzXY="; } .${stdenv.system} or (throw "unsupported system ${stdenv.system}"); + python3 = python312; + in buildBazelPackage rec { pname = "envoy"; inherit (srcVer) version; - bazel = bazel_6; + bazel = bazel_7; src = applyPatches { src = fetchFromGitHub { @@ -97,11 +99,11 @@ buildBazelPackage rec { --replace-fail 'crate_universe_dependencies()' 'crate_universe_dependencies(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc")' \ --replace-fail 'crates_repository(' 'crates_repository(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc",' - # patch rules_rust for envoy specifics, but also to support old Bazel - # (Bazel 6 doesn't have ctx.watch, but ctx.path is sufficient for our use) + # patch rules_rust for envoy specifics cp ${./rules_rust.patch} bazel/rules_rust.patch substituteInPlace bazel/repositories.bzl \ - --replace-fail ', "@envoy//bazel:rules_rust_ppc64le.patch"' "" + --replace-fail ', "@envoy//bazel:rules_rust_ppc64le.patch"' "" \ + --replace-fail '"@envoy//bazel:emsdk.patch"' "" substitute ${./rules_rust_extra.patch} bazel/nix/rules_rust_extra.patch \ --subst-var-by bash "$(type -p bash)" @@ -130,11 +132,23 @@ buildBazelPackage rec { postPatch = '' ${postPatch} + echo "common --repository_cache=\"$bazelOut/external/repository_cache\"" >> .bazelrc + substituteInPlace bazel/dependency_imports.bzl \ --replace-fail 'crate_universe_dependencies(' 'crate_universe_dependencies(bootstrap=True, ' \ --replace-fail 'crates_repository(' 'crates_repository(generator="@@cargo_bazel_bootstrap//:cargo-bazel", ' ''; preInstall = '' + mkdir $NIX_BUILD_TOP/empty + pushd $NIX_BUILD_TOP/empty + touch MODULE.bazel + # Unfortunately, we need to fetch a lot of irrelevant junk to make this work. + # This really bloats the size of the FOD. + # TODO: lukegb - figure out how to make this suck less. + bazel fetch --repository_cache="$bazelOut/external/repository_cache" + bazel sync --repository_cache="$bazelOut/external/repository_cache" + popd + # Strip out the path to the build location (by deleting the comment line). find $bazelOut/external -name requirements.bzl | while read requirements; do sed -i '/# Generated from /d' "$requirements" @@ -151,7 +165,6 @@ buildBazelPackage rec { $bazelOut/external/rules_rust/util/process_wrapper/private/process_wrapper.sh \ $bazelOut/external/rules_rust/crate_universe/src/metadata/cargo_tree_rustc_wrapper.sh - rm -r $bazelOut/external/go_sdk rm -r $bazelOut/external/local_jdk rm -r $bazelOut/external/bazel_gazelle_go_repository_tools/bin @@ -175,7 +188,11 @@ buildBazelPackage rec { dontUseCmakeConfigure = true; dontUseGnConfigure = true; dontUseNinjaInstall = true; + bazel = null; preConfigure = '' + echo "common --repository_cache=\"$bazelOut/external/repository_cache\"" >> .bazelrc + echo "common --repository_disable_download" >> .bazelrc + # Make executables work, for the most part. find $bazelOut/external -type f -executable | while read execbin; do file "$execbin" | grep -q ': ELF .*, dynamically linked,' || continue @@ -211,6 +228,9 @@ buildBazelPackage rec { removeLocalConfigCc = true; removeLocal = false; bazelTargets = [ "//source/exe:envoy-static" ]; + bazelFlags = [ + "--repo_env=BAZEL_HTTP_RULES_URLS_AS_DEFAULT_CANONICAL_ID=0" + ]; bazelBuildFlags = [ "-c opt" "--spawn_strategy=standalone" diff --git a/pkgs/by-name/en/envoy/rules_rust.patch b/pkgs/by-name/en/envoy/rules_rust.patch index 7261cb2fc760..7bb2353a8e61 100644 --- a/pkgs/by-name/en/envoy/rules_rust.patch +++ b/pkgs/by-name/en/envoy/rules_rust.patch @@ -5,61 +5,10 @@ Subject: [PATCH] rules_rust base Signed-off-by: Luke Granger-Brown --- - cargo/private/cargo_bootstrap.bzl | 8 ++++---- - crate_universe/extensions.bzl | 10 +++++----- crate_universe/src/lockfile.rs | 4 ++-- rust/private/rustc.bzl | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) -diff --git cargo/private/cargo_bootstrap.bzl cargo/private/cargo_bootstrap.bzl -index a8021c49d62037ef32c7c64d5bb4a5efe3a8b4aa..f63d7c23ae0bddc9f3fece347a3a2b5b0afe6d8d 100644 ---- cargo/private/cargo_bootstrap.bzl -+++ cargo/private/cargo_bootstrap.bzl -@@ -173,13 +173,13 @@ def _detect_changes(repository_ctx): - # 'consumed' which means changes to it will trigger rebuilds - - for src in repository_ctx.attr.srcs: -- repository_ctx.watch(src) -+ repository_ctx.path(src) - -- repository_ctx.watch(repository_ctx.attr.cargo_lockfile) -- repository_ctx.watch(repository_ctx.attr.cargo_toml) -+ repository_ctx.path(repository_ctx.attr.cargo_lockfile) -+ repository_ctx.path(repository_ctx.attr.cargo_toml) - - if repository_ctx.attr.cargo_config: -- repository_ctx.watch(repository_ctx.attr.cargo_config) -+ repository_ctx.path(repository_ctx.attr.cargo_config) - - def _cargo_bootstrap_repository_impl(repository_ctx): - # Pretend to Bazel that this rule's input files have been used, so that it will re-run the rule if they change. -diff --git crate_universe/extensions.bzl crate_universe/extensions.bzl -index a749b10c8d469bd316d78034059c94b1fd98dbef..8f8c84dac1ec330d5e8e6abbd930387cb6c9f29e 100644 ---- crate_universe/extensions.bzl -+++ crate_universe/extensions.bzl -@@ -957,17 +957,17 @@ def _crate_impl(module_ctx): - fail("Spec specified for repo {}, but the module defined repositories {}".format(repo, local_repos)) - - for cfg in mod.tags.from_cargo + mod.tags.from_specs: -- # Preload all external repositories. Calling `module_ctx.watch` will cause restarts of the implementation -+ # Preload all external repositories. Calling `module_ctx.path` will cause restarts of the implementation - # function of the module extension when the file has changed. - if cfg.cargo_lockfile: -- module_ctx.watch(cfg.cargo_lockfile) -+ module_ctx.path(cfg.cargo_lockfile) - if cfg.lockfile: -- module_ctx.watch(cfg.lockfile) -+ module_ctx.path(cfg.lockfile) - if cfg.cargo_config: -- module_ctx.watch(cfg.cargo_config) -+ module_ctx.path(cfg.cargo_config) - if hasattr(cfg, "manifests"): - for m in cfg.manifests: -- module_ctx.watch(m) -+ module_ctx.path(m) - - cargo_path, rustc_path = _get_host_cargo_rustc(module_ctx, host_triple, cfg.host_tools_repo) - cargo_bazel_fn = new_cargo_bazel_fn( diff --git crate_universe/src/lockfile.rs crate_universe/src/lockfile.rs index 3e0ce6265fda6fbdd9e3e989e3e4e4443b615b8c..0fafcea8fbc7a590676d34d2c4ca8c413b953955 100644 --- crate_universe/src/lockfile.rs