hydra/src/lib/Hydra/View/NixDepGraph.pm
Eelco Dolstra c39a693afd * Generate SVG instead of PNG, which is much faster and smaller. I
tried this before but the text didn't fit in the boxes in Firefox.
  The solution is to use Graphviz' svg:cairo backend instead of svg.
  svg:cairo doesn't depend on client-side fonts.
2009-03-31 15:59:31 +00:00

24 lines
444 B
Perl

package Hydra::View::NixDepGraph;
use strict;
use base qw/Catalyst::View/;
use IO::Pipe;
sub process {
my ($self, $c) = @_;
$c->response->content_type('image/svg+xml');
my @storePaths = @{$c->stash->{storePaths}};
my $fh = new IO::Handle;
open $fh, "nix-store --query --graph @storePaths | dot -Tsvg:cairo -Gdpi=100 -Gsize=20,20 -Gbgcolor=transparent |";
$c->response->body($fh);
return 1;
}
1;