diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/nix-collect-garbage.in | 2 | ||||
-rw-r--r-- | scripts/nix-install-package.in | 6 | ||||
-rw-r--r-- | scripts/nix-prefetch-url.in | 18 | ||||
-rw-r--r-- | scripts/nix-pull.in | 6 | ||||
-rw-r--r-- | scripts/nix-push.in | 14 | ||||
-rw-r--r-- | scripts/readmanifest.pm.in | 2 |
6 files changed, 27 insertions, 21 deletions
diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in index c701ad482f00..20c6731a14b5 100755 --- a/scripts/nix-collect-garbage.in +++ b/scripts/nix-collect-garbage.in @@ -34,7 +34,7 @@ foreach my $link (@links) { my $extraarg = ""; if ($keepsuccessors) { $extraarg = "--include-successors"; }; -my $pid = open2(\*READ, \*WRITE, "nix-store --query --requisites $extraarg @roots") +my $pid = open2(\*READ, \*WRITE, "@bindir@/nix-store --query --requisites $extraarg @roots") or die "determining live paths"; close WRITE; while (<READ>) { diff --git a/scripts/nix-install-package.in b/scripts/nix-install-package.in index 73afead7d825..0fcfd4e8f770 100644 --- a/scripts/nix-install-package.in +++ b/scripts/nix-install-package.in @@ -17,7 +17,7 @@ system "bunzip2 < $pkgfile | (cd $tmpdir && tar xf -)"; die if $?; print "This package contains the following derivations:\n"; -system "nix-env -qasf $tmpdir/default.nix"; +system "@bindir@/nix-env -qasf $tmpdir/default.nix"; die if $?; print "Do you wish to install these (Y/N)? "; @@ -26,11 +26,11 @@ chomp $reply; exit if (!($reply eq "y")); print "Pulling caches...\n"; -system "nix-pull `cat $tmpdir/caches`"; +system "@bindir@/nix-pull `cat $tmpdir/caches`"; die if $?; print "Installing package...\n"; -system "nix-env -if $tmpdir/default.nix '*'"; +system "@bindir@/nix-env -if $tmpdir/default.nix '*'"; die if $?; print "Installation succeeded! Press Enter to continue.\n"; diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in index d921e922b589..df6a1c86a5a0 100644 --- a/scripts/nix-prefetch-url.in +++ b/scripts/nix-prefetch-url.in @@ -10,7 +10,7 @@ print "fetching $url...\n"; my $out = "@storedir@/nix-prefetch-url-$$"; -system "@wget@ --passive-ftp '$url' -O '$out'"; +system "@curl@ --fail --location --max-redirs 20 \"$url\" > \"$out\""; $? == 0 or die "unable to fetch $url"; my $hash=`@bindir@/nix-hash --flat $out`; @@ -27,11 +27,12 @@ my $nixexpr = "(import @datadir@/nix/corepkgs/fetchurl) " . "{url = $url; md5 = \"$hash\"; system = \"@system@\";}"; -print "expr: $nixexpr\n"; +#print STDERR "expr: $nixexpr\n"; # Instantiate a Nix expression. -print STDERR "instantiating Nix expression...\n"; -my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate"; +#print STDERR "instantiating Nix expression...\n"; +my $pid = open2(\*READ, \*WRITE, "@bindir@/nix-instantiate -") + or die "cannot run nix-instantiate"; print WRITE $nixexpr; close WRITE; @@ -43,8 +44,13 @@ waitpid $pid, 0; $? == 0 or die "nix-instantiate failed"; # Run Nix. -print STDERR "realising store expression $drvpath...\n"; -system "nix-store --realise $drvpath > /dev/null"; +#print STDERR "realising store expression $drvpath...\n"; +system "@bindir@/nix-store --realise $drvpath > /dev/null"; $? == 0 or die "realisation failed"; +my $path = `@bindir@/nix-store -qn $drvpath`; +$? == 0 or die "query failed"; + +print "path is $path"; + unlink $out2; diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index acb4c0732623..6472c7c64776 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -65,7 +65,7 @@ $fullexpr .= "]"; # Instantiate store expressions from the Nix expressions we created above. print STDERR "instantiating store expressions...\n"; -my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate"; +my $pid = open2(\*READ, \*WRITE, "@bindir@/nix-instantiate -") or die "cannot run nix-instantiate"; print WRITE $fullexpr; close WRITE; @@ -91,7 +91,7 @@ while (scalar @subs > 0) { if ($n > 256) { $n = 256 }; my @subs2 = @subs[0..$n - 1]; @subs = @subs[$n..scalar @subs - 1]; - system "nix-store --substitute @subs2"; + system "@bindir@/nix-store --substitute @subs2"; if ($?) { die "`nix-store --substitute' failed"; } } @@ -104,6 +104,6 @@ while (scalar @sucs > 0) { if ($n > 256) { $n = 256 }; my @sucs2 = @sucs[0..$n - 1]; @sucs = @sucs[$n..scalar @sucs - 1]; - system "nix-store --successor @sucs2"; + system "@bindir@/nix-store --successor @sucs2"; if ($?) { die "`nix-store --successor' failed"; } } diff --git a/scripts/nix-push.in b/scripts/nix-push.in index 167d787b759c..57d89d13ccad 100644 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -12,7 +12,7 @@ my $manifest = "$tmpdir/MANIFEST"; END { unlink $manifest; unlink $nixfile; rmdir $tmpdir; } -my $curl = "curl --fail --silent"; +my $curl = "@curl@ --fail --silent"; # Parse the command line. @@ -30,10 +30,10 @@ foreach my $storeexpr (@ARGV) { # Get all paths referenced by the normalisation of the given # Nix expression. - system "nix-store --realise $storeexpr > /dev/null"; + system "@bindir@/nix-store --realise $storeexpr > /dev/null"; die if ($?); - open PATHS, "nix-store --query --requisites --include-successors $storeexpr 2> /dev/null |" or die; + open PATHS, "@bindir@/nix-store --query --requisites --include-successors $storeexpr 2> /dev/null |" or die; while (<PATHS>) { chomp; die "bad: $_" unless /^\//; @@ -69,7 +69,7 @@ close NIX; # Instantiate store expressions from the Nix expression. my @storeexprs; print STDERR "instantiating store expressions...\n"; -open STOREEXPRS, "nix-instantiate $nixfile |" or die "cannot run nix-instantiate"; +open STOREEXPRS, "@bindir@/nix-instantiate $nixfile |" or die "cannot run nix-instantiate"; while (<STOREEXPRS>) { chomp; die unless /^\//; @@ -90,10 +90,10 @@ while (scalar @tmp > 0) { my @tmp2 = @tmp[0..$n - 1]; @tmp = @tmp[$n..scalar @tmp - 1]; - system "nix-store --realise -B @tmp2 > /dev/null"; + system "@bindir@/nix-store --realise -B @tmp2 > /dev/null"; if ($?) { die "`nix-store --realise' failed"; } - open NARPATHS, "nix-store --query --list @tmp2 |" or die "cannot run nix"; + open NARPATHS, "@bindir@/nix-store --query --list @tmp2 |" or die "cannot run nix"; while (<NARPATHS>) { chomp; die unless (/^\//); @@ -135,7 +135,7 @@ for (my $n = 0; $n < scalar @storepaths; $n++) { print MANIFEST " MD5: $hash\n"; if ($storepath =~ /\.store$/) { - open PREDS, "nix-store --query --predecessors $storepath |" or die "cannot run nix"; + open PREDS, "@bindir@/nix-store --query --predecessors $storepath |" or die "cannot run nix"; while (<PREDS>) { chomp; die unless (/^\//); diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in index 08227a5d7ea5..bca6c4c8acc5 100644 --- a/scripts/readmanifest.pm.in +++ b/scripts/readmanifest.pm.in @@ -10,7 +10,7 @@ sub processURL { $url =~ s/\/$//; print "obtaining list of Nix archives at $url...\n"; - system("curl --fail --silent --show-error " . + system("@curl@ --fail --silent --show-error --location --max-redirs 20 " . "'$url' > '$manifest' 2> /dev/null") == 0 or die "curl failed: $?"; |