Last active
April 15, 2019 18:45
-
-
Save chris-martin/a1c337c3caa8649c47cf2d6fc059ab2d to your computer and use it in GitHub Desktop.
LaTeX + Nix setup for "Finding Success and Failure in Haskell"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
pkgs = | |
import (import ./nixpkgs.nix) {}; | |
texlive = | |
import ./texlive.nix { inherit (pkgs) texlive; }; | |
fontsForLatex = | |
[ | |
{ name = "google-fonts"; | |
path = "${pkgs.google-fonts}/share/fonts/truetype"; } | |
{ name = "fira-mono"; | |
path = "${pkgs.fira-mono}/share/fonts/opentype"; } | |
]; | |
latexInputs = | |
pkgs.linkFarm "latexInputs" | |
([ | |
{ name = "book.tex"; path = findingSuccessTex; } | |
{ name = "preamble.tex"; path = "${./templates/preamble.tex}"; } | |
{ name = "code.tex"; path = "${./templates/code.tex}"; } | |
{ name = "cover.pdf"; path = coverPdf; } | |
{ name = "cover-inside.pdf"; path = coverInsidePdf; } | |
{ name = "figures"; path = texFigures; } | |
] ++ fontsForLatex); | |
findingSuccessPdf = | |
pkgs.runCommand "finding-success.pdf" | |
{ | |
buildInputs = [ texlive ]; | |
inherit latexInputs; | |
} | |
'' | |
ln -s "$latexInputs"/* . | |
xelatex book.tex | |
xelatex book.tex | |
mv book.pdf $out | |
''; | |
# ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import <nixpkgs> { }).fetchFromGitHub { | |
owner = "NixOS"; | |
repo = "nixpkgs"; | |
# NixOS unstable, 2019 Feb 14 | |
rev = "36f316007494c388df1fec434c1e658542e3c3cc"; | |
sha256 = "1w1dg9ankgi59r2mh0jilccz5c4gv30a6q1k6kv2sn8vfjazwp9k"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ texlive }: | |
texlive.combine { | |
inherit (texlive) | |
# The program we use to turn .tex into .pdf files | |
xetex | |
# An aggegrate base package with bunch of tex packages | |
scheme-medium | |
# For quieting latex's build output | |
silence | |
# For building graphics with tikz | |
pgf | |
# Provides the `extdash` package which gives \Hyphdash | |
ncctools | |
# Provides the `standalone` document class, which we use to render images | |
standalone | |
# The Merriweather font | |
merriweather | |
# Used to style the code blocks that pandoc generates | |
framed | |
# Provides the `adjustbox` environment for minor positional adjustments | |
adjustbox | |
# Dependency of adjustbox | |
collectbox | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment