tectonic: redefine to wrap it with biber-for-tectonic

The `tectonic` attribute is redefined to be a wrapper with a compatible
version of biber, provided by `biber-for-tectonic`.

The wrapper is partially recovered from a previous nixpkgs commit:

  5aa8e9f0f9

Also:

- Remove unneeded makeBinaryWrapper input in `tectonic-unwrapped`.
- Add @bryango as a maintainer of both `tectonic-unwrapped` and
  `tectonic`.

Co-authored-by: Doron Behar <doron.behar@gmail.com>
This commit is contained in:
Bryan Lai 2023-12-19 14:18:54 +08:00 committed by Doron Behar
parent 0a85473c12
commit 04f1b554ce
3 changed files with 69 additions and 3 deletions

View file

@ -1,3 +1,11 @@
/*
This file provides the `tectonic-unwrapped` package. On the other hand,
the `tectonic` package is defined in `./wrapper.nix`, by wrapping
- [`tectonic-unwrapped`](./default.nix) i.e. this package, and
- [`biber-for-tectonic`](./biber.nix),
which provides a compatible version of `biber`.
*/
{ lib
, stdenv
, fetchFromGitHub
@ -25,7 +33,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-1WjZbmZFPB1+QYpjqq5Y+fDkMZNmWJYIxmMFWg7Tiac=";
nativeBuildInputs = [ pkg-config makeBinaryWrapper ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ icu fontconfig harfbuzz openssl ]
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices Cocoa Foundation ]);
@ -51,6 +59,6 @@ rustPlatform.buildRustPackage rec {
changelog = "https://github.com/tectonic-typesetting/tectonic/blob/tectonic@${version}/CHANGELOG.md";
license = with licenses; [ mit ];
mainProgram = "tectonic";
maintainers = with maintainers; [ lluchs doronbehar ];
maintainers = with maintainers; [ lluchs doronbehar bryango ];
};
}

View file

@ -0,0 +1,56 @@
{ lib
, symlinkJoin
, tectonic-unwrapped
, biber-for-tectonic
, makeWrapper
}:
symlinkJoin {
name = "${tectonic-unwrapped.pname}-wrapped-${tectonic-unwrapped.version}";
paths = [ tectonic-unwrapped ];
nativeBuildInputs = [ makeWrapper ];
passthru = {
unwrapped = tectonic-unwrapped;
biber = biber-for-tectonic;
};
# Replace the unwrapped tectonic with the one wrapping it with biber
postBuild = ''
rm $out/bin/{tectonic,nextonic}
''
# Ideally, we would have liked to also pin the version of the online TeX
# bundle that Tectonic's developer distribute, so that the `biber` version
# and the `biblatex` version distributed from there are compatible.
# However, that is not currently possible, due to lack of upstream support
# for specifying this in runtime, there were 2 suggestions sent upstream
# that suggested a way of improving the situation:
#
# - https://github.com/tectonic-typesetting/tectonic/pull/1132
# - https://github.com/tectonic-typesetting/tectonic/pull/1131
#
# The 1st suggestion seems more promising as it'd allow us to simply use
# makeWrapper's --add-flags option. However, the PR linked above is not
# complete, and as of currently, upstream hasn't even reviewed it, or
# commented on the idea.
#
# Note also that upstream has announced that they will put less time and
# energy for the project:
#
# https://github.com/tectonic-typesetting/tectonic/discussions/1122
#
# Hence, we can be rather confident that for the near future, the online
# TeX bundle won't be updated and hence the biblatex distributed there
# won't require a higher version of biber.
+ ''
makeWrapper ${lib.getBin tectonic-unwrapped}/bin/tectonic $out/bin/tectonic \
--prefix PATH : "${lib.getBin biber-for-tectonic}/bin"
ln -s $out/bin/tectonic $out/bin/nextonic
'';
meta = tectonic-unwrapped.meta // {
description = "Tectonic TeX/LaTeX engine, wrapped with a compatible biber";
maintainers = with lib.maintainers; [ doronbehar bryango ];
};
}

View file

@ -25317,7 +25317,9 @@ with pkgs;
tecla = callPackage ../development/libraries/tecla { };
tectonic = callPackage ../tools/typesetting/tectonic {
tectonic = callPackage ../tools/typesetting/tectonic/wrapper.nix { };
tectonic-unwrapped = callPackage ../tools/typesetting/tectonic {
harfbuzz = harfbuzzFull;
};