From 8aecb65a2d0700e53d1758e41ef6a2bcc792df66 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Wed, 16 Jul 2025 14:55:18 +0200 Subject: [PATCH] tree-sitter.grammars: pin known bad with pythonPackages.tree-sitter 0.24 This commit prevents the update script from touching the files listed under `pinnedGrammars`. This way breakages cannot accidentally be caused again (re: #414233 breaking the heck out of staging-next et al) --- .../tools/parsing/tree-sitter/update.nix | 16 ++++++++++++++++ .../tools/parsing/tree-sitter/update_impl.py | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/pkgs/development/tools/parsing/tree-sitter/update.nix b/pkgs/development/tools/parsing/tree-sitter/update.nix index cf9502ed575e..2174fba4393f 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update.nix +++ b/pkgs/development/tools/parsing/tree-sitter/update.nix @@ -494,6 +494,21 @@ let }; }; + pinnedGrammars = [ + "tree-sitter-bash" + "tree-sitter-bibtex" + "tree-sitter-c" + "tree-sitter-comment" + "tree-sitter-fortran" + "tree-sitter-hcl" + "tree-sitter-hyprlang" + "tree-sitter-llvm" + "tree-sitter-markdown" + "tree-sitter-query" + "tree-sitter-rust" + ]; + pinnedGrammarsJson = jsonFile pinnedGrammars; + allGrammars = let treeSitterOrgaGrammars = lib.listToAttrs ( @@ -523,6 +538,7 @@ let inherit knownTreeSitterOrgGrammarRepos ignoredTreeSitterOrgRepos + pinnedGrammars ; } ( diff --git a/pkgs/development/tools/parsing/tree-sitter/update_impl.py b/pkgs/development/tools/parsing/tree-sitter/update_impl.py index a53e1ee62c36..3133aa3902af 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update_impl.py +++ b/pkgs/development/tools/parsing/tree-sitter/update_impl.py @@ -96,6 +96,10 @@ def fetchRepo() -> None: "outputDir": outputDir, "nixRepoAttrName": nixRepoAttrName, }: + if repo in args["pinnedGrammars"]: + log(f"Grammar {repo} is pinned, skipping upgrade...") + return + token: str | None = os.environ.get("GITHUB_TOKEN", None) out = run_cmd( curl_github_args(