about summary refs log tree commit diff
path: root/pkgs/applications/editors/neovim
diff options
context:
space:
mode:
authorSymphorien Gibol <symphorien+git@xlumurb.eu>2018-07-12 22:47:02 +0200
committerSymphorien Gibol <symphorien+git@xlumurb.eu>2018-07-27 00:27:44 +0200
commitdddaa94ac26ecb223ca6d0a6a2121c7818d4b840 (patch)
tree20c3163f51627f2f6ffb3669972b09e09d09b4bd /pkgs/applications/editors/neovim
parentc1752666dfb1f47bf18225524c695621978d1419 (diff)
downloadnixlib-dddaa94ac26ecb223ca6d0a6a2121c7818d4b840.tar
nixlib-dddaa94ac26ecb223ca6d0a6a2121c7818d4b840.tar.gz
nixlib-dddaa94ac26ecb223ca6d0a6a2121c7818d4b840.tar.bz2
nixlib-dddaa94ac26ecb223ca6d0a6a2121c7818d4b840.tar.lz
nixlib-dddaa94ac26ecb223ca6d0a6a2121c7818d4b840.tar.xz
nixlib-dddaa94ac26ecb223ca6d0a6a2121c7818d4b840.tar.zst
nixlib-dddaa94ac26ecb223ca6d0a6a2121c7818d4b840.zip
neovim wrapper: also make <vimplugin>.pythonDepedencies a function
A function of the same signature as the argument of python.withPackages
Diffstat (limited to 'pkgs/applications/editors/neovim')
-rw-r--r--pkgs/applications/editors/neovim/wrapper.nix22
1 files changed, 12 insertions, 10 deletions
diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix
index 90b7f1ae7bea..17cf49521f1d 100644
--- a/pkgs/applications/editors/neovim/wrapper.nix
+++ b/pkgs/applications/editors/neovim/wrapper.nix
@@ -16,7 +16,7 @@ let
     , withPyGUI ? false
     , vimAlias ? false
     , viAlias ? false
-    , configure ? null
+    , configure ? {}
   }:
   let
 
@@ -35,18 +35,20 @@ let
   extraPythonPackagesFun = compatFun extraPythonPackages;
   extraPython3PackagesFun = compatFun extraPython3Packages;
 
-  pluginPythonPackages = if configure == null then [] else builtins.concatLists
-    (map ({ pythonDependencies ? [], ...}: pythonDependencies)
-         (vimUtils.requiredPlugins configure));
+  requiredPlugins = vimUtils.requiredPlugins configure;
+  getDeps = attrname: map (plugin: plugin.${attrname} or (_:[]));
+
+  pluginPythonPackages = getDeps "pythonDependencies" requiredPlugins;
   pythonEnv = pythonPackages.python.withPackages(ps:
         (if withPyGUI then [ ps.neovim_gui ] else [ ps.neovim ])
-        ++ (extraPythonPackagesFun ps) ++ pluginPythonPackages);
+        ++ (extraPythonPackagesFun ps)
+        ++ (concatMap (f: f ps) pluginPythonPackages));
 
-  pluginPython3Packages = if configure == null then [] else builtins.concatLists
-    (map ({ python3Dependencies ? [], ...}: python3Dependencies)
-         (vimUtils.requiredPlugins configure));
+  pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
   python3Env = python3Packages.python.withPackages (ps:
-    [ ps.neovim ] ++ (extraPython3PackagesFun ps) ++ pluginPython3Packages);
+        [ ps.neovim ]
+        ++ (extraPython3PackagesFun ps)
+        ++ (concatMap (f: f ps) pluginPython3Packages));
 
   in
   stdenv.mkDerivation {
@@ -87,7 +89,7 @@ let
       ln -s $out/bin/nvim $out/bin/vim
     '' + optionalString viAlias ''
       ln -s $out/bin/nvim $out/bin/vi
-    '' + optionalString (configure != null) ''
+    '' + optionalString (configure != {}) ''
     wrapProgram $out/bin/nvim --add-flags "-u ${vimUtils.vimrcFile configure}"
     ''
     ;