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

26 lines
459 B
Perl
Raw Normal View History

package Hydra::View::NixNAR;
use strict;
use base qw/Catalyst::View/;
use Hydra::Helper::CatalystUtils;
sub process {
my ($self, $c) = @_;
my $storePath = $c->stash->{storePath};
2013-01-22 14:41:02 +01:00
$c->response->content_type('application/x-nix-archive'); # !!! check MIME type
my $fh = new IO::Handle;
2013-01-22 14:41:02 +01:00
open $fh, "nix-store --dump '$storePath' | bzip2 |";
setCacheHeaders($c, 365 * 24 * 60 * 60);
$c->response->body($fh);
return 1;
}
1;