bscpkgs/garlic/report.nix

35 lines
760 B
Nix
Raw Normal View History

2020-10-19 17:52:47 +08:00
{
stdenv
, fig
, writeText
, busybox
, jq
, texlive
, sedReport
2020-10-19 17:52:47 +08:00
}:
let
2020-10-27 17:49:27 +08:00
# TODO: We can select only which elements we need from fig by using:
# echo [ $(grep -o '@[^ @]*@' garlic/report.tex | sed 's/@//g') ]
# and them importing as valid nix lang.
# By now, we require all plots
2020-10-19 17:52:47 +08:00
figJSON = writeText "fig.json" (builtins.toJSON fig);
sedCmd = (import sedReport) fig;
2020-10-19 17:52:47 +08:00
in
stdenv.mkDerivation {
name = "report";
src = ./.;
buildInputs = [ jq texlive.combined.scheme-basic ];
buildPhase = ''
${sedCmd}
cat report.tex
2020-10-19 17:52:47 +08:00
pdflatex report.tex -o report.pdf
# Run again to fix figure references
2020-10-19 17:52:47 +08:00
pdflatex report.tex -o report.pdf
'';
installPhase = ''
mkdir $out
cp report.* $out
'';
}