diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-08-10T12·33+0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-10T12·33+0200 |
commit | fe94b72acc40c00f9a2a6ad78a28e62edd63d75c (patch) | |
tree | 8a7909bcee714533db1bac4d5f596ff0301e3014 | |
parent | c8608c488c10789d381b784cf69bb81e2e2b088d (diff) | |
parent | 15c035c13f3c452ffef3960e97bd0e9b38d98ec2 (diff) |
Merge pull request #1021 from shlevy/remove-nix-install-package
Remove nix-install-package.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | doc/manual/command-ref/nix-install-package.xml | 208 | ||||
-rw-r--r-- | doc/manual/command-ref/utilities.xml | 1 | ||||
-rw-r--r-- | doc/manual/introduction/quick-start.xml | 12 | ||||
-rw-r--r-- | doc/manual/local.mk | 2 | ||||
-rw-r--r-- | doc/manual/packages/one-click.xml | 37 | ||||
-rw-r--r-- | doc/manual/packages/package-management.xml | 1 | ||||
-rw-r--r-- | scripts/local.mk | 1 | ||||
-rwxr-xr-x | scripts/nix-install-package.in | 127 | ||||
-rw-r--r-- | tests/install-package.sh | 20 | ||||
-rw-r--r-- | tests/local.mk | 2 |
11 files changed, 2 insertions, 410 deletions
diff --git a/.gitignore b/.gitignore index a524e9b6a29b..245b89f3cbc2 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,6 @@ Makefile.config /scripts/nix-switch /scripts/nix-collect-garbage /scripts/nix-prefetch-url -/scripts/nix-install-package /scripts/nix-channel /scripts/nix-build /scripts/nix-copy-closure diff --git a/doc/manual/command-ref/nix-install-package.xml b/doc/manual/command-ref/nix-install-package.xml deleted file mode 100644 index e17166caaaf3..000000000000 --- a/doc/manual/command-ref/nix-install-package.xml +++ /dev/null @@ -1,208 +0,0 @@ -<refentry xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - version="5.0" - xml:id="sec-nix-install-package"> - -<refmeta> - <refentrytitle>nix-install-package</refentrytitle> - <manvolnum>1</manvolnum> - <refmiscinfo class="source">Nix</refmiscinfo> - <refmiscinfo class="version"><xi:include href="../version.txt" parse="text"/></refmiscinfo> -</refmeta> - -<refnamediv> - <refname>nix-install-package</refname> - <refpurpose>install a Nix Package file</refpurpose> -</refnamediv> - -<refsynopsisdiv> - <cmdsynopsis> - <command>nix-install-package</command> - <arg><option>--non-interactive</option></arg> - <arg> - <group choice='req'> - <arg choice='plain'><option>--profile</option></arg> - <arg choice='plain'><option>-p</option></arg> - </group> - <replaceable>path</replaceable> - </arg> - <arg><option>--set</option></arg> - <sbr /> - <group choice='req'> - <arg choice='req'> - <option>--url</option> - <arg choice='plain'><replaceable>url</replaceable></arg> - </arg> - <arg choice='req'> - <arg choice='plain'><replaceable>file</replaceable></arg> - </arg> - </group> - </cmdsynopsis> -</refsynopsisdiv> - - -<refsection><title>Description</title> - -<para>The command <command>nix-install-package</command> interactively -installs a Nix Package file (<filename>*.nixpkg</filename>), which is -a small file that contains a store path to be installed along with the -URL of a binary cache. The Nix Package file is either -<replaceable>file</replaceable>, or automatically downloaded from -<replaceable>url</replaceable> if the <option>--url</option> switch is -used.</para> - -<para><command>nix-install-package</command> is used in <link -linkend="sec-one-click">one-click installs</link> to download and -install pre-built binary packages with all necessary dependencies. -<command>nix-install-package</command> is intended to be associated -with the MIME type <literal>application/nix-package</literal> in a web -browser so that it is invoked automatically when you click on -<filename>*.nixpkg</filename> files. When invoked, it restarts itself -in a terminal window (since otherwise it would be invisible when run -from a browser), asks the user to confirm whether to install the -package, and if so downloads and installs the package into the user’s -current profile.</para> - -<para>To obtain a window, <command>nix-install-package</command> tries -to restart itself with <command>xterm</command>, -<command>konsole</command> and -<command>gnome-terminal</command>.</para> - -</refsection> - - -<refsection><title>Options</title> - -<variablelist> - - <varlistentry><term><option>--non-interactive</option></term> - - <listitem><para>Do not open a new terminal window and do not ask - for confirmation.</para></listitem> - - </varlistentry> - - <varlistentry><term><option>--profile</option></term> - <term><option>-p</option></term> - - <listitem><para>Install the package into the specified profile - rather than the user’s current profile.</para></listitem> - - </varlistentry> - - <varlistentry><term><option>--set</option></term> - - <listitem><para>Install the package as the profile so that the - profile contains exactly the contents of the package.</para></listitem> - - </varlistentry> - -</variablelist> - -</refsection> - - -<refsection><title>Examples</title> - -<para>To install <filename>subversion-1.4.0.nixpkg</filename> into the -user’s current profile, without any prompting: - -<screen> -$ nix-install-package --non-interactive subversion-1.4.0.nixpkg</screen> - -</para> - -<para>To install the same package from some URL into a different -profile: - -<screen> -$ nix-install-package --non-interactive -p /nix/var/nix/profiles/eelco \ - --url http://nix.cs.uu.nl/dist/nix/nixpkgs-0.10pre6622/pkgs/subversion-1.4.0-i686-linux.nixpkg</screen> - -</para> - -</refsection> - - -<refsection><title>Format of <literal>nixpkg</literal> files</title> - -<para>A Nix Package file consists of a single line with the following -format: - -<screen> -NIXPKG1 <replaceable>manifestURL</replaceable> <replaceable>name</replaceable> <replaceable>system</replaceable> <replaceable>drvPath</replaceable> <replaceable>outPath</replaceable></screen> - -The elements are as follows: - -<variablelist> - - <varlistentry><term><literal>NIXPKG1</literal></term> - - <listitem><para>The version of the Nix Package - file.</para></listitem> - - </varlistentry> - - <varlistentry><term><replaceable>manifestURL</replaceable></term> - - <listitem><para>Obsolete.</para></listitem> - - </varlistentry> - - <varlistentry><term><replaceable>name</replaceable></term> - - <listitem><para>The symbolic name and version of the - package.</para></listitem> - - </varlistentry> - - <varlistentry><term><replaceable>system</replaceable></term> - - <listitem><para>The platform identifier of the platform for which - this binary package is intended.</para></listitem> - - </varlistentry> - - <varlistentry><term><replaceable>drvPath</replaceable></term> - - <listitem><para>The path in the Nix store of the derivation from - which <replaceable>outPath</replaceable> was built. Not currently - used.</para></listitem> - - </varlistentry> - - <varlistentry><term><replaceable>outPath</replaceable></term> - - <listitem><para>The path in the Nix store of the - package.</para></listitem> - - </varlistentry> - - <varlistentry><term><replaceable>binaryCacheURL</replaceable></term> - - <listitem><para>The URL of a binary cache containing the closure - of <replaceable>outPath</replaceable>.</para></listitem> - - </varlistentry> - -</variablelist> - -</para> - -<para>An example follows: - -<screen> -NIXPKG1 http://.../nixpkgs-0.10pre6622/MANIFEST subversion-1.4.0 i686-darwin \ - /nix/store/4kh60jkp...-subversion-1.4.0.drv \ - /nix/store/nkw7wpgb...-subversion-1.4.0</screen> - -(The line breaks (<literal>\</literal>) are for presentation purposes -and not part of the actual file.) - -</para> - -</refsection> - - -</refentry> diff --git a/doc/manual/command-ref/utilities.xml b/doc/manual/command-ref/utilities.xml index 25e457e4e554..0800b5380d41 100644 --- a/doc/manual/command-ref/utilities.xml +++ b/doc/manual/command-ref/utilities.xml @@ -14,7 +14,6 @@ work with Nix.</para> <xi:include href="nix-copy-closure.xml" /> <xi:include href="nix-daemon.xml" /> <xi:include href="nix-hash.xml" /> -<xi:include href="nix-install-package.xml" /> <xi:include href="nix-instantiate.xml" /> <xi:include href="nix-prefetch-url.xml" /> <xi:include href="nix-push.xml" /> diff --git a/doc/manual/introduction/quick-start.xml b/doc/manual/introduction/quick-start.xml index 0d13651e0ab3..5ae9f6ad543b 100644 --- a/doc/manual/introduction/quick-start.xml +++ b/doc/manual/introduction/quick-start.xml @@ -95,18 +95,6 @@ The latter command will upgrade each installed package for which there is a “newer” version (as determined by comparing the version numbers).</para></step> -<!-- -<step><para>You can also install specific packages directly from -your web browser. For instance, you can go to <link -xlink:href="http://hydra.nixos.org/jobset/nixpkgs/trunk/channel/latest" -/> and click on any link for the individual packages for your -platform. Associate <literal>application/nix-package</literal> with -the program <command>nix-install-package</command>. A window should -appear asking you whether it’s okay to install the package. Say -<literal>Y</literal>. The package and all its dependencies will be -installed.</para></step> ---> - <step><para>If you're unhappy with the result of a <command>nix-env</command> action (e.g., an upgraded package turned out not to work properly), you can go back: diff --git a/doc/manual/local.mk b/doc/manual/local.mk index 3c4fc52dfd67..9a1123638ebb 100644 --- a/doc/manual/local.mk +++ b/doc/manual/local.mk @@ -41,7 +41,7 @@ man-pages := $(foreach n, \ nix-env.1 nix-build.1 nix-shell.1 nix-store.1 nix-instantiate.1 \ nix-collect-garbage.1 nix-push.1 \ nix-prefetch-url.1 nix-channel.1 \ - nix-install-package.1 nix-hash.1 nix-copy-closure.1 \ + nix-hash.1 nix-copy-closure.1 \ nix.conf.5 nix-daemon.8, \ $(d)/$(n)) diff --git a/doc/manual/packages/one-click.xml b/doc/manual/packages/one-click.xml deleted file mode 100644 index cef9a2bbff4e..000000000000 --- a/doc/manual/packages/one-click.xml +++ /dev/null @@ -1,37 +0,0 @@ -<chapter xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - version="5.0" - xml:id="sec-one-click"> - -<title>One-Click Installation</title> - -<para>Often, when you want to install a specific package (e.g., from -the <link -xlink:href="http://nixos.org/nixpkgs/">Nix -Packages collection</link>), subscribing to a channel is a bit -cumbersome. And channels don’t help you at all if you want to install -an older version of a package than the one provided by the current -contents of the channel, or a package that has been removed from the -channel. That’s when <emphasis>one-click installs</emphasis> come in -handy: you can just go to the web page that contains the package, -click on it, and it will be installed with all the necessary -dependencies.</para> - -<para>For instance, you can go to <link -xlink:href="http://hydra.nixos.org/jobset/nixpkgs/trunk/channel/latest" -/> and click on any link for the individual packages for your -platform. The first time you do this, your browser will ask what to -do with <literal>application/nix-package</literal> files. You should -open them with <filename>/nix/bin/nix-install-package</filename>. -This will open a window that asks you to confirm that you want to -install the package. When you answer <literal>Y</literal>, the -package and all its dependencies will be installed. This is a binary -deployment mechanism — you get packages pre-compiled for the selected -platform type.</para> - -<para>You can also install <literal>application/nix-package</literal> -files from the command line directly. See <xref -linkend='sec-nix-install-package' /> for details.</para> - -</chapter> \ No newline at end of file diff --git a/doc/manual/packages/package-management.xml b/doc/manual/packages/package-management.xml index 5cc5c381bb43..61e55faeb311 100644 --- a/doc/manual/packages/package-management.xml +++ b/doc/manual/packages/package-management.xml @@ -18,7 +18,6 @@ who want to <emphasis>create</emphasis> packages should consult <xi:include href="profiles.xml" /> <xi:include href="garbage-collection.xml" /> <xi:include href="channels.xml" /> -<xi:include href="one-click.xml" /> <xi:include href="sharing-packages.xml" /> </part> diff --git a/scripts/local.mk b/scripts/local.mk index edaf44cc492d..46b3fe3cf781 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 ba349774af54..000000000000 --- 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>; -} diff --git a/tests/install-package.sh b/tests/install-package.sh deleted file mode 100644 index 1916f72713e2..000000000000 --- a/tests/install-package.sh +++ /dev/null @@ -1,20 +0,0 @@ -source common.sh - -drvPath=$(nix-instantiate ./dependencies.nix) -outPath=$(nix-store -r $drvPath) -nix-push --dest $cacheDir $outPath - -clearStore -clearProfiles - -cat > $TEST_ROOT/foo.nixpkg <<EOF -NIXPKG1 - simple $system $drvPath $outPath file://$cacheDir -EOF - -nix-install-package --non-interactive -p $profiles/test $TEST_ROOT/foo.nixpkg -test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 1 - -clearProfiles - -nix-install-package --non-interactive -p $profiles/test --url file://$TEST_ROOT/foo.nixpkg -test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 1 diff --git a/tests/local.mk b/tests/local.mk index 7c5a553d39e0..3d25327bd590 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -5,7 +5,7 @@ nix_tests = \ init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \ build-hook.sh nix-push.sh gc.sh gc-concurrent.sh \ referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \ - gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \ + gc-runtime.sh check-refs.sh filter-source.sh \ remote-store.sh export.sh export-graph.sh \ timeout.sh secure-drv-outputs.sh nix-channel.sh \ multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \ |