From a2d93ae0122aff62866e9266e5e51d4615a00783 Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Mon, 28 Jul 2025 17:11:11 -0400 Subject: Disable automatic `#include` insertion for clangd (#7951) --- flake.nix | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 5b63b0e4c..3f1bf6e62 100644 --- a/flake.nix +++ b/flake.nix @@ -21,10 +21,23 @@ # the latter brings in GCC by default on Linux. devShell = pkgs.mkShellNoCC { buildInputs = [ - # Must put `clang-tools` before `clang` for clangd to work properly. - # We use `llvmPackages_17.clang-tools` instead of just `clang-tools` - # to match the `clang-format` version used in CI. - pkgs.llvmPackages_17.clang-tools + # We must list clangd before the `clang` package to make sure it + # comes earlier on the `PATH`, and we must get it from the + # `clang-tools` package so that it is wrapped properly. + (pkgs.linkFarm "clangd-21" [ + { + name = "bin/clangd"; + # New enough to support `HeaderInsertion: Never` in `.clangd`. + path = "${pkgs.llvmPackages_21.clang-tools}/bin/clangd"; + } + ]) + (pkgs.linkFarm "clang-format-17" [ + { + name = "bin/clang-format"; + # Match the clang-format version used in CI. + path = "${pkgs.llvmPackages_17.clang-tools}/bin/clang-format"; + } + ]) pkgs.clang pkgs.cmake -- cgit v1.2.3