From ad798619ae7743933943f22d60acbefb073a251a Mon Sep 17 00:00:00 2001 From: teto <886074+teto@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:00:19 +0100 Subject: [PATCH] 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 ? --- pkgs/by-name/ne/neovim-unwrapped/package.nix | 46 +++++++++++--------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/pkgs/by-name/ne/neovim-unwrapped/package.nix b/pkgs/by-name/ne/neovim-unwrapped/package.nix index b480f18a3827..3ea83dfa8bef 100644 --- a/pkgs/by-name/ne/neovim-unwrapped/package.nix +++ b/pkgs/by-name/ne/neovim-unwrapped/package.nix @@ -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 );