neovim wrapper: add withNodeJs to build wrapper with nodejs support

This commit is contained in:
Wael M. Nasreddine 2018-11-07 12:38:18 -08:00
parent 657e18e011
commit da4a004193
No known key found for this signature in database
GPG key ID: 82AE0A31B33CEFCF

View file

@ -1,6 +1,8 @@
{ stdenv, lib, makeWrapper
, vimUtils
, bundlerEnv, ruby
, nodejs
, nodePackages
, pythonPackages
, python3Packages
}:
@ -12,6 +14,7 @@ let
wrapper = {
withPython ? true, extraPythonPackages ? (_: []) /* the function you would have passed to python.withPackages */
, withPython3 ? true, extraPython3Packages ? (_: []) /* the function you would have passed to python.withPackages */
, withNodeJs? false
, withRuby ? true
, withPyGUI ? false
, vimAlias ? false
@ -50,6 +53,8 @@ let
++ (extraPython3PackagesFun ps)
++ (concatMap (f: f ps) pluginPython3Packages));
binPath = makeBinPath (optionals withRuby [rubyEnv] ++ optionals withNodeJs [nodejs]);
in
stdenv.mkDerivation {
name = "neovim-${stdenv.lib.getVersion neovim}";
@ -62,10 +67,12 @@ let
makeWrapper "$(readlink -v --canonicalize-existing "${bin}")" \
"$out/bin/nvim" --add-flags " \
--cmd \"${if withNodeJs then "let g:node_host_prog='${nodePackages.neovim}/bin/neovim-node-host'" else "let g:loaded_node_provider=1"}\" \
--cmd \"${if withPython then "let g:python_host_prog='$out/bin/nvim-python'" else "let g:loaded_python_provider = 1"}\" \
--cmd \"${if withPython3 then "let g:python3_host_prog='$out/bin/nvim-python3'" else "let g:loaded_python3_provider = 1"}\" \
--cmd \"${if withRuby then "let g:ruby_host_prog='$out/bin/nvim-ruby'" else "let g:loaded_ruby_provider=1"}\" " \
${optionalString withRuby '' --suffix PATH : ${rubyEnv}/bin --set GEM_HOME ${rubyEnv}/${rubyEnv.ruby.gemPath}'' }
--suffix PATH : ${binPath} \
${optionalString withRuby '' --set GEM_HOME ${rubyEnv}/${rubyEnv.ruby.gemPath}'' }
''
+ optionalString (!stdenv.isDarwin) ''