3
0
Fork 0
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:
figsoda 2022-11-17 19:11:21 -05:00 committed by GitHub
commit 1d6d5f975d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,15 +34,28 @@ let
# or for all grammars:
# pkgs.vimPlugins.nvim-treesitter.withAllGrammars
withPlugins =
grammarFn: self.nvim-treesitter.overrideAttrs (_: {
postPatch =
let
grammars = tree-sitter.withPlugins (ps: grammarFn (ps // builtGrammars));
in
''
rm -r parser
ln -s ${grammars} parser
'';
f: self.nvim-treesitter.overrideAttrs (_: {
passthru.dependencies = map
(grammar:
let
name = lib.pipe grammar [
lib.getName
# 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);
@ -79,4 +92,3 @@ in
meta.maintainers = with lib.maintainers; [ figsoda ];
}