Subject: [RFC PATCH v2 4/5] publish: Add support for storing ERIS encoded blocks to IPFS.

From: pukkamustard <[email-masked]>
Date: Tue, 25 Jan 2022 19:22:00 +0000

* guix/scripts/publish.scm (bake-narinfo+nar): Use guix-eris-block-reducer
from (guix eris).
---
 guix/scripts/publish.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index 9c83f5183d..556107ab7d 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -41,6 +41,7 @@ (define-module (guix scripts publish)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
+  #:use-module (srfi srfi-71)
   #:use-module (web http)
   #:use-module (web request)
   #:use-module (web response)
@@ -58,6 +59,7 @@ (define-module (guix scripts publish)
   #:use-module (guix workers)
   #:use-module (guix store)
   #:use-module ((guix serialization) #:select (write-file))
+  #:use-module (guix eris)
   #:use-module (eris)
   #:use-module (zlib)
   #:autoload   (lzlib) (call-with-lzip-output-port
@@ -644,8 +646,14 @@ (define (eris-encode-nar compressions)
                 (stat (stat nar #f)))
            (and stat
                 (call-with-input-file nar
-                  (cut eris-encode->string <>
-                       #:block-size %eris-block-size-large))))))
+                  (lambda (port)
+                    (let ((eris-urn _
+                                    (eris-encode port
+                                                 #:block-size
+                                                 %eris-block-size-large
+                                                 #:block-reducer
+                                                 guix-eris-block-reducer)))
+                      (uri->string eris-urn))))))))
 
   (let ((compression (actual-compressions item compressions)))
 
-- 
2.34.0