Currently I use:
find /nix/store/* -maxdepth 1 | xargs -L <N> nix-copy-closure --sign --gzip --use-substitutes --to <remote machine>
N is some reasonable number that will not make the line length too long for
Is there a more idiomatic method of doing this on two running machines?
Advantages of above method:
- Does not copy closures that exist on both ends. This also means you can stop a transfer and pick up where you left off other then some hash checking overhead
--use-substituesThis will make the remote machine download from binary caches first and then sending machine second. This is great in the common case of sending files from my laptop to a remove server where the remote server often has 100 times the bandwidth to nix's binary cache compared to my laptop
nix-copy-closurecopies over ssh so the transfer is encrypted.
- nix-copy-closure, to my limited knowledge, should not interfere with any other operations happening on the nix store.