Skip to content

Commit a8b3c0f

Browse files
authored
envoy: 1.33.0 -> 1.34.0 (NixOS#399369)
2 parents 7a5ae34 + b16ad9c commit a8b3c0f

File tree

6 files changed

+165
-12
lines changed

6 files changed

+165
-12
lines changed

pkgs/by-name/en/envoy/0001-nixpkgs-use-system-Python.patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Date: Mon, 22 Apr 2024 11:52:59 +0200
44
Subject: [PATCH] nixpkgs: use system Python
55

66
Signed-off-by: Paul Meyer <[email protected]>
7+
Signed-off-by: Luke Granger-Brown <[email protected]>
78
---
89
bazel/python_dependencies.bzl | 9 ++++-----
910
bazel/repositories_extra.bzl | 17 +----------------

pkgs/by-name/en/envoy/0002-nixpkgs-use-system-Go.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ Date: Mon, 22 Apr 2024 11:58:00 +0200
44
Subject: [PATCH] nixpkgs: use system Go
55

66
Signed-off-by: Paul Meyer <[email protected]>
7+
Signed-off-by: Luke Granger-Brown <[email protected]>
78
---
89
bazel/dependency_imports.bzl | 2 +-
910
1 file changed, 1 insertion(+), 1 deletion(-)
1011

1112
diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl
12-
index c68eb4bf3ed2d39d46d38d7bd0eeab2c74a507fa..addee4f6af74ea78ae778b73384e01db83ac6694 100644
13+
index aef33aa103dc1136e63e165fb9ee6a267f52ba54..c5aefca14b729b548c4e90857202eb82576b507d 100644
1314
--- a/bazel/dependency_imports.bzl
1415
+++ b/bazel/dependency_imports.bzl
15-
@@ -20,7 +20,7 @@ load("@rules_rust//rust:defs.bzl", "rust_common")
16+
@@ -22,7 +22,7 @@ load("@rules_rust//rust:defs.bzl", "rust_common")
1617
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set")
1718

1819
# go version for rules_go

pkgs/by-name/en/envoy/0003-nixpkgs-use-system-C-C-toolchains.patch

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ Date: Mon, 22 Apr 2024 11:59:22 +0200
44
Subject: [PATCH] nixpkgs: use system C/C++ toolchains
55

66
Signed-off-by: Paul Meyer <[email protected]>
7+
Signed-off-by: Luke Granger-Brown <[email protected]>
78
---
89
bazel/dependency_imports.bzl | 6 +++++-
910
1 file changed, 5 insertions(+), 1 deletion(-)
1011

1112
diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl
12-
index addee4f6af74ea78ae778b73384e01db83ac6694..dc1967e43b2b71358d2767a3d83b52819987290d 100644
13+
index c5aefca14b729b548c4e90857202eb82576b507d..6938ce63abb53661e8d1fb71eaaab03ba0cc37c6 100644
1314
--- a/bazel/dependency_imports.bzl
1415
+++ b/bazel/dependency_imports.bzl
15-
@@ -26,7 +26,11 @@ JQ_VERSION = "1.7"
16-
YQ_VERSION = "4.24.4"
16+
@@ -30,7 +30,11 @@ YQ_VERSION = "4.24.4"
17+
BUF_VERSION = "v1.50.0"
1718

18-
def envoy_dependency_imports(go_version = GO_VERSION, jq_version = JQ_VERSION, yq_version = YQ_VERSION):
19+
def envoy_dependency_imports(go_version = GO_VERSION, jq_version = JQ_VERSION, yq_version = YQ_VERSION, buf_version = BUF_VERSION):
1920
- rules_foreign_cc_dependencies()
2021
+ rules_foreign_cc_dependencies(
2122
+ register_default_tools=False, # no prebuilt toolchains
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Luke Granger-Brown <[email protected]>
3+
Date: Thu, 17 Apr 2025 02:40:18 +0100
4+
Subject: [PATCH] nixpkgs: bump rules_rust to 0.60.0
5+
6+
Signed-off-by: Luke Granger-Brown <[email protected]>
7+
---
8+
bazel/repository_locations.bzl | 6 +++---
9+
1 file changed, 3 insertions(+), 3 deletions(-)
10+
11+
diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl
12+
index 6904bc93bdda3ee2308f13d61e62295fa11d799b..e4574878a566cceb4dc2343f3cade0350ea5e5ff 100644
13+
--- a/bazel/repository_locations.bzl
14+
+++ b/bazel/repository_locations.bzl
15+
@@ -1465,8 +1465,8 @@ REPOSITORY_LOCATIONS_SPEC = dict(
16+
project_name = "Bazel rust rules",
17+
project_desc = "Bazel rust rules (used by Wasm)",
18+
project_url = "https://github.com/bazelbuild/rules_rust",
19+
- version = "0.56.0",
20+
- sha256 = "f1306aac0b258b790df01ad9abc6abb0df0b65416c74b4ef27f4aab298780a64",
21+
+ version = "0.60.0",
22+
+ sha256 = "7825214ccad7c2482cb490ac91dbc1e88b30223062796ce328aca893b74ae342",
23+
# Note: rules_rust should point to the releases, not archive to avoid the hassle of bootstrapping in crate_universe.
24+
# This is described in https://bazelbuild.github.io/rules_rust/crate_universe.html#setup, otherwise bootstrap
25+
# is required which in turn requires a system CC toolchains, not the bazel controlled ones.
26+
@@ -1477,7 +1477,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
27+
"dataplane_ext",
28+
],
29+
extensions = ["envoy.wasm.runtime.wasmtime"],
30+
- release_date = "2024-12-16",
31+
+ release_date = "2025-04-08",
32+
cpe = "N/A",
33+
license = "Apache-2.0",
34+
license_url = "https://github.com/bazelbuild/rules_rust/blob/{version}/LICENSE.txt",

pkgs/by-name/en/envoy/package.nix

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ let
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.33.0";
38-
rev = "b0f43d67aa25c1b03c97186a200cc187f4c22db3";
39-
hash = "sha256-zqekRpOlaA2IrwwFUEwASa1uokET98h5sr7EwzWgcbU=";
37+
version = "1.34.0";
38+
rev = "d7809ba2b07fd869d49bfb122b27f6a7977b4d94";
39+
hash = "sha256-SKdUrBXe0E3fMo73NROFO9Ck5FZidF/awP+QRA5t3VM=";
4040
};
4141

4242
# these need to be updated for any changes to fetchAttrs
4343
depsHash =
4444
{
45-
x86_64-linux = "sha256-4CQkHlXbDpRiqzeyserVf9PpLx3ME7TtZ2H88ggog6U=";
46-
aarch64-linux = "sha256-FxkfBWiG0NIInl28w+l4YvaV2VFuCtjn5VBAKvJoxM8=";
45+
x86_64-linux = "sha256-CiP9qH8/+nNZM8BNz84eVwWphVyDNo2KOYcK0wOsXn0=";
46+
aarch64-linux = "sha256-9HGg68R546JY1EOm22tg9CuPt0nU+FooFcLG9A2hkzE=";
4747
}
4848
.${stdenv.system} or (throw "unsupported system ${stdenv.system}");
4949

@@ -59,6 +59,8 @@ buildBazelPackage rec {
5959
repo = "envoy";
6060
inherit (srcVer) hash rev;
6161
};
62+
# By convention, these patches are generated like:
63+
# git format-patch --zero-commit --signoff --no-numbered --minimal --full-index --no-signature
6264
patches = [
6365
# use system Python, not bazel-fetched binary Python
6466
./0001-nixpkgs-use-system-Python.patch
@@ -68,6 +70,9 @@ buildBazelPackage rec {
6870

6971
# use system C/C++ tools
7072
./0003-nixpkgs-use-system-C-C-toolchains.patch
73+
74+
# bump rules_rust to support newer Rust
75+
./0004-nixpkgs-bump-rules_rust-to-0.60.0.patch
7176
];
7277
postPatch = ''
7378
chmod -R +w .
@@ -92,6 +97,12 @@ buildBazelPackage rec {
9297
--replace-fail 'crate_universe_dependencies()' 'crate_universe_dependencies(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc")' \
9398
--replace-fail 'crates_repository(' 'crates_repository(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc",'
9499
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+
cp ${./rules_rust.patch} bazel/rules_rust.patch
103+
substituteInPlace bazel/repositories.bzl \
104+
--replace-fail ', "@envoy//bazel:rules_rust_ppc64le.patch"' ""
105+
95106
substitute ${./rules_rust_extra.patch} bazel/nix/rules_rust_extra.patch \
96107
--subst-var-by bash "$(type -p bash)"
97108
cat bazel/nix/rules_rust_extra.patch bazel/rules_rust.patch > bazel/nix/rules_rust.patch
@@ -133,6 +144,7 @@ buildBazelPackage rec {
133144
sed -i \
134145
-e 's,${python3},__NIXPYTHON__,' \
135146
-e 's,${stdenv.shellPackage},__NIXSHELL__,' \
147+
-e 's,${builtins.storeDir}/[^/]\+/bin/bash,__NIXBASH__,' \
136148
$bazelOut/external/com_github_luajit_luajit/build.py \
137149
$bazelOut/external/local_config_sh/BUILD \
138150
$bazelOut/external/*_pip3/BUILD.bazel \
@@ -180,9 +192,12 @@ buildBazelPackage rec {
180192
sed -i \
181193
-e 's,__NIXPYTHON__,${python3},' \
182194
-e 's,__NIXSHELL__,${stdenv.shellPackage},' \
195+
-e 's,__NIXBASH__,${stdenv.shell},' \
183196
$bazelOut/external/com_github_luajit_luajit/build.py \
184197
$bazelOut/external/local_config_sh/BUILD \
185-
$bazelOut/external/*_pip3/BUILD.bazel
198+
$bazelOut/external/*_pip3/BUILD.bazel \
199+
$bazelOut/external/rules_rust/util/process_wrapper/private/process_wrapper.sh \
200+
$bazelOut/external/rules_rust/crate_universe/src/metadata/cargo_tree_rustc_wrapper.sh
186201
187202
# Install repinned rules_rust lockfile
188203
cp $bazelOut/external/Cargo.Bazel.lock source/extensions/dynamic_modules/sdk/rust/Cargo.Bazel.lock
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Luke Granger-Brown <[email protected]>
3+
Date: Thu, 17 Apr 2025 02:44:24 +0100
4+
Subject: [PATCH] rules_rust base
5+
6+
Signed-off-by: Luke Granger-Brown <[email protected]>
7+
---
8+
cargo/private/cargo_bootstrap.bzl | 8 ++++----
9+
crate_universe/extensions.bzl | 10 +++++-----
10+
crate_universe/src/lockfile.rs | 4 ++--
11+
rust/private/rustc.bzl | 4 ++--
12+
4 files changed, 13 insertions(+), 13 deletions(-)
13+
14+
diff --git cargo/private/cargo_bootstrap.bzl cargo/private/cargo_bootstrap.bzl
15+
index a8021c49d62037ef32c7c64d5bb4a5efe3a8b4aa..f63d7c23ae0bddc9f3fece347a3a2b5b0afe6d8d 100644
16+
--- cargo/private/cargo_bootstrap.bzl
17+
+++ cargo/private/cargo_bootstrap.bzl
18+
@@ -173,13 +173,13 @@ def _detect_changes(repository_ctx):
19+
# 'consumed' which means changes to it will trigger rebuilds
20+
21+
for src in repository_ctx.attr.srcs:
22+
- repository_ctx.watch(src)
23+
+ repository_ctx.path(src)
24+
25+
- repository_ctx.watch(repository_ctx.attr.cargo_lockfile)
26+
- repository_ctx.watch(repository_ctx.attr.cargo_toml)
27+
+ repository_ctx.path(repository_ctx.attr.cargo_lockfile)
28+
+ repository_ctx.path(repository_ctx.attr.cargo_toml)
29+
30+
if repository_ctx.attr.cargo_config:
31+
- repository_ctx.watch(repository_ctx.attr.cargo_config)
32+
+ repository_ctx.path(repository_ctx.attr.cargo_config)
33+
34+
def _cargo_bootstrap_repository_impl(repository_ctx):
35+
# Pretend to Bazel that this rule's input files have been used, so that it will re-run the rule if they change.
36+
diff --git crate_universe/extensions.bzl crate_universe/extensions.bzl
37+
index a749b10c8d469bd316d78034059c94b1fd98dbef..8f8c84dac1ec330d5e8e6abbd930387cb6c9f29e 100644
38+
--- crate_universe/extensions.bzl
39+
+++ crate_universe/extensions.bzl
40+
@@ -957,17 +957,17 @@ def _crate_impl(module_ctx):
41+
fail("Spec specified for repo {}, but the module defined repositories {}".format(repo, local_repos))
42+
43+
for cfg in mod.tags.from_cargo + mod.tags.from_specs:
44+
- # Preload all external repositories. Calling `module_ctx.watch` will cause restarts of the implementation
45+
+ # Preload all external repositories. Calling `module_ctx.path` will cause restarts of the implementation
46+
# function of the module extension when the file has changed.
47+
if cfg.cargo_lockfile:
48+
- module_ctx.watch(cfg.cargo_lockfile)
49+
+ module_ctx.path(cfg.cargo_lockfile)
50+
if cfg.lockfile:
51+
- module_ctx.watch(cfg.lockfile)
52+
+ module_ctx.path(cfg.lockfile)
53+
if cfg.cargo_config:
54+
- module_ctx.watch(cfg.cargo_config)
55+
+ module_ctx.path(cfg.cargo_config)
56+
if hasattr(cfg, "manifests"):
57+
for m in cfg.manifests:
58+
- module_ctx.watch(m)
59+
+ module_ctx.path(m)
60+
61+
cargo_path, rustc_path = _get_host_cargo_rustc(module_ctx, host_triple, cfg.host_tools_repo)
62+
cargo_bazel_fn = new_cargo_bazel_fn(
63+
diff --git crate_universe/src/lockfile.rs crate_universe/src/lockfile.rs
64+
index 3e0ce6265fda6fbdd9e3e989e3e4e4443b615b8c..0fafcea8fbc7a590676d34d2c4ca8c413b953955 100644
65+
--- crate_universe/src/lockfile.rs
66+
+++ crate_universe/src/lockfile.rs
67+
@@ -146,10 +146,10 @@ impl Digest {
68+
));
69+
hasher.update(b"\0");
70+
71+
- hasher.update(Digest::compute_single_hash(cargo_version, "Cargo version"));
72+
+ hasher.update(Digest::compute_single_hash("hermetic", "Cargo version"));
73+
hasher.update(b"\0");
74+
75+
- hasher.update(Digest::compute_single_hash(rustc_version, "Rustc version"));
76+
+ hasher.update(Digest::compute_single_hash("hermetic", "Rustc version"));
77+
hasher.update(b"\0");
78+
79+
let hash = hasher.finalize().encode_hex::<String>();
80+
diff --git rust/private/rustc.bzl rust/private/rustc.bzl
81+
index d78c28902c8f73ae655b8f6b5df3db5a1805aa19..321a24a946c33d5e3452758a72a77b52d5a3eccf 100644
82+
--- rust/private/rustc.bzl
83+
+++ rust/private/rustc.bzl
84+
@@ -1059,7 +1059,7 @@ def construct_arguments(
85+
86+
if toolchain.llvm_cov and ctx.configuration.coverage_enabled:
87+
# https://doc.rust-lang.org/rustc/instrument-coverage.html
88+
- rustc_flags.add("--codegen=instrument-coverage")
89+
+ pass
90+
91+
if toolchain._experimental_link_std_dylib:
92+
rustc_flags.add("--codegen=prefer-dynamic")
93+
@@ -1563,7 +1563,7 @@ def rustc_compile_action(
94+
})
95+
crate_info = rust_common.create_crate_info(**crate_info_dict)
96+
97+
- if crate_info.type in ["staticlib", "cdylib"]:
98+
+ if crate_info.type in ["staticlib", "cdylib"] and not out_binary:
99+
# These rules are not supposed to be depended on by other rust targets, and
100+
# as such they shouldn't provide a CrateInfo. However, one may still want to
101+
# write a rust_test for them, so we provide the CrateInfo wrapped in a provider

0 commit comments

Comments
 (0)