nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchFromGitHub, makeWrapper
2, cmake, llvmPackages, rapidjson, runtimeShell }:
3
4stdenv.mkDerivation rec {
5 name = "ccls-${version}";
6 version = "0.20181225.8";
7
8 src = fetchFromGitHub {
9 owner = "MaskRay";
10 repo = "ccls";
11 rev = version;
12 sha256 = "05vih8wi2lzp4zqlqd18fs3va6s8p74ws8sx7vwpcc8vcsdzq5w9";
13 };
14
15 nativeBuildInputs = [ cmake makeWrapper ];
16 buildInputs = with llvmPackages; [ clang-unwrapped llvm rapidjson ];
17
18 cmakeFlags = [ "-DSYSTEM_CLANG=ON" ];
19
20 shell = runtimeShell;
21 postFixup = ''
22 # We need to tell ccls where to find the standard library headers.
23
24 standard_library_includes="\\\"-isystem\\\", \\\"${stdenv.lib.getDev stdenv.cc.libc}/include\\\""
25 standard_library_includes+=", \\\"-isystem\\\", \\\"${llvmPackages.libcxx}/include/c++/v1\\\""
26 export standard_library_includes
27
28 wrapped=".ccls-wrapped"
29 export wrapped
30
31 mv $out/bin/ccls $out/bin/$wrapped
32 substituteAll ${./wrapper} $out/bin/ccls
33 chmod --reference=$out/bin/$wrapped $out/bin/ccls
34 '';
35
36 meta = with stdenv.lib; {
37 description = "A c/c++ language server powered by clang";
38 homepage = https://github.com/MaskRay/ccls;
39 license = licenses.asl20;
40 platforms = platforms.linux;
41 maintainers = [ maintainers.mic92 ];
42 };
43}