dragnpkgs/templates/beamer/flake.nix

46 lines
1.2 KiB
Nix

{
description = "A very basic presentation with Beamer";
outputs = { self, dragnpkgs } @ inputs: dragnpkgs.lib.mkFlake {
# Define a texlive environment to use
packages.texlive-custom = { texliveMedium }: texliveMedium.withPackages (ps: with ps; [
fontawesome5
moloch
]);
# Package definition for building the PDF
packages.default = { system, stdenvNoCC }: stdenvNoCC.mkDerivation rec {
pname = "my-beamer-presentation";
name = "${pname}.pdf";
nativeBuildInputs = [
self.packages.${system}.texlive-custom
];
src = self;
buildPhase = ''
latexmk -pdf ${pname}.tex
'';
installPhase = ''
cp ${pname}.pdf $out
'';
};
# Runnable package (ie `nix run`) to start the presentation
apps.default = { lib, system, writeShellScript, pympress }: {
type = "app";
program = "${writeShellScript "start-presentation" ''
exec ${lib.getExe pympress} ${self.packages.${system}.default}
''}";
};
# Devshell definition to expose the texlive environment to eg nvim
devShells.default = { mkShell, system }: mkShell {
packages = [ self.packages.${system}.texlive-custom ];
};
};
}