Skip to content

tree-sitter-grammars: pin rev for unstable grammars#491704

Merged
teto merged 1 commit intoNixOS:masterfrom
andresilva:tree-sitter-grammars-sources
Feb 18, 2026
Merged

tree-sitter-grammars: pin rev for unstable grammars#491704
teto merged 1 commit intoNixOS:masterfrom
andresilva:tree-sitter-grammars-sources

Conversation

@andresilva
Copy link
Member

@andresilva andresilva commented Feb 18, 2026

Things done

Grammars pod and quint use github:owner/repo/release as their URL, which causes parseUrl to pass the branch name release directly as rev to fetchFromGitHub. This works on first fetch but produces hash mismatches once the branch advances.

This adds a rev attribute to grammar sources that takes priority over the ref parsed from the URL, allowing the branch name to remain in the URL for nix-update compatibility while pinning the actual commit. An assertion ensures unstable grammars always resolve to a commit hash.

The update script also passed --version branch for all unstable grammars, which tracks the default branch. Grammars with an explicit branch in their URL now pass --version branch=REF instead.

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@nixpkgs-ci nixpkgs-ci bot requested a review from aciceri February 18, 2026 09:46
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 6.topic: tree-sitter Tree-sitter is a parser generator tool and an incremental parsing library. labels Feb 18, 2026
@andresilva andresilva force-pushed the tree-sitter-grammars-sources branch from b8cff68 to bfab3b5 Compare February 18, 2026 09:47
@andresilva
Copy link
Member Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 491704
Commit: bfab3b5870fe98129bd1d2d1d28fb4ca4b7a707a


x86_64-linux

✅ 6 packages built:
  • diffsitter
  • python313Packages.tree-sitter-grammars.tree-sitter-quint
  • python313Packages.tree-sitter-grammars.tree-sitter-quint.dist
  • python314Packages.tree-sitter-grammars.tree-sitter-quint
  • python314Packages.tree-sitter-grammars.tree-sitter-quint.dist
  • tree-sitter-grammars.tree-sitter-quint

codeberg = fetchFromCodeberg;
# NOTE: include other types here as required
};
rev = attrs.rev or source.ref or "v${attrs.version}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont we want to avoid this scenario source.ref ? if it's for the assert later, unstable version requires a pinned commit hash as rev, got '${rev or source.ref}'" would be cleaner.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it so that unstable grammars must have a rev attribute, rather than parsing it from the URL. I think that's simpler.

Copy link
Member

@aciceri aciceri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside form the comment by @teto the idea looks good to me, thank you for working on this that that fast.

I believe we also want to make @kimburgess aware of this issue.

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Feb 18, 2026
@andresilva andresilva force-pushed the tree-sitter-grammars-sources branch from bfab3b5 to ebfb1d1 Compare February 18, 2026 11:17
@andresilva
Copy link
Member Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 491704
Commit: ebfb1d12d482441c97c92a4b8e82d5c4cdd26e24


x86_64-linux

✅ 6 packages built:
  • diffsitter
  • python313Packages.tree-sitter-grammars.tree-sitter-quint
  • python313Packages.tree-sitter-grammars.tree-sitter-quint.dist
  • python314Packages.tree-sitter-grammars.tree-sitter-quint
  • python314Packages.tree-sitter-grammars.tree-sitter-quint.dist
  • tree-sitter-grammars.tree-sitter-quint

@teto teto merged commit 2dda182 into NixOS:master Feb 18, 2026
28 of 31 checks passed
This was referenced Feb 18, 2026
This was referenced Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: tree-sitter Tree-sitter is a parser generator tool and an incremental parsing library. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants