David Thompson <dthomps...@worcester.edu> skribis: > Ludovic Courtès <l...@gnu.org> writes: > >> To produce that, use ‘write-file’ from (guix serialization): >> >> --8<---------------cut here---------------start------------->8--- >> $ ./pre-inst-env guile -c '(use-modules (guix serialization)) (write-file >> "/gnu/store/wy70n5zk8qinxjz0wdk9q2hh1zjfb32j-miscfiles-1.5" >> (current-output-port))' > t.nar >> $ ./pre-inst-env guile -c '(use-modules (guix serialization)) >> (call-with-input-file "t.nar" (lambda (port) (restore-file port >> "restored")))' >> $ ls restored/ >> share >> --8<---------------cut here---------------end--------------->8--- > > The above snippet works. However, 'guix substitute-binary' throws the > following error: > > guix substitute-binary: error: invalid nar end-of-file marker > > Here's my nar rendering code: > > (define (render-nar store-item) > "Render archive of the store path corresponding to STORE-ITEM." > (let ((store-path (string-append %store-directory "/" store-item))) > (values '((content-type . (text/x-nix-archive))) > (lambda (port) > (write-file store-path port)))))
Hmm, some ideas of things to try: 1. Add (force-output port) after (write-file ...). 2. Display the value of ‘x’ in ‘restore-file’ at the point where the exception is raised. 2. strace the substituter and/or ‘guix publish’ to see exactly what happens on the wire. Is the end-of-file marker string sent? Is it received? etc. Ludo’.