Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Last active April 15, 2019 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-martin/a1c337c3caa8649c47cf2d6fc059ab2d to your computer and use it in GitHub Desktop.
Save chris-martin/a1c337c3caa8649c47cf2d6fc059ab2d to your computer and use it in GitHub Desktop.
LaTeX + Nix setup for "Finding Success and Failure in Haskell"
{
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
'';
# ...
}
(import <nixpkgs> { }).fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
# NixOS unstable, 2019 Feb 14
rev = "36f316007494c388df1fec434c1e658542e3c3cc";
sha256 = "1w1dg9ankgi59r2mh0jilccz5c4gv30a6q1k6kv2sn8vfjazwp9k";
}
{ 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