neovim wrapper: use python.withPackages instead of python.buildEnv
They are both as powerful, but buildEnv is treacherous: if you pass a package which depends on another python (for example the one of unstable when you are on stable) it will be *silently* dropped, leading to hair pulling. Use case: override neovim from unstable, but still keep stable's pythonPackages.
This commit is contained in:
parent
10436a707a
commit
c1752666df
@ -10,8 +10,8 @@ neovim:
|
|||||||
|
|
||||||
let
|
let
|
||||||
wrapper = {
|
wrapper = {
|
||||||
withPython ? true, extraPythonPackages ? []
|
withPython ? true, extraPythonPackages ? (_: []) /* the function you would have passed to python.withPackages */
|
||||||
, withPython3 ? true, extraPython3Packages ? []
|
, withPython3 ? true, extraPython3Packages ? (_: []) /* the function you would have passed to python.withPackages */
|
||||||
, withRuby ? true
|
, withRuby ? true
|
||||||
, withPyGUI ? false
|
, withPyGUI ? false
|
||||||
, vimAlias ? false
|
, vimAlias ? false
|
||||||
@ -28,25 +28,25 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* for compatibility with passing extraPythonPackages as a list; added 2018-07-11 */
|
||||||
|
compatFun = funOrList: (if builtins.isList funOrList then
|
||||||
|
(_: builtins.trace "passing a list as extraPythonPackages to the neovim wrapper is deprecated, pass a function as to python.withPackages instead" funOrList)
|
||||||
|
else funOrList);
|
||||||
|
extraPythonPackagesFun = compatFun extraPythonPackages;
|
||||||
|
extraPython3PackagesFun = compatFun extraPython3Packages;
|
||||||
|
|
||||||
pluginPythonPackages = if configure == null then [] else builtins.concatLists
|
pluginPythonPackages = if configure == null then [] else builtins.concatLists
|
||||||
(map ({ pythonDependencies ? [], ...}: pythonDependencies)
|
(map ({ pythonDependencies ? [], ...}: pythonDependencies)
|
||||||
(vimUtils.requiredPlugins configure));
|
(vimUtils.requiredPlugins configure));
|
||||||
pythonEnv = pythonPackages.python.buildEnv.override {
|
pythonEnv = pythonPackages.python.withPackages(ps:
|
||||||
extraLibs = (
|
(if withPyGUI then [ ps.neovim_gui ] else [ ps.neovim ])
|
||||||
if withPyGUI
|
++ (extraPythonPackagesFun ps) ++ pluginPythonPackages);
|
||||||
then [ pythonPackages.neovim_gui ]
|
|
||||||
else [ pythonPackages.neovim ]
|
|
||||||
) ++ extraPythonPackages ++ pluginPythonPackages;
|
|
||||||
ignoreCollisions = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
pluginPython3Packages = if configure == null then [] else builtins.concatLists
|
pluginPython3Packages = if configure == null then [] else builtins.concatLists
|
||||||
(map ({ python3Dependencies ? [], ...}: python3Dependencies)
|
(map ({ python3Dependencies ? [], ...}: python3Dependencies)
|
||||||
(vimUtils.requiredPlugins configure));
|
(vimUtils.requiredPlugins configure));
|
||||||
python3Env = python3Packages.python.buildEnv.override {
|
python3Env = python3Packages.python.withPackages (ps:
|
||||||
extraLibs = [ python3Packages.neovim ] ++ extraPython3Packages ++ pluginPython3Packages;
|
[ ps.neovim ] ++ (extraPython3PackagesFun ps) ++ pluginPython3Packages);
|
||||||
ignoreCollisions = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user