-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
42 lines (36 loc) · 908 Bytes
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ stdenv
, latex
, biber
, ghostscript
, makeFontsCache
# Contents
, thesis-source
, python
, which
}:
with stdenv.lib;
let
filename = "main";
# -shell-escape for `minted` package
XELATEX="xelatex -halt-on-error -shell-escape";
fontsConf = makeFontsCache {
fontDirectories = [
"${ghostscript}/share/ghostscript/fonts"
];
};
pythonEnv = python.withPackages(ps: [ps.pygments]);
# XELATEX="pdflatex";
in stdenv.mkDerivation {
name = "thesis.pdf";
src = thesis-source;
sourceRoot = "${thesis-source.name}/report";
# pythonEnv and which are needed for the `minted` latex package
buildInputs = [ latex biber ghostscript pythonEnv which ];
buildPhase = ''
export FONTCONFIG_FILE=${fontsConf}
${XELATEX} ${filename}.tex && biber ${filename}.bcf && biber ${filename}.bcf && ${XELATEX} ${filename}.tex
'';
installPhase = ''
mv ${filename}.pdf $out
'';
}