From 5af48ce05c09affacbc4c3dbd3580e901a66161e Mon Sep 17 00:00:00 2001 From: Luna Nova Date: Mon, 22 Sep 2025 17:46:57 -0700 Subject: [PATCH 1/2] electron: fix LLVM 21+ build by backporting patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chromium <139's histogram_macros_internal.h contains a UB static cast that causes a compile error for LLVM 21+ return static_cast(base::to_underlying(Enum::kMaxValue) + 1); → integer value 4 is outside the valid range of values [0, 3] for the enumeration type 'LandlockState' → error: static assertion expression is not an integral constant expression UMA_HISTOGRAM_ENUMERATION("Security.Sandbox.LandlockState", landlock_state); applying upstream fix from https://chromium-review.googlesource.com/c/chromium/src/+/6633292 A static cast to an enum type that is outside the range of enum values was defined to be undefined behavior in February 2014 in https://cplusplus.github.io/CWG/issues/1766.html --- 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 3b3fbf923cb8..bedef826ea5e 100644 --- a/pkgs/development/tools/electron/common.nix +++ b/pkgs/development/tools/electron/common.nix @@ -140,6 +140,15 @@ in url = "https://github.com/chromium/chromium/commit/6aae0e2353c857d98980ff677bf304288d7c58de.patch"; hash = "sha256-Dd38c/0hiH+PbGPJhhEFuW6kUR45A36XZqOVExoxlhM="; }) + ] + ++ lib.optionals (lib.versionOlder info.version "38") [ + # Fix build with LLVM 21+ + # https://chromium-review.googlesource.com/c/chromium/src/+/6633292 + (fetchpatch { + name = "Dont-return-an-enum-from-EnumSizeTraits-Count.patch"; + url = "https://github.com/chromium/chromium/commit/b0ff8c3b258a8816c05bdebf472dbba719d3c491.patch"; + hash = "sha256-YIWcsCj5w0jUd7D67hsuk0ljTA/IbHwA6db3eK4ggUY="; + }) ]; npmRoot = "third_party/node"; From 965f006e78235a57ac928c74412ed07442d84f0c Mon Sep 17 00:00:00 2001 From: qbisi Date: Tue, 23 Sep 2025 18:24:57 +0800 Subject: [PATCH 2/2] brunsli: fix build with cmake v4 --- pkgs/by-name/br/brunsli/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/br/brunsli/package.nix b/pkgs/by-name/br/brunsli/package.nix index c687020c0a31..1a0399733fb8 100644 --- a/pkgs/by-name/br/brunsli/package.nix +++ b/pkgs/by-name/br/brunsli/package.nix @@ -42,6 +42,11 @@ stdenv.mkDerivation rec { '' + lib.optionalString stdenv.hostPlatform.isDarwin '' rm -r build + '' + # fix build with cmake v4, should be removed in next release + + '' + substituteInPlace CMakeLists.txt \ + --replace-fail 'cmake_minimum_required(VERSION 3.1)' 'cmake_minimum_required(VERSION 3.10)' ''; nativeBuildInputs = [