lol

tree-sitter/update: BINARIES -> ARGS.binaries

I want to pass more information in the next step, so binaries are just
one of multiple elements of the json value.

Generate a json file via `format` so that we get nicer
formatting (`lib.generators.toJSON` uses `builtins.toJSON` which does
not add any whitespace).

+12 -9
+10 -8
pkgs/development/tools/parsing/tree-sitter/update.nix
··· 405 405 ''; 406 406 407 407 # implementation of the fetching of repo information from github 408 - fetchImpl = passBinaries "fetchImpl-wrapped" { 409 - curl = "${curl}/bin/curl"; 410 - nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git"; 411 - inherit atomically-write; 408 + fetchImpl = passArgs "fetchImpl-with-args" { 409 + binaries = { 410 + curl = "${curl}/bin/curl"; 411 + nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git"; 412 + inherit atomically-write; 413 + }; 412 414 } 413 415 (writers.writePython3 "fetchImpl" { 414 416 flakeIgnore = ["E501"]; 415 417 } ./update_impl.py); 416 418 417 - # Pass the given binaries to the command, in the BINARIES environment variable. 418 - # The binaries are just an attrset from name to executable. 419 - passBinaries = name: binAttrs: script: writeShellScript name '' 420 - env BINARIES=${lib.escapeShellArg (lib.generators.toJSON {} binAttrs)} \ 419 + # Pass the given arguments to the command, in the ARGS environment variable. 420 + # The arguments are just a json object that should be available in the script. 421 + passArgs = name: argAttrs: script: writeShellScript name '' 422 + env ARGS="$(< ${jsonFile "${name}-args" argAttrs})" \ 421 423 ${script} "$@" 422 424 ''; 423 425
+2 -1
pkgs/development/tools/parsing/tree-sitter/update_impl.py
··· 7 7 8 8 debug: bool = True if os.environ.get("DEBUG", False) else False 9 9 Bin = str 10 - bins: dict[str, Bin] = json.loads(os.environ["BINARIES"]) 10 + args: dict[str, Any] = json.loads(os.environ["ARGS"]) 11 + bins: dict[str, Bin] = args["binaries"] 11 12 12 13 mode: str = sys.argv[1] 13 14 jsonArg: dict = json.loads(sys.argv[2])