Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

nix-casync v0.5

Latest
Compare
Choose a tag to compare
@flokli flokli released this 21 Feb 15:29
· 61 commits to main since this release
4eb4ff3

This brings the following features since the initial release:

Access Logging

nix-casync serve now prints out an access log by default, allowing to see the
amount of requests its getting, as well as debugging Nix local cache behaviour.
It can optionally be disabled with the --no-access-log parameter.

Compression support for uploading and downloading

Initially I didn't implement any transport-level compression support, as the
idea was to have the local instance of nix-casync transparently doing an
"upgrade" to a to-be-defined more efficient protocol while talking to the
remote binary cache backend.

However, some people apparently started playing with nix-casync in a
"standalone binary cache" scenario. Here, it's desirable to have compression
while uploading store paths, as well as when substituting from other machines.

Following up on my [sidenote]({{<relref "posts/2021-12-10-nix-casync-intro.md#fn:3">}})
in the previous article, Nix doesn't use the FileHash, FileSize and
Compression attributes in .narinfo files for signatures, doesn't
require/check FileHash/FileSize fields when downloading NAR files (it
checks the uncompressed NarHash and NarSize though), and also doesn't
require NAR files to be uploaded at nar/$filehash.nar[.$compressionSuffix].

This means, if you hold things creatively, you can accept variously compressed
.nar files on upload, feed them uncompressed to the chunker, and when serving
back, optionally also use any compression format (and change it on the fly).

Support uploading with compression

nix-casync now supports uploading with the following compression methods
(can be passed with the ?compression=… parameter during a nix copy):

  • none
  • br
  • bzip2
  • gzip
  • lz4
  • lzip
  • xz
  • zstd

This is a subset of the formats supported by Nix, mostly due to library
availability. Keep in mind this is only used for compressing upload transfer
stream, so picking a fast compression (zstd) is recommended.
Also note Nix defaults to gzip for backwards compat reasons if you don't
specify the ?compression=… parameter explicitly.

Support serving with compression

nix-casync now also supports serving NAR files in compressed form. Only
none, brotli, gzip and zstd are supported here, mostly because the
other ones are too CPU-intensive.

This behaviour can be modified with the --nar-compression=… parameter, and
defaults to ZSTD.