From 4f0917ea13ca9b33997d1dd791c2280c3e8c2be0 Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 19 Aug 2025 12:18:27 +0200 Subject: [PATCH 1/3] electron: clean up unused patches --- pkgs/development/tools/electron/common.nix | 20 ------------------- .../tools/electron/use-rust-adler2.patch | 13 ------------ 2 files changed, 33 deletions(-) delete mode 100644 pkgs/development/tools/electron/use-rust-adler2.patch diff --git a/pkgs/development/tools/electron/common.nix b/pkgs/development/tools/electron/common.nix index 44c4ea2c62a0..f2a2c60da5a8 100644 --- a/pkgs/development/tools/electron/common.nix +++ b/pkgs/development/tools/electron/common.nix @@ -86,26 +86,6 @@ in patches = base.patches - # Fix building with Rust 1.86+ - # electron_33 and electron_34 use older chromium versions which expect rust - # to provide the older `adler` library instead of the newer `adler2` library - # This patch makes those older versions also use the new adler2 library - ++ lib.optionals (lib.versionOlder info.version "35") [ - ./use-rust-adler2.patch - ] - # Requirements for the next section - ++ lib.optionals (lib.versionOlder info.version "35") [ - (fetchpatch { - name = "Avoid-build-rust-PartitionAlloc-dep-when-not-build_with_chromium.patch"; - url = "https://github.com/chromium/chromium/commit/ee94f376a0dd642a93fbf4a5fa8e7aa8fb2a69b5.patch"; - hash = "sha256-qGjy9VZ4d3T5AuqOrBKEajBswwBU/7j0n80rpvHZLmM="; - }) - (fetchpatch { - name = "Suppress-unsafe_libc_call-warning-for-rust-remap_alloc-cc.patch"; - url = "https://github.com/chromium/chromium/commit/d5d79d881e74c6c8630f7d2f3affd4f656fdeb4e.patch"; - hash = "sha256-1oy5WRvNzKuUTJkt8kULUqE4JU+EKEV1PB9QN8HF4SE="; - }) - ] # Fix building with Rust 1.87+ # https://issues.chromium.org/issues/407024458 ++ lib.optionals (lib.versionOlder info.version "37") [ diff --git a/pkgs/development/tools/electron/use-rust-adler2.patch b/pkgs/development/tools/electron/use-rust-adler2.patch deleted file mode 100644 index 7a7bdacecd3d..000000000000 --- a/pkgs/development/tools/electron/use-rust-adler2.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/build/rust/std/BUILD.gn b/build/rust/std/BUILD.gn -index 6b996aa1fe3865187d02c017e56c0918bcc9b8f4..68b085be200fa4f116aa709b9157c4d2efdf7d6a 100644 ---- a/build/rust/std/BUILD.gn -+++ b/build/rust/std/BUILD.gn -@@ -89,7 +89,7 @@ if (toolchain_has_rust) { - # These are no longer present in the Windows toolchain. - stdlib_files += [ - "addr2line", -- "adler", -+ "adler2", - "gimli", - "libc", - "memchr", From 6a7b45f0f78fa7dbb96cd2978050f62e04b0ba4e Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 19 Aug 2025 12:51:58 +0200 Subject: [PATCH 2/3] chromium: fix build with rust 1.89.0 Co-authored-by: Emily --- .../networking/browsers/chromium/common.nix | 18 ++++++++++++++++++ ...ust-1.86-mismatched_lifetime_syntaxes.patch | 14 ++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/applications/networking/browsers/chromium/patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index f0be1d3a5c99..e7e05416dfa8 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -526,6 +526,24 @@ let # preventing compilations of chromium with versions below their intended version, not about running the very # exact version or even running a newer version. ./patches/chromium-136-nodejs-assert-minimal-version-instead-of-exact-match.patch + ] + ++ lib.optionals (chromiumVersionAtLeast "138") [ + (fetchpatch { + # Unbreak building with Rust 1.89+ which introduced + # a new mismatched_lifetime_syntaxes lint. + # https://issues.chromium.org/issues/424424323 + name = "chromium-138-rust-1.86-mismatched_lifetime_syntaxes.patch"; + # https://chromium-review.googlesource.com/c/chromium/src/+/6658267 + url = "https://chromium.googlesource.com/chromium/src/+/94a87ff38c51fd1a71980a5051d3553978391608^!?format=TEXT"; + decode = "base64 -d"; + includes = [ "build/rust/cargo_crate.gni" ]; + hash = "sha256-xf1Jq5v3InXkiVH0uT7+h1HPwZse5MDcHKuJNjSLR6k="; + }) + ] + ++ lib.optionals (!chromiumVersionAtLeast "138") [ + # Rebased variant of the patch above for + # electron 35 (M134) and 36 (M136) + ./patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch ]; postPatch = diff --git a/pkgs/applications/networking/browsers/chromium/patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch b/pkgs/applications/networking/browsers/chromium/patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch new file mode 100644 index 000000000000..51e60a711a7a --- /dev/null +++ b/pkgs/applications/networking/browsers/chromium/patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch @@ -0,0 +1,14 @@ +diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni +index 8266c44cbd1dfb8a53797dbe911ea74c32ce070e..ec7d751f2d068151dfeb71aa1f6510483bebd95c 100644 +--- a/build/rust/cargo_crate.gni ++++ b/build/rust/cargo_crate.gni +@@ -285,6 +285,9 @@ template("cargo_crate") { + } + rustenv = _rustenv + ++ # TODO(crbug.com/424424323): Clean up and enable. ++ rustflags += [ "-Amismatched_lifetime_syntaxes" ] ++ + if (!defined(build_native_rust_unit_tests)) { + build_native_rust_unit_tests = _crate_type != "proc-macro" + } From 283050e8c7ee88b1bc3d2614449ade12b01c63cd Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 19 Aug 2025 13:23:34 +0200 Subject: [PATCH 3/3] electron: fix build with rust 1.89.0 --- pkgs/development/tools/electron/common.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/tools/electron/common.nix b/pkgs/development/tools/electron/common.nix index f2a2c60da5a8..3bc8a00dcae6 100644 --- a/pkgs/development/tools/electron/common.nix +++ b/pkgs/development/tools/electron/common.nix @@ -131,6 +131,15 @@ in url = "https://github.com/chromium/chromium/commit/f8f21fb4aa01f75acbb12abf5ea8c263c6817141.patch"; hash = "sha256-z/aQ1oQjFZnkUeRnrD6P/WDZiYAI1ncGhOUM+HmjMZA="; }) + ] + # Fix build with Rust 1.89.0 + ++ lib.optionals (lib.versionOlder info.version "38") [ + # https://chromium-review.googlesource.com/c/chromium/src/+/6624733 + (fetchpatch { + name = "Define-rust-no-alloc-shim-is-unstable-v2.patch"; + url = "https://github.com/chromium/chromium/commit/6aae0e2353c857d98980ff677bf304288d7c58de.patch"; + hash = "sha256-Dd38c/0hiH+PbGPJhhEFuW6kUR45A36XZqOVExoxlhM="; + }) ]; npmRoot = "third_party/node";