(zilch lang rust): call yj inside nix
Change-Id: I3bc75045534ef524ca2a8a2df290e2876a6a6964
This commit is contained in:
parent
d97a24bf1a
commit
edbdf48a5a
3 changed files with 20 additions and 21 deletions
|
|
@ -15,7 +15,6 @@
|
||||||
xxd
|
xxd
|
||||||
];
|
];
|
||||||
|
|
||||||
overrides.NIX_CFLAGS_COMPILE = "-DYJ_PATH=\"${yj}/bin/yj\"";
|
|
||||||
overrides.preBuild = ''
|
overrides.preBuild = ''
|
||||||
(cat ${./helpers/src/bin/buildscript-runner.rs}; printf '\0') | xxd -i -n runner_source > runner_source.h
|
(cat ${./helpers/src/bin/buildscript-runner.rs}; printf '\0') | xxd -i -n runner_source > runner_source.h
|
||||||
(cat ${./helpers/src/bin/rustc-wrapper.rs}; printf '\0') | xxd -i -n rustc_wrap_source > rustc_wrap_source.h
|
(cat ${./helpers/src/bin/rustc-wrapper.rs}; printf '\0') | xxd -i -n rustc_wrap_source > rustc_wrap_source.h
|
||||||
|
|
|
||||||
|
|
@ -45,17 +45,18 @@
|
||||||
|
|
||||||
(begin
|
(begin
|
||||||
(define linker (delay (let ((v (cdr (assoc "out" (nixpkgs "gcc"))))) #~,(string-append #$v "/bin/cc"))))
|
(define linker (delay (let ((v (cdr (assoc "out" (nixpkgs "gcc"))))) #~,(string-append #$v "/bin/cc"))))
|
||||||
(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 yj (delay (let ((v (cdr (assoc "out" (nixpkgs "yj"))))) #~,(string-append #$v "/bin/yj"))))
|
||||||
(define (parse-toml toml-to-parse)
|
(define (parse-toml toml-to-parse)
|
||||||
(define-values (read-port write-port pid) (process yj-path '("yj" "-tj")))
|
(define store-path
|
||||||
(write-string toml-to-parse write-port)
|
(cdar
|
||||||
(close-output-port write-port)
|
(store-path-for-ca-drv*
|
||||||
(define parsed (json-read read-port))
|
"parse-toml" "x86_64-linux"
|
||||||
(close-input-port read-port)
|
'("/bin/sh" "-c" "$yj -tj < $in > $out")
|
||||||
; (define-values (_ _ _) (process-wait pid))
|
`(("in" . ,(zfile toml-to-parse))
|
||||||
parsed)
|
("yj" . ,(force yj)))
|
||||||
|
'("out"))))
|
||||||
|
(call-with-port (store-path-open store-path) json-read))
|
||||||
|
|
||||||
;; A single target for a crate.
|
;; A single target for a crate.
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,17 @@
|
||||||
lockfile-entry-checksum lockfile-entry-dependencies)
|
lockfile-entry-checksum lockfile-entry-dependencies)
|
||||||
|
|
||||||
(begin
|
(begin
|
||||||
(define yj-path (foreign-value "YJ_PATH" nonnull-c-string))
|
(define yj (delay (let ((v (cdr (assoc "out" (nixpkgs "yj"))))) #~,(string-append #$v "/bin/yj"))))
|
||||||
|
|
||||||
;; 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 (parse-toml toml-to-parse)
|
||||||
(define-values (read-port write-port pid) (process yj-path '("yj" "-tj")))
|
(define store-path
|
||||||
(write-string toml-to-parse write-port)
|
(cdar
|
||||||
(close-output-port write-port)
|
(store-path-for-ca-drv*
|
||||||
(define parsed (json-read read-port))
|
"parse-toml" "x86_64-linux"
|
||||||
(close-input-port read-port)
|
'("/bin/sh" "-c" "$yj -tj < $in > $out")
|
||||||
; (define-values (_ _ _) (process-wait pid))
|
`(("in" . ,(zfile toml-to-parse))
|
||||||
parsed)
|
("yj" . ,(force yj)))
|
||||||
|
'("out"))))
|
||||||
|
(call-with-port (store-path-open store-path) json-read))
|
||||||
|
|
||||||
;; The contents of a single lockfile entry.
|
;; The contents of a single lockfile entry.
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue