tvl-depot/users/flokli/presentations/2024-10-25-nixcon-tvix/default.nix
Florian Klink 5faa3f9c65 fix(users/flokli/nixon-2024): fix pdf gen
Change-Id: I02c101fc16e4ce57d53cd423f7aa0b6a98f856df
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12685
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: flokli <flokli@flokli.de>
2024-10-26 10:13:46 +00:00

35 lines
1,020 B
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 = "2024-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
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
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
'';
}