2007-09-19 17:01:41 +03:00
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook"
|
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
2009-07-14 17:58:12 +03:00
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
|
|
|
xml:id="sec-nix-copy-closure">
|
2007-09-19 17:01:41 +03:00
|
|
|
|
|
|
|
|
|
<refmeta>
|
|
|
|
|
<refentrytitle>nix-copy-closure</refentrytitle>
|
|
|
|
|
<manvolnum>1</manvolnum>
|
|
|
|
|
<refmiscinfo class="source">Nix</refmiscinfo>
|
2014-09-16 15:57:45 +03:00
|
|
|
|
<refmiscinfo class="version"><xi:include href="../version.txt" parse="text"/></refmiscinfo>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>nix-copy-closure</refname>
|
|
|
|
|
<refpurpose>copy a closure to or from a remote machine via SSH</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
|
<cmdsynopsis>
|
|
|
|
|
<command>nix-copy-closure</command>
|
|
|
|
|
<group>
|
|
|
|
|
<arg choice='plain'><option>--to</option></arg>
|
|
|
|
|
<arg choice='plain'><option>--from</option></arg>
|
|
|
|
|
</group>
|
|
|
|
|
<arg><option>--gzip</option></arg>
|
2014-07-24 18:11:54 +03:00
|
|
|
|
<!--
|
|
|
|
|
<arg><option>- -show-progress</option></arg>
|
|
|
|
|
-->
|
2011-11-23 17:39:02 +02:00
|
|
|
|
<arg><option>--include-outputs</option></arg>
|
2017-07-07 21:37:16 +03:00
|
|
|
|
<group>
|
|
|
|
|
<arg choice='plain'><option>--use-substitutes</option></arg>
|
|
|
|
|
<arg choice='plain'><option>-s</option></arg>
|
|
|
|
|
</group>
|
2015-07-20 02:52:07 +03:00
|
|
|
|
<arg><option>-v</option></arg>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
<arg choice='plain'>
|
2020-07-23 15:28:05 +03:00
|
|
|
|
<emphasis>user@</emphasis><emphasis>machine</emphasis>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
</arg>
|
2020-07-23 15:28:05 +03:00
|
|
|
|
<arg choice='plain'><emphasis>paths</emphasis></arg>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
</cmdsynopsis>
|
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<refsection><title>Description</title>
|
|
|
|
|
|
|
|
|
|
<para><command>nix-copy-closure</command> gives you an easy and
|
|
|
|
|
efficient way to exchange software between machines. Given one or
|
2020-07-23 15:28:05 +03:00
|
|
|
|
more Nix store <emphasis>paths</emphasis> on the local
|
2007-09-19 17:01:41 +03:00
|
|
|
|
machine, <command>nix-copy-closure</command> 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
|
|
|
|
|
<command>ssh</command> (Secure Shell) command. With the
|
|
|
|
|
<option>--from</option>, the direction is reversed:
|
2020-07-23 15:28:05 +03:00
|
|
|
|
the closure of <emphasis>paths</emphasis> on a remote machine is
|
2007-09-19 17:01:41 +03:00
|
|
|
|
copied to the Nix store on the local machine.</para>
|
|
|
|
|
|
|
|
|
|
<para>This command is efficient because it only sends the store paths
|
|
|
|
|
that are missing on the target machine.</para>
|
|
|
|
|
|
|
|
|
|
<para>Since <command>nix-copy-closure</command> calls
|
|
|
|
|
<command>ssh</command>, you may be asked to type in the appropriate
|
|
|
|
|
password or passphrase. In fact, you may be asked
|
|
|
|
|
<emphasis>twice</emphasis> because <command>nix-copy-closure</command>
|
|
|
|
|
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
|
|
|
|
|
<command>ssh-agent</command>.</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<refsection><title>Options</title>
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
2012-11-23 17:20:16 +02:00
|
|
|
|
|
2007-09-19 17:01:41 +03:00
|
|
|
|
<varlistentry><term><option>--to</option></term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>Copy the closure of
|
2020-07-23 15:28:05 +03:00
|
|
|
|
<emphasis>paths</emphasis> from the local Nix store to the
|
|
|
|
|
Nix store on <emphasis>machine</emphasis>. This is the
|
2007-09-19 17:01:41 +03:00
|
|
|
|
default.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry><term><option>--from</option></term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>Copy the closure of
|
2020-07-23 15:28:05 +03:00
|
|
|
|
<emphasis>paths</emphasis> from the Nix store on
|
|
|
|
|
<emphasis>machine</emphasis> to the local Nix
|
2007-09-19 17:01:41 +03:00
|
|
|
|
store.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2014-07-24 18:11:54 +03:00
|
|
|
|
<varlistentry><term><option>--gzip</option></term>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
|
2014-07-24 18:11:54 +03:00
|
|
|
|
<listitem><para>Enable compression of the SSH
|
|
|
|
|
connection.</para></listitem>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2011-11-23 17:39:02 +02:00
|
|
|
|
<varlistentry><term><option>--include-outputs</option></term>
|
2012-11-23 17:20:16 +02:00
|
|
|
|
|
|
|
|
|
<listitem><para>Also copy the outputs of store derivations
|
|
|
|
|
included in the closure.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry><term><option>--use-substitutes</option> / <option>-s</option></term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>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 <literal>nixos.org</literal> (the default
|
|
|
|
|
binary cache server) is fast.</para></listitem>
|
|
|
|
|
|
2011-11-23 17:39:02 +02:00
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2015-07-20 02:52:07 +03:00
|
|
|
|
<varlistentry><term><option>-v</option></term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>Show verbose output.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2007-09-19 17:01:41 +03:00
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
|
|
</refsection>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<refsection><title>Environment variables</title>
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
2020-07-23 11:38:19 +03:00
|
|
|
|
<varlistentry><term><literal>NIX_SSHOPTS</literal></term>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
|
|
|
|
|
<listitem><para>Additional options to be passed to
|
|
|
|
|
<command>ssh</command> on the command line.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
2012-11-23 17:20:16 +02:00
|
|
|
|
|
2007-09-19 17:01:41 +03:00
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
|
|
</refsection>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<refsection><title>Examples</title>
|
|
|
|
|
|
|
|
|
|
<para>Copy Firefox with all its dependencies to a remote machine:
|
|
|
|
|
|
|
|
|
|
<screen>
|
2008-11-19 17:20:46 +02:00
|
|
|
|
$ nix-copy-closure --to alice@itchy.labs $(type -tP firefox)</screen>
|
2007-09-19 17:01:41 +03:00
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>Copy Subversion from a remote machine and then install it into a
|
|
|
|
|
user environment:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-copy-closure --from alice@itchy.labs \
|
|
|
|
|
/nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
|
|
|
|
$ nix-env -i /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
|
|
|
|
</screen>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</refsection>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</refsection>
|
|
|
|
|
|
|
|
|
|
</refentry>
|