This commit is contained in:
parent
ed1668704e
commit
f89757fbd4
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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) = @_;
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue