tijdelijk-te-laat/latex/flake.nix

49 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2023-10-22 19:19:19 +02:00
# inspired by https://flyx.org/nix-flakes-latex/
{ description = "A latex template";
inputs = {
2024-03-09 02:39:58 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
2023-10-22 19:19:19 +02:00
};
outputs = { self, nixpkgs, flake-utils}:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
texInput = "main";
# If you're not lazy, figure out what dependencies you need.
# If you are lazy, just take the full scheme.
tex = (pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-full;
#scheme-basic latex-bin latexmk;
});
in {
packages = rec {
2023-11-17 13:16:50 +01:00
document = pkgs.stdenvNoCC.mkDerivation rec {
2023-10-22 19:19:19 +02:00
pname = throw "put document name here";
version = "0.0";
src = ./src;
2024-03-09 02:39:58 +01:00
buildInputs = [
2023-10-22 19:19:19 +02:00
tex
];
buildPhase = ''
mkdir -p .cache/texmf-var
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
2024-05-27 09:25:45 +02:00
latexmk -interaction=nonstopmode -lualatex \
2023-10-22 19:19:19 +02:00
${texInput}.tex
'';
installPhase = ''
mkdir -p $out
2023-11-17 13:16:50 +01:00
cp ${texInput}.pdf $out/${pname}.pdf
2023-10-22 19:19:19 +02:00
'';
};
default = document;
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
texlab # my language server of choice
tex
];
};
});
}