diff --git a/pkgs/development/tools/misc/ycmd/default.nix b/pkgs/development/tools/misc/ycmd/default.nix index 6779c096d398..f77ced3a2ada 100644 --- a/pkgs/development/tools/misc/ycmd/default.nix +++ b/pkgs/development/tools/misc/ycmd/default.nix @@ -1,16 +1,17 @@ { stdenv, lib, fetchgit, cmake, llvmPackages, boost, python -, gocode ? null -, godef ? null -, gotools ? null -, nodePackages ? null -, fixDarwinDylibNames, Cocoa ? null +, withGocode ? true, gocode +, withGodef ? true, godef +, withGotools? true, gotools +, withTypescript ? true, nodePackages +, fixDarwinDylibNames, Cocoa }: stdenv.mkDerivation { pname = "ycmd"; - version = "2020-02-22"; + version = "unstable-2020-02-22"; disabled = !python.isPy3k; + # required for third_party directory creation src = fetchgit { url = "https://github.com/Valloric/ycmd.git"; rev = "9a6b86e3a156066335b678c328f226229746bae5"; @@ -20,7 +21,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; buildInputs = [ boost llvmPackages.libclang ] - ++ lib.optional stdenv.hostPlatform.isDarwin Cocoa; + ++ lib.optional stdenv.isDarwin Cocoa; buildPhase = '' export EXTRA_CMAKE_ARGS=-DPATH_TO_LLVM_ROOT=${llvmPackages.clang-unwrapped} @@ -58,19 +59,19 @@ stdenv.mkDerivation { mkdir -p $out/lib/ycmd/third_party cp -r third_party/* $out/lib/ycmd/third_party/ - '' + lib.optionalString (gocode != null) '' + '' + lib.optionalString withGocode '' TARGET=$out/lib/ycmd/third_party/gocode mkdir -p $TARGET ln -sf ${gocode}/bin/gocode $TARGET - '' + lib.optionalString (godef != null) '' + '' + lib.optionalString withGodef '' TARGET=$out/lib/ycmd/third_party/godef mkdir -p $TARGET ln -sf ${godef}/bin/godef $TARGET - '' + lib.optionalString (gotools != null) '' + '' + lib.optionalString withGotools '' TARGET=$out/lib/ycmd/third_party/go/src/golang.org/x/tools/cmd/gopls mkdir -p $TARGET ln -sf ${gotools}/bin/gopls $TARGET - '' + lib.optionalString (nodePackages != null) '' + '' + lib.optionalString withTypescript '' TARGET=$out/lib/ycmd/third_party/tsserver ln -sf ${nodePackages.typescript} $TARGET ''; @@ -79,10 +80,8 @@ stdenv.mkDerivation { # python won't be thrown off by argv[0] postFixup = '' substituteInPlace $out/lib/ycmd/ycmd/__main__.py \ - --replace $out/lib/ycmd/ycmd/__main__.py \ - $out/bin/ycmd \ - --replace __file__ \ - "'$out/lib/ycmd/ycmd/__main__.py'" + --replace $out/lib/ycmd/ycmd/__main__.py $out/bin/ycmd \ + --replace __file__ "'$out/lib/ycmd/ycmd/__main__.py'" ''; meta = with lib; {