mirror of
https://git.adityakumar.xyz/flakes.git
synced 2024-11-09 14:19:43 +00:00
38 lines
1.2 KiB
Nix
38 lines
1.2 KiB
Nix
# Taken from https://flyx.org/nix-flakes-latex/
|
|
|
|
{
|
|
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;
|
|
});
|
|
}
|