nix-copy-closure1Nixnix-copy-closurecopy a closure to or from a remote machine via SSHnix-copy-closureuser@machinepathsDescriptionnix-copy-closure gives you an easy and
efficient way to exchange software between machines. Given one or
more Nix store paths paths on the local
machine, 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
, 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.Since nix-copy-closure calls
ssh, you may be asked to type in the appropriate
password or passphrase. In fact, you may be asked
twice because 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. If this bothers you, use
ssh-agent.OptionsCopy 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.Let the sending machine cryptographically sign the
dump of each path with the key in
/nix/etc/nix/signing-key.sec. If the user on
the target machine does not have direct access to the Nix store
(i.e., if the target machine has a multi-user Nix installation),
then the target machine will check the dump against
/nix/etc/nix/signing-key.pub before unpacking
it in its Nix store. This allows secure sharing of store paths
between untrusted users on two machines, provided that there is a
trust relation between the Nix installations on both machines
(namely, they have matching public/secret keys).Compress the dump of each path with
gzip before sending it.Environment variablesNIX_SSHOPTSAdditional options to be passed to
ssh on the command line.ExamplesCopy Firefox with all its dependencies to a remote machine:
$ nix-copy-closure alice@itchy.labs $(type -tP firefox)Copy Subversion from a remote machine and then install it into a
user environment:
$ nix-copy-closure --from alice@itchy.labs \
/nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
$ nix-env -i /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4