forked from mirrors/nixpkgs
Merge pull request #201548 from figsoda/treesitter-deps
vimPlugins.nvim-treesitter: add plugins to dependencies to avoid extending vimPlugins
This commit is contained in:
commit
1d6d5f975d
|
@ -34,15 +34,28 @@ let
|
||||||
# or for all grammars:
|
# or for all grammars:
|
||||||
# pkgs.vimPlugins.nvim-treesitter.withAllGrammars
|
# pkgs.vimPlugins.nvim-treesitter.withAllGrammars
|
||||||
withPlugins =
|
withPlugins =
|
||||||
grammarFn: self.nvim-treesitter.overrideAttrs (_: {
|
f: self.nvim-treesitter.overrideAttrs (_: {
|
||||||
postPatch =
|
passthru.dependencies = map
|
||||||
let
|
(grammar:
|
||||||
grammars = tree-sitter.withPlugins (ps: grammarFn (ps // builtGrammars));
|
let
|
||||||
in
|
name = lib.pipe grammar [
|
||||||
''
|
lib.getName
|
||||||
rm -r parser
|
|
||||||
ln -s ${grammars} parser
|
# added in buildGrammar
|
||||||
'';
|
(lib.removeSuffix "-grammar")
|
||||||
|
|
||||||
|
# grammars from tree-sitter.builtGrammars
|
||||||
|
(lib.removePrefix "tree-sitter-")
|
||||||
|
(lib.replaceStrings [ "-" ] [ "_" ])
|
||||||
|
];
|
||||||
|
in
|
||||||
|
|
||||||
|
runCommand "nvim-treesitter-${name}-grammar" { } ''
|
||||||
|
mkdir -p $out/parser
|
||||||
|
ln -s ${grammar}/parser $out/parser/${name}.so
|
||||||
|
''
|
||||||
|
)
|
||||||
|
(f (tree-sitter.builtGrammars // builtGrammars));
|
||||||
});
|
});
|
||||||
|
|
||||||
withAllGrammars = withPlugins (_: allGrammars);
|
withAllGrammars = withPlugins (_: allGrammars);
|
||||||
|
@ -79,4 +92,3 @@ in
|
||||||
|
|
||||||
meta.maintainers = with lib.maintainers; [ figsoda ];
|
meta.maintainers = with lib.maintainers; [ figsoda ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue