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

25 lines
417 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;
2021-08-19 16:36:43 -04:00
use warnings;
2008-11-18 14:48:40 +00:00
use base qw/Catalyst::View/;
use IO::Pipe;
sub process {
2009-02-25 14:34:29 +00:00
my ($self, $c) = @_;
2013-01-22 14:41:02 +01:00
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
my $fh = IO::Handle->new();
2013-01-22 14:41:02 +01:00
open($fh, "-|", "nix-store --export `nix-store -qR @storePaths` | gzip");
2008-11-18 14:48:40 +00:00
$c->response->body($fh);
2013-01-22 14:41:02 +01:00
2008-11-18 14:48:40 +00:00
return 1;
}
1;