add flake-latex

This commit is contained in:
aditya 2023-06-30 15:35:45 +05:30
parent fd71d74d4e
commit 31259cface
Signed by: aditya
SSH key fingerprint: SHA256:jL1IvWsjjlPtw6HvDIHfXfhO9IkIokNEyIfuFhSdoyU

36
flake-latex.nix Normal file
View file

@ -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;
});
}