summaryrefslogtreecommitdiffstats
path: root/beamer/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'beamer/flake.nix')
-rw-r--r--beamer/flake.nix116
1 files changed, 10 insertions, 106 deletions
diff --git a/beamer/flake.nix b/beamer/flake.nix
index d5e1614..b2c472e 100644
--- a/beamer/flake.nix
+++ b/beamer/flake.nix
@@ -2,115 +2,19 @@
2 description = "My epic presentation"; 2 description = "My epic presentation";
3 3
4 inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 4 inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5 inputs.beamertheme-metropolis = { 5 inputs.pandoc-nix-templates.url = "github:minijackson/pandoc-nix-templates";
6 url = "github:matze/mtheme";
7 flake = false;
8 };
9 inputs.draculaTheme = {
10 url = "github:dracula/pygments";
11 flake = false;
12 };
13 inputs.pandoc-templates = {
14 url = "github:minijackson/pandoc-templates";
15 flake = false;
16 };
17 6
18 outputs = { self, nixpkgs, beamertheme-metropolis, draculaTheme, pandoc-templates, }: 7 outputs = { self, nixpkgs, pandoc-nix-templates, }:
19 let 8 let
20 pkgs = nixpkgs.legacyPackages.x86_64-linux; 9 pkgs = import nixpkgs {
10 system = "x86_64-linux";
11 overlays = [ pandoc-nix-templates.overlay ];
12 };
21 in 13 in
22 { 14 {
23 15 defaultPackage.x86_64-linux = pkgs.mkPandocBeamerPdf {
24 packages.x86_64-linux.pygments = pkgs.python3Packages.pygments.overrideAttrs (oldAttrs: { 16 name = "slides";
25 postPatch = '' 17 src = ./.;
26 cp ${draculaTheme}/dracula.py pygments/styles/ 18 };
27 sed -i 's/bg:.\+ //' pygments/styles/inkpot.py
28 '';
29 });
30
31 defaultPackage.x86_64-linux =
32 let
33 beamertheme-metropolis' = pkgs.stdenvNoCC.mkDerivation {
34 pname = "texlive-beamertheme-metropolis";
35 version = "${builtins.substring 0 8 beamertheme-metropolis.lastModifiedDate}-${beamertheme-metropolis.shortRev or "dirty"}";
36
37 src = beamertheme-metropolis;
38
39 outputs = [ "out" "doc" ];
40
41 nativeBuildInputs = with pkgs; [
42 (texlive.combine {
43 inherit (texlive)
44 scheme-small
45 enumitem
46 fileinfo
47 latexmk;
48 })
49 ];
50
51 passthru = {
52 pname = "beamertheme-metropolis";
53 tlType = "run";
54 };
55
56 DESTDIR = placeholder "out";
57
58 dontConfigure = true;
59 };
60 in
61 pkgs.runCommand "slides"
62 {
63 src = ./.;
64 nativeBuildInputs = with pkgs; [
65 pandoc
66 self.packages.x86_64-linux.pygments
67 fira-code
68 which
69 (texlive.combine {
70 inherit (texlive)
71 scheme-medium
72 latexmk
73
74 beamercolorthemeowl
75
76 # For framed code listings
77 tcolorbox environ
78
79 # Optional pandoc dependencies
80 microtype upquote parskip xurl bookmark footnotehyper
81
82 # Some dependencies
83 fvextra pgfopts minted catchfile xstring framed;
84 beamertheme-metropolis = { pkgs = [ beamertheme-metropolis' ]; };
85 })
86 ];
87
88 FONTCONFIG_FILE = pkgs.makeFontsConf {
89 fontDirectories = with pkgs; [ lmodern freefont_ttf fira fira-code ];
90 };
91 } ''
92 unpackFile $src
93 cd */
94 chmod -R u+w .
95
96 pandoc slides.md -t beamer -so slides.tex \
97 --template=${pandoc-templates}/default.latex \
98 --lua-filter=${pkgs.pandoc-lua-filters}/share/pandoc/filters/minted.lua \
99 --pdf-engine=xelatex \
100 --pdf-engine-opt=-aux-directory=./build \
101 --pdf-engine-opt=-shell-escape
102
103 latexmk \
104 -shell-escape \
105 -xelatex \
106 -8bit \
107 -interaction=nonstopmode \
108 -verbose \
109 -file-line-error \
110 -output-directory=./build slides
111
112 cp build/slides.pdf $out
113 '';
114 # TODO: diagram-generator?
115 }; 19 };
116} 20}