nixpkgs/pkgs/development/tools/misc/ccls/default.nix
Jörg Thalheim dadc7eb329
treewide: use runtimeShell instead of stdenv.shell whenever possible
Whenever we create scripts that are installed to $out, we must use runtimeShell
in order to get the shell that can be executed on the machine we create the
package for. This is relevant for cross-compiling. The only use case for
stdenv.shell are scripts that are executed as part of the build system.
Usages in checkPhase are borderline however to decrease the likelyhood
of people copying the wrong examples, I decided to use runtimeShell as well.
2019-02-26 14:10:49 +00:00

44 lines
1.3 KiB
Nix

{ stdenv, fetchFromGitHub, makeWrapper
, cmake, llvmPackages, rapidjson, runtimeShell }:
stdenv.mkDerivation rec {
name = "ccls-${version}";
version = "0.20181225.8";
src = fetchFromGitHub {
owner = "MaskRay";
repo = "ccls";
rev = version;
sha256 = "05vih8wi2lzp4zqlqd18fs3va6s8p74ws8sx7vwpcc8vcsdzq5w9";
};
nativeBuildInputs = [ cmake makeWrapper ];
buildInputs = with llvmPackages; [ clang-unwrapped llvm rapidjson ];
cmakeFlags = [ "-DSYSTEM_CLANG=ON" ];
shell = runtimeShell;
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 ];
};
}