about summary refs log tree commit diff
path: root/users/flokli/presentations/2023-09-09-nixcon-tvix/default.nix
blob: b50309b6c2f6e81f0242b731dd603384fcde649d (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
{ depot, pkgs, ... }:

let
  inherit (pkgs)
    fontconfig qrencode runCommand stdenv;
  mkQr = url: runCommand "qrcode.png" { } ''
    ${qrencode}/bin/qrencode -o $out -t SVG -s 5 \
      --background=fafafa \
      --foreground=000000 \
      ${url}
  '';
in
stdenv.mkDerivation {
  name = "2023-nixcon-tvix";
  src = ./.;

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

  nativeBuildInputs = [ pkgs.reveal-md pkgs.graphviz ];

  buildPhase = ''
    cp ${depot.tvix.logo}/logo.png tvix-logo.png
    dot -Tsvg crate-deps.dot > crate-deps.svg
    cp ${mkQr "https://flokli.de"} qrcode-flokli.svg
    cp ${mkQr "https://tvix.dev"} qrcode-tvix.svg

    mkdir -p $out
    reveal-md --static $out presentation.md
    cp tvixbolt.webm $out

    CHROME_CONFIG_HOME=/build/.config reveal-md presentation.md --print $out/slides.pdf --puppeteer-chromium-executable="${pkgs.chromium}/bin/chromium"
    # Above command doesn't fail on error, ensure file has been created
    [[ -f "$out/slides.pdf" ]] || exit 1
  '';
}