diff --git a/pkgs/tools/typesetting/tex/texpresso/default.nix b/pkgs/tools/typesetting/tex/texpresso/default.nix new file mode 100644 index 000000000000..f057b411219c --- /dev/null +++ b/pkgs/tools/typesetting/tex/texpresso/default.nix @@ -0,0 +1,74 @@ +{ stdenv +, lib +, fetchFromGitHub +, makeWrapper +, writeScript +, mupdf +, SDL2 +, re2c +, freetype +, jbig2dec +, harfbuzz +, openjpeg +, gumbo +, libjpeg +, texpresso-tectonic +}: + +stdenv.mkDerivation rec { + pname = "texpresso"; + version = "0-unstable-2024-03-24"; + + nativeBuildInputs = [ + makeWrapper + mupdf + SDL2 + re2c + freetype + jbig2dec + harfbuzz + openjpeg + gumbo + libjpeg + ]; + + src = fetchFromGitHub { + owner = "let-def"; + repo = "texpresso"; + rev = "08d4ae8632ef0da349595310d87ac01e70f2c6ae"; + hash = "sha256-a0yBVtLfmE0oTl599FXp7A10JoiKusofLSeXigx4GvA="; + }; + + buildFlags = [ "texpresso" ]; + + installPhase = '' + runHook preInstall + install -Dm0755 -t "$out/bin/" "build/${pname}" + runHook postInstall + ''; + + # needs to have texpresso-tonic on its path + postInstall = '' + wrapProgram $out/bin/texpresso \ + --prefix PATH : ${lib.makeBinPath [ texpresso-tectonic ]} + ''; + + passthru = { + tectonic = texpresso-tectonic; + 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 --version=branch texpresso + nix-update --version=branch=$tectonic_version texpresso.tectonic + ''; + }; + + meta = { + inherit (src.meta) homepage; + description = "Live rendering and error reporting for LaTeX."; + maintainers = with lib.maintainers; [ nickhu ]; + license = lib.licenses.mit; + }; +} diff --git a/pkgs/tools/typesetting/tex/texpresso/tectonic.nix b/pkgs/tools/typesetting/tex/texpresso/tectonic.nix new file mode 100644 index 000000000000..76c4cb71b6ee --- /dev/null +++ b/pkgs/tools/typesetting/tex/texpresso/tectonic.nix @@ -0,0 +1,19 @@ +{ 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 = "a6d47e45cd610b271a1428898c76722e26653667"; + hash = "sha256-CDky1NdSQoXpTVDQ7sJWjcx3fdsBclO9Eun/70iClcI="; + fetchSubmodules = true; + }; + cargoHash = "sha256-M4XYjBK2MN4bOrk2zTSyuixmAjZ0t6IYI/MlYWrmkIk="; + # binary has a different name, bundled tests won't work + doCheck = false; + meta.mainProgram = "texpresso-tonic"; + }); + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1b026907c960..5d065c8cb599 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24867,6 +24867,10 @@ with pkgs; tet = callPackage ../development/tools/misc/tet { }; + texpresso = callPackage ../tools/typesetting/tex/texpresso { + texpresso-tectonic = callPackage ../tools/typesetting/tex/texpresso/tectonic.nix { }; + }; + text-engine = callPackage ../development/libraries/text-engine { }; the-foundation = callPackage ../development/libraries/the-foundation { };