{ description = "PDF page number and header annotator using LaTeX"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; in { packages.${system} = { pdf-annotator = let texlive = pkgs.texlive.combined.scheme-full; script = "run.sh"; tex = "numbered.tex"; in pkgs.stdenv.mkDerivation rec { name = "${pname}"; pname = "pdf-annotator"; src = ./.; buildInputs = [ texlive ]; nativeBuildInputs = with pkgs; [ makeWrapper ]; postPatch = '' substituteInPlace run.sh \ --replace pdflatex ${texlive}/bin/pdflatex \ --replace ${tex} $out/share/${tex} ''; installPhase = '' runHook preInstall mkdir -p $out/bin cp ${script} $out/bin/${pname} mkdir -p $out/share cp ${tex} $out/share/${tex} wrapProgram $out/bin/${pname} --prefix PATH : ${nixpkgs.lib.makeBinPath (with pkgs; [ bash ])} runHook postInstall ''; }; default = self.packages.${system}.pdf-annotator; }; devShells.${system}.default = with pkgs; mkShell { inputsFrom = with self.packages.${system}; [ pdf-annotator ]; }; }; }