Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tectonic, tectonic-unwrapped, texpresso: fix build & clean up #384706

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
38 changes: 19 additions & 19 deletions pkgs/by-name/te/tectonic-unwrapped/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

{
lib,
stdenv,
clangStdenv,
fetchFromGitHub,
rustPlatform,
darwin,
fontconfig,
harfbuzzFull,
openssl,
Expand All @@ -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";

Expand Down Expand Up @@ -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/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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 (
Expand All @@ -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
Expand All @@ -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;
};
}
})
42 changes: 42 additions & 0 deletions pkgs/by-name/te/texpresso/tectonic.nix
Original file line number Diff line number Diff line change
@@ -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";
};
}
)
33 changes: 0 additions & 33 deletions pkgs/tools/typesetting/tex/texpresso/tectonic.nix

This file was deleted.

4 changes: 0 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10623,10 +10623,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 { };
Expand Down