tree-sitter/update: get executables from nix instead of environment

This was a small bug, the update script should of course not depend on
any executables in the environment.

Since we don’t use a nix string anymore, interpolation is out of the
question, so we pass it as arglib environment json string.
This commit is contained in:
Profpatsch
2022-09-06 21:43:07 +02:00
parent 0d067c8603
commit 805b5e978d
2 changed files with 12 additions and 5 deletions
@@ -408,9 +408,15 @@ let
urlEscape = x: x;
# implementation of the fetching of repo information from github
fetchImpl = writers.writePython3 "fetchImpl" {
flakeIgnore = ["E501"];
} ./update_impl.py;
fetchImpl = writeShellScript "fetchImpl-wrapped" ''
env ARGLIB_JSON=${lib.escapeShellArg (lib.generators.toJSON {} {
curl = "${curl}/bin/curl";
nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git";
})} \
${writers.writePython3 "fetchImpl" {
flakeIgnore = ["E501"];
} ./update_impl.py} "$@"
'';
# find the latest repos of a github organization
latestGithubRepos = { orga }: writeShellScript "latest-github-repos" ''
@@ -5,6 +5,7 @@ import os
import sys
debug = True if os.environ.get("DEBUG", False) else False
bins = json.loads(os.environ['ARGLIB_JSON'])
mode = sys.argv[1]
jsonArg = json.loads(sys.argv[2])
@@ -12,7 +13,7 @@ jsonArg = json.loads(sys.argv[2])
def curl_github_args(token, url):
"""Query the github API via curl"""
yield "curl"
yield bins["curl"]
if not debug:
yield "--silent"
if token:
@@ -36,7 +37,7 @@ def curl_result(orga, repo, output):
def nix_prefetch_args(url, version_rev):
"""Prefetch a git repository"""
yield "nix-prefetch-git"
yield bins["nix-prefetch-git"]
if not debug:
yield "--quiet"
yield "--no-deepClone"