neovim wrapper: also make <vimplugin>.pythonDepedencies a function
A function of the same signature as the argument of python.withPackages
This commit is contained in:
parent
c1752666df
commit
dddaa94ac2
@ -16,7 +16,7 @@ let
|
|||||||
, withPyGUI ? false
|
, withPyGUI ? false
|
||||||
, vimAlias ? false
|
, vimAlias ? false
|
||||||
, viAlias ? false
|
, viAlias ? false
|
||||||
, configure ? null
|
, configure ? {}
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
||||||
@ -35,18 +35,20 @@ let
|
|||||||
extraPythonPackagesFun = compatFun extraPythonPackages;
|
extraPythonPackagesFun = compatFun extraPythonPackages;
|
||||||
extraPython3PackagesFun = compatFun extraPython3Packages;
|
extraPython3PackagesFun = compatFun extraPython3Packages;
|
||||||
|
|
||||||
pluginPythonPackages = if configure == null then [] else builtins.concatLists
|
requiredPlugins = vimUtils.requiredPlugins configure;
|
||||||
(map ({ pythonDependencies ? [], ...}: pythonDependencies)
|
getDeps = attrname: map (plugin: plugin.${attrname} or (_:[]));
|
||||||
(vimUtils.requiredPlugins configure));
|
|
||||||
|
pluginPythonPackages = getDeps "pythonDependencies" requiredPlugins;
|
||||||
pythonEnv = pythonPackages.python.withPackages(ps:
|
pythonEnv = pythonPackages.python.withPackages(ps:
|
||||||
(if withPyGUI then [ ps.neovim_gui ] else [ ps.neovim ])
|
(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
|
pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
|
||||||
(map ({ python3Dependencies ? [], ...}: python3Dependencies)
|
|
||||||
(vimUtils.requiredPlugins configure));
|
|
||||||
python3Env = python3Packages.python.withPackages (ps:
|
python3Env = python3Packages.python.withPackages (ps:
|
||||||
[ ps.neovim ] ++ (extraPython3PackagesFun ps) ++ pluginPython3Packages);
|
[ ps.neovim ]
|
||||||
|
++ (extraPython3PackagesFun ps)
|
||||||
|
++ (concatMap (f: f ps) pluginPython3Packages));
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
@ -87,7 +89,7 @@ let
|
|||||||
ln -s $out/bin/nvim $out/bin/vim
|
ln -s $out/bin/nvim $out/bin/vim
|
||||||
'' + optionalString viAlias ''
|
'' + optionalString viAlias ''
|
||||||
ln -s $out/bin/nvim $out/bin/vi
|
ln -s $out/bin/nvim $out/bin/vi
|
||||||
'' + optionalString (configure != null) ''
|
'' + optionalString (configure != {}) ''
|
||||||
wrapProgram $out/bin/nvim --add-flags "-u ${vimUtils.vimrcFile configure}"
|
wrapProgram $out/bin/nvim --add-flags "-u ${vimUtils.vimrcFile configure}"
|
||||||
''
|
''
|
||||||
;
|
;
|
||||||
|
@ -1015,7 +1015,7 @@ let
|
|||||||
sha256 = "03sr53680kcwxaa5xbqzdfbsgday3bkzja33wym49w9gjmlaa320";
|
sha256 = "03sr53680kcwxaa5xbqzdfbsgday3bkzja33wym49w9gjmlaa320";
|
||||||
};
|
};
|
||||||
dependencies = ["vimproc" "vimshell" "self" "forms"];
|
dependencies = ["vimproc" "vimshell" "self" "forms"];
|
||||||
pythonDependencies = with pythonPackages; [ sexpdata websocket_client ];
|
passthru.python3Dependencies = ps: with ps; [ sexpdata websocket_client ];
|
||||||
};
|
};
|
||||||
|
|
||||||
supertab = buildVimPluginFrom2Nix { # created by nix#NixDerivation
|
supertab = buildVimPluginFrom2Nix { # created by nix#NixDerivation
|
||||||
|
@ -280,6 +280,7 @@ let
|
|||||||
installPhase = lib.concatStringsSep
|
installPhase = lib.concatStringsSep
|
||||||
"\n"
|
"\n"
|
||||||
(lib.flatten (lib.mapAttrsToList packageLinks packages));
|
(lib.flatten (lib.mapAttrsToList packageLinks packages));
|
||||||
|
preferLocalBuild = true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
@ -423,6 +424,7 @@ rec {
|
|||||||
} // a);
|
} // a);
|
||||||
|
|
||||||
requiredPlugins = {
|
requiredPlugins = {
|
||||||
|
packages ? {},
|
||||||
givenKnownPlugins ? null,
|
givenKnownPlugins ? null,
|
||||||
vam ? null,
|
vam ? null,
|
||||||
pathogen ? null, ...
|
pathogen ? null, ...
|
||||||
@ -437,8 +439,12 @@ rec {
|
|||||||
vamNames = findDependenciesRecursively { inherit knownPlugins; names = lib.concatMap toNames vam.pluginDictionaries; };
|
vamNames = findDependenciesRecursively { inherit knownPlugins; names = lib.concatMap toNames vam.pluginDictionaries; };
|
||||||
names = (lib.optionals (pathogen != null) pathogenNames) ++
|
names = (lib.optionals (pathogen != null) pathogenNames) ++
|
||||||
(lib.optionals (vam != null) vamNames);
|
(lib.optionals (vam != null) vamNames);
|
||||||
|
nonNativePlugins = map (name: knownPlugins.${name}) names;
|
||||||
|
nativePluginsConfigs = lib.attrsets.attrValues packages;
|
||||||
|
nativePlugins = lib.concatMap ({start?[], opt?[]}: start++opt) nativePluginsConfigs;
|
||||||
in
|
in
|
||||||
map (name: knownPlugins.${name}) names;
|
nativePlugins ++ nonNativePlugins;
|
||||||
|
|
||||||
|
|
||||||
# test cases:
|
# test cases:
|
||||||
test_vim_with_vim_addon_nix_using_vam = vim_configurable.customize {
|
test_vim_with_vim_addon_nix_using_vam = vim_configurable.customize {
|
||||||
|
@ -1 +1 @@
|
|||||||
pythonDependencies = with pythonPackages; [ sexpdata websocket_client ];
|
passthru.python3Dependencies = ps: with ps; [ sexpdata websocket_client ];
|
||||||
|
Loading…
Reference in New Issue
Block a user