summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2019-01-16 23:56:55 +0000
committerGitHub <noreply@github.com>2019-01-16 23:56:55 +0000
commitbb885d502ae2b1de0f15b7422dbcfc83eda20715 (patch)
tree2f130ac61c1e2cb53ec40f65a479fad56be5ba85
parent9b99afa86ac2082b540a70402e2ef2ba5490005a (diff)
parentca61531750349c74006c6195ba47970022d179b7 (diff)
downloadnixpkgs-bb885d502ae2b1de0f15b7422dbcfc83eda20715.tar
nixpkgs-bb885d502ae2b1de0f15b7422dbcfc83eda20715.tar.gz
nixpkgs-bb885d502ae2b1de0f15b7422dbcfc83eda20715.tar.bz2
nixpkgs-bb885d502ae2b1de0f15b7422dbcfc83eda20715.tar.lz
nixpkgs-bb885d502ae2b1de0f15b7422dbcfc83eda20715.tar.xz
nixpkgs-bb885d502ae2b1de0f15b7422dbcfc83eda20715.tar.zst
nixpkgs-bb885d502ae2b1de0f15b7422dbcfc83eda20715.zip
Merge pull request #53888 from Mic92/ccls
ccls: init at 0.20181225.7
-rw-r--r--pkgs/development/tools/misc/ccls/default.nix43
-rw-r--r--pkgs/development/tools/misc/ccls/wrapper12
-rw-r--r--pkgs/top-level/all-packages.nix6
3 files changed, 60 insertions, 1 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[@]}" "$@"
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 90ea01bd6c8..69da6853836 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8502,7 +8502,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;