diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2018-12-26 09:53:41 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2019-01-15 17:12:56 +0000 |
commit | ca61531750349c74006c6195ba47970022d179b7 (patch) | |
tree | b0a62f86e51467040d4f2e2294c5ddcce594f663 /pkgs/development/tools/misc/ccls | |
parent | f9bd1533773e5fd3576b07cd7a39215b0cb3dad9 (diff) | |
download | nixpkgs-ca61531750349c74006c6195ba47970022d179b7.tar nixpkgs-ca61531750349c74006c6195ba47970022d179b7.tar.gz nixpkgs-ca61531750349c74006c6195ba47970022d179b7.tar.bz2 nixpkgs-ca61531750349c74006c6195ba47970022d179b7.tar.lz nixpkgs-ca61531750349c74006c6195ba47970022d179b7.tar.xz nixpkgs-ca61531750349c74006c6195ba47970022d179b7.tar.zst nixpkgs-ca61531750349c74006c6195ba47970022d179b7.zip |
ccls: init at 0.20181225
- tested with [emacs](https://dl.thalheim.io/kdh-PwxzlwGKTEl1_NpTzg/2019-01-13-190156_1920x1080_scrot.png) and vim. - wrapped to pick up our cc wrapper environment -> works perfectly in nix-shell
Diffstat (limited to 'pkgs/development/tools/misc/ccls')
-rw-r--r-- | pkgs/development/tools/misc/ccls/default.nix | 43 | ||||
-rw-r--r-- | pkgs/development/tools/misc/ccls/wrapper | 12 |
2 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/ccls/default.nix b/pkgs/development/tools/misc/ccls/default.nix new file mode 100644 index 00000000000..267cd943edd --- /dev/null +++ b/pkgs/development/tools/misc/ccls/default.nix @@ -0,0 +1,43 @@ +{ 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 ]; + }; +} diff --git a/pkgs/development/tools/misc/ccls/wrapper b/pkgs/development/tools/misc/ccls/wrapper new file mode 100644 index 00000000000..f8d7b9eb3fe --- /dev/null +++ b/pkgs/development/tools/misc/ccls/wrapper @@ -0,0 +1,12 @@ +#! @shell@ -e + +initString="--init={\"clang\":{\"extraArgs\": [@standard_library_includes@" + +if [ "${NIX_CFLAGS_COMPILE}" != "" ]; then + read -a cflags_array <<< ${NIX_CFLAGS_COMPILE} + initString+=$(printf ', \"%s\"' "${cflags_array[@]}") +fi + +initString+="]}}" + +exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "${extraFlagsArray[@]}" "$@" |