(ziclh lang rust): use compile-time path for yj

This will have to be replaced with a small Rust program, but I don't
want to resolve the chicken-egg problem right now.
This commit is contained in:
puck 2025-03-02 22:13:05 +00:00
parent cb046ea859
commit 307b1c7218
4 changed files with 8 additions and 4 deletions

View file

@ -15,9 +15,11 @@
lockfile-entry? lockfile-entry-name lockfile-entry-version lockfile-entry-source lockfile-entry-checksum lockfile-entry-dependencies)
(begin
(define yj-path (foreign-value "YJ_PATH" nonnull-c-string))
;; Shell out to a TOML-to-JSON parser. This will be replaced with a Nix-native solution later(tm).
(define (parse-toml toml-to-parse)
(define-values (read-port write-port pid) (process "yj" '("yj" "-tj")))
(define-values (read-port write-port pid) (process yj-path '("yj" "-tj")))
(write-string toml-to-parse write-port)
(close-output-port write-port)
(define parsed (json-read read-port))