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

25 lines
452 B
Perl
Raw Normal View History

2008-11-25 11:01:42 +00:00
package Hydra::View::NixClosure;
2008-11-18 14:48:40 +00:00
use strict;
use base qw/Catalyst::View/;
use IO::Pipe;
sub process {
2009-02-25 14:34:29 +00:00
my ($self, $c) = @_;
2008-11-18 14:48:40 +00:00
$c->response->content_type('application/x-nix-export');
2009-02-25 14:34:29 +00:00
my @storePaths = @{$c->stash->{storePaths}};
2008-11-18 14:48:40 +00:00
2009-02-25 14:34:29 +00:00
open(OUTPUT, "nix-store --export `nix-store -qR @storePaths` | gzip |");
2008-11-18 14:48:40 +00:00
my $fh = new IO::Handle;
$fh->fdopen(fileno(OUTPUT), "r") or die;
$c->response->body($fh);
return 1;
}
1;