master-thesis-tex/flake.nix

57 lines
2.4 KiB
Nix
Raw Normal View History

2022-06-20 21:43:27 +02:00
{
description = "Typesetting for Valentin's Masters Thesis";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils }:
with flake-utils.lib; eachSystem allSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
tex = pkgs.texlive.combine {
2022-09-27 14:24:38 +02:00
inherit (pkgs.texlive) scheme-medium latexmk koma-script babel-english
2022-06-20 21:43:27 +02:00
physics mathtools amsmath fontspec booktabs siunitx caption biblatex float
pgfplots microtype fancyvrb csquotes setspace newunicodechar hyperref
2022-07-01 18:14:55 +02:00
cleveref multirow bbold unicode-math biblatex-phys xpatch beamerposter
2022-08-15 21:43:40 +02:00
type1cm changepage lualatex-math footmisc wrapfig2 curve2e pict2e wrapfig
2022-09-27 14:24:38 +02:00
appendixnumberbeamer sidecap appendix orcidlink ncctools bigfoot crop xcolor;
2022-06-20 21:43:27 +02:00
};
in rec {
packages = {
2022-06-28 20:33:44 +02:00
watch = pkgs.writeShellScriptBin "watch-latex" ''
${tex}/bin/latexmk
2022-08-11 18:39:08 +02:00
while ${pkgs.inotify-tools}/bin/inotifywait --include ".*\.(sty|tex|pgf|pdf)" -e modify -r .; do
2022-06-28 20:33:44 +02:00
${tex}/bin/latexmk
done
'';
2022-06-20 21:43:27 +02:00
document = pkgs.stdenvNoCC.mkDerivation rec {
name = "masters-thesis";
src = self;
buildInputs = [ pkgs.coreutils tex pkgs.biber];
phases = ["unpackPhase" "buildPhase" "installPhase"];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
mkdir -p .cache/texmf-var
2022-09-08 13:18:00 +02:00
mkdir -p output/src
2022-06-20 21:43:27 +02:00
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
2022-09-08 13:18:00 +02:00
OSFONTDIR=${pkgs.gyre-fonts}/share/fonts:${pkgs.liberation_ttf}/share/fonts:${pkgs.lato}/share/fonts/lato:${pkgs.raleway}/share/fonts:${pkgs.lmodern}/share/fonts \
latexmk ./index.tex
2022-06-20 21:43:27 +02:00
'';
installPhase = ''
mkdir -p $out
2022-06-28 20:33:44 +02:00
cp output/index.pdf $out/
2022-06-20 21:43:27 +02:00
'';
};
};
defaultPackage = packages.document;
2022-06-28 20:33:44 +02:00
devShell = pkgs.mkShellNoCC {
2022-08-11 18:39:08 +02:00
buildInputs = [packages.watch pkgs.openjdk] ++ packages.document.buildInputs;
2022-06-28 20:33:44 +02:00
shellHook = ''
2022-08-11 18:39:08 +02:00
export OSFONTDIR=${pkgs.gyre-fonts}/share/fonts:${pkgs.liberation_ttf}/share/fonts:${pkgs.lato}/share/fonts/lato:${pkgs.raleway}/share/fonts:${pkgs.lmodern}/share/fonts
2022-06-28 20:33:44 +02:00
'';
};
2022-06-20 21:43:27 +02:00
});
}