summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..271ef18
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,69 @@
1{
2 description = "Latex Project Presentation Template";
3
4 inputs = {
5 nixpkgs.url = "github:nixos/nixpkgs";
6 utils.url = "github:numtide/flake-utils";
7 gitignore = {
8 url = "github:hercules-ci/gitignore";
9 flake = false;
10 };
11 };
12
13 outputs = { self, nixpkgs, utils, gitignore, ... }:
14 utils.lib.eachDefaultSystem (system:
15 let
16 pname = "presentation";
17 version = "0.1.0";
18 pkgs = nixpkgs.legacyPackages."${system}";
19 inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource;
20 nativeBuildInputs = with pkgs; [
21 (texlive.combine {
22 inherit (texlive)
23 scheme-medium
24 multirow
25 hyperref
26 blindtext
27 etoolbox
28 topiclongtable
29 beamer;
30 })
31 gnumake
32 ];
33 watcher = pkgs.writeScriptBin "watch" ''
34 out=".latexmkout"
35 mkdir "$out"
36 latexmk \
37 -pvc \
38 -outdir="$out" \
39 -pdf \
40 -pdflatex="pdflatex -interaction=nonstopmode" \
41 -use-make ${pname}.tex
42 rm -r "$out"
43 '';
44 in
45 rec {
46 defaultPackage = pkgs.stdenv.mkDerivation {
47 inherit pname version;
48 src = gitignoreSource ./.;
49 buildInputs = nativeBuildInputs;
50 buildPhase = ''
51 latexmk \
52 -pdf \
53 -pdflatex="pdflatex -interaction=nonstopmode" \
54 -use-make ${pname}.tex
55 '';
56 installPhase = ''
57 mkdir -p $out
58 cp ${pname}.pdf $out/
59 '';
60 };
61 apps.watch = {
62 type = "app";
63 program = "${watcher}/bin/watch";
64 };
65 devShell = pkgs.mkShell {
66 nativeBuildInputs = nativeBuildInputs;
67 };
68 });
69}