3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
Jörg Thalheim 2018-12-26 09:53:41 +01:00
parent f9bd153377
commit ca61531750
No known key found for this signature in database
GPG key ID: CA4106B8D7CC79FA
3 changed files with 60 additions and 1 deletions

View file

@ -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 ];
};
}

View file

@ -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[@]}" "$@"

View file

@ -8492,7 +8492,11 @@ in
cpplint = callPackage ../development/tools/analysis/cpplint { };
cquery = callPackage ../development/tools/misc/cquery {
llvmPackages = llvmPackages_7;
llvmPackages = llvmPackages_latest;
};
ccls = callPackage ../development/tools/misc/ccls {
llvmPackages = llvmPackages_latest;
};
credstash = with python3Packages; toPythonApplication credstash;