2020-07-22 11:51:11 +00:00
|
|
|
|
# Name
|
|
|
|
|
|
|
|
|
|
`nix-copy-closure` - copy a closure to or from a remote machine via SSH
|
|
|
|
|
|
|
|
|
|
# Synopsis
|
|
|
|
|
|
2020-07-24 10:56:19 +00:00
|
|
|
|
`nix-copy-closure`
|
|
|
|
|
[`--to` | `--from`]
|
|
|
|
|
[`--gzip`]
|
|
|
|
|
[`--include-outputs`]
|
|
|
|
|
[`--use-substitutes` | `-s`]
|
|
|
|
|
[`-v`]
|
|
|
|
|
_user@machine_ _paths_
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
|
|
|
|
# Description
|
|
|
|
|
|
|
|
|
|
`nix-copy-closure` gives you an easy and efficient way to exchange
|
|
|
|
|
software between machines. Given one or more Nix store _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 `--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.
|
|
|
|
|
|
|
|
|
|
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`.
|
|
|
|
|
|
|
|
|
|
# Options
|
|
|
|
|
|
2021-04-23 12:30:42 +00:00
|
|
|
|
- `--to`\
|
2020-07-24 11:01:00 +00:00
|
|
|
|
Copy the closure of _paths_ from the local Nix store to the Nix
|
|
|
|
|
store on _machine_. This is the default.
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
2021-04-23 12:30:42 +00:00
|
|
|
|
- `--from`\
|
2020-07-24 11:01:00 +00:00
|
|
|
|
Copy the closure of _paths_ from the Nix store on _machine_ to the
|
|
|
|
|
local Nix store.
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
2021-04-23 12:30:42 +00:00
|
|
|
|
- `--gzip`\
|
2020-07-24 11:01:00 +00:00
|
|
|
|
Enable compression of the SSH connection.
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
2021-04-23 12:30:42 +00:00
|
|
|
|
- `--include-outputs`\
|
2020-07-24 11:01:00 +00:00
|
|
|
|
Also copy the outputs of store derivations included in the closure.
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
2021-04-23 12:30:42 +00:00
|
|
|
|
- `--use-substitutes` / `-s`\
|
2020-07-24 11:01:00 +00:00
|
|
|
|
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.
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
2021-04-23 12:30:42 +00:00
|
|
|
|
- `-v`\
|
2020-07-24 11:01:00 +00:00
|
|
|
|
Show verbose output.
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
|
|
|
|
# Environment variables
|
|
|
|
|
|
2021-04-23 12:30:42 +00:00
|
|
|
|
- `NIX_SSHOPTS`\
|
2020-07-24 11:01:00 +00:00
|
|
|
|
Additional options to be passed to `ssh` on the command
|
|
|
|
|
line.
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
|
|
|
|
# Examples
|
|
|
|
|
|
|
|
|
|
Copy Firefox with all its dependencies to a remote machine:
|
|
|
|
|
|
2020-07-31 13:43:25 +00:00
|
|
|
|
```console
|
|
|
|
|
$ nix-copy-closure --to alice@itchy.labs $(type -tP firefox)
|
|
|
|
|
```
|
2020-07-22 11:51:11 +00:00
|
|
|
|
|
|
|
|
|
Copy Subversion from a remote machine and then install it into a user
|
|
|
|
|
environment:
|
|
|
|
|
|
2020-07-31 13:43:25 +00:00
|
|
|
|
```console
|
|
|
|
|
$ nix-copy-closure --from alice@itchy.labs \
|
|
|
|
|
/nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
|
|
|
|
$ nix-env -i /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
|
|
|
|
```
|