about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/nix-pull.in2
-rw-r--r--scripts/nix-push.in25
2 files changed, 12 insertions, 15 deletions
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index a75c1f258b1e..47762e857698 100644
--- a/scripts/nix-pull.in
+++ b/scripts/nix-pull.in
@@ -38,7 +38,7 @@ while (<CONFFILE>) {
             # Nix archive from the network.
             my $fetch =
               "App(IncludeFix(\"fetchurl/fetchurl.fix\"), " .
-              "[(\"url\", \"$url/$fn\"), (\"hash\", \"\")])";
+              "[(\"url\", \"$url/$fn\"), (\"md5\", \"ignore\")])";
             my $fixexpr = 
                 "App(IncludeFix(\"nar/unnar.fix\"), " .
                 "[ (\"nar\", $fetch)" .
diff --git a/scripts/nix-push.in b/scripts/nix-push.in
index bf30f3a49d7f..fdb4323038fc 100644
--- a/scripts/nix-push.in
+++ b/scripts/nix-push.in
@@ -2,14 +2,14 @@
 
 my @pushlist;
 
-foreach my $hash (@ARGV) {
+foreach my $id (@ARGV) {
 
-    die unless $hash =~ /^([0-9a-z]{32})$/;
+    die unless $id =~ /^([0-9a-z]{32})$/;
 
     # Get all paths referenced by the normalisation of the given 
     # fstate expression.
     my @paths;
-    open PATHS, "nix -qrh $hash 2> /dev/null |" or die "nix -qrh";
+    open PATHS, "nix -qrh $id 2> /dev/null |" or die "nix -qrh";
     while (<PATHS>) {
         chomp;
         next unless /^\//;
@@ -21,15 +21,12 @@ foreach my $hash (@ARGV) {
     # a Nix archive.
     foreach my $path (@paths) {
 
-        # Hash the path.
-        my $phash = `nix-hash $path`;
-        $? and die "nix-hash";
-        chomp $phash;
-        die unless $phash =~ /^([0-9a-z]{32})$/;
+	next unless ($path =~ /\/([0-9a-z]{32})[^\/]*/);
+	my $pathid = $1;
 
         # Construct a name for the Nix archive.  If the file is an
         # fstate successor, encode this into the name.
-        my $name = $phash;
+        my $name = $pathid;
         if ($path =~ /-s-([0-9a-z]{32}).nix$/) {
             $name = "$name-s-$1";
         }
@@ -38,7 +35,7 @@ foreach my $hash (@ARGV) {
         # Construct a Fix expression that creates a Nix archive.
         my $fixexpr = 
           "App(IncludeFix(\"nar/nar.fix\"), " .
-          "[ (\"path\", Path(\"$path\", Hash(\"$phash\"), [Include(\"$hash\")]))" .
+          "[ (\"path\", Slice([\"$pathid\"], [(\"$path\", \"$pathid\", [])]))" .
           ", (\"name\", \"$name\")" .
           "])";
 	
@@ -48,13 +45,13 @@ foreach my $hash (@ARGV) {
         close FIX;
 
         # Instantiate a Nix expression from the Fix expression.
-        my $nhash = `fix $fixfile`;
+        my $nid = `fix $fixfile`;
         $? and die "instantiating Nix archive expression";
-        chomp $nhash;
-        die unless $nhash =~ /^([0-9a-z]{32})$/;
+        chomp $nid;
+        die unless $nid =~ /^([0-9a-z]{32})$/;
 
         # Realise the Nix expression.
-        my $npath = `nix -qph $nhash 2> /dev/null`;
+        my $npath = `nix -qph $nid 2> /dev/null`;
         $? and die "creating Nix archive";
         chomp $npath;