diff options
author | Shea Levy <shea@shealevy.com> | 2016-08-10 08:20:51 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2016-08-10 08:20:51 -0400 |
commit | 15c035c13f3c452ffef3960e97bd0e9b38d98ec2 (patch) | |
tree | 8a7909bcee714533db1bac4d5f596ff0301e3014 /scripts | |
parent | c8608c488c10789d381b784cf69bb81e2e2b088d (diff) |
Remove nix-install-package.
Refs #831
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/local.mk | 1 | ||||
-rwxr-xr-x | scripts/nix-install-package.in | 127 |
2 files changed, 0 insertions, 128 deletions
diff --git a/scripts/local.mk b/scripts/local.mk index edaf44cc4..46b3fe3cf 100644 --- a/scripts/local.mk +++ b/scripts/local.mk @@ -2,7 +2,6 @@ nix_bin_scripts := \ $(d)/nix-build \ $(d)/nix-channel \ $(d)/nix-copy-closure \ - $(d)/nix-install-package \ $(d)/nix-push bin-scripts += $(nix_bin_scripts) diff --git a/scripts/nix-install-package.in b/scripts/nix-install-package.in deleted file mode 100755 index ba349774a..000000000 --- a/scripts/nix-install-package.in +++ /dev/null @@ -1,127 +0,0 @@ -#! @perl@ -w @perlFlags@ - -use utf8; -use strict; -use Nix::Config; -use Nix::Utils; - -binmode STDERR, ":encoding(utf8)"; - - -# Parse the command line arguments. -my @args = @ARGV; - -my $source; -my $fromURL = 0; -my @extraNixEnvArgs = (); -my $interactive = 1; -my $op = "--install"; - -while (scalar @args) { - my $arg = shift @args; - if ($arg eq "--help") { - exec "man nix-install-package" or die; - } - elsif ($arg eq "--url") { - $fromURL = 1; - } - elsif ($arg eq "--profile" || $arg eq "-p") { - my $profile = shift @args; - die "$0: ‘--profile’ requires an argument\n" if !defined $profile; - push @extraNixEnvArgs, "-p", $profile; - } - elsif ($arg eq "--set") { - $op = "--set"; - } - elsif ($arg eq "--non-interactive") { - $interactive = 0; - } - else { - $source = $arg; - } -} - -die "$0: please specify a .nixpkg file or URL\n" unless defined $source; - - -# Re-execute in a terminal, if necessary, so that if we're executed -# from a web browser, the user gets to see us. -if ($interactive && !defined $ENV{"NIX_HAVE_TERMINAL"}) { - $ENV{"NIX_HAVE_TERMINAL"} = "1"; - $ENV{"LD_LIBRARY_PATH"} = ""; - foreach my $term ("xterm", "konsole", "gnome-terminal", "xterm") { - exec($term, "-e", "$Nix::Config::binDir/nix-install-package", @ARGV); - } - die "cannot execute ‘xterm’"; -} - - -my $tmpDir = mkTempDir("nix-install-package"); - - -sub barf { - my $msg = shift; - print "\nInstallation failed: $msg\n"; - <STDIN> if $interactive; - exit 1; -} - - -# Download the package description, if necessary. -my $pkgFile = $source; -if ($fromURL) { - $pkgFile = "$tmpDir/tmp.nixpkg"; - system("@curl@", "-L", "--silent", $source, "-o", $pkgFile) == 0 - or barf "curl failed: $?"; -} - - -# Read and parse the package file. -open PKGFILE, "<$pkgFile" or barf "cannot open ‘$pkgFile’: $!"; -my $contents = <PKGFILE>; -close PKGFILE; - -my $nameRE = "(?: [A-Za-z0-9\+\-\.\_\?\=]+ )"; # see checkStoreName() -my $systemRE = "(?: [A-Za-z0-9\+\-\_]+ )"; -my $pathRE = "(?: \/ [\/A-Za-z0-9\+\-\.\_\?\=]* )"; - -# Note: $pathRE doesn't check that whether we're looking at a valid -# store path. We'll let nix-env do that. - -$contents =~ - / ^ \s* (\S+) \s+ (\S+) \s+ ($nameRE) \s+ ($systemRE) \s+ ($pathRE) \s+ ($pathRE) ( \s+ ($Nix::Utils::urlRE) )? /x - or barf "invalid package contents"; -my $version = $1; -my $manifestURL = $2; -my $drvName = $3; -my $system = $4; -my $drvPath = $5; -my $outPath = $6; -my $binaryCacheURL = $8; - -barf "invalid package version ‘$version’" unless $version eq "NIXPKG1"; - - -if ($interactive) { - # Ask confirmation. - print "Do you want to install ‘$drvName’ (Y/N)? "; - my $reply = <STDIN>; - chomp $reply; - exit if $reply ne "y" && $reply ne "Y"; -} - - -die "$0: package does not supply a binary cache\n" unless defined $binaryCacheURL; - -push @extraNixEnvArgs, "--option", "extra-binary-caches", $binaryCacheURL; - - -print "\nInstalling package...\n"; -system("$Nix::Config::binDir/nix-env", $op, $outPath, "--force-name", $drvName, @extraNixEnvArgs) == 0 - or barf "nix-env failed: $?"; - - -if ($interactive) { - print "\nInstallation succeeded! Press Enter to continue.\n"; - <STDIN>; -} |