From 84be33e6de9a2fc67e62219485a0315809dc6a8d Mon Sep 17 00:00:00 2001 From: phanirithvij Date: Thu, 4 Jun 2026 11:04:25 +0530 Subject: [PATCH] texlyre: init at 0.8.0 Co-Authored-By: blokyk Co-Authored-By: eljamm Signed-off-by: phanirithvij --- pkgs/by-name/te/texlyre/package.nix | 90 +++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 pkgs/by-name/te/texlyre/package.nix diff --git a/pkgs/by-name/te/texlyre/package.nix b/pkgs/by-name/te/texlyre/package.nix new file mode 100644 index 000000000000..19a77b0f8cfe --- /dev/null +++ b/pkgs/by-name/te/texlyre/package.nix @@ -0,0 +1,90 @@ +{ + lib, + xsel, + serve, + fetchzip, + makeWrapper, + buildNpmPackage, + fetchFromGitHub, + + baseUrl ? "/", +}: + +buildNpmPackage (finalAttrs: { + pname = "texlyre"; + version = "0.8.0"; + + src = fetchFromGitHub { + owner = "TeXlyre"; + repo = "texlyre"; + tag = "v${finalAttrs.version}"; + hash = "sha256-aBGhTJS/UDcWOhzP4HtIQO5ZjNGXTj3oPLje65HIhe4="; + }; + + npmDepsHash = "sha256-davqKXgSwjPM0QQ/moo5sjh7e9wVXjH30SrFC4opmuQ="; + + postPatch = '' + sed -i 's/"version": ".*"/"version": "${finalAttrs.version}"/' package.json + + substituteInPlace texlyre.config.ts \ + --replace-fail "baseUrl: '/texlyre/'" "baseUrl: '${baseUrl}'" + + # disable downloading assets + substituteInPlace scripts/setup-assets.cjs \ + --replace-fail "await downloadCoreAssets();" "" + ''; + + nativeBuildInputs = [ makeWrapper ]; + + __structuredAttrs = true; + + preBuild = '' + # put core assets in place + mkdir -p public/core + cp -r ${finalAttrs.passthru.drawioEmbed}/drawio-embed public/core/drawio-embed + cp -r ${finalAttrs.passthru.busytexAssets} public/core/busytex + + npm run generate:configs + ''; + + doCheck = true; + checkPhase = '' + runHook preCheck + npm run test:check + runHook postCheck + ''; + + installPhase = '' + runHook preInstall + mv dist $out + runHook postInstall + ''; + + postFixup = '' + makeWrapper ${lib.getExe serve} $out/bin/texlyre \ + --prefix PATH : ${lib.makeBinPath [ xsel ]} \ + --chdir $out + ''; + + passthru = { + drawioEmbed = fetchzip { + url = "https://github.com/TeXlyre/drawio-embed-mirror/archive/refs/tags/v29.7.9.zip"; + hash = "sha256-mj+i+6n14Koo9TYaygrCgFg0OLfBZnnL6rE3PkJGa9w="; + }; + busytexAssets = fetchzip { + url = "https://github.com/TeXlyre/texlyre-busytex/releases/download/assets-v1.1.1/busytex-assets.tar.gz"; + hash = "sha256-CLhLYLNXsJflX6o642EEJu+hxwoy3zkzfAOShiZGVPg="; + stripRoot = false; + }; + }; + + meta = { + changelog = "https://github.com/TeXlyre/texlyre/releases/tag/${finalAttrs.src.rev}"; + description = "Local-first LaTeX & Typst web editor with real-time collaboration & offline support"; + homepage = "https://github.com/TeXlyre/texlyre"; + license = lib.licenses.agpl3Only; + platforms = lib.platforms.all; + mainProgram = "texlyre"; + teams = with lib.teams; [ ngi ]; + }; +})