summaryrefslogtreecommitdiffstats
path: root/latex.nix
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2021-11-04 10:45:06 +0100
committerMinijackson <minijackson@riseup.net>2021-11-04 10:45:06 +0100
commita777982b17ca555cb2a33e5828f8dc9cca302430 (patch)
tree7af0bdc41ec7eb19bed9c87b3886fd67060063d0 /latex.nix
parent1649317cb21c7fd30a5147cffdd1b24a6cef258a (diff)
downloadpandoc-nix-templates-a777982b17ca555cb2a33e5828f8dc9cca302430.tar.gz
pandoc-nix-templates-a777982b17ca555cb2a33e5828f8dc9cca302430.zip
factorize build instructions
Diffstat (limited to 'latex.nix')
-rw-r--r--latex.nix73
1 files changed, 73 insertions, 0 deletions
diff --git a/latex.nix b/latex.nix
new file mode 100644
index 0000000..7c0de49
--- /dev/null
+++ b/latex.nix
@@ -0,0 +1,73 @@
1{ runCommand
2, makeFontsConf
3, fira
4, fira-code
5, freefont_ttf
6, lmodern
7, pandoc
8, pandoc-lua-filters
9, pandoc-templates
10, pygments
11, texlive
12, which
13, documentType ? "latex"
14}:
15
16{ name, src }:
17
18runCommand name
19{
20 inherit src;
21
22 nativeBuildInputs = [
23 pandoc
24 pygments
25 fira-code
26 which
27 (texlive.combine {
28 inherit (texlive)
29 scheme-medium
30 latexmk
31
32 beamertheme-metropolis
33 beamercolorthemeowl
34
35 # For framed code listings
36 tcolorbox environ
37
38 # Optional pandoc dependencies
39 microtype upquote parskip xurl bookmark footnotehyper
40
41 # Some dependencies
42 fvextra pgfopts minted catchfile xstring framed;
43 })
44 ];
45
46 FONTCONFIG_FILE = makeFontsConf {
47 fontDirectories = [ lmodern freefont_ttf fira fira-code ];
48 };
49} ''
50 unpackFile $src
51 cd */
52 chmod -R u+w .
53
54 pandoc ${name}.md -t ${documentType} -so document.tex \
55 --template=${pandoc-templates}/default.latex \
56 --lua-filter=${pandoc-lua-filters}/share/pandoc/filters/minted.lua \
57 --pdf-engine=xelatex \
58 --pdf-engine-opt=-aux-directory=./build \
59 --pdf-engine-opt=-shell-escape
60
61 latexmk \
62 -shell-escape \
63 -xelatex \
64 -8bit \
65 -interaction=nonstopmode \
66 -verbose \
67 -file-line-error \
68 -output-directory=./build document.tex
69
70 cp build/document.pdf $out
71''
72
73# TODO: diagram-generator?