From c84bc29a8e9e963c9d8b4adce40653dddcb02f4c Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 29 May 2026 11:18:16 +0100 Subject: feat(nix/common): expose run-clang-tidy missing from nixpkgs clang-tools nixpkgs' clang-tools derivation symlinks scripts from clang-unwrapped only when they're executable; run-clang-tidy loses the +x bit during the multi-output split and gets skipped. Re-expose it ourselves by probing clang-unwrapped's main and python outputs (bin/ first, then the legacy share/clang/ layout) and installing the first hit at $out/bin/run-clang-tidy. --- nix/common.nix | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'nix/common.nix') diff --git a/nix/common.nix b/nix/common.nix index ba3a5e3..5707d2b 100644 --- a/nix/common.nix +++ b/nix/common.nix @@ -115,8 +115,28 @@ gnupg (pass.withExtensions (exts: [ exts.pass-otp ])) - # C/C++ source tooling (no compiler driver in PATH) + # C/C++ source tooling (no compiler driver in PATH). + # clang-tools ships clangd/clang-format/clang-tidy and most of the + # python helpers (git-clang-format, clang-format-diff, clang-tidy-diff) + # but skips run-clang-tidy because the symlink loop in nixpkgs' + # clang-tools derivation gates on the +x bit and run-clang-tidy + # loses it during the multi-output split. Re-expose it ourselves + # from clang-unwrapped's `python` output (tries both the modern + # bin/ layout and the legacy share/clang/ layout). clang-tools + (runCommand "run-clang-tidy" { } '' + mkdir -p $out/bin + for cand in ${llvmPackages.clang-unwrapped}/bin/run-clang-tidy \ + ${llvmPackages.clang-unwrapped.python}/bin/run-clang-tidy \ + ${llvmPackages.clang-unwrapped.python}/share/clang/run-clang-tidy.py; do + if [ -f "$cand" ]; then + install -m755 "$cand" $out/bin/run-clang-tidy + exit 0 + fi + done + echo "run-clang-tidy not found in clang-unwrapped outputs" >&2 + exit 1 + '') # CI runner (drives podman from pacman; act itself is just a Go binary) act -- cgit v1.3.1