-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
40 lines (40 loc) · 1.47 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
description = "A template for solutions to my Introduction to Computation course";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils }:
with flake-utils.lib; eachSystem allSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
tex = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-minimal latex-bin latexmk xetex
algorithmicx algorithms amsmath babel-english bookmark caption cite
colortbl enumitem epstopdf epstopdf-pkg float footmisc grfext hyperref
import infwarerr kvdefinekeys kvoptions kvsetkeys listings ltxcmds
mathtools nicematrix oberdiek pgf thmtools tools varwidth;
};
in rec {
packages = {
document = pkgs.stdenvNoCC.mkDerivation rec {
name = "intro-to-computation-template";
src = self;
buildInputs = [ pkgs.coreutils tex ];
phases = ["unpackPhase" "buildPhase" "installPhase"];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
mkdir -p .cache/texmf-var
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
latexmk -interaction=nonstopmode -pdf -xelatex \
main.tex
'';
installPhase = ''
mkdir -p $out
cp main.pdf $out/
'';
};
};
defaultPackage = packages.document;
});
}