about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2022-09-06 21:43:07 +0200
committerProfpatsch <mail@profpatsch.de>2022-11-04 18:14:33 +0100
commit805b5e978d6aff39429e9ebcbc0a6fc2df1a893a (patch)
tree1fc8e180c615e2d3ce6b70f678fc2cda2b4bb7ee /pkgs
parent0d067c8603cde7118fbe11b806b718d00c78d493 (diff)
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.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/parsing/tree-sitter/update.nix12
-rw-r--r--pkgs/development/tools/parsing/tree-sitter/update_impl.py5
2 files changed, 12 insertions, 5 deletions
diff --git a/pkgs/development/tools/parsing/tree-sitter/update.nix b/pkgs/development/tools/parsing/tree-sitter/update.nix
index 8181280df7edc..9655dd0f0ef76 100644
--- a/pkgs/development/tools/parsing/tree-sitter/update.nix
+++ b/pkgs/development/tools/parsing/tree-sitter/update.nix
@@ -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" ''
diff --git a/pkgs/development/tools/parsing/tree-sitter/update_impl.py b/pkgs/development/tools/parsing/tree-sitter/update_impl.py
index 63ace17c3583a..37378feea6beb 100644
--- a/pkgs/development/tools/parsing/tree-sitter/update_impl.py
+++ b/pkgs/development/tools/parsing/tree-sitter/update_impl.py
@@ -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"