This commit is contained in:
Eelco Dolstra 2009-02-25 15:39:51 +00:00
parent ed1668704e
commit f89757fbd4
4 changed files with 19 additions and 19 deletions

View file

@ -39,4 +39,20 @@ sub nar : Chained('nix') PathPart {
}
sub pkg : Chained('nix') PathPart Args(1) {
my ($self, $c, $pkgName) = @_;
my $pkg = $c->stash->{nixPkgs}->{$pkgName};
notFound($c, "Unknown Nix package `$pkgName'.")
unless defined $pkg;
$c->stash->{build} = $pkg;
$c->stash->{current_view} = 'Hydra::View::NixPkg';
$c->response->content_type('application/nix-package');
}
1;

View file

@ -124,6 +124,8 @@ sub nix : Chained('build') PathPart('nix') CaptureArgs(0) {
$c->stash->{name} = $build->nixname;
$c->stash->{storePaths} = [$build->outpath];
my $pkgName = $build->nixname . "-" . $build->system . ".nixpkg";
$c->stash->{nixPkgs} = {$pkgName => $build};
}

View file

@ -544,24 +544,6 @@ sub default :Path {
}
sub nixpkg :Local {
my ($self, $c, $buildId) = @_;
my $build = getBuild($c, $buildId);
notFound($c, "Build $buildId doesn't exist.") if !defined $build;
error($c, "Build $buildId cannot be downloaded as a Nix package.")
if !$build->buildproducts->find({type => "nix-build"});
error($c, "Path " . $build->outpath . " is no longer available.") unless isValidPath($build->outpath);
$c->stash->{current_view} = 'Hydra::View::NixPkg';
$c->stash->{build} = $build;
$c->response->content_type('application/nix-package');
}
sub end : ActionClass('RenderView') {
my ($self, $c) = @_;

View file

@ -13,7 +13,7 @@
[% CASE "nix-build" %]
<li class="product">
[% uri = c.uri_for('/nixpkg' build.id) %]
[% uri = c.uri_for('/build' build.id 'nix' 'pkg' "${build.nixname}-${build.system}.nixpkg") %]
<a href="[% uri %]">
<img src="/static/images/nix-build.png" alt="Source" />
One-click install of Nix package <tt>[% build.nixname %]</tt>