diff --git a/pkgs/development/tools/parsing/tree-sitter/update.nix b/pkgs/development/tools/parsing/tree-sitter/update.nix index b9d4a0131633..a51208a5bfde 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update.nix +++ b/pkgs/development/tools/parsing/tree-sitter/update.nix @@ -405,19 +405,21 @@ let ''; # implementation of the fetching of repo information from github - fetchImpl = passBinaries "fetchImpl-wrapped" { - curl = "${curl}/bin/curl"; - nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git"; - inherit atomically-write; + fetchImpl = passArgs "fetchImpl-with-args" { + binaries = { + curl = "${curl}/bin/curl"; + nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git"; + inherit atomically-write; + }; } (writers.writePython3 "fetchImpl" { flakeIgnore = ["E501"]; } ./update_impl.py); - # Pass the given binaries to the command, in the BINARIES environment variable. - # The binaries are just an attrset from name to executable. - passBinaries = name: binAttrs: script: writeShellScript name '' - env BINARIES=${lib.escapeShellArg (lib.generators.toJSON {} binAttrs)} \ + # Pass the given arguments to the command, in the ARGS environment variable. + # The arguments are just a json object that should be available in the script. + passArgs = name: argAttrs: script: writeShellScript name '' + env ARGS="$(< ${jsonFile "${name}-args" argAttrs})" \ ${script} "$@" ''; diff --git a/pkgs/development/tools/parsing/tree-sitter/update_impl.py b/pkgs/development/tools/parsing/tree-sitter/update_impl.py index 1e2edd0944b4..1bff7aac1abf 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update_impl.py +++ b/pkgs/development/tools/parsing/tree-sitter/update_impl.py @@ -7,7 +7,8 @@ from typing import Iterator, Any, Literal debug: bool = True if os.environ.get("DEBUG", False) else False Bin = str -bins: dict[str, Bin] = json.loads(os.environ["BINARIES"]) +args: dict[str, Any] = json.loads(os.environ["ARGS"]) +bins: dict[str, Bin] = args["binaries"] mode: str = sys.argv[1] jsonArg: dict = json.loads(sys.argv[2])