about summary refs log tree commit diff
path: root/pkgs/applications/editors/neovim/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/editors/neovim/default.nix')
-rw-r--r--pkgs/applications/editors/neovim/default.nix24
1 files changed, 17 insertions, 7 deletions
diff --git a/pkgs/applications/editors/neovim/default.nix b/pkgs/applications/editors/neovim/default.nix
index e76683aa1807..354aaf6db546 100644
--- a/pkgs/applications/editors/neovim/default.nix
+++ b/pkgs/applications/editors/neovim/default.nix
@@ -5,6 +5,7 @@
 , withPython ? true, pythonPackages, extraPythonPackages ? []
 , withPython3 ? true, python3Packages, extraPython3Packages ? []
 , withJemalloc ? true, jemalloc
+, withRuby ? true, bundlerEnv
 
 , withPyGUI ? false
 , vimAlias ? false
@@ -44,6 +45,14 @@ let
     };
   };
 
+  rubyEnv = bundlerEnv {
+    name = "neovim-ruby-env";
+    gemdir = ./ruby_provider;
+  };
+
+  rubyWrapper = ''--suffix PATH : \"${rubyEnv}/bin\" '' +
+                ''--suffix GEM_HOME : \"${rubyEnv}/${rubyEnv.ruby.gemPath}\" '';
+
   pythonEnv = pythonPackages.python.buildEnv.override {
     extraLibs = (
         if withPyGUI
@@ -52,11 +61,17 @@ let
       ) ++ extraPythonPackages;
     ignoreCollisions = true;
   };
+  pythonWrapper = ''--cmd \"let g:python_host_prog='$out/bin/nvim-python'\" '';
 
   python3Env = python3Packages.python.buildEnv.override {
     extraLibs = [ python3Packages.neovim ] ++ extraPython3Packages;
     ignoreCollisions = true;
   };
+  python3Wrapper = ''--cmd \"let g:python3_host_prog='$out/bin/nvim-python3'\" '';
+  pythonFlags = optionalString (withPython || withPython3) ''--add-flags "${
+    (optionalString withPython pythonWrapper) +
+    (optionalString withPython3 python3Wrapper)
+  }"'';
 
   neovim = stdenv.mkDerivation rec {
     name = "neovim-${version}";
@@ -124,13 +139,8 @@ let
         --prefix PATH : "$out/bin"
     '' + optionalString withPython3 ''
       ln -s ${python3Env}/bin/python3 $out/bin/nvim-python3
-    '' + optionalString (withPython || withPython3) ''
-        wrapProgram $out/bin/nvim --add-flags "${
-          (optionalString withPython
-            ''--cmd \"let g:python_host_prog='$out/bin/nvim-python'\" '') +
-          (optionalString withPython3
-            ''--cmd \"let g:python3_host_prog='$out/bin/nvim-python3'\" '')
-        }"
+    '' + optionalString (withPython || withPython3 || withRuby) ''
+      wrapProgram $out/bin/nvim ${rubyWrapper + pythonFlags}
     '';
 
     meta = {