hydra/src/lib/Hydra/View/NixPkg.pm

32 lines
852 B
Perl
Raw Normal View History

2009-02-25 14:33:33 +00:00
package Hydra::View::NixPkg;
use strict;
use base qw/Catalyst::View/;
sub process {
my ($self, $c) = @_;
$c->response->content_type('application/nix-package');
my $build = $c->stash->{build};
2016-03-02 15:35:55 +01:00
my $storeMode = $c->config->{store_mode} // "direct";
my $channelUri =
$storeMode eq "direct" ? $c->uri_for('/')
: $storeMode eq "s3-binary-cache" ?
($c->config->{binary_cache_public_uri} // ("https://" . $c->config->{binary_cache_s3_bucket} . ".s3.amazonaws.com/"))
: die "Not supported.\n";
# FIXME: add multiple output support
2016-03-02 15:24:23 +01:00
my $s = "NIXPKG1 http://invalid.org/"
2009-02-25 14:33:33 +00:00
. " " . $build->nixname . " " . $build->system
. " " . $build->drvpath . " " . $build->buildoutputs->find({name => "out"})->path
2016-03-02 15:35:55 +01:00
. " " . $channelUri;
2013-01-22 14:41:02 +01:00
2009-02-25 14:33:33 +00:00
$c->response->body($s);
return 1;
}
1;