-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tree-sitter: Update grammars #232633
tree-sitter: Update grammars #232633
Conversation
Result of 2 packages failed to build:
38 packages built:
|
1 similar comment
Result of 2 packages failed to build:
38 packages built:
|
Result of 40 packages built:
|
Result of 40 packages built:
|
Instead of specifying a branch, we can also do this: --- a/pkgs/development/tools/parsing/tree-sitter/default.nix
+++ b/pkgs/development/tools/parsing/tree-sitter/default.nix
@@ -62,12 +62,14 @@ let
inherit version;
src = grammar.src or (fetchGrammar grammar);
location = grammar.location or null;
+ generate = grammar.generate or false;
};
grammars' = import ./grammars { inherit lib; } // extraGrammars;
grammars = grammars' //
{ tree-sitter-ocaml = grammars'.tree-sitter-ocaml // { location = "ocaml"; }; } //
{ tree-sitter-ocaml-interface = grammars'.tree-sitter-ocaml // { location = "interface"; }; } //
{ tree-sitter-org-nvim = grammars'.tree-sitter-org-nvim // { language = "org"; }; } //
+ { tree-sitter-sql = grammars'.tree-sitter-sql // { generate = true; }; } //
{ tree-sitter-typescript = grammars'.tree-sitter-typescript // { location = "typescript"; }; } //
{ tree-sitter-tsx = grammars'.tree-sitter-typescript // { location = "tsx"; }; } //
{ tree-sitter-markdown = grammars'.tree-sitter-markdown // { location = "tree-sitter-markdown"; }; } // |
That would be also possible. However, I think that the ability to chose branch might be handy so I would keep it the way it is, unless you have a strong preference toward |
It would be easier for me to review since it's simpler and I'm also not familiar with the update script, but either option would work |
)) | ||
match curl_result(branch_out): | ||
case {"commit": {"sha": commit_hash}}: | ||
release = commit_hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just do f"refs/heads/{branch}"
here without the extra api request, nix-prefetch-git
still outputs a sha as rev
as expected, using the command from nix_prefetch_git_args
$ nix-prefetch-git --quiet --no-deepClone --url https://github.com/derekstride/tree-sitter-sql --rev refs/heads/gh-pages
{
"url": "https://github.com/derekstride/tree-sitter-sql",
"rev": "721087c8819cda10ca37f974e914ab9be46b290f",
"date": "2023-05-19T15:56:01+00:00",
"path": "/nix/store/5mbri1m7rrwmvhzp5nz3bs1pdzj87fni-tree-sitter-sql",
"sha256": "10njfi84b78z036bkgbrxnxgy9av9yprxq1p2zla87w0g6ixqva7",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, great :) this will simplify things.
Result of 41 packages built:
|
Description of changes
This PR updates the grammars as instructed by
nixpkgs/pkgs/development/tools/parsing/tree-sitter/default.nix
Lines 28 to 32 in 41beb48
Update
It turned out that
tree-sitter-sql
cannot be built anymore. The reason is that maintainers of that repository decided to move generated parser into a separate branch (see for details:DerekStride/tree-sitter-sql#100).This PR allows for specifying an optional parameter
branch
when defining the list of tree-sitter grammars that will be used when fetching grammar parser.Details: If
branch
key is specified then there is an additional call made to github api to fetch latest commit for the provided branch. It is then passed tonix-prefech-git
asrev
. Otherwise the behavior remains the same. I couldn't simply alternix-prefetch-git
invocation as thebranch-name
argument is only used there to checkout to a specific branch locally (without tracking the upstream).Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)