diff options
author | Symphorien Gibol <symphorien+git@xlumurb.eu> | 2018-07-11 22:57:26 +0200 |
---|---|---|
committer | Symphorien Gibol <symphorien+git@xlumurb.eu> | 2018-07-24 15:05:50 +0200 |
commit | c1752666dfb1f47bf18225524c695621978d1419 (patch) | |
tree | 7b8e31330ba5379dbefbd7ade7025772eceb441a /pkgs/applications/editors/neovim/wrapper.nix | |
parent | 10436a707a45f540e10d6b0cb5a2c075dff1fc66 (diff) | |
download | nixlib-c1752666dfb1f47bf18225524c695621978d1419.tar nixlib-c1752666dfb1f47bf18225524c695621978d1419.tar.gz nixlib-c1752666dfb1f47bf18225524c695621978d1419.tar.bz2 nixlib-c1752666dfb1f47bf18225524c695621978d1419.tar.lz nixlib-c1752666dfb1f47bf18225524c695621978d1419.tar.xz nixlib-c1752666dfb1f47bf18225524c695621978d1419.tar.zst nixlib-c1752666dfb1f47bf18225524c695621978d1419.zip |
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.
Diffstat (limited to 'pkgs/applications/editors/neovim/wrapper.nix')
-rw-r--r-- | pkgs/applications/editors/neovim/wrapper.nix | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index a57831ba03c0..90b7f1ae7bea 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -10,8 +10,8 @@ neovim: let wrapper = { - withPython ? true, extraPythonPackages ? [] - , withPython3 ? true, extraPython3Packages ? [] + withPython ? true, extraPythonPackages ? (_: []) /* the function you would have passed to python.withPackages */ + , withPython3 ? true, extraPython3Packages ? (_: []) /* the function you would have passed to python.withPackages */ , withRuby ? true , withPyGUI ? 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 (map ({ pythonDependencies ? [], ...}: pythonDependencies) (vimUtils.requiredPlugins configure)); - pythonEnv = pythonPackages.python.buildEnv.override { - extraLibs = ( - if withPyGUI - then [ pythonPackages.neovim_gui ] - else [ pythonPackages.neovim ] - ) ++ extraPythonPackages ++ pluginPythonPackages; - ignoreCollisions = true; - }; + pythonEnv = pythonPackages.python.withPackages(ps: + (if withPyGUI then [ ps.neovim_gui ] else [ ps.neovim ]) + ++ (extraPythonPackagesFun ps) ++ pluginPythonPackages); pluginPython3Packages = if configure == null then [] else builtins.concatLists (map ({ python3Dependencies ? [], ...}: python3Dependencies) (vimUtils.requiredPlugins configure)); - python3Env = python3Packages.python.buildEnv.override { - extraLibs = [ python3Packages.neovim ] ++ extraPython3Packages ++ pluginPython3Packages; - ignoreCollisions = true; - }; + python3Env = python3Packages.python.withPackages (ps: + [ ps.neovim ] ++ (extraPython3PackagesFun ps) ++ pluginPython3Packages); in stdenv.mkDerivation { |