.\" -*- mode: troff; coding: utf-8 -*- .TH "nix-copy-closure" "1" "" .SH Name \fCnix-copy-closure\fR - copy a closure to or from a remote machine via SSH .SH Synopsis \fCnix-copy-closure\fR [\fC--to\fR | \fC--from\fR] [\fC--gzip\fR] [\fC--include-outputs\fR] [\fC--use-substitutes\fR | \fC-s\fR] [\fC-v\fR] \fIuser@machine\fR \fIpaths\fR .SH Description \fCnix-copy-closure\fR gives you an easy and efficient way to exchange software between machines. Given one or more Nix store \fIpaths\fR on the local machine, \fCnix-copy-closure\fR 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 \fCssh\fR (Secure Shell) command. With the \fC--from\fR option, the direction is reversed: the closure of \fIpaths\fR on a remote machine is copied to the Nix store on the local machine. .PP This command is efficient because it only sends the store paths that are missing on the target machine. .PP Since \fCnix-copy-closure\fR calls \fCssh\fR, you may be asked to type in the appropriate password or passphrase. In fact, you may be asked \fItwice\fR because \fCnix-copy-closure\fR 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 \fCssh-agent\fR. .SH Options .IP "\(bu" 2 \fC--to\fR .br Copy the closure of \fIpaths\fR from the local Nix store to the Nix store on \fImachine\fR. This is the default. .IP "\(bu" 2 \fC--from\fR .br Copy the closure of \fIpaths\fR from the Nix store on \fImachine\fR to the local Nix store. .IP "\(bu" 2 \fC--gzip\fR .br Enable compression of the SSH connection. .IP "\(bu" 2 \fC--include-outputs\fR .br Also copy the outputs of store derivations included in the closure. .IP "\(bu" 2 \fC--use-substitutes\fR / \fC-s\fR .br 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 \fCnixos.org\fR (the default binary cache server) is fast. .IP "\(bu" 2 \fC-v\fR .br Show verbose output. .SH Environment variables .IP "\(bu" 2 \fCNIX_SSHOPTS\fR .br Additional options to be passed to \fCssh\fR on the command line. .SH Examples Copy Firefox with all its dependencies to a remote machine: .LP .EX $ nix-copy-closure --to alice@itchy.labs $(type -tP firefox) .EE .PP Copy Subversion from a remote machine and then install it into a user environment: .LP .EX $ nix-copy-closure --from alice@itchy.labs \e /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4 $ nix-env -i /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4 .EE