nix_templates/talk_org_revealjs/flake.nix

62 lines
1.6 KiB
Nix

{
description = "A template for a talk built with org-mode, Pandoc and reveal.js";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
revealjs = {
url = "git+https://github.com/hakimel/reveal.js?tag=4.4.0";
flake = false;
};
};
outputs = { self, nixpkgs, revealjs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
buildInputs = with pkgs; [
pandoc-katex
haskellPackages.pandoc-crossref
texlive.combined.scheme-small
];
in {
packages.${system}.report = (
pkgs.stdenv.mkDerivation {
name = "talkSlides";
src = ./.;
inherit buildInputs;
phases = ["unpackPhase" "buildPhase"];
buildPhase = ''
mkdir -p $out
pandoc --embed-resources \
--standalone \
--filter pandoc-katex \
--css ${pkgs.nodePackages_latest.katex}/lib/node_modules/katex/dist/katex.min.css \
--incremental \
-t revealjs \
-V revealjs-url=${revealjs} \
slides.org -o $out/index.html
if [ -f handout.org ]; then
cat << EOF > header.tex
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{TEMPLATE_NAME}
\fancyhead[C]{}
\fancyhead[R]{YOUR_NAME}
EOF
pandoc --include-in-header=header.tex \
--pdf-engine=xelatex \
handout.org -o $out/handout.pdf
fi
'';
}
);
defaultPackage.${system} = self.packages.x86_64-linux.report;
};
}