[PATCH] tools: use llvmPackages as input

Alyssa Ross
2025-11-04T18:33:18Z

This makes sure that clang and clang-tidy will be using the same
version of LLVM. (It's looking like we might also need LLVM libunwind
at some point, so that's another thing we could take from a single
llvmPackages.)

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
tools/default.nix | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/default.nix b/tools/default.nix
index 398f570..06b7ed2 100644
--- a/tools/default.nix
+++ b/tools/default.nix
@@ -5,9 +5,9 @@
import ../lib/call-package.nix (
{ src, lib, stdenv, fetchCrate, fetchurl, runCommand, buildPackages
, meson, ninja, pkg-config, rustc
-, clang-tools, clippy, jq
+, llvmPackages, clippy, jq
, dbus, linuxHeaders
-, clang, libbpf
+, libbpf
, buildSupport ? false
, appSupport ? true
, hostSupport ? false
@@ -86,7 +86,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ meson ninja ]
++ lib.optionals (appSupport || driverSupport) [ pkg-config ]
++ lib.optionals hostSupport [ rustc ]
- ++ lib.optionals driverSupport [ clang.cc ];
+ ++ lib.optionals driverSupport [ llvmPackages.clang-unwrapped ];
buildInputs = lib.optionals appSupport [ dbus ]
++ lib.optionals driverSupport [ libbpf linuxHeaders ];

@@ -121,7 +121,7 @@ stdenv.mkDerivation (finalAttrs: {

# clang-tools needs to be before clang, otherwise it will not use
# the Nix include path correctly and fail to find headers
- nativeBuildInputs = [ clang-tools jq ] ++ nativeBuildInputs;
+ nativeBuildInputs = [ llvmPackages.clang-tools jq ] ++ nativeBuildInputs;

buildPhase = ''
jq -r '.[].file | select(endswith(".c"))' compile_commands.json |

base-commit: 1d666582892fbdf812662b4490caf7821078eaf9
--
2.51.0