Hi! ‘guix publish --compression’ can now compress archives in gzip format, using zlib, which makes it much more usable in real life. See commit 4a1fc562ae5eedf40f6ae4eabe30580b0983b8f6.
‘guix publish’ is cache-friendly: it uses /nar/gzip URLs for gzipped archives, and /nar for uncompressed archives. That way, even if ‘guix publish’ is restarted with different compression parameters, previously announced /nar/* URLs remain valid. Please try it and report back. To recap, the difficulty with all this is that we couldn’t just call out the ‘gzip’ command because ‘guix publish’ uses threads, and threads and fork(2) don’t go together well. So we needed zlib bindings, and when discussing it earlier with Dave, I thought we’d have to wrap zlib’s low-level API, which is painful, so we were sad and all. Next we had this hydra.gnu.org outage, which entailed more sadness. Then I realized that zlib has this high-level ‘gz’ API, which is easy and does what we need; hence, (guix zlib) provides bindings to that. The only limitation is that it needs a file descriptor as its source or sink and cannot compress into memory. That’s enough for ‘guix publish’ though. Comments welcome! Ludo’.