tree-sitter: Add withPlugins

This commit is contained in:
José Luis Lafuente
2021-03-16 19:39:23 +01:00
committed by Matthieu Coudron
parent a48ea1b0b3
commit f29292db76
2 changed files with 51 additions and 1 deletions

View File

@@ -50,6 +50,9 @@
, CoreFoundation
, CoreServices
# nvim-treesitter dependencies
, tree-sitter
# sved dependencies
, glib
, gobject-introspection
@@ -364,6 +367,24 @@ self: super: {
dependencies = with super; [ popfix ];
});
# Usage:
# pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [ p.tree-sitter-c p.tree-sitter-java ... ])
# or for all grammars:
# pkgs.vimPlugins.nvim-treesitter.withPlugins (_: tree-sitter.allGrammars)
nvim-treesitter = super.nvim-treesitter.overrideAttrs (old: {
passthru.withPlugins =
grammarFn: self.nvim-treesitter.overrideAttrs (_: {
postPatch =
let
grammars = tree-sitter.withPlugins grammarFn;
in
''
rm -r parser
ln -s ${grammars} parser
'';
});
});
onehalf = super.onehalf.overrideAttrs (old: {
configurePhase = "cd vim";
});