From 26aadca7c61d5a9a49ee1e6f1c705516e21bc06d Mon Sep 17 00:00:00 2001
From: Michael Weiss <dev.primeos@gmail.com>
Date: Tue, 31 Jan 2023 23:34:28 +0100
Subject: [PATCH] chromiumBeta: Fix the patch phase

Upstream dropped use_system_libwayland and related build arguments [0].
The deprecation is tracked in [1].
As a result, we must now build with third_party/wayland instead of
wayland from the system (or complex patches would be required).

This fixes [2].

[0]: https://source.chromium.org/chromium/chromium/src/+/1c3c8db518f78cb2d08a3990e5280e324c4a6e99
[1]: https://bugs.chromium.org/p/chromium/issues/detail?id=1385736
[2]: https://github.com/NixOS/nixpkgs/issues/213862#issuecomment-1411153401
---
 pkgs/applications/networking/browsers/chromium/common.nix | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index 413db2cf985c..aea178a3afc5 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -258,8 +258,6 @@ let
       host_toolchain = "//build/toolchain/linux/unbundle:default";
       # Don't build against a sysroot image downloaded from Cloud Storage:
       use_sysroot = false;
-      # The default value is hardcoded instead of using pkg-config:
-      system_wayland_scanner_path = "${wayland.bin}/bin/wayland-scanner";
       # Because we use a different toolchain / compiler version:
       treat_warnings_as_errors = false;
       # We aren't compiling with Chrome's Clang (would enable Chrome-specific
@@ -293,11 +291,14 @@ let
       chrome_pgo_phase = 0;
       clang_base_path = "${llvmPackages.clang}";
       use_qt = false;
+    } // lib.optionalAttrs (!chromiumVersionAtLeast "110") {
       # The default has changed to false. We'll build with libwayland from
       # Nixpkgs for now but might want to eventually use the bundled libwayland
       # as well to avoid incompatibilities (if this continues to be a problem
       # from time to time):
       use_system_libwayland = true;
+      # The default value is hardcoded instead of using pkg-config:
+      system_wayland_scanner_path = "${wayland.bin}/bin/wayland-scanner";
     } // lib.optionalAttrs proprietaryCodecs {
       # enable support for the H.264 codec
       proprietary_codecs = true;