summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorRok Garbas <rok@garbas.si>2017-11-16 03:34:01 +0100
committerRok Garbas <rok@garbas.si>2017-11-20 13:10:13 +0100
commitfb5f41bb00534c1a21bb9a516907069752483403 (patch)
treef0262a00a2645a6622e2db2b454a02482577abeb /pkgs/applications
parent54c281fa39615cd83d03b20b26bf851ab6f25966 (diff)
downloadnixpkgs-fb5f41bb00534c1a21bb9a516907069752483403.tar
nixpkgs-fb5f41bb00534c1a21bb9a516907069752483403.tar.gz
nixpkgs-fb5f41bb00534c1a21bb9a516907069752483403.tar.bz2
nixpkgs-fb5f41bb00534c1a21bb9a516907069752483403.tar.lz
nixpkgs-fb5f41bb00534c1a21bb9a516907069752483403.tar.xz
nixpkgs-fb5f41bb00534c1a21bb9a516907069752483403.tar.zst
nixpkgs-fb5f41bb00534c1a21bb9a516907069752483403.zip
neovim: ruby and python isolation
the code has been taken from #31604 and fixed so that :CheckHealth for
ruby provider is also green (ruby and gem are required to be in PATH).
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/editors/neovim/default.nix37
-rw-r--r--pkgs/applications/editors/neovim/ruby_provider/Gemfile.lock4
-rw-r--r--pkgs/applications/editors/neovim/ruby_provider/gemset.nix14
3 files changed, 36 insertions, 19 deletions
diff --git a/pkgs/applications/editors/neovim/default.nix b/pkgs/applications/editors/neovim/default.nix
index cc6e8f005e7..ba3abe6a221 100644
--- a/pkgs/applications/editors/neovim/default.nix
+++ b/pkgs/applications/editors/neovim/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchFromGitHub, cmake, gettext, libmsgpack, libtermkey
 , libtool, libuv, luaPackages, ncurses, perl, pkgconfig
-, unibilium, makeWrapper, vimUtils, xsel, gperf
+, unibilium, makeWrapper, vimUtils, xsel, gperf, callPackage
 
 , withPython ? true, pythonPackages, extraPythonPackages ? []
 , withPython3 ? true, python3Packages, extraPython3Packages ? []
 , withJemalloc ? true, jemalloc
-, withRuby ? true, bundlerEnv
+, withRuby ? true, bundlerEnv, ruby
 
 , withPyGUI ? false
 , vimAlias ? false
@@ -48,10 +48,11 @@ let
   rubyEnv = bundlerEnv {
     name = "neovim-ruby-env";
     gemdir = ./ruby_provider;
+    postBuild = ''
+      ln -s ${ruby}/bin/* $out/bin
+    '';
   };
-
-  rubyWrapper = ''--suffix PATH : \"${rubyEnv}/bin\" '' +
-                ''--suffix GEM_HOME : \"${rubyEnv}/${rubyEnv.ruby.gemPath}\" '';
+  rubyWrapper = ''--cmd \"let g:ruby_host_prog='$out/bin/nvim-ruby'\" '';
 
   pluginPythonPackages = if configure == null then [] else builtins.concatLists
     (map ({ pythonDependencies ? [], ...}: pythonDependencies)
@@ -74,10 +75,14 @@ let
     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)
-  }"'';
+
+  additionalFlags =
+    optionalString (withPython || withPython3 || withRuby)
+      ''--add-flags "${(optionalString withPython pythonWrapper) +
+                       (optionalString withPython3 python3Wrapper) +
+                       (optionalString withRuby rubyWrapper)}" --unset PYTHONPATH '' +
+    optionalString (withRuby)
+      ''--suffix PATH : \"${rubyEnv}/bin\" --set GEM_HOME \"${rubyEnv}/${rubyEnv.ruby.gemPath}\" '';
 
   neovim = stdenv.mkDerivation rec {
     name = "neovim-${version}";
@@ -128,21 +133,23 @@ let
       substituteInPlace src/nvim/CMakeLists.txt --replace "    util" ""
     '';
 
-    postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
-      echo patching $out/bin/nvim
+    postInstall = stdenv.lib.optionalString stdenv.isLinux ''
+      sed -i -e "s|'xsel|'${xsel}/bin/xsel|" $out/share/nvim/runtime/autoload/provider/clipboard.vim
+    '' + stdenv.lib.optionalString (withJemalloc && stdenv.isDarwin) ''
       install_name_tool -change libjemalloc.1.dylib \
                 ${jemalloc}/lib/libjemalloc.1.dylib \
                 $out/bin/nvim
-      sed -i -e "s|'xsel|'${xsel}/bin/xsel|" $out/share/nvim/runtime/autoload/provider/clipboard.vim
     '' + optionalString withPython ''
       ln -s ${pythonEnv}/bin/python $out/bin/nvim-python
+    '' + optionalString withPython3 ''
+      ln -s ${python3Env}/bin/python3 $out/bin/nvim-python3
+    '' + optionalString withPython3 ''
+      ln -s ${rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby
     '' + optionalString withPyGUI ''
       makeWrapper "${pythonEnv}/bin/pynvim" "$out/bin/pynvim" \
         --prefix PATH : "$out/bin"
-    '' + optionalString withPython3 ''
-      ln -s ${python3Env}/bin/python3 $out/bin/nvim-python3
     '' + optionalString (withPython || withPython3 || withRuby) ''
-      wrapProgram $out/bin/nvim ${rubyWrapper + pythonFlags}
+      wrapProgram $out/bin/nvim ${additionalFlags}
     '';
 
     meta = {
diff --git a/pkgs/applications/editors/neovim/ruby_provider/Gemfile.lock b/pkgs/applications/editors/neovim/ruby_provider/Gemfile.lock
index dcb79095aa6..61df9ed7932 100644
--- a/pkgs/applications/editors/neovim/ruby_provider/Gemfile.lock
+++ b/pkgs/applications/editors/neovim/ruby_provider/Gemfile.lock
@@ -2,8 +2,10 @@ GEM
   remote: https://rubygems.org/
   specs:
     msgpack (1.1.0)
-    neovim (0.5.1)
+    multi_json (1.12.2)
+    neovim (0.6.1)
       msgpack (~> 1.0)
+      multi_json (~> 1.0)
 
 PLATFORMS
   ruby
diff --git a/pkgs/applications/editors/neovim/ruby_provider/gemset.nix b/pkgs/applications/editors/neovim/ruby_provider/gemset.nix
index 9d0ecb2788e..85bff42b64d 100644
--- a/pkgs/applications/editors/neovim/ruby_provider/gemset.nix
+++ b/pkgs/applications/editors/neovim/ruby_provider/gemset.nix
@@ -7,13 +7,21 @@
     };
     version = "1.1.0";
   };
+  multi_json = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1raim9ddjh672m32psaa9niw67ywzjbxbdb8iijx3wv9k5b0pk2x";
+      type = "gem";
+    };
+    version = "1.12.2";
+  };
   neovim = {
-    dependencies = ["msgpack"];
+    dependencies = ["msgpack" "multi_json"];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "08xn7r4g13wl4bhvkmp4hx3x0ppvifs1x2iiqh8jl9f1jb4jhfcp";
+      sha256 = "1dnv2pdl8lwwy4av8bqc6kdlgxw88dmajm4fkdk6hc7qdx1sw234";
       type = "gem";
     };
-    version = "0.5.1";
+    version = "0.6.1";
   };
 }
\ No newline at end of file