Add example report

This commit is contained in:
2020-10-19 11:52:47 +02:00
parent 067fb0c0a2
commit 30ad4219d9
3 changed files with 66 additions and 0 deletions

30
garlic/report.nix Normal file
View File

@@ -0,0 +1,30 @@
{
stdenv
, fig
, exp
, writeText
, busybox
, jq
, texlive
}:
let
figJSON = writeText "fig.json" (builtins.toJSON fig);
expJSON = writeText "exp.json" (builtins.toJSON exp);
in
stdenv.mkDerivation {
name = "report";
src = ./.;
buildInputs = [ jq texlive.combined.scheme-basic ];
buildPhase = ''
ls -l
sed -i -e "s:@fig\.nbody\.test@:$(jq -r .nbody.test ${figJSON}):g" report.tex
jq . ${figJSON}
jq . ${expJSON}
pdflatex report.tex -o report.pdf
pdflatex report.tex -o report.pdf
'';
installPhase = ''
mkdir $out
cp report.* $out
'';
}