From cf9ead61ff5732e6c5abeef79b5b3566c982841e Mon Sep 17 00:00:00 2001 From: kb Date: Mon, 5 Jan 2026 23:16:03 +1000 Subject: [PATCH] tree-sitter-grammars: insert default meta attrs Adds a default meta.description and meta.homepage for all grammars. --- .../tools/parsing/tree-sitter/build-grammar.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/tools/parsing/tree-sitter/build-grammar.nix b/pkgs/development/tools/parsing/tree-sitter/build-grammar.nix index dbbc8bcb83eb..86a8e19f6434 100644 --- a/pkgs/development/tools/parsing/tree-sitter/build-grammar.nix +++ b/pkgs/development/tools/parsing/tree-sitter/build-grammar.nix @@ -10,6 +10,7 @@ language, version, src, + meta ? { }, generate ? false, ... }@args: @@ -105,6 +106,15 @@ stdenv.mkDerivation ( fi runHook postInstall ''; + + # Merge default meta attrs with any explicitly defined on the source. + meta = { + description = "Tree-sitter grammar for ${language}"; + } + // (lib.optionalAttrs (src ? meta.homepage) { + homepage = src.meta.homepage; + }) + // meta; } # FIXME: neovim and nvim-treesitter currently rely on passing location rather # than a src attribute with a correctly positioned root (e.g. for grammars in @@ -114,5 +124,6 @@ stdenv.mkDerivation ( }) // removeAttrs args [ "generate" + "meta" ] )