vim_configurable: handle python3Dependencies

This commit is contained in:
oxalica 2021-08-15 20:09:40 +08:00
parent d5ae62096e
commit 039fc793c3
No known key found for this signature in database
GPG Key ID: CED392DE0C483D00

View File

@ -3,6 +3,7 @@
, nix-prefetch-hg, nix-prefetch-git
, fetchFromGitHub, runtimeShell
, hasLuaModule
, python3
}:
/*
@ -210,13 +211,24 @@ let
# and can simply pass `null`.
depsOfOptionalPlugins = lib.subtractLists opt (findDependenciesRecursively opt);
startWithDeps = findDependenciesRecursively start;
allPlugins = lib.unique (startWithDeps ++ depsOfOptionalPlugins);
python3Env = python3.withPackages (ps:
lib.flatten (builtins.map (plugin: (plugin.python3Dependencies or (_: [])) ps) allPlugins)
);
in
[ "mkdir -p $out/pack/${packageName}/start" ]
# To avoid confusion, even dependencies of optional plugins are added
# to `start` (except if they are explicitly listed as optional plugins).
++ (builtins.map (x: link x packageName "start") (lib.unique (startWithDeps ++ depsOfOptionalPlugins)))
++ (builtins.map (x: link x packageName "start") allPlugins)
++ ["mkdir -p $out/pack/${packageName}/opt"]
++ (builtins.map (x: link x packageName "opt") opt)
# Assemble all python3 dependencies into a single `site-packages` to avoid doing recursive dependency collection
# for each plugin.
# This directory is only for python import search path, and will not slow down the startup time.
++ [
"mkdir -p $out/pack/${packageName}/start/__python3_dependencies"
"ln -s ${python3Env}/${python3Env.sitePackages} $out/pack/${packageName}/start/__python3_dependencies/python3"
]
);
packDir = (packages:
stdenv.mkDerivation {