diff options
author | Bryan Lai <bryanlais@gmail.com> | 2023-12-19 14:18:54 +0800 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2023-12-21 18:23:11 +0200 |
commit | 04f1b554cedecb9940b86d6963a2bfebe2e1e2fd (patch) | |
tree | ecd39453f1a5bd62fbd737ca1d21cb73ffeec10e | |
parent | 0a85473c1244cb285a96877febb7944c67c50559 (diff) |
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: https://github.com/NixOS/nixpkgs/commit/5aa8e9f0f90b0c9bbdf7b18ead18704d1622c509 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>
-rw-r--r-- | pkgs/tools/typesetting/tectonic/default.nix | 12 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tectonic/wrapper.nix | 56 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
3 files changed, 69 insertions, 3 deletions
diff --git a/pkgs/tools/typesetting/tectonic/default.nix b/pkgs/tools/typesetting/tectonic/default.nix index 21391ac72917d..6b98a5db63438 100644 --- a/pkgs/tools/typesetting/tectonic/default.nix +++ b/pkgs/tools/typesetting/tectonic/default.nix @@ -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 ]; }; } diff --git a/pkgs/tools/typesetting/tectonic/wrapper.nix b/pkgs/tools/typesetting/tectonic/wrapper.nix new file mode 100644 index 0000000000000..5a4dc47e37a29 --- /dev/null +++ b/pkgs/tools/typesetting/tectonic/wrapper.nix @@ -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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8a0c052fda09b..861d41181f1d1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; }; |