about summary refs log tree commit diff
path: root/users/tazjin/presentations/tvix-eval-2023/default.nix
blob: a4d855197c5eadfc9e9868d8a092b64933e160d6 (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ depot, pkgs, ... }:

let
  inherit (pkgs) fontconfig texlive stdenv imagemagick runCommand qrencode;

  tex = texlive.combine {
    inherit (texlive)
      babel
      babel-russian
      beamer
      beamertheme-metropolis
      etoolbox
      euenc
      extsizes
      fontspec
      listings
      xetex
      minted
      ms
      pgfopts
      scheme-basic
      translator;
  };

  linksQrCode = runCommand "qrcode.png" { } ''
    ${qrencode}/bin/qrencode -o code.png -s 8 \
      --background=fafafa \
      --foreground=000000 \
      'https://tazj.in/blog/tvix-eval-talk-2023'

    # latex has trouble with the PDF produced by qrencode
    ${imagemagick}/bin/convert code.png $out
  '';
in
stdenv.mkDerivation {
  name = "progmsk-tvix-eval";
  src = ./.;

  nativeBuildInputs = [ tex imagemagick fontconfig ];

  FONTCONFIG_FILE = pkgs.makeFontsConf {
    fontDirectories = with pkgs; [ jetbrains-mono fira fira-code fira-mono ];
  };

  buildPhase = ''
    # LaTeX needs a cache folder in /home/ ...
    mkdir home
    export HOME=$PWD/home

    cp ${depot.tvix.logo}/logo.png tvix-logo.png
    cp ${linksQrCode} qrcode.png

    # As usual, TeX needs to be run twice ...
    ${tex}/bin/xelatex presentation.tex
    ${tex}/bin/xelatex presentation.tex
  '';

  installPhase = ''
    mkdir -p $out
    cp presentation.pdf $out/
    cp $src/presentation.pdfpc $out/
  '';
}