{ description = "Latex Project Presentation Template"; inputs = { nixpkgs.url = "github:nixos/nixpkgs"; utils.url = "github:numtide/flake-utils"; gitignore = { url = "github:hercules-ci/gitignore"; flake = false; }; }; outputs = { self, nixpkgs, utils, gitignore, ... }: utils.lib.eachDefaultSystem (system: let pname = "presentation"; version = "0.1.0"; pkgs = nixpkgs.legacyPackages."${system}"; inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource; nativeBuildInputs = with pkgs; [ (texlive.combine { inherit (texlive) scheme-medium multirow hyperref blindtext etoolbox topiclongtable beamer; }) gnumake ]; watcher = pkgs.writeScriptBin "watch" '' out=".latexmkout" mkdir "$out" latexmk \ -pvc \ -outdir="$out" \ -pdf \ -pdflatex="pdflatex -interaction=nonstopmode" \ -use-make ${pname}.tex rm -r "$out" ''; in rec { defaultPackage = pkgs.stdenv.mkDerivation { inherit pname version; src = gitignoreSource ./.; buildInputs = nativeBuildInputs; buildPhase = '' latexmk \ -pdf \ -pdflatex="pdflatex -interaction=nonstopmode" \ -use-make ${pname}.tex ''; installPhase = '' mkdir -p $out cp ${pname}.pdf $out/ ''; }; apps.watch = { type = "app"; program = "${watcher}/bin/watch"; }; devShell = pkgs.mkShell { nativeBuildInputs = nativeBuildInputs; }; }); }