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.
This commit is contained in:
Jason Lau
2020-11-17 10:54:42 -08:00
parent 1491bab2b1
commit 9fd2cb7597
@@ -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 () {