about summary refs log tree commit diff
path: root/scripts/nix-prefetch-url.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-22T18·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-22T18·45+0000
commitab0bc4999a49efbc8e1c25989662a96e32fa0cc5 (patch)
tree3864cf300fccb46a97decd2d00b8176c047a87d0 /scripts/nix-prefetch-url.in
parent40d9eb14dfb842c51e9f86818b43ae7711e1a5d6 (diff)
* Maintain integrity of the substitute and successor mappings when
  deleting a path in the store.
* Allow absolute paths in Nix expressions.
* Get nix-prefetch-url to work again.
* Various other fixes.

Diffstat (limited to 'scripts/nix-prefetch-url.in')
-rw-r--r--scripts/nix-prefetch-url.in28
1 files changed, 15 insertions, 13 deletions
diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in
index 332290d40ac8..0873f5a8d7cb 100644
--- a/scripts/nix-prefetch-url.in
+++ b/scripts/nix-prefetch-url.in
@@ -22,27 +22,29 @@ print "file has hash $hash\n";
 my $out2 = "@prefix@/store/nix-prefetch-url-$hash";
 rename $out, $out2;
 
-# Create a Fix expression.
-my $fixexpr = 
-    "App(IncludeFix(\"fetchurl/fetchurl.fix\"), " .
-    "[(\"url\", \"$url\"), (\"md5\", \"$hash\")])";
+# Create a Nix expression.
+my $nixexpr =
+    "(import @datadir@/nix/corepkgs/fetchurl) " .
+    "{url = $url; md5 = \"$hash\"; system = \"@host@\"}";
+
+print "expr: $nixexpr\n";
 
 # Instantiate a Nix expression.
-print STDERR "running fix...\n";
-my $pid = open2(\*READ, \*WRITE, "fix -") or die "cannot run fix";
+print STDERR "instantiating Nix expression...\n";
+my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate";
 
-print WRITE $fixexpr;
+print WRITE $nixexpr;
 close WRITE;
 
-my $id = <READ>;
-chomp $id;
+my $drvpath = <READ>;
+chomp $drvpath;
 
 waitpid $pid, 0;
-$? == 0 or die "fix failed";
+$? == 0 or die "nix-instantiate failed";
 
 # Run Nix.
-print STDERR "running nix...\n";
-system "nix --install $id > /dev/null";
-$? == 0 or die "`nix --install' failed";
+print STDERR "realising store expression $drvpath...\n";
+system "nix-store --realise $drvpath > /dev/null";
+$? == 0 or die "realisation failed";
 
 unlink $out2;