diff --git a/pkgs/by-name/te/tectonic-unwrapped/package.nix b/pkgs/by-name/te/tectonic-unwrapped/package.nix index ab4800a389fd..27270b54c86b 100644 --- a/pkgs/by-name/te/tectonic-unwrapped/package.nix +++ b/pkgs/by-name/te/tectonic-unwrapped/package.nix @@ -8,61 +8,40 @@ { lib, - clangStdenv, + stdenv, fetchFromGitHub, rustPlatform, + + # nativeBuildInputs + pkg-config, + + # buildInputs fontconfig, harfbuzzFull, openssl, - pkg-config, icu, - fetchpatch2, + + # passthru.tests + tectonic, }: -let - - buildRustPackage = rustPlatform.buildRustPackage.override { - # use clang to work around build failure with GCC 14 - # see: https://github.com/tectonic-typesetting/tectonic/issues/1263 - stdenv = clangStdenv; - }; - -in - -buildRustPackage (finalAttrs: { +rustPlatform.buildRustPackage (finalAttrs: { pname = "tectonic"; - version = "0.15.0"; + version = "0.16.9"; src = fetchFromGitHub { owner = "tectonic-typesetting"; repo = "tectonic"; rev = "tectonic@${finalAttrs.version}"; - sha256 = "sha256-dZnUu0g86WJIIvwMgdmwb6oYqItxoYrGQTFNX7I61Bs="; + sha256 = "sha256-5yphhmrrfgFwQ952eWpToyGfIJVJfV6y5w0BgznSOe0="; }; - patches = [ - (fetchpatch2 { - # https://github.com/tectonic-typesetting/tectonic/pull/1155 - name = "1155-fix-endless-reruns-when-generating-bbl"; - url = "https://github.com/tectonic-typesetting/tectonic/commit/fbb145cd079497b8c88197276f92cb89685b4d54.patch"; - hash = "sha256-6FW5MFkOWnqzYX8Eg5DfmLaEhVWKYVZwodE4SGXHKV0="; - }) - ./tectonic-0.15-fix-dangerous_implicit_autorefs.patch + cargoHash = "sha256-22Hy51zCzY2DRytcYHgwkI9+e/g52o1jy4eosvEm3KY="; + + nativeBuildInputs = [ + pkg-config ]; - cargoPatches = [ - (fetchpatch2 { - # cherry-picked from https://github.com/tectonic-typesetting/tectonic/pull/1202 - name = "1202-fix-build-with-rust-1_80-and-icu-75"; - url = "https://github.com/tectonic-typesetting/tectonic/compare/19654bf152d602995da970f6164713953cffc2e6...6b49ca8db40aaca29cb375ce75add3e575558375.patch?full_index=1"; - hash = "sha256-CgQBCFvfYKKXELnR9fMDqmdq97n514CzGJ7EBGpghJc="; - }) - ]; - - cargoHash = "sha256-OMa89riyopKMQf9E9Fr7Qs4hFfEfjnDFzaSWFtkYUXE="; - - nativeBuildInputs = [ pkg-config ]; - buildFeatures = [ "external-harfbuzz" ]; buildInputs = [ @@ -72,19 +51,68 @@ buildRustPackage (finalAttrs: { openssl ]; + # By default, tectonic looks up the latest bundle by opening this URL: + # + # https://relay.fullyjustified.net/default_bundle_v${FORMAT_VERSION}.tar + # + # Where FORMAT_VERSION is defined here: + # + # https://github.com/tectonic-typesetting/tectonic/blob/master/crates/engine_xetex/xetex/xetex_bindings.h + # + # When we updated the package, this URL redirects to the following: + # + # https://data1.fullyjustified.net/tlextras-2022.0r0.tar + # + # The environment variable set below, sets the URL that will be used during + # runtime by default. We chose to hard-code a URL to a specific version of + # the web bundle, so that upstream won't update the `default_bundle` without + # us noticing, and break compatibility with our biber-for-tectonic package. + # + # This is in principle the right thing to do, ever since the 0.16.0 release. + # As opposed to what we had with version 0.15.0, we choose to not hard-code a + # --web-bundle (or --bundle) argument in the wrapper of the + # `tectonic-wrapped` package, as it is not compatible with nextonic, and + # `tectonic -X` commands of versions 0.16.0+ -- These commands require the + # `--bundle` argument to appear after the subcommand. + # + # Lastly, we might in the future need to update the bundle URL below if + # upstream will upload a new bundle. However, upstream hasn't updated a new + # bundle for a long time, see: + # + # https://github.com/tectonic-typesetting/tectonic/issues/1269 + # + env.TECTONIC_BUNDLE_LOCKED = "https://data1.fullyjustified.net/tlextras-2022.0r0.tar"; + postInstall = '' # Makes it possible to automatically use the V2 CLI API ln -s $out/bin/tectonic $out/bin/nextonic '' - + lib.optionalString clangStdenv.hostPlatform.isLinux '' + + lib.optionalString stdenv.hostPlatform.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/ + --replace-fail Exec=tectonic Exec=$out/bin/tectonic + install -Dm644 dist/appimage/tectonic.desktop -t $out/share/applications/ + install -Dm644 dist/appimage/tectonic.svg -t $out/share/icons/hicolor/scalable/apps/ ''; + checkFlags = [ + # Test fails due to tectonic bundle missing and can't be downloaded in the + # sandbox + "--skip=tests::no_segfault_after_failed_compilation" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Test Panics only on Darwin, see: + # https://github.com/tectonic-typesetting/tectonic/issues/1352 + "--skip=v2_watch_succeeds" + ]; doCheck = true; + passthru = { + inherit (tectonic.passthru) tests; + }; + + strictDeps = true; + __structuredAttrs = true; + meta = { description = "Modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive"; homepage = "https://tectonic-typesetting.github.io/"; diff --git a/pkgs/by-name/te/tectonic-unwrapped/tectonic-0.15-fix-dangerous_implicit_autorefs.patch b/pkgs/by-name/te/tectonic-unwrapped/tectonic-0.15-fix-dangerous_implicit_autorefs.patch deleted file mode 100644 index 883c38486a71..000000000000 --- a/pkgs/by-name/te/tectonic-unwrapped/tectonic-0.15-fix-dangerous_implicit_autorefs.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/crates/engine_bibtex/src/xbuf.rs b/crates/engine_bibtex/src/xbuf.rs -index 8f3949e7..c216eb4d 100644 ---- a/crates/engine_bibtex/src/xbuf.rs -+++ b/crates/engine_bibtex/src/xbuf.rs -@@ -52,7 +52,7 @@ pub unsafe fn xrealloc_zeroed( - old: *mut [T], - new_len: usize, - ) -> Option<&'static mut [T]> { -- let old_len = (*old).len(); -+ let old_len = (&(*old)).len(); - let new_size = new_len * mem::size_of::(); - // SAFETY: realloc can be called with any size, even 0, that will just deallocate and return null - let ptr = unsafe { xrealloc(old.cast(), new_size) }.cast::(); diff --git a/pkgs/by-name/te/tectonic/package.nix b/pkgs/by-name/te/tectonic/package.nix index 0f36036bfcfb..947bed1eeacf 100644 --- a/pkgs/by-name/te/tectonic/package.nix +++ b/pkgs/by-name/te/tectonic/package.nix @@ -1,7 +1,6 @@ { lib, symlinkJoin, - tectonic, tectonic-unwrapped, biber-for-tectonic, makeBinaryWrapper, @@ -19,13 +18,6 @@ symlinkJoin { unwrapped = tectonic-unwrapped; biber = biber-for-tectonic; tests = callPackage ./tests.nix { }; - - # The version locked tectonic web bundle, redirected from: - # https://relay.fullyjustified.net/default_bundle_v33.tar - # To check for updates, see: - # https://github.com/tectonic-typesetting/tectonic/blob/master/crates/bundles/src/lib.rs - # ... and look up `get_fallback_bundle_url`. - bundleUrl = "https://data1.fullyjustified.net/tlextras-2022.0r0.tar"; }; # Replace the unwrapped tectonic with the one wrapping it with biber @@ -48,7 +40,6 @@ symlinkJoin { + '' makeWrapper ${lib.getBin tectonic-unwrapped}/bin/tectonic $out/bin/tectonic \ --prefix PATH : "${lib.getBin biber-for-tectonic}/bin" \ - --add-flags "--web-bundle ${tectonic.passthru.bundleUrl}" \ --inherit-argv0 ## make sure binary name e.g. `nextonic` is passed along ln -s $out/bin/tectonic $out/bin/nextonic ''; diff --git a/pkgs/by-name/te/tectonic/tests.nix b/pkgs/by-name/te/tectonic/tests.nix index 04c91a1235c3..cb95d18de6ff 100644 --- a/pkgs/by-name/te/tectonic/tests.nix +++ b/pkgs/by-name/te/tectonic/tests.nix @@ -94,7 +94,7 @@ lib.mapAttrs networkRequiringTestPkg { workspace = '' tectonic -X new - cat Tectonic.toml | grep "${tectonic.bundleUrl}" + cat Tectonic.toml | grep "${tectonic.unwrapped.TECTONIC_BUNDLE_LOCKED}" ''; /** diff --git a/pkgs/by-name/te/texpresso/package.nix b/pkgs/by-name/te/texpresso/package.nix index ddda76c43b6d..894dc5ea9b51 100644 --- a/pkgs/by-name/te/texpresso/package.nix +++ b/pkgs/by-name/te/texpresso/package.nix @@ -1,83 +1,84 @@ { - stdenv, lib, + stdenv, fetchFromGitHub, + + # nativeBuildInputs makeWrapper, - writeScript, + pkg-config, + writeShellScriptBin, + + # buildInputs + fontconfig, + freetype, + harfbuzz, + icu, + jbig2dec, + libjpeg, mupdf, SDL2, - re2c, - freetype, - jbig2dec, - harfbuzz, - openjpeg, - gumbo, - libjpeg, - callPackage, }: stdenv.mkDerivation (finalAttrs: { pname = "texpresso"; - version = "0.1"; + version = "0.1-unstable-2026-04-02"; src = fetchFromGitHub { owner = "let-def"; repo = "texpresso"; - tag = "v${finalAttrs.version}"; - hash = "sha256-d+wNQIysn3hdTQnHN9MJbFOIhJQ0ml6PoeuwsryntTI="; + rev = "96f008c94ece067fac8e896d0ab1808c948a4dd3"; + hash = "sha256-ew7n3Sp4uYLv5jijRW2rRM9s63TQCeFgKXmmBXdYjx4="; }; postPatch = '' substituteInPlace Makefile \ --replace-fail "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" \ --replace-fail "LDCC=g++" "LDCC=${stdenv.cc.targetPrefix}c++" + substituteInPlace src/engine/Makefile \ + --replace-fail "_CC?=gcc" "_CC?=${stdenv.cc.targetPrefix}cc" \ + --replace-fail "_LD?=g++" "_LD?=${stdenv.cc.targetPrefix}c++" \ + --replace-fail "_CXX?=g++" "_CXX?=${stdenv.cc.targetPrefix}c++" ''; + strictDeps = true; + nativeBuildInputs = [ makeWrapper - mupdf - SDL2 - re2c - freetype - jbig2dec - harfbuzz - openjpeg - gumbo - libjpeg + pkg-config + # Especially for Darwin builds, we pretend we are Linux to avoid upstream's + # makefiles from using brew. + (writeShellScriptBin "uname" "echo Linux") ]; - buildFlags = [ "texpresso" ]; + buildInputs = [ + fontconfig + freetype + harfbuzz + icu + jbig2dec + libjpeg + mupdf + SDL2 + ]; - env.NIX_CFLAGS_COMPILE = toString ( - lib.optionals stdenv.hostPlatform.isDarwin [ + buildFlags = [ + "texpresso" + "texpresso-xetex" + ]; + + env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { + NIX_CFLAGS_COMPILE = toString [ "-Wno-error=implicit-function-declaration" - ] - ); + ]; + }; installPhase = '' runHook preInstall - install -Dm0755 -t "$out/bin/" "build/texpresso" + install -D -t "$out/bin/" "build/texpresso" + install -D -t "$out/bin/" "build/texpresso-xetex" runHook postInstall ''; - # needs to have texpresso-tonic on its path - postInstall = '' - wrapProgram $out/bin/texpresso \ - --prefix PATH : ${lib.makeBinPath [ finalAttrs.finalPackage.passthru.tectonic ]} - ''; - - passthru = { - tectonic = callPackage ./tectonic.nix { }; - 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 texpresso - nix-update --version=branch=$tectonic_version texpresso.tectonic - ''; - }; - meta = { inherit (finalAttrs.src.meta) homepage; description = "Live rendering and error reporting for LaTeX"; diff --git a/pkgs/by-name/te/texpresso/tectonic.nix b/pkgs/by-name/te/texpresso/tectonic.nix deleted file mode 100644 index fe04d15191d7..000000000000 --- a/pkgs/by-name/te/texpresso/tectonic.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - tectonic-unwrapped, - fetchFromGitHub, - rustPlatform, -}: - -tectonic-unwrapped.overrideAttrs ( - finalAttrs: prevAttrs: { - pname = "texpresso-tonic"; - version = "0.15.0-unstable-2024-04-19"; - src = fetchFromGitHub { - owner = "let-def"; - repo = "tectonic"; - rev = "b38cb3b2529bba947d520ac29fbb7873409bd270"; - hash = "sha256-ap7fEPHsASAphIQkjcvk1CC7egTdxaUh7IpSS5os4W8="; - fetchSubmodules = true; - }; - - cargoHash = "sha256-mqhbIv5r/5EDRDfP2BymXv9se2NCKxzRGqNqwqbD9A0="; - # rebuild cargoDeps by hand because `.overrideAttrs cargoHash` - # does not reconstruct cargoDeps (a known limitation): - cargoDeps = rustPlatform.fetchCargoVendor { - inherit (finalAttrs) src; - name = "${finalAttrs.pname}-${finalAttrs.version}"; - hash = finalAttrs.cargoHash; - patches = finalAttrs.cargoPatches; - }; - # binary has a different name, bundled tests won't work - doCheck = false; - postInstall = '' - ${prevAttrs.postInstall or ""} - - # Remove the broken `nextonic` symlink - # It points to `tectonic`, which doesn't exist because the exe is - # renamed to texpresso-tonic - rm $out/bin/nextonic - ''; - meta = prevAttrs.meta // { - mainProgram = "texpresso-tonic"; - }; - } -)