2020-10-19 11:52:47 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
, fig
|
|
|
|
, writeText
|
|
|
|
, busybox
|
|
|
|
, jq
|
|
|
|
, texlive
|
2020-11-11 19:03:02 +01:00
|
|
|
, sedReport
|
2020-10-19 11:52:47 +02:00
|
|
|
}:
|
|
|
|
let
|
2020-10-27 10:49:27 +01: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 11:52:47 +02:00
|
|
|
figJSON = writeText "fig.json" (builtins.toJSON fig);
|
2020-11-11 19:03:02 +01:00
|
|
|
sedCmd = (import sedReport) fig;
|
2020-10-19 11:52:47 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "report";
|
|
|
|
src = ./.;
|
|
|
|
buildInputs = [ jq texlive.combined.scheme-basic ];
|
|
|
|
buildPhase = ''
|
2020-11-11 19:03:02 +01:00
|
|
|
${sedCmd}
|
|
|
|
cat report.tex
|
2020-10-19 11:52:47 +02:00
|
|
|
pdflatex report.tex -o report.pdf
|
2020-10-19 12:10:11 +02:00
|
|
|
# Run again to fix figure references
|
2020-10-19 11:52:47 +02:00
|
|
|
pdflatex report.tex -o report.pdf
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp report.* $out
|
|
|
|
'';
|
|
|
|
}
|