From dee0cb7be53647613281c9bb95e94c8703af98f3 Mon Sep 17 00:00:00 2001 From: Sirio Balmelli Date: Fri, 20 Sep 2019 20:22:09 +0200 Subject: [PATCH] ycmd: add gopls completer ycmd gives 'no completer support' because of missing 'gopls'. Add this as a conditional dependency. Refactor the 'mkdir -p' step to be conditional per-dependency, and placed just before the link step. This is mostly for legibility but also pedantic correctness: do not create a directory unless it will be used. Signed-off-by: Sirio Balmelli --- pkgs/development/tools/misc/ycmd/default.nix | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pkgs/development/tools/misc/ycmd/default.nix b/pkgs/development/tools/misc/ycmd/default.nix index f4cb84beb8d2..eac81aa7f171 100644 --- a/pkgs/development/tools/misc/ycmd/default.nix +++ b/pkgs/development/tools/misc/ycmd/default.nix @@ -1,6 +1,7 @@ { stdenv, lib, fetchgit, cmake, llvmPackages, boost, python , gocode ? null , godef ? null +, gotools ? null , rustracerd ? null , fixDarwinDylibNames, Cocoa ? null }: @@ -49,19 +50,28 @@ stdenv.mkDerivation { mkdir -p $out/bin ln -s $out/lib/ycmd/ycmd/__main__.py $out/bin/ycmd - mkdir -p $out/lib/ycmd/third_party/{gocode,godef,racerd/target/release} - # Copy everything: the structure of third_party has been known to change. # When linking our own libraries below, do so with '-f' # to clobber anything we may have copied here. + mkdir -p $out/lib/ycmd/third_party cp -r third_party/* $out/lib/ycmd/third_party/ '' + lib.optionalString (gocode != null) '' - ln -sf ${gocode}/bin/gocode $out/lib/ycmd/third_party/gocode + TARGET=$out/lib/ycmd/third_party/gocode + mkdir -p $TARGET + ln -sf ${gocode}/bin/gocode $TARGET '' + lib.optionalString (godef != null) '' - ln -sf ${godef}/bin/godef $out/lib/ycmd/third_party/godef + TARGET=$out/lib/ycmd/third_party/godef + mkdir -p $TARGET + ln -sf ${godef}/bin/godef $TARGET + '' + lib.optionalString (gotools != null) '' + 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 (rustracerd != null) '' - ln -sf ${rustracerd}/bin/racerd $out/lib/ycmd/third_party/racerd/target/release + TARGET=$out/lib/ycmd/third_party/racerd/target/release + mkdir -p $TARGET + ln -sf ${rustracerd}/bin/racerd $TARGET ''; # fixup the argv[0] and replace __file__ with the corresponding path so