Speed up nix copy?

Hi, is it possible to speed up a `nix copy --to file://… $store_path?
An initial copy of a system derivation takes ~15 minutes here. While doing so, the nix (v2.4) process just uses 1 core.

  1. Is it possible to make nix use all cores for compression? I’ve tried the options core and max-jobs in ~/.config/nix/nix.conf. But, it looks like they behave as the documentation states and effect builds only and a copy/compression doesn’t count.
  2. Is it possible to change the compression or its level? Haven’t found any option for this.

Thanks, Daniel

1 Like

Try this:

nix copy --to 'file:///tmp/cache/?compression=none&secret-key=/tmp/cache.pem' $store_path
2 Likes

Just opened the nix code and saw that there will be an additional “parallel-compression” and “compression-level” option in the next (?) release.

1 Like

It’s in! Add compression level for NARs by tomberek · Pull Request #5372 · NixOS/nix · GitHub

1 Like

nix copy was previously able to copy paths in parallel but that’s currently disabled (nix/store-api.cc at 52a3b2ee6367306a3f17fe9a2d0e2e4096852e05 · NixOS/nix · GitHub).

1 Like

Why was it disabled? It’s not obvious to me from skimming over the commit message: Low-latency closure copy · NixOS/nix@fe1f34f · GitHub

1 Like