I’m trying to use nix copy
to copy a derivation (from my own project) from one machine to another (with dependencies) using a USB stick.
On the source machine I run:
nix copy --to file:///mnt/usb-device /nix/store/<derivation-hash>.drv
This spends several minutes copying packages.
I then move the USB to the target computer.
I execute:
nix copy --from file:///mnt/usb-device /nix/store/<derivation-hash>.drv
This errors out with:
error: path '/nix/store/<derivation-hash>.drv' is not valid
I’m assuming this is because the target machine’s store/channel has no knowledge of this path. This is expected; the path is coming from the on-disk store/cache.
What is the correct way to do this?