nix-pack-closure
pack the closure of a store path into a single file that
can be unpacked with
nix-unpack-closure
nix-pack-closure
paths
Description
The command nix-pack-closure packs the
contents of the store paths paths and
all their dependencies into a single file, which
is written to standard output. (That is, it
serialises paths.)
The output can then be unpacked into the Nix store of another machine
using nix-unpack-closure.
Together, nix-pack-closure and
nix-unpack-closure provide a quick and easy way to
deploy a package to a different machine. However, as the output of
nix-pack-closure tends to be rather large (since it
contains all dependencies), it’s not very efficient.
nix-push and nix-pull are more
efficient, but are also a bit more cumbersome to use.
Examples
To copy some instance of Subversion with all its dependencies to
another machine:
$ nix-pack-closure /nix/store/hj232g1r...-subversion-1.3.0 > svn.closure
Copy svn.closure to the remote machine, then on the remote machine do:
$ nix-unpack-closure < svn.closure
Copy the program azureus with all its
dependencies to the machine scratchy:
$ nix-pack-closure $(which azureus) | ssh scratchy nix-unpack-closure