diff --git a/src/lib/Hydra/Base/Controller/NixChannel.pm b/src/lib/Hydra/Base/Controller/NixChannel.pm index 6a73bdb3..fd172833 100644 --- a/src/lib/Hydra/Base/Controller/NixChannel.pm +++ b/src/lib/Hydra/Base/Controller/NixChannel.pm @@ -3,7 +3,7 @@ package Hydra::Base::Controller::NixChannel; use strict; use warnings; use base 'Hydra::Base::Controller::REST'; -use List::MoreUtils qw(all); +use List::MoreUtils qw(any); use Nix::Store; use Hydra::Helper::Nix; use Hydra::Helper::CatalystUtils; @@ -90,10 +90,8 @@ sub pkg : Chained('nix') PathPart Args(1) { || notFound($c, "No such package in this channel."); } - requireLocalStore($c); - gone($c, "Build " . $c->stash->{build}->id . " is no longer available.") - unless all { isValidPath($_->path) } $c->stash->{build}->buildoutputs->all; + if isLocalStore() && any { !isValidPath($_->path) } $c->stash->{build}->buildoutputs->all; $c->stash->{current_view} = 'NixPkg'; diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 0dc01b65..08f864a6 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -432,9 +432,11 @@ sub nix : Chained('buildChain') PathPart('nix') CaptureArgs(0) { notFound($c, "Build cannot be downloaded as a closure or Nix package.") if $build->buildproducts->search({type => "nix-build"})->count == 0; - foreach my $out ($build->buildoutputs) { - notFound($c, "Path " . $out->path . " is no longer available.") - unless isValidPath($out->path); + if (isLocalStore) { + foreach my $out ($build->buildoutputs) { + notFound($c, "Path " . $out->path . " is no longer available.") + unless isValidPath($out->path); + } } $c->stash->{channelBuilds} = $c->model('DB::Builds')->search( diff --git a/src/lib/Hydra/View/NixPkg.pm b/src/lib/Hydra/View/NixPkg.pm index b8a46571..857f2f26 100644 --- a/src/lib/Hydra/View/NixPkg.pm +++ b/src/lib/Hydra/View/NixPkg.pm @@ -11,9 +11,7 @@ sub process { my $build = $c->stash->{build}; - requireLocalStore($c); - - my $channelUri = $c->uri_for('/'); + my $channelUri = $c->config->{binary_cache_public_uri} // $c->uri_for('/'); # FIXME: add multiple output support my $s = "NIXPKG1 http://invalid.org/"