wrapNeovim: symlink treesitter grammars in the wrapper
This commit is contained in:
@@ -343,7 +343,9 @@ let
|
||||
|
||||
nativeBuildInputs = [ toNvimTreesitterGrammar ];
|
||||
|
||||
passthru = grammar.passthru or { };
|
||||
passthru = grammar.passthru or { } // {
|
||||
isTreesitterGrammar = true;
|
||||
};
|
||||
|
||||
meta = {
|
||||
platforms = lib.platforms.all;
|
||||
|
||||
@@ -21,7 +21,10 @@ let
|
||||
vimUtils.toVimPlugin (
|
||||
runCommand "nvim-treesitter-queries-${language}"
|
||||
{
|
||||
passthru = { inherit language; };
|
||||
passthru = {
|
||||
inherit language;
|
||||
isTreesitterQuery = true;
|
||||
};
|
||||
meta.description = "Queries for ${language} from nvim-treesitter";
|
||||
}
|
||||
''
|
||||
@@ -94,12 +97,7 @@ let
|
||||
];
|
||||
in
|
||||
self.nvim-treesitter.overrideAttrs {
|
||||
passthru.dependencies = [
|
||||
(symlinkJoin {
|
||||
name = "nvim-treesitter-grammars";
|
||||
paths = grammarPlugins ++ queryPlugins;
|
||||
})
|
||||
];
|
||||
passthru.dependencies = grammarPlugins ++ queryPlugins;
|
||||
};
|
||||
|
||||
withAllGrammars = withPlugins (_: allGrammars);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
vim,
|
||||
vimPlugins,
|
||||
buildEnv,
|
||||
symlinkJoin,
|
||||
writeText,
|
||||
runCommand,
|
||||
makeWrapper,
|
||||
@@ -200,12 +201,26 @@ let
|
||||
# and can simply pass `null`.
|
||||
depsOfOptionalPlugins = lib.subtractLists opt (findDependenciesRecursively opt);
|
||||
startWithDeps = findDependenciesRecursively start;
|
||||
allPlugins = lib.unique (startWithDeps ++ depsOfOptionalPlugins);
|
||||
allPluginsAndGrammars = lib.unique (startWithDeps ++ depsOfOptionalPlugins);
|
||||
|
||||
allPython3Dependencies =
|
||||
ps: lib.flatten (map (plugin: (plugin.python3Dependencies or (_: [ ])) ps) allPlugins);
|
||||
python3Env = python3.withPackages allPython3Dependencies;
|
||||
|
||||
packdirStart = vimFarm "pack/${packageName}/start" "packdir-start" allPlugins;
|
||||
partitionGrammars = lib.partition (
|
||||
p: p.isTreesitterGrammar or false || p.isTreesitterQuery or false
|
||||
);
|
||||
allPluginsAndGrammarsPartitioned = partitionGrammars allPluginsAndGrammars;
|
||||
allPlugins = allPluginsAndGrammarsPartitioned.wrong;
|
||||
allGrammars = allPluginsAndGrammarsPartitioned.right;
|
||||
allGrammarsSymlinked = symlinkJoin {
|
||||
name = "nvim-treesitter-grammars";
|
||||
paths = allGrammars;
|
||||
};
|
||||
|
||||
packdirStart = vimFarm "pack/${packageName}/start" "packdir-start" (
|
||||
if allGrammars != [ ] then allPlugins ++ [ allGrammarsSymlinked ] else allPlugins
|
||||
);
|
||||
packdirOpt = vimFarm "pack/${packageName}/opt" "packdir-opt" opt;
|
||||
# Assemble all python3 dependencies into a single `site-packages` to avoid doing recursive dependency collection
|
||||
# for each plugin.
|
||||
|
||||
Reference in New Issue
Block a user