#! @perl@ -w my $binDir = $ENV{"NIX_BIN_DIR"}; $binDir = "@bindir@" unless defined $binDir; if (scalar @ARGV < 1) { print STDERR <) { chomp; die "bad: $_" unless /^\//; if (!defined $storePathsSeen{$_}) { push @storePaths, $_; $storePathsSeen{$_} = 1; } } close READ or die "nix-store failed: $?"; } # Ask the remote host which paths are invalid. open(READ, "ssh @sshOpts $sshHost sh --login -c '\"nix-store --check-validity --print-invalid @storePaths\"'|"); my @missing = (); while () { chomp; print STDERR "target needs $_\n"; push @missing, $_; } close READ or die; # Export the store paths and import them on the remote machine. if (scalar @missing > 0) { my $extraOpts = ""; $extraOpts .= "--sign" if $sign == 1; system("nix-store --export $extraOpts @missing | $compressor | ssh @sshOpts $sshHost sh --login -c '\"$decompressor | nix-store --import\"'") == 0 or die "copying store paths to remote machine failed: $?"; }