diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-24T11·11+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-24T11·11+0000 |
commit | e7ea52d3b336e6336c801eb8f868c0b8dd464910 (patch) | |
tree | dd7bad3d993dac097e729e6922c777e599d932e4 /scripts/nix-install-package.in | |
parent | b8572678930568efcf0b44523e6a2a65afef7c43 (diff) |
* One-click installation :-)
The script nix-install-package takes a `Nix package file' (which contains one or more derivations, along with URLs of Nix caches), unpacks it, pulls the caches, and installs the derivations in the user's environment. For best results, associate the command `xterm -e /nix/bin/nix-install-package' with the MIME type `application/x-nix-package' and visit http://losser.st-lab.cs.uu.nl/~eelco/test/.
Diffstat (limited to 'scripts/nix-install-package.in')
-rw-r--r-- | scripts/nix-install-package.in | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/nix-install-package.in b/scripts/nix-install-package.in new file mode 100644 index 000000000000..4988606c3a20 --- /dev/null +++ b/scripts/nix-install-package.in @@ -0,0 +1,37 @@ +#! /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 -qsf $tmpdir/default.nix"; +die if $?; + +print "do you wish to install them (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 -i $tmpdir/default.nix '*'"; +die if $?; + +print "installing succeeded! (enter to continue)\n"; +<STDIN>; |