From 9fd2cb7597c9174720db9f09f58d92818da0ade0 Mon Sep 17 00:00:00 2001 From: Jason Lau Date: Tue, 17 Nov 2020 10:49:36 -0800 Subject: [PATCH] vim_configurable: restore python derivation overriding In the current Vim, the Python support can be implemented by linking to the Python library, e.g., lib/libpython3.8.dylib on darwin. The previous workaround of wrapping Vim to prefix $PATH is not sufficient anymore. Since in the current Vim, the Python interpreter is no longer invoked, but instead, the dynamically linked library is used, in which only the original Python modules are loaded, causing plugins to fail to load their required Python modules. Experiments show that, however, it is controlled by the $NIX_PYTHONPATH environment variable. In this commit, we add the required environment variable to the wrapped Vim workaround as previously proposed. So that the Vim plugins can use Python modules in the specified Python derivation. --- pkgs/applications/editors/vim/configurable.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix index aa8120470d14..edc33098bf1d 100644 --- a/pkgs/applications/editors/vim/configurable.nix +++ b/pkgs/applications/editors/vim/configurable.nix @@ -162,7 +162,8 @@ in stdenv.mkDerivation rec { ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc '' + stdenv.lib.optionalString wrapPythonDrv '' - wrapProgram "$out/bin/vim" --prefix PATH : "${python3}/bin" + wrapProgram "$out/bin/vim" --prefix PATH : "${python3}/bin" \ + --set NIX_PYTHONPATH "${python3}/${python3.sitePackages}" '' + stdenv.lib.optionalString (guiSupport == "gtk3") '' rewrap () {