Coc.nvim: How to install coc.nvim on nixos?

Created on 20 Mar 2019  ·  4Comments  ·  Source: neoclide/coc.nvim

Is your feature request related to a problem? Please describe.
Hi. i'm currently on nixos.
It's file system isn't follow FHS.
And when i want to use coc, i get an error:
Edit: i'm using vim-plug as plugin manager and this method works fine in arch linux:
Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}}

help wanted

Most helpful comment

UPDATE: The base Coc plugin can be installed using the vimPlugins.coc-nvim package, as described below, and works well. However, while the extensions are available, many of them are not in a usable state yet. The vimPlugins.coc-* extensions packages described below have been added to the Nixpkgs repo in their raw source code form. Many will need further packaging refinements (e.g., being compiled) to become usable. This is a known but not well-documented issue and we need more developers to step in (see this discussion for more context). You can try your luck installing your extension using the Nixpkgs, and if it doesn't work, you can fall back to using :CocInstall, which will cause your extension to be installed in the normal fashion.


For anyone coming in from Google, the README.md advice as of writing is outdated. Coc and many Coc extensions are now distributed through Nix itself and you can use Nix to manage everything.

Coc itself is packaged as nixpkgs.vimPlugins.coc-nvim (vimplugin-coc-nvim) and can be installed using home-manager (just add pkgs.vimPlugins.coc-nvim to programs.neovim.plugins in your home-manager config). Alternatively, if you don't want to use home-manager, try this: https://www.mpscholten.de/nixos/2016/04/11/setting-up-vim-on-nixos.html. These methods leverage vim's/Neovim's built-in module system under the hood, I believe.

~For a list of Coc extensions, see the master plugins list and search for coc-. You can use nix search to find more details about each package.~ You can see a list of Coc extensions here by searching for coc-, but note that as of writing, many of these don't work (see above).

The traditional methods using vim plug, Pathogen, etc. still work. Pick your poison.

All 4 comments

It use https://github.com/zeit/pkg for build binary, but it doesn't provide prebuild nodejs for your system, so you have to build from source code.

I can actually figure out how to install coc.nvim on nixos:
~~1. Install nodejs and yarn via nix-env or put them on /etc/nixos/configuration.nix, then sudo nixos-rebuild switch

  1. change a little bit in install.sh script, so we don't want to download nodejs and yarn anymore, comment this line in __download()__ function:
    install_yarn
  2. Run: ./install.sh~~

Edit: Can i send this approach as PR for you?
Edit 2: See: Install Coc

Can i send this approach as PR for you?

Sure.

UPDATE: The base Coc plugin can be installed using the vimPlugins.coc-nvim package, as described below, and works well. However, while the extensions are available, many of them are not in a usable state yet. The vimPlugins.coc-* extensions packages described below have been added to the Nixpkgs repo in their raw source code form. Many will need further packaging refinements (e.g., being compiled) to become usable. This is a known but not well-documented issue and we need more developers to step in (see this discussion for more context). You can try your luck installing your extension using the Nixpkgs, and if it doesn't work, you can fall back to using :CocInstall, which will cause your extension to be installed in the normal fashion.


For anyone coming in from Google, the README.md advice as of writing is outdated. Coc and many Coc extensions are now distributed through Nix itself and you can use Nix to manage everything.

Coc itself is packaged as nixpkgs.vimPlugins.coc-nvim (vimplugin-coc-nvim) and can be installed using home-manager (just add pkgs.vimPlugins.coc-nvim to programs.neovim.plugins in your home-manager config). Alternatively, if you don't want to use home-manager, try this: https://www.mpscholten.de/nixos/2016/04/11/setting-up-vim-on-nixos.html. These methods leverage vim's/Neovim's built-in module system under the hood, I believe.

~For a list of Coc extensions, see the master plugins list and search for coc-. You can use nix search to find more details about each package.~ You can see a list of Coc extensions here by searching for coc-, but note that as of writing, many of these don't work (see above).

The traditional methods using vim plug, Pathogen, etc. still work. Pick your poison.

Was this page helpful?
0 / 5 - 0 ratings