Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vimPlugins.coc-*: add npm dependencies #82578

Merged
merged 3 commits into from Mar 15, 2020
Merged

vimPlugins.coc-*: add npm dependencies #82578

merged 3 commits into from Mar 15, 2020

Conversation

eyJhb
Copy link
Member

@eyJhb eyJhb commented Mar 14, 2020

Motivation for this change

These plugins do not work, without having the npm package, as it needs to be build beforehand.

Things done

Added all the npm packages that exists for the plugins.

Small snippets used at the bottom.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Things used to generated this

Find all current packages

$ cat pkgs/misc/vim-plugins/generated.nix | grep 'pname = "coc-' | sed -E 's/.*pname = "([^"]+)";/\1/g'

Output this to a file coc-vimplugins.txt.

#!/usr/bin/env bash
while read in; do
	curl --silent "https://www.npmjs.com/search?q=$in" | grep -i '0<!-- --> packages found' > /dev/null
	if [ $? -ne 0 ]; then
		echo $in
	#else
		#echo $in does not exists
	fi
done

OUtput to new file, then cat coc-vimplugins-npm.txt | xargs -I "{}" echo ', "{}"', and add to node-packagesv10.json.

Now override them all in vim-plugins-overrides.nix.

cat coc-vimplugins-npm.txt | xargs -I "{}" printf '  {} = buildVimPluginFrom2Nix {\n    pname = "{}";\n    version = nodePackages.{}.version;\n    src = "${nodePackages.{}}/lib/node_modules/{}";\n  };\n\n'

@adisbladis go go! ;)

@eyJhb eyJhb requested a review from jonringer as a code owner March 14, 2020 12:58
@ofborg ofborg bot added the 6.topic: vim label Mar 14, 2020
@@ -125,6 +126,78 @@ self: super: {
'';
});

coc-css = buildVimPluginFrom2Nix {
pname = "coc-css";
version = nodePackages.coc-css.version;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently, this cannot be seen:

attribute 'coc-css' missing ... pkgs/misc/vim-plugins/overrides.nix:131:15

https://gist.github.com/GrahamcOfBorg/69f8e0bd962f1ce6fc88277a0d6fecce

@felschr
Copy link
Member

felschr commented Mar 15, 2020

I'm not sure if any of the added extensions in this PR require this but can I suggest adding the $HOME fix to this commit as well:
https://github.com/NixOS/nixpkgs/pull/72506/files#diff-a394ac424cb08e8ae710c7275ae578ff

Considering that this commit also adds coc-prettier, #72506 would then not be needed anymore.

UPDATE: Oh, it's just been merged.

@adisbladis
Copy link
Member

@felschr I'm in communications with @eyJhb on IRC and we're synchronising merges of related PRs. :)

@adisbladis adisbladis merged commit 48b799e into NixOS:master Mar 15, 2020
jonringer pushed a commit that referenced this pull request Sep 4, 2020
There are 32 vim plugins, all related to the coc.nvim LSP plugin, that
are actually node packages and are included in nodePackages. In #82578,
those vim plugins were made to point at the corresponding node packages,
which fixed issues where the sources weren't being compiled properly
with Javascript build systems.

The way each of those vim plugins wraps its corresponding node package
is identical, so I factored that out into a function and eliminated the
duplication.

In addition, for some reason coc-go got missed, which led to it not
working correctly for me. I included it in my list of packages to wrap,
so that fixes that issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants