Currently I use:
find /nix/store/* -maxdepth 1 | xargs -L <N> nix-copy-closure --sign --gzip --use-substitutes --to <remote machine>
Where N
is some reasonable number that will not make the line length too long for xargs
.
Is there a more idiomatic method of doing this on two running machines?
edit:
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-substitues
This 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 laptopnix-copy-closure
copies 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.
Best Answer
I prefer to use
nix-serve
to share packages between laptopsmore options how to share nix packages between machines described in nix manual