1{
2 lib,
3 symlinkJoin,
4 tectonic,
5 tectonic-unwrapped,
6 biber-for-tectonic,
7 makeBinaryWrapper,
8 callPackage,
9}:
10
11symlinkJoin {
12 name = "${tectonic-unwrapped.pname}-wrapped-${tectonic-unwrapped.version}";
13 paths = [ tectonic-unwrapped ];
14
15 nativeBuildInputs = [ makeBinaryWrapper ];
16
17 passthru = {
18 unwrapped = tectonic-unwrapped;
19 biber = biber-for-tectonic;
20 tests = callPackage ./tests.nix { };
21
22 # The version locked tectonic web bundle, redirected from:
23 # https://relay.fullyjustified.net/default_bundle_v33.tar
24 # To check for updates, see:
25 # https://github.com/tectonic-typesetting/tectonic/blob/master/crates/bundles/src/lib.rs
26 # ... and look up `get_fallback_bundle_url`.
27 bundleUrl = "https://data1.fullyjustified.net/tlextras-2022.0r0.tar";
28 };
29
30 # Replace the unwrapped tectonic with the one wrapping it with biber
31 postBuild = ''
32 rm $out/bin/{tectonic,nextonic}
33 ''
34 # Pin the version of the online TeX bundle that Tectonic's developer
35 # distribute, so that the `biber` version and the `biblatex` version
36 # distributed from there are compatible.
37 #
38 # Upstream is updating it's online TeX bundle slower then
39 # https://github.com/plk/biber. That's why we match here the `bundleURL`
40 # version with that of `biber-for-tectonic`. See also upstream discussion:
41 #
42 # https://github.com/tectonic-typesetting/tectonic/discussions/1122
43 #
44 # Hence, we can be rather confident that for the near future, the online
45 # TeX bundle won't be updated and hence the biblatex distributed there
46 # won't require a higher version of biber.
47 + ''
48 makeWrapper ${lib.getBin tectonic-unwrapped}/bin/tectonic $out/bin/tectonic \
49 --prefix PATH : "${lib.getBin biber-for-tectonic}/bin" \
50 --add-flags "--web-bundle ${tectonic.passthru.bundleUrl}" \
51 --inherit-argv0 ## make sure binary name e.g. `nextonic` is passed along
52 ln -s $out/bin/tectonic $out/bin/nextonic
53 '';
54
55 meta = tectonic-unwrapped.meta // {
56 description = "Tectonic TeX/LaTeX engine, wrapped with a compatible biber";
57 maintainers = with lib.maintainers; [
58 doronbehar
59 bryango
60 ];
61 };
62}