files. Target location is no longer hard-coded; it accepts a number of URLs on the command line. * `nix-install-package': compatibility fixes.
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			785 B
		
	
	
	
		
			Perl
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			785 B
		
	
	
	
		
			Perl
		
	
	
	
	
	
| #! /usr/bin/perl -w
 | |
| 
 | |
| use strict;
 | |
| use POSIX qw(tmpnam);
 | |
| 
 | |
| my $pkgfile = $ARGV[0];
 | |
| die unless defined $pkgfile;
 | |
| 
 | |
| my $tmpdir;
 | |
| do { $tmpdir = tmpnam(); }
 | |
| until mkdir $tmpdir, 0777;
 | |
| 
 | |
| # !!! remove tmpdir on exit
 | |
| 
 | |
| print "Unpacking $pkgfile in $tmpdir...\n";
 | |
| system "bunzip2 < $pkgfile | (cd $tmpdir && tar xf -)";
 | |
| die if $?;
 | |
| 
 | |
| print "This package contains the following derivations:\n";
 | |
| system "nix-env -qasf $tmpdir/default.nix";
 | |
| die if $?;
 | |
| 
 | |
| print "Do you wish to install these (Y/N)? ";
 | |
| my $reply = <STDIN>;
 | |
| chomp $reply;
 | |
| exit if (!($reply eq "y"));
 | |
| 
 | |
| print "Pulling caches...\n";
 | |
| system "nix-pull `cat $tmpdir/caches`";
 | |
| die if $?;
 | |
| 
 | |
| print "Installing package...\n";
 | |
| system "nix-env -if $tmpdir/default.nix '*'";
 | |
| die if $?;
 | |
| 
 | |
| print "Installation succeeded! Press Enter to continue.\n";
 | |
| <STDIN>;
 |