Skip to content

Commit

Permalink
feat(flake): Add a helper function to print to pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
etu committed Oct 13, 2024
1 parent d4aa6b5 commit ccf31b5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,34 @@
'';
};

buildPrintToPdf = {
builderDerivation,
format ? "A4",
}:
pkgs.writeShellApplication {
name = "print-to-pdf";
runtimeInputs = [
pkgs.puppeteer-cli
pkgs.nodePackages.live-server

# Include the desired builders program that cointains `resumed-render`
builderDerivation
];
text = ''
resumed-render
PORT=$(shuf -i 2000-65000 -n 1)
live-server --watch=resume.html --open=resume.html --host=127.0.0.1 --port=$PORT --wait=300 &
sleep 1
# Out will never be defined so we have to ignore it.
# shellcheck disable=SC2154
puppeteer print "http://127.0.0.1:$PORT/" "$out" --format ${format}
'';
};

buildThemeBuilder = themeName: let
themePkg = pkgs.callPackage ./themes/jsonresume-theme-${themeName} {};
in
Expand Down

0 comments on commit ccf31b5

Please sign in to comment.