report: build only required figures

Introduces a intermediate derivation that can be imported into the
report derivation, which contains a string cmd that expands the fig
variable as needed.
This commit is contained in:
2020-11-11 19:03:02 +01:00
parent 9a7e59a076
commit 5333058741
4 changed files with 28 additions and 5 deletions

19
garlic/sedReport.nix Normal file
View File

@@ -0,0 +1,19 @@
{
stdenv
, fig
}:
stdenv.mkDerivation {
name = "report";
src = ./.;
buildPhase = ''
grep -o '@[^ @]*@' report.tex | sed 's/@//g' | sort -u > list
echo "fig:" > fun.nix
echo "'''" >> fun.nix
sed 's:\(^.*\)$:sed -i "s;@\1@;''${\1};g" report.tex:g' list >> fun.nix
echo "'''" >> fun.nix
'';
installPhase = ''
cp fun.nix $out
'';
}