From fd463ff403f039a518d84cb1f2e97bdf10526500 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Jan 2018 14:27:58 +0100 Subject: [PATCH] Remove nix-install-package support 'nix-install-package' no longer exists in Nix 1.12. Closes #268. --- src/lib/Hydra/Base/Controller/NixChannel.pm | 21 ---------------- src/lib/Hydra/Controller/Build.pm | 2 ++ src/lib/Hydra/View/NixPkg.pm | 27 --------------------- src/root/channel-contents.tt | 8 +----- src/root/product-list.tt | 24 +++++------------- 5 files changed, 9 insertions(+), 73 deletions(-) delete mode 100644 src/lib/Hydra/View/NixPkg.pm diff --git a/src/lib/Hydra/Base/Controller/NixChannel.pm b/src/lib/Hydra/Base/Controller/NixChannel.pm index fd172833..a598144f 100644 --- a/src/lib/Hydra/Base/Controller/NixChannel.pm +++ b/src/lib/Hydra/Base/Controller/NixChannel.pm @@ -78,27 +78,6 @@ sub manifest : Chained('nix') PathPart("MANIFEST") Args(0) { } -sub pkg : Chained('nix') PathPart Args(1) { - my ($self, $c, $pkgName) = @_; - - if (!$c->stash->{build}) { - $pkgName =~ /-(\d+)\.nixpkg$/ or notFound($c, "Bad package name."); - # FIXME: need to handle multiple outputs: channelBuilds is - # joined with the build outputs, so find() can return multiple - # results. - $c->stash->{build} = $c->stash->{channelBuilds}->find({ id => $1 }) - || notFound($c, "No such package in this channel."); - } - - gone($c, "Build " . $c->stash->{build}->id . " is no longer available.") - if isLocalStore() && any { !isValidPath($_->path) } $c->stash->{build}->buildoutputs->all; - - $c->stash->{current_view} = 'NixPkg'; - - $c->response->content_type('application/nix-package'); -} - - sub nixexprs : Chained('nix') PathPart('nixexprs.tar.bz2') Args(0) { my ($self, $c) = @_; requireLocalStore($c); diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 8ad866f2..282fb536 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -121,6 +121,8 @@ sub build_GET { $c->stash->{constituents} = [$build->constituents_->search({}, {order_by => ["job"]})]; $c->stash->{steps} = [$build->buildsteps->search({}, {order_by => "stepnr desc"})]; + + $c->stash->{binaryCachePublicUri} = $c->config->{binary_cache_public_uri}; } diff --git a/src/lib/Hydra/View/NixPkg.pm b/src/lib/Hydra/View/NixPkg.pm deleted file mode 100644 index 857f2f26..00000000 --- a/src/lib/Hydra/View/NixPkg.pm +++ /dev/null @@ -1,27 +0,0 @@ -package Hydra::View::NixPkg; - -use strict; -use base qw/Catalyst::View/; -use Hydra::Helper::CatalystUtils; - -sub process { - my ($self, $c) = @_; - - $c->response->content_type('application/nix-package'); - - my $build = $c->stash->{build}; - - my $channelUri = $c->config->{binary_cache_public_uri} // $c->uri_for('/'); - - # FIXME: add multiple output support - my $s = "NIXPKG1 http://invalid.org/" - . " " . $build->nixname . " " . $build->system - . " " . $build->drvpath . " " . $build->buildoutputs->find({name => "out"})->path - . " " . $channelUri; - - $c->response->body($s); - - return 1; -} - -1; diff --git a/src/root/channel-contents.tt b/src/root/channel-contents.tt index 4335b328..eb0d9460 100644 --- a/src/root/channel-contents.tt +++ b/src/root/channel-contents.tt @@ -24,11 +24,6 @@ $ nix-env -u '*' [% IF genericChannel %] -

Alternatively, if you have associated the -application/nix-package MIME type with the -nix-install-package program in your web browser, you can -install the package simply by clicking on the packages below.

-

Packages

This channel contains the following packages.

@@ -49,11 +44,10 @@ install the package simply by clicking on the packages below.

[% FOREACH pkg IN nixPkgs %] [% b = pkg.build %] - [% uri = "${curUri}/pkg/${pkg.name}.nixpkg" %] [% b.id %] - [% b.get_column('releasename') || b.nixname %] + [% b.get_column('releasename') || b.nixname %] [% b.system %] [% IF b.homepage %] diff --git a/src/root/product-list.tt b/src/root/product-list.tt index 7ae3e0dd..c02e1975 100644 --- a/src/root/product-list.tt +++ b/src/root/product-list.tt @@ -71,29 +71,17 @@ Source - One-Click install + Nix package - [% uri = c.uri_for('/build' build.id 'nix' 'pkg' "${build.nixname}-${build.system}.nixpkg") %] - - [% build.nixname %] - + [% HTML.escape(build.nixname) %] - [% WRAPPER makePopover title="Help" classes="btn-mini" %] -

If you have Nix installed on your machine, you can - install this package and all its dependencies automatically - by clicking on the link above. This requires that you have - the application/nix-package MIME type associated - with the nix-install-package program in your web - browser. Alternatively, you can install it from the - command-line:

+ [% WRAPPER makePopover title="Help" classes="btn-mini" + %]

Yu can install this package using the Nix package + manager from the command-line:

-
$ nix-install-package --non-interactive --url [% uri %]
- -

If you get an error message “Permission denied”, you - should make sure that you have sufficient access rights to - the Nix store, e.g., run the command as root.

+
$ nix-env -i [%HTML.escape(product.path)%][% IF binaryCachePublicUri %] --option binary-caches [% HTML.escape(binaryCachePublicUri) %][% END %]
[% END %] [% IF localStore %] Contents