forked from lix-project/hydra
8b752627a2
that the pipe gets closed, and the child process dies, if the HTTP connection is prematurely interrupted.
23 lines
387 B
Perl
23 lines
387 B
Perl
package Hydra::View::NixNAR;
|
|
|
|
use strict;
|
|
use base qw/Catalyst::View/;
|
|
|
|
sub process {
|
|
my ($self, $c) = @_;
|
|
|
|
my $storePath = $c->stash->{storePath};
|
|
|
|
$c->response->content_type('application/x-nix-archive'); # !!! check MIME type
|
|
|
|
my $fh = new IO::Handle;
|
|
|
|
open $fh, "nix-store --dump '$storePath' | bzip2 |";
|
|
|
|
$c->response->body($fh);
|
|
|
|
return 1;
|
|
}
|
|
|
|
1;
|