diff --git a/pkgs/development/tools/parsing/tree-sitter/update.nix b/pkgs/development/tools/parsing/tree-sitter/update.nix index ccb81a3f94b6..83a1cecc6aab 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update.nix +++ b/pkgs/development/tools/parsing/tree-sitter/update.nix @@ -405,14 +405,19 @@ let ''; # implementation of the fetching of repo information from github - fetchImpl = writeShellScript "fetchImpl-wrapped" '' - env ARGLIB_JSON=${lib.escapeShellArg (lib.generators.toJSON {} { + fetchImpl = passBinaries "fetchImpl-wrapped" { curl = "${curl}/bin/curl"; nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git"; - })} \ - ${writers.writePython3 "fetchImpl" { - flakeIgnore = ["E501"]; - } ./update_impl.py} "$@" + } + (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)} \ + ${script} "$@" ''; foreachSh = attrs: f: diff --git a/pkgs/development/tools/parsing/tree-sitter/update_impl.py b/pkgs/development/tools/parsing/tree-sitter/update_impl.py index 8c9351c433cd..809651636fdd 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update_impl.py +++ b/pkgs/development/tools/parsing/tree-sitter/update_impl.py @@ -7,7 +7,7 @@ from typing import Generator, Any, Literal debug: bool = True if os.environ.get("DEBUG", False) else False Bin = str -bins: dict[str, Bin] = json.loads(os.environ['ARGLIB_JSON']) +bins: dict[str, Bin] = json.loads(os.environ["BINARIES"]) mode: str = sys.argv[1] jsonArg: dict = json.loads(sys.argv[2])