Commit ad798619 authored by teto's avatar teto
Browse files

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 ?
parent 8c6cf3f9
Loading
Loading
Loading
Loading
+26 −20
Original line number Diff line number Diff line
@@ -123,7 +123,19 @@ stdenv.mkDerivation (

    inherit lua;
    treesitter-parsers =
      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";
@@ -134,7 +146,8 @@ stdenv.mkDerivation (
              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
    );