nix-copy-closure - copy a closure to or from a remote machine via SSH
nix-copy-closure gives you an easy and efficient way to exchange
software between machines. Given one or more Nix store paths on the
nix-copy-closure computes the closure of those paths
(i.e. all their dependencies in the Nix store), and copies all paths
in the closure to the remote machine via the
ssh (Secure Shell)
command. With the
--from option, the direction is reversed: the
closure of paths on a remote machine is copied to the Nix store on
the local machine.
This command is efficient because it only sends the store paths that are missing on the target machine.
ssh, you may be asked to type in the
appropriate password or passphrase. In fact, you may be asked twice
nix-copy-closure currently connects twice to the remote
machine, first to get the set of paths missing on the target machine,
and second to send the dump of those paths. When using public key
authentication, you can avoid typing the passphrase with
Copy the closure of paths from the local Nix store to the Nix store on machine. This is the default.
Copy the closure of paths from the Nix store on machine to the local Nix store.
Enable compression of the SSH connection.
Also copy the outputs of store derivations included in the closure.
Attempt to download missing paths on the target machine using Nix’s substitute mechanism. Any paths that cannot be substituted on the target are still copied normally from the source. This is useful, for instance, if the connection between the source and target machine is slow, but the connection between the target machine and
nixos.org(the default binary cache server) is fast.
Show verbose output.
Additional options to be passed to
sshon the command line.
Copy Firefox with all its dependencies to a remote machine:
$ nix-copy-closure --to email@example.com $(type -tP firefox)
Copy Subversion from a remote machine and then install it into a user environment:
$ nix-copy-closure --from firstname.lastname@example.org \ /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4 $ nix-env -i /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4