From 31259cfaceae81566040299b8a107f38b7195ab1 Mon Sep 17 00:00:00 2001 From: aditya Date: Fri, 30 Jun 2023 15:35:45 +0530 Subject: [PATCH] add flake-latex --- flake-latex.nix | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 flake-latex.nix diff --git a/flake-latex.nix b/flake-latex.nix new file mode 100644 index 0000000..da5706d --- /dev/null +++ b/flake-latex.nix @@ -0,0 +1,36 @@ +{ + description = "LaTeX Document Demo"; + inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05; + flake-utils.url = github:numtide/flake-utils; + }; + outputs = { self, nixpkgs, flake-utils }: + with flake-utils.lib; eachSystem allSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + tex = pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-basic pgf nicematrix latex-bin latexmk; + }; + in rec { + packages = { + document = pkgs.stdenvNoCC.mkDerivation rec { + name = "latex-demo-document"; + src = self; + buildInputs = [ pkgs.coreutils tex ]; + phases = ["unpackPhase" "buildPhase" "installPhase"]; + buildPhase = '' + export PATH="${pkgs.lib.makeBinPath buildInputs}"; + mkdir -p .cache/texmf-var + env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \ + latexmk -interaction=nonstopmode -pdf -lualatex \ + document.tex + ''; + installPhase = '' + mkdir -p $out + cp document.pdf $out/ + ''; + }; + }; + defaultPackage = packages.document; + }); +}