From 0ed60bbcd1b043431958f004c29cb0f01ebd9004 Mon Sep 17 00:00:00 2001 From: emilylange Date: Sun, 10 Dec 2023 22:24:41 +0100 Subject: [PATCH] chromium: fix increased build time for non-cross-compilation builds Having ```nix host_toolchain = "//build/toolchain/linux/unbundle:host"; v8_snapshot_toolchain = "//build/toolchain/linux/unbundle:host"; ``` on native, non-cross-compilation builds roughly doubles the build steps and, by proxy, compute and time needed to build. So to resolve this, we conditionally change those values depending on whether we are cross-compiling or not. Co-authored-by: Adam Joseph --- pkgs/applications/networking/browsers/chromium/common.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 386957bed0c2..50d11ff39d84 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -387,9 +387,13 @@ let # depending on which part of the codebase you are in; see: # https://github.com/chromium/chromium/blob/d36462cc9279464395aea5e65d0893d76444a296/build/config/BUILDCONFIG.gn#L17-L44 custom_toolchain = "//build/toolchain/linux/unbundle:default"; + host_toolchain = "//build/toolchain/linux/unbundle:default"; + # We only build those specific toolchains when we cross-compile, as native non-cross-compilations would otherwise + # end up building much more things than they need to (roughtly double the build steps and time/compute): + } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { host_toolchain = "//build/toolchain/linux/unbundle:host"; v8_snapshot_toolchain = "//build/toolchain/linux/unbundle:host"; - + } // { host_pkg_config = "${pkgsBuildBuild.pkg-config}/bin/pkg-config"; pkg_config = "${pkgsBuildHost.pkg-config}/bin/${stdenv.cc.targetPrefix}pkg-config";