The vim plugin "LanguageClient-neovim" seems to miss a dependency, when installing it via configuration.nix, vim starts with warnings:
Error detected while processing /nix/store/ah9najhdvhhh1x0n8lymv3qr9yjag4wq-vimplugin-LanguageClient-neovim-2017-12-05/share/vim-plugins/LanguageClient-neovim/plugin/LanguageClient.vim:
line 8:
E117: Unknown function: yarp#py3
E15: Invalid expression: yarp#py3('LanguageClient_wrapper')
It seems these are not yet packaged in nixpkgs.
Install { name = "LanguageClient-neovim"; } in vim customization, then start vim after rebuilding.
"x86_64-linux"Linux 4.14.5, NixOS, 18.03pre124015.f59a0f7f1a6 (Impala)yesyesnix-env (Nix) 1.11.16"nixos-18.03pre124015.f59a0f7f1a6"""/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgsThis wont be that simple. nvim-yarp needs python3Packages.neovim, but I don't know how to add this dependency properly in a package definition for nvim-yarp... so things are complicated.
Ok. I tried adding the missing packages to my knownPlugins:
"vim-hug-neovim-rpc" = buildVimPlugin {
name = "vim-hug-neovim-rpc";
src = fetchgit {
url = "https://github.com/roxma/vim-hug-neovim-rpc";
rev = "60093847f0ba0a57ace54df30bd17a8239a99d6f";
sha256 = "0rim73si32z1h9rh0i2qs5gy010cpb6mz1zxr197agf85zdq7x0f";
};
dependencies = [];
pythonDependencies = with pkgs.python3Packages; [ neovim ];
};
"nvim-yarp" = buildVimPlugin {
name = "nvim-yarp";
src = fetchgit {
url = "https://github.com/roxma/nvim-yarp";
rev = "b222af8dbbfb35c6d833fd76a940f6ca2fe322fa";
sha256 = "0rialn5xmyd3n02j81cflvljrx2lld2mhggni66frrjdz5c45xkl";
};
dependencies = [];
pythonDependencies = with pkgs.python3Packages; [ neovim ];
};
and import them into my
pluginDictionaries = [
/* others */
{ name = "LanguageClient-neovim"; }
{ name = "nvim-yarp"; }
{ name = "vim-hug-neovim-rpc"; }
];
But when firing up vim I still get
[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):
Error detected while processing function HandleCursorMoved[1]..yarp#core#notify[1]..yarp#core#wait_channel[5]..yarp#core#jobstart[2]..yarp#pyx#init[13]..yarp#core#serveraddr[1]..neovim_rpc#serveraddr:
line 15:
E605: Exception not caught: [vim-hug-neovim-rpc] requires `:pythonx import neovim` command to work
I guess I'll ping some vim guys now (because I don't know how to continue): @bjornfor @jagajaga and @garbas seem to contrib a lot commits in the vim-plugins tree... so you get pinged! :smile:
Here's a working expression:
LanguageClient-neovim = let x = rustPlatform.buildRustPackage {
name = "vimplugin-LanguageClient-neovim-2018-03-10";
src = fetchgit {
url = "https://github.com/autozimu/LanguageClient-neovim";
rev = "afd61dabf0989d081f0d2654d0e3888103faef75";
sha256 = "1hcx48y52k4flz0lw95pvdcwkn9h969fz6mq9ixxmvvbzzcb34gl";
};
cargoSha256 = "0c2sklpvab63a1f1mhcq9abq5m2srkj52ypq7dq44g8ngn2a05ka";
installPhase = ''
cp target/release/languageclient bin/
target=$out/${rtpPath}/LanguageClient-neovim
mkdir -p $out/${rtpPath}
cp -r . $target
${vimHelpTags}
vimHelpTags $target
if [ -n "$addonInfo" ]; then
echo "$addonInfo" > $target/addon-info.json
fi
'';
}; in x // {rtp = "${x}/${rtpPath}/LanguageClient-neovim";};
I think probably buildVimPlugin and/or buildRustPackage should be refactored so they can be combined more easily.
I also had a try at getting this to work
{
LanguageClient-neovim =
let
LanguageClient-neovim-src = fetchgit {
url = "https://github.com/autozimu/LanguageClient-neovim";
rev = "fbc46862af7fa254f74f1108149fd0669c46f1ad";
sha256 = "1wrrmikriyw8an8hn7240igcaca9a0ykh1j0dfy45kslxkmqkk3r";
};
LanguageClient-neovim-bin = rustPlatform.buildRustPackage {
name = "LanguageClient-neovim-bin";
src = LanguageClient-neovim-src;
cargoSha256 = "0c2sklpvab63a1f1mhcq9abq5m2srkj52ypq7dq44g8ngn2a05ka";
};
in buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "LanguageClient-neovim-2018-03-06";
src = LanguageClient-neovim-src;
dependencies = [];
propogatedBuildInputs = [ LanguageClient-neovim-bin ];
preFixup = ''
substituteInPlace "$out"/share/vim-plugins/LanguageClient-neovim/plugin/LanguageClient.vim \
--replace "let l:command = [s:root . '/bin/languageclient']" "let l:command = ['${LanguageClient-neovim-bin}/bin/languageclient']"
'';
};
}
I couldn't see a way to make it look reasonable as a patch for vim2nix though without at least 2 derivations (either in a let binding or a recursive set).
@johnchildren I think it is ok for some complicated plugins to just be done manually. Make sure to put it above # --- generated packages bellow this line --- comment. Would you be able to create a PR with this fix?
https://github.com/NixOS/nixpkgs/pull/36829 hopefully contains the requested changes.
edit: I don't know if this actually addresses the original issue though.
@matthiasbeyer you maybe have time to check if LanguageClient-neovim works for you now, since we merged #36856?
@garbas I'd love to. Unfortunately, because I bake vim directly into configuration.nix, I would need to rebuild _a lot_: these paths will be fetched (1077.08 MiB download, 3725.46 MiB unpacked):.
Is there a way to build only one package from configuration.nix?
Am trying with
{ pkgs ? (import <nixpkgs> {}) }:
let
vim = import ./pkgs/vim.nix { pkgs = pkgs; lib = pkgs.lib; };
in
pkgs.stdenv.mkDerivation rec {
name = "vim";
src = /var/empty;
version = "0.0.0";
buildInputs = vim;
}
and nix-build script.nix -I nixpkgs=/my/checkout.
The above fails:
unpacking source archive /nix/store/9ljssglw74jabzzsqsl3lim4d5jgh4ya-empty
source root is empty
/nix/store/15kgcm8hnd99p7plqzx7p4lcr2jni4df-set-source-date-epoch-to-latest.sh: line 13: [: : integer expression expected
patching sources
configuring
no configure script, doing nothing
building
no Makefile, doing nothing
installing
install flags: install
make: *** No rule to make target 'install'. Stop.
builder for '/nix/store/6i35g99m9550ybfvibm7r1fa4x8lk1pd-vim.drv' failed with exit code 2
error: build of '/nix/store/6i35g99m9550ybfvibm7r1fa4x8lk1pd-vim.drv' failed
With master at 669cbb63d089917c089b17a8bd39791375782e26
Cargo-culted with nix repl and loading the default.nix from master and then :b builtins.head (import ./pkgs/vim.nix { pkgs = pkgs; lib = pkgs.lib; }).
This results in a vim which does not print the error messages from this issue anymore. Will now do more tests.
I just renamed a function with RLS! Seems to work :tada:
Most helpful comment
I just renamed a function with RLS! Seems to work :tada: