tvl-depot/users/flokli/presentations/2023-09-09-nixcon-tvix/default.nix
Florian Klink f3f20c2080 fix(users/flokli/slides/2023-nixcon): fix pdf gen
reveal-md didn't exit with a nonzero exit code and just didn't contain
the PDF. Fix this.

Change-Id: Ie4bc7cbf4b9117b0a672a3294e9e64fb13459247
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12683
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2024-10-26 10:13:46 +00:00

37 lines
1.1 KiB
Nix

{ 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
'';
}