Skip to content

Commit 5f3c644

Browse files
author
Adam Joseph
committed
chromium: control llvmPackages version selection with a string
Sometimes we access `llvmPackages` via `pkgs`, and other times via `pkgsFooBar`, so unfortunately a string (attrname) is the only way to have a single point of control over the LLVM version used for both buildPlatform and hostPlatform.
1 parent 53af611 commit 5f3c644

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

pkgs/applications/networking/browsers/chromium/common.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{ stdenv, lib, fetchurl, fetchpatch
2+
, buildPackages
3+
, pkgsBuildBuild
4+
, pkgsBuildTarget
25
# Channel data:
36
, channel, upstream-info
47
# Helper functions:
@@ -8,7 +11,7 @@
811
, ninja, pkg-config
912
, python3, perl
1013
, which
11-
, llvmPackages
14+
, llvmPackages_attrName
1215
, rustc
1316
# postPatch:
1417
, pkgsBuildHost
@@ -130,7 +133,7 @@ let
130133
ninja pkg-config
131134
python3WithPackages perl
132135
which
133-
llvmPackages.bintools
136+
buildPackages.${llvmPackages_attrName}.bintools
134137
bison gperf
135138
];
136139

@@ -308,7 +311,7 @@ let
308311
rtc_use_pipewire = true;
309312
# Disable PGO because the profile data requires a newer compiler version (LLVM 14 isn't sufficient):
310313
chrome_pgo_phase = 0;
311-
clang_base_path = "${llvmPackages.stdenv.cc}";
314+
clang_base_path = "${pkgsBuildTarget.${llvmPackages_attrName}.stdenv.cc}";
312315
use_qt = false;
313316
# To fix the build as we don't provide libffi_pic.a
314317
# (ld.lld: error: unable to find library -l:libffi_pic.a):

pkgs/applications/networking/browsers/chromium/default.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
, commandLineArgs ? ""
1919
, pkgsBuildTarget
2020
, pkgsBuildBuild
21+
, pkgs
2122
}:
2223

2324
let
24-
llvmPackages = pkgsBuildTarget.llvmPackages_16;
25-
stdenv = llvmPackages.stdenv;
25+
# Sometimes we access `llvmPackages` via `pkgs`, and other times
26+
# via `pkgsFooBar`, so a string (attrname) is the only way to have
27+
# a single point of control over the LLVM version used.
28+
llvmPackages_attrName = "llvmPackages_16";
29+
stdenv = pkgs.${llvmPackages_attrName}.stdenv;
2630

2731
upstream-info = (lib.importJSON ./upstream-info.json).${channel};
2832

@@ -44,7 +48,7 @@ let
4448
callPackage = newScope chromium;
4549

4650
chromium = rec {
47-
inherit stdenv llvmPackages upstream-info;
51+
inherit stdenv llvmPackages_attrName upstream-info;
4852

4953
mkChromiumDerivation = callPackage ./common.nix ({
5054
inherit channel chromiumVersionAtLeast versionRange;

0 commit comments

Comments
 (0)