nixpkgs/pkgs/development/tools/misc/ccls/default.nix

44 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, makeWrapper
, cmake, llvmPackages, rapidjson }:
stdenv.mkDerivation rec {
name = "ccls-${version}";
version = "0.20181225.7";
src = fetchFromGitHub {
owner = "MaskRay";
repo = "ccls";
rev = version;
sha256 = "1qgb2nk4nsgbx4qwymwlzi202daskk536a5l877fsp878jpp61cm";
};
nativeBuildInputs = [ cmake makeWrapper ];
buildInputs = with llvmPackages; [ clang-unwrapped llvm rapidjson ];
cmakeFlags = [ "-DSYSTEM_CLANG=ON" ];
shell = stdenv.shell;
postFixup = ''
# We need to tell ccls where to find the standard library headers.
standard_library_includes="\\\"-isystem\\\", \\\"${stdenv.lib.getDev stdenv.cc.libc}/include\\\""
standard_library_includes+=", \\\"-isystem\\\", \\\"${llvmPackages.libcxx}/include/c++/v1\\\""
export standard_library_includes
wrapped=".ccls-wrapped"
export wrapped
mv $out/bin/ccls $out/bin/$wrapped
substituteAll ${./wrapper} $out/bin/ccls
chmod --reference=$out/bin/$wrapped $out/bin/ccls
'';
meta = with stdenv.lib; {
description = "A c/c++ language server powered by clang";
homepage = https://github.com/MaskRay/ccls;
license = licenses.asl20;
platforms = platforms.linux;
maintainers = [ maintainers.mic92 ];
};
}