1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
{ stdenv
, lib
, fetchFromGitHub
, makeWrapper
, writeScript
, mupdf
, SDL2
, re2c
, freetype
, jbig2dec
, harfbuzz
, openjpeg
, gumbo
, libjpeg
, texpresso-tectonic
}:
stdenv.mkDerivation rec {
pname = "texpresso";
version = "0-unstable-2024-06-22";
postPatch = ''
substituteInPlace Makefile \
--replace-fail "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" \
--replace-fail "LDCC=g++" "LDCC=${stdenv.cc.targetPrefix}c++"
'';
nativeBuildInputs = [
makeWrapper
mupdf
SDL2
re2c
freetype
jbig2dec
harfbuzz
openjpeg
gumbo
libjpeg
];
src = fetchFromGitHub {
owner = "let-def";
repo = "texpresso";
rev = "e1e05f5559751d4b50772cd51d14101be0563ce1";
hash = "sha256-av1yadR2giJUxFQuHSXFgTbCNsmccrzKOmLVnAGJt6c=";
};
buildFlags = [ "texpresso" ];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-Wno-error=implicit-function-declaration"
]);
installPhase = ''
runHook preInstall
install -Dm0755 -t "$out/bin/" "build/${pname}"
runHook postInstall
'';
# needs to have texpresso-tonic on its path
postInstall = ''
wrapProgram $out/bin/texpresso \
--prefix PATH : ${lib.makeBinPath [ texpresso-tectonic ]}
'';
passthru = {
tectonic = texpresso-tectonic;
updateScript = writeScript "update-texpresso" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq nix-update
tectonic_version="$(curl -s "https://api.github.com/repos/let-def/texpresso/contents/tectonic" | jq -r '.sha')"
nix-update --version=branch texpresso
nix-update --version=branch=$tectonic_version texpresso.tectonic
'';
};
meta = {
inherit (src.meta) homepage;
description = "Live rendering and error reporting for LaTeX";
maintainers = with lib.maintainers; [ nickhu ];
license = lib.licenses.mit;
platforms = lib.platforms.unix;
};
}
|