diff --git a/pkgs/by-name/te/tectonic-unwrapped/package.nix b/pkgs/by-name/te/tectonic-unwrapped/package.nix index e9b9dcb2c815..50d64c8416e1 100644 --- a/pkgs/by-name/te/tectonic-unwrapped/package.nix +++ b/pkgs/by-name/te/tectonic-unwrapped/package.nix @@ -8,10 +8,9 @@ { lib, - stdenv, + clangStdenv, fetchFromGitHub, rustPlatform, - darwin, fontconfig, harfbuzzFull, openssl, @@ -20,7 +19,17 @@ fetchpatch2, }: -rustPlatform.buildRustPackage rec { +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 rec { pname = "tectonic"; version = "0.15.0"; @@ -56,28 +65,19 @@ rustPlatform.buildRustPackage rec { buildFeatures = [ "external-harfbuzz" ]; - buildInputs = - [ - icu - fontconfig - harfbuzzFull - openssl - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin ( - with darwin.apple_sdk.frameworks; - [ - ApplicationServices - Cocoa - Foundation - ] - ); + buildInputs = [ + icu + fontconfig + harfbuzzFull + openssl + ]; postInstall = '' # Makes it possible to automatically use the V2 CLI API ln -s $out/bin/tectonic $out/bin/nextonic '' - + lib.optionalString stdenv.hostPlatform.isLinux '' + + lib.optionalString clangStdenv.hostPlatform.isLinux '' substituteInPlace dist/appimage/tectonic.desktop \ --replace Exec=tectonic Exec=$out/bin/tectonic install -D dist/appimage/tectonic.desktop -t $out/share/applications/ diff --git a/pkgs/tools/typesetting/tex/texpresso/default.nix b/pkgs/by-name/te/texpresso/package.nix similarity index 85% rename from pkgs/tools/typesetting/tex/texpresso/default.nix rename to pkgs/by-name/te/texpresso/package.nix index 17f27483b7a6..ab4c11d7e980 100644 --- a/pkgs/tools/typesetting/tex/texpresso/default.nix +++ b/pkgs/by-name/te/texpresso/package.nix @@ -13,13 +13,20 @@ openjpeg, gumbo, libjpeg, - texpresso-tectonic, + callPackage, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "texpresso"; version = "0-unstable-2025-01-29"; + src = fetchFromGitHub { + owner = "let-def"; + repo = "texpresso"; + rev = "c42a5912f501f180984840fa8adf9ffc09c5ac13"; + hash = "sha256-T/vou7OcGtNoodCrznmjBLxg6ZAFDCjhpYgNyZaf44g="; + }; + postPatch = '' substituteInPlace Makefile \ --replace-fail "CC=gcc" "CC=${stdenv.cc.targetPrefix}cc" \ @@ -39,13 +46,6 @@ stdenv.mkDerivation rec { libjpeg ]; - src = fetchFromGitHub { - owner = "let-def"; - repo = "texpresso"; - rev = "c42a5912f501f180984840fa8adf9ffc09c5ac13"; - hash = "sha256-T/vou7OcGtNoodCrznmjBLxg6ZAFDCjhpYgNyZaf44g="; - }; - buildFlags = [ "texpresso" ]; env.NIX_CFLAGS_COMPILE = toString ( @@ -56,18 +56,18 @@ stdenv.mkDerivation rec { installPhase = '' runHook preInstall - install -Dm0755 -t "$out/bin/" "build/${pname}" + install -Dm0755 -t "$out/bin/" "build/${finalAttrs.pname}" runHook postInstall ''; # needs to have texpresso-tonic on its path postInstall = '' wrapProgram $out/bin/texpresso \ - --prefix PATH : ${lib.makeBinPath [ texpresso-tectonic ]} + --prefix PATH : ${lib.makeBinPath [ finalAttrs.finalPackage.passthru.tectonic ]} ''; passthru = { - tectonic = texpresso-tectonic; + tectonic = callPackage ./tectonic.nix { }; updateScript = writeScript "update-texpresso" '' #!/usr/bin/env nix-shell #!nix-shell -i bash -p curl jq nix-update @@ -79,10 +79,10 @@ stdenv.mkDerivation rec { }; meta = { - inherit (src.meta) homepage; + inherit (finalAttrs.src.meta) homepage; description = "Live rendering and error reporting for LaTeX"; maintainers = with lib.maintainers; [ nickhu ]; license = lib.licenses.mit; platforms = lib.platforms.unix; }; -} +}) diff --git a/pkgs/by-name/te/texpresso/tectonic.nix b/pkgs/by-name/te/texpresso/tectonic.nix new file mode 100644 index 000000000000..515fc53cf3cb --- /dev/null +++ b/pkgs/by-name/te/texpresso/tectonic.nix @@ -0,0 +1,42 @@ +{ + 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; + }; + useFetchCargoVendor = 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"; + }; + } +) diff --git a/pkgs/tools/typesetting/tex/texpresso/tectonic.nix b/pkgs/tools/typesetting/tex/texpresso/tectonic.nix deleted file mode 100644 index f5550e2a8c82..000000000000 --- a/pkgs/tools/typesetting/tex/texpresso/tectonic.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ tectonic-unwrapped, fetchFromGitHub }: -tectonic-unwrapped.override (old: { - rustPlatform = old.rustPlatform // { - buildRustPackage = - args: - old.rustPlatform.buildRustPackage ( - args - // { - pname = "texpresso-tonic"; - src = fetchFromGitHub { - owner = "let-def"; - repo = "tectonic"; - rev = "b38cb3b2529bba947d520ac29fbb7873409bd270"; - hash = "sha256-ap7fEPHsASAphIQkjcvk1CC7egTdxaUh7IpSS5os4W8="; - fetchSubmodules = true; - }; - useFetchCargoVendor = true; - cargoHash = "sha256-mqhbIv5r/5EDRDfP2BymXv9se2NCKxzRGqNqwqbD9A0="; - # binary has a different name, bundled tests won't work - doCheck = false; - postInstall = '' - ${args.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.mainProgram = "texpresso-tonic"; - } - ); - }; -}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a0255e34a29f..640b52bebbee 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10625,10 +10625,6 @@ with pkgs; fmt = fmt_11; }; - texpresso = callPackage ../tools/typesetting/tex/texpresso { - texpresso-tectonic = callPackage ../tools/typesetting/tex/texpresso/tectonic.nix { }; - }; - tinyxml = tinyxml2; tinyxml2 = callPackage ../development/libraries/tinyxml/2.6.2.nix { };