diff --git a/doc/manual/Makefile.am b/doc/manual/Makefile.am index 1011ee7aa..62a7e9bff 100644 --- a/doc/manual/Makefile.am +++ b/doc/manual/Makefile.am @@ -14,7 +14,6 @@ XSLTPROC = $(xsltproc) $(xmlflags) \ man1_MANS = nix-env.1 nix-build.1 nix-store.1 nix-instantiate.1 \ nix-collect-garbage.1 nix-push.1 nix-pull.1 \ nix-prefetch-url.1 nix-channel.1 \ - nix-pack-closure.1 nix-unpack-closure.1 \ nix-install-package.1 nix-hash.1 nix-copy-closure.1 FIGURES = figures/user-environments.png diff --git a/doc/manual/manual.xml b/doc/manual/manual.xml index d564b09d8..22e9f6afd 100644 --- a/doc/manual/manual.xml +++ b/doc/manual/manual.xml @@ -89,10 +89,6 @@ nix-install-package -
- nix-pack-closure - -
nix-prefetch-url @@ -105,10 +101,6 @@ nix-push
-
- nix-unpack-closure - -
diff --git a/doc/manual/nix-pack-closure.xml b/doc/manual/nix-pack-closure.xml deleted file mode 100644 index c11dacd26..000000000 --- a/doc/manual/nix-pack-closure.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - nix-pack-closure - 1 - Nix - - - - - 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 - - - -As a variation on the previous example, copy -azureus, and also install it in the user’s profile -on the target machine: - - -$ nix-pack-closure $(which azureus) | ssh scratchy 'nix-env -i $(nix-unpack-closure)' - - - - - - - - diff --git a/doc/manual/nix-unpack-closure.xml b/doc/manual/nix-unpack-closure.xml deleted file mode 100644 index dce0d1db4..000000000 --- a/doc/manual/nix-unpack-closure.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - nix-unpack-closure - 1 - Nix - - - - - nix-unpack-closure - unpack the closure of a store path created by nix-pack-closure into the Nix store - - - - - nix-unpack-closure - - - - -Description - -The command nix-unpack-closure unpacks the -closure of a set of store paths created by -nix-pack-closure into the local Nix store. The -closure is a single file read from standard input. See the -description of nix-pack-closure for details and -examples. - -The top-level paths in the closure (i.e., the paths passed to -the original nix-pack-closure call that created the -closure) are printed on standard output. These paths can be passed, -for instance, to nix-env -i to install them into a -user environment on the target machine. - - - - - diff --git a/doc/manual/release-notes.xml b/doc/manual/release-notes.xml index 112ffabd7..b64e2025c 100644 --- a/doc/manual/release-notes.xml +++ b/doc/manual/release-notes.xml @@ -47,6 +47,13 @@ nix-prefetch-url now supports mirror:// URLs. + Removed the commands + nix-pack-closure and + nix-unpack-closure. You can do almost the same + thing but much more efficiently by doing nix-store --export + $(nix-store -qR paths) > closure and + nix-store --import < closure. + diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 662384b59..0e8443e9c 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,7 +1,6 @@ bin_SCRIPTS = nix-collect-garbage \ nix-pull nix-push nix-prefetch-url \ nix-install-package nix-channel nix-build \ - nix-pack-closure nix-unpack-closure \ nix-copy-closure noinst_SCRIPTS = nix-profile.sh generate-patches.pl \ @@ -36,7 +35,6 @@ EXTRA_DIST = nix-collect-garbage.in \ download-using-manifests.pl.in \ copy-from-other-stores.pl.in \ generate-patches.pl.in \ - nix-pack-closure.in nix-unpack-closure.in \ nix-copy-closure.in \ find-runtime-roots.pl.in \ build-remote.pl.in \ diff --git a/scripts/nix-pack-closure.in b/scripts/nix-pack-closure.in deleted file mode 100644 index 0634537d0..000000000 --- a/scripts/nix-pack-closure.in +++ /dev/null @@ -1,75 +0,0 @@ -#! @perl@ -w - -# This tool computes the closure of a path (using "nix-store --query -# --requisites") and puts the contents of each path in the closure in -# a big NAR archive that can be installed on another Nix installation -# using "nix-unpack-closure". - -# TODO: make this program "streamy", i.e., don't use a temporary -# directory. - -use strict; -use File::Temp qw(tempdir); - -my $binDir = $ENV{"NIX_BIN_DIR"}; -$binDir = "@bindir@" unless defined $binDir; - -my $tmpDir = tempdir("nix-pack-closure.XXXXXX", CLEANUP => 1, TMPDIR => 1) - or die "cannot create a temporary directory"; - -mkdir "$tmpDir/contents", 0755 or die; -mkdir "$tmpDir/references", 0755 or die; -mkdir "$tmpDir/derivers", 0755 or die; - -open TOPLEVEL, ">$tmpDir/top-level" or die; - - -my %storePaths; - - -while (@ARGV) { - my $storePath = shift @ARGV; - - # $storePath might be a symlink to the store, so resolve it. - $storePath = (`$binDir/nix-store --query --resolve '$storePath'` - or die "cannot resolve `$storePath'"); - chomp $storePath; - print TOPLEVEL $storePath, "\n"; - - # Get the closure of this path. - my $pid = open(READ, - "$binDir/nix-store --query --requisites '$storePath'|") or die; - - while () { - chomp; - die "bad: $_" unless /^\//; - $storePaths{$_} = ""; - } - - close READ or die "nix-store failed: $?"; -} - - -close TOPLEVEL or die; - - -foreach my $storePath (sort(keys %storePaths)) { - print STDERR "packing `$storePath'...\n"; - - $storePath =~ /\/([^\/]+)$/; - my $name = $1; - - system("$binDir/nix-store --dump '$storePath' > $tmpDir/contents/$name") == 0 - or die "nix-store --dump failed on `$storePath': $?"; - - system("$binDir/nix-store --query --references '$storePath' > $tmpDir/references/$name") == 0 - or die "nix-store --query --references failed on `$storePath': $?"; - - system("$binDir/nix-store --query --deriver '$storePath' > $tmpDir/derivers/$name") == 0 - or die "nix-store --query --deriver failed on `$storePath': $?"; -} - - -# Write a NAR archive of everything to standard output. -system("nix-store --dump '$tmpDir'") == 0 - or die "nix-store --dump failed"; diff --git a/scripts/nix-unpack-closure.in b/scripts/nix-unpack-closure.in deleted file mode 100644 index 2b60bb485..000000000 --- a/scripts/nix-unpack-closure.in +++ /dev/null @@ -1,88 +0,0 @@ -#! @perl@ -w - -# This tool unpacks the closures created by "nix-pack-closure" and -# adds them to the Nix store. - -# TODO: make this program "streamy", i.e., don't use a temporary -# directory. - -use strict; -use File::Temp qw(tempdir); - -my $binDir = $ENV{"NIX_BIN_DIR"}; -$binDir = "@bindir@" unless defined $binDir; - -my $tmpDir = tempdir("nix-unpack-closure.XXXXXX", CLEANUP => 1, TMPDIR => 1) - or die "cannot create a temporary directory"; - - -# Unpack the NAR archive on standard input. -system("nix-store --restore '$tmpDir/unpacked'") == 0 - or die "nix-store --restore failed"; - - -open VALID, ">$tmpDir/validity" or die; - - -# For each path in the closure that is not yet valid, add it to the -# store. TODO: use proper locking. Or even better, let nix-store do -# this. -opendir(DIR, "$tmpDir/unpacked/contents") or die "cannot open directory: $!"; - -foreach my $name (sort(readdir DIR)) { - next if $name eq "." or $name eq ".."; - - my $storePath = "@storedir@/$name"; # !!! - - # !!! this really isn't a good validity check! - system "$binDir/nix-store --check-validity '$storePath' 2> /dev/null"; - if ($? != 0) { - print STDERR "unpacking `$storePath'...\n"; - - # !!! race - system("@coreutils@/rm -rf '$storePath'") == 0 - or die "cannot remove `$storePath': $?"; - - system("$binDir/nix-store --restore '$storePath' < '$tmpDir/unpacked/contents/$name'") == 0 - or die "nix-store --dump failed on `$storePath': $?"; - - print VALID "$storePath\n"; - - open DRV, "<$tmpDir/unpacked/derivers/$name" or die; - my $deriver = ; - chomp $deriver; - $deriver = "" if $deriver eq "unknown-deriver"; - close DRV; - - my @refs; - open REFS, "<$tmpDir/unpacked/references/$name" or die; - while () { - chomp; - push @refs, $_; - } - close REFS; - - print VALID "$deriver\n"; - - print VALID (scalar @refs), "\n"; - foreach my $ref (@refs) { - print VALID "$ref\n"; - } - } -} - -closedir(DIR) or die; - - -# Register the invalid paths as valid. -system("nix-store --register-validity <'$tmpDir/validity'") == 0 - or die "nix-store --register-validity failed"; - - -# Show the top-level paths so that something useful can be done with -# them, e.g., passing them to `nix-env -i'. -if (-e "$tmpDir/unpacked/top-level") { - open TOPLEVEL, "<$tmpDir/unpacked/top-level" or die; - while () { print "$_"; } - close TOPLEVEL; -}