3c7d4c74be
* This was mostly for //third_party/nix and its dependencies which now have been set to use llvmPackages_11 manually. * For //users/grfn/achilles we also manually select the newer LLVM version. * //tools/cheddar doesn't seem to need llvm anymore. * //third_party/buzz also compiles with clang 7.1.0 * replace clang-tools everywhere with new attribute clang-tools_11 For the future we may want to have something similar again, but it may not be necessary to invest too much time into it: nixpkgs is set to upgrade their default llvmPackages to LLVM 11 as well at some point in the near future. Co-Authored-By: sterni <sternenseemann@systemli.org> Change-Id: Id83868dbc476a6c776b59518b856c933f30ea79d Reviewed-on: https://cl.tvl.fyi/c/depot/+/3135 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi>
30 lines
851 B
Nix
30 lines
851 B
Nix
# Create a clangd wrapper script that can be used with this project.
|
|
# The default Nix wrapper only works with C projects, not C++
|
|
# projects.
|
|
#
|
|
# The CPATH construction logic is lifted from the original wrapper
|
|
# script.
|
|
|
|
pkgs:
|
|
|
|
pkgs.writeShellScriptBin "nix-clangd" ''
|
|
buildcpath() {
|
|
local path
|
|
while (( $# )); do
|
|
case $1 in
|
|
-isystem)
|
|
shift
|
|
path=$path''${path:+':'}$1
|
|
esac
|
|
shift
|
|
done
|
|
echo $path
|
|
}
|
|
|
|
export CPATH=''${CPATH}''${CPATH:+':'}:$(buildcpath ''${NIX_CFLAGS_COMPILE})
|
|
export CPATH=${pkgs.glibc.dev}/include''${CPATH:+':'}''${CPATH}
|
|
export CPLUS_INCLUDE_PATH=${pkgs.llvmPackages_11.libcxx}/include/c++/v1:''${CPATH}
|
|
|
|
# TODO(tazjin): Configurable commands directory?
|
|
exec -a clangd ${pkgs.llvmPackages_11.clang-unwrapped}/bin/clangd -cross-file-rename $@
|
|
''
|