From bc32f4eb33f976b8473819b0e5bee6bf6af8fd6a Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Tue, 12 Dec 2023 01:18:39 +0800 Subject: [PATCH 1/4] maintainers: add @bryango Checked with: - nix eval --file maintainers/scripts/check-maintainers-sorted.nix - nix build --file lib/tests/maintainers.nix --print-out-paths --no-link --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 31948d66d50b..51adf62424f1 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -2722,6 +2722,12 @@ githubId = 53131727; name = "Bryan Albuquerque"; }; + bryango = { + name = "Bryan Lai"; + email = "bryanlais@gmail.com"; + github = "bryango"; + githubId = 26322692; + }; bryanhonof = { name = "Bryan Honof"; email = "bryanhonof@gmail.com"; From d9c62652be7e305cd61b7cefaa70b8f72dda8cfb Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Sat, 9 Dec 2023 16:20:18 +0800 Subject: [PATCH 2/4] biber-for-tectonic: init at 2.17 The `tectonic` package depends on a version of `biber` that is generally different from the one in the nixpkgs `texlive` bundle. This package provides an override of biber suitable for use with tectonic. For biber<=2.17 on perl>=5.36.0 a patch is needed. This is recovered from a previous nixpkgs commit: https://github.com/NixOS/nixpkgs/commit/c784cdbf6b98e3e3aefb678b6ee8309cbb8bee15 Co-authored-by: Mauricio Collares Co-authored-by: Doron Behar --- pkgs/tools/typesetting/tectonic/biber.nix | 54 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 56 insertions(+) create mode 100644 pkgs/tools/typesetting/tectonic/biber.nix diff --git a/pkgs/tools/typesetting/tectonic/biber.nix b/pkgs/tools/typesetting/tectonic/biber.nix new file mode 100644 index 000000000000..9798c1471667 --- /dev/null +++ b/pkgs/tools/typesetting/tectonic/biber.nix @@ -0,0 +1,54 @@ +/* + This package, `biber-for-tectonic`, provides a compatible version of `biber` + as an optional runtime dependency of `tectonic`. + + The development of tectonic is slowing down recently, such that its `biber` + dependency has been lagging behind the one in the nixpkgs `texlive` bundle. + See: + + https://github.com/tectonic-typesetting/tectonic/discussions/1122 + + It is now feasible to track the biber dependency in nixpkgs, as the + version bump is not very frequent, and it would provide a more complete + user experience of tectonic in nixpkgs. +*/ + +{ lib +, fetchFromGitHub +, fetchpatch +, biber +}: + +let version = "2.17"; in ( + biber.override { + /* + It is necessary to first override the `version` data here, which is + passed to `buildPerlModule`, and then to `mkDerivation`. + + If we simply do `biber.overrideAttrs` the resulting package `name` + would be incorrect, since it has already been preprocessed by + `buildPerlModule`. + */ + texlive.pkgs.biber.texsource = { + inherit version; + inherit (biber) pname meta; + }; + } +).overrideAttrs (prevAttrs: { + src = fetchFromGitHub { + owner = "plk"; + repo = "biber"; + rev = "v${version}"; + hash = "sha256-Tt2sN2b2NGxcWyZDj5uXNGC8phJwFRiyH72n3yhFCi0="; + }; + patches = [ + # Perl>=5.36.0 compatibility + (fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/plk/biber/pull/411.patch"; + hash = "sha256-osgldRVfe3jnMSOMnAMQSB0Ymc1s7J6KtM2ig3c93SE="; + }) + ]; + meta = prevAttrs.meta // { + maintainers = with lib.maintainers; [ doronbehar bryango ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6dc814930760..8a0c052fda09 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6689,6 +6689,8 @@ with pkgs; biber = callPackage ../tools/typesetting/biber { }; + biber-for-tectonic = callPackage ../tools/typesetting/tectonic/biber.nix { }; + biber-ms = callPackage ../tools/typesetting/biber-ms { }; biblatex-check = callPackage ../tools/typesetting/biblatex-check { }; From 0a85473c1244cb285a96877febb7944c67c50559 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 21 Dec 2023 18:21:37 +0200 Subject: [PATCH 3/4] tectonic: symlink nextonic for all platforms Probably this was conditioned on stdenv.isLinux by mistake. --- pkgs/tools/typesetting/tectonic/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/typesetting/tectonic/default.nix b/pkgs/tools/typesetting/tectonic/default.nix index 607e71cfbb44..21391ac72917 100644 --- a/pkgs/tools/typesetting/tectonic/default.nix +++ b/pkgs/tools/typesetting/tectonic/default.nix @@ -33,13 +33,14 @@ rustPlatform.buildRustPackage rec { # workaround for https://github.com/NixOS/nixpkgs/issues/166205 NIX_LDFLAGS = lib.optionalString (stdenv.cc.isClang && stdenv.cc.libcxx != null) " -l${stdenv.cc.libcxx.cxxabi.libName}"; - postInstall = lib.optionalString stdenv.isLinux '' + postInstall = '' + # Makes it possible to automatically use the V2 CLI API + ln -s $out/bin/tectonic $out/bin/nextonic + '' + lib.optionalString stdenv.isLinux '' substituteInPlace dist/appimage/tectonic.desktop \ --replace Exec=tectonic Exec=$out/bin/tectonic install -D dist/appimage/tectonic.desktop -t $out/share/applications/ install -D dist/appimage/tectonic.svg -t $out/share/icons/hicolor/scalable/apps/ - - ln -s $out/bin/tectonic $out/bin/nextonic ''; doCheck = true; From 04f1b554cedecb9940b86d6963a2bfebe2e1e2fd Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Tue, 19 Dec 2023 14:18:54 +0800 Subject: [PATCH 4/4] 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 --- pkgs/tools/typesetting/tectonic/default.nix | 12 ++++- pkgs/tools/typesetting/tectonic/wrapper.nix | 56 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 pkgs/tools/typesetting/tectonic/wrapper.nix diff --git a/pkgs/tools/typesetting/tectonic/default.nix b/pkgs/tools/typesetting/tectonic/default.nix index 21391ac72917..6b98a5db6343 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 000000000000..5a4dc47e37a2 --- /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 8a0c052fda09..861d41181f1d 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; };