From 496934a99ce509ac94a99a938d7d79d1b38461ef Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 24 Nov 2003 09:25:08 +0000 Subject: [PATCH] * Fix nix-pull. --- scripts/nix-pull.in | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index 4cb6409d7..ad21b6f8a 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -18,7 +18,6 @@ my @subs; my @sucs; my $fullexpr = "["; -my $first = 1; open CONFFILE, "<$conffile"; @@ -63,20 +62,15 @@ while () { my $fullurl = "$url/$narname"; print "$storepath\n"; - # Construct a Fix expression that fetches and unpacks a + # Construct a Nix expression that fetches and unpacks a # Nix archive from the network. my $fetch = - "App(IncludeFix(\"fetchurl/fetchurl.fix\"), " . - "[(\"url\", \"$fullurl\"), (\"md5\", \"$hash\")])"; - my $fixexpr = - "App(IncludeFix(\"nar/unnar.fix\"), " . - "[ (\"nar\", $fetch)" . - ", (\"outPath\", \"$storepath\")" . - "])"; - - if (!$first) { $fullexpr .= "," }; - $first = 0; - $fullexpr .= $fixexpr; # !!! O(n^2)? + "(import @datadir@/nix/corepkgs/fetchurl) " . + "{url = $fullurl; md5 = \"$hash\"; system = \"@host@\"}"; + my $nixexpr = + "((import @datadir@/nix/corepkgs/nar/unnar.nix) " . + "{narFile = ($fetch); outPath = \"$storepath\"; system = \"@host@\"}) "; + $fullexpr .= $nixexpr; # !!! O(n^2)? push @srcpaths, $storepath; @@ -110,9 +104,9 @@ while () { $fullexpr .= "]"; -# Instantiate Nix expressions from the Fix expressions we created above. -print STDERR "running fix...\n"; -my $pid = open2(\*READ, \*WRITE, "fix -") or die "cannot run fix"; +# Instantiate store expressions from the Nix expressions we created above. +print STDERR "instantiating Nix expression...\n"; +my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate"; print WRITE $fullexpr; close WRITE; @@ -128,16 +122,16 @@ while () { } waitpid $pid, 0; -$? == 0 or die "fix failed"; +$? == 0 or die "nix-instantiate failed"; # Register all substitutes. print STDERR "registering substitutes...\n"; -system "nix --substitute @subs"; -if ($?) { die "`nix --substitute' failed"; } +system "nix-store --substitute @subs"; +if ($?) { die "`nix-store --substitute' failed"; } # Register all successors. print STDERR "registering successors...\n"; -system "nix --successor @sucs"; -if ($?) { die "`nix --successor' failed"; } +system "nix-store --successor @sucs"; +if ($?) { die "`nix-store --successor' failed"; }