Skip to content

Instantly share code, notes, and snippets.

@chris-martin chris-martin/default.nix
Last active Apr 15, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.