neovim: expose derivations instead of just src

which is strictly better as you can still access the original url via
`neovim-unwrapped.treesitter-parsers.c.src`

Initial motivation started while developing on neovim via the following
devShell:
https://github.com/nix-community/neovim-nightly-overlay/blob/0fcef258e524f08cdcaaa163c37f14b892f6fd88/flake/dev/devshells.nix#L32

I've had neovim built from source complaining about missing grammars.
I am not sure why, I think it's because we disable bundled dependencies.
Exposing the derivations avoid users having to express the grammars
themselves.

This changes the type for outside consumers but for the better I think.
I dont know anyone using it ?
This commit is contained in:
teto
2026-03-25 21:51:12 +01:00
parent 8c6cf3f9ab
commit ad798619ae
+26 -20
View File
@@ -123,18 +123,31 @@ stdenv.mkDerivation (
inherit lua;
treesitter-parsers =
treesitter-parsers
// {
markdown = treesitter-parsers.markdown // {
location = "tree-sitter-markdown";
};
}
// {
markdown_inline = treesitter-parsers.markdown // {
language = "markdown_inline";
location = "tree-sitter-markdown-inline";
};
};
lib.mapAttrs
(
language: grammar:
tree-sitter.buildGrammar {
inherit (grammar) src;
version = "neovim-${finalAttrs.version}";
language = grammar.language or language;
location = grammar.location or null;
}
)
(
treesitter-parsers
// {
markdown = treesitter-parsers.markdown // {
location = "tree-sitter-markdown";
};
}
// {
markdown_inline = treesitter-parsers.markdown // {
language = "markdown_inline";
location = "tree-sitter-markdown-inline";
};
}
);
buildInputs = [
libuv
@@ -226,14 +239,7 @@ stdenv.mkDerivation (
+ lib.concatStrings (
lib.mapAttrsToList (language: grammar: ''
ln -s \
${
tree-sitter.buildGrammar {
inherit (grammar) src;
version = "neovim-${finalAttrs.version}";
language = grammar.language or language;
location = grammar.location or null;
}
}/parser \
${grammar}/parser \
$out/lib/nvim/parser/${language}.so
'') finalAttrs.treesitter-parsers
);