texlyre: init at 0.9.0 (#527886)

This commit is contained in:
Ivan Mincik
2026-06-29 12:05:22 +00:00
committed by GitHub
2 changed files with 126 additions and 0 deletions
+107
View File
@@ -0,0 +1,107 @@
{
lib,
xsel,
serve,
fetchzip,
stdenvNoCC,
makeWrapper,
buildNpmPackage,
fetchFromGitHub,
baseUrl ? "/",
}:
buildNpmPackage (finalAttrs: {
pname = "texlyre";
version = "0.9.0";
src = fetchFromGitHub {
owner = "TeXlyre";
repo = "texlyre";
tag = "v${finalAttrs.version}";
hash = "sha256-sUyQYtTuE5bNEqxDw9DYT0KRiww7PmGnQ7CYt60EbSc=";
};
npmDepsHash = "sha256-bOhK7kQWY3QYri9S+WoD8VyZXTGK5gcK/ixpGeeP4hg=";
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 = {
updateScript = ./update.sh;
drawioEmbed = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "drawio-embed";
version = "30.2.2";
src = fetchFromGitHub {
owner = "TeXlyre";
repo = "drawio-embed-mirror";
tag = "v${finalAttrs.version}";
hash = "sha256-bdOhviJl0P/+GSJKaHMbGoPf+uEhoX5GeyY6bGBOpCg=";
};
dontBuild = true;
installPhase = "cp -a . $out";
});
busytexAssets = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "busytex-assets";
version = "1.1.1";
src = fetchFromGitHub {
owner = "TeXlyre";
repo = "texlyre-busytex";
tag = "assets-v${finalAttrs.version}";
hash = "sha256-vlLoJw5EX6x3nTQvBC8hntDa5QKtY46eJSxJLJzs4EE=";
};
dontBuild = true;
installPhase = "cp -a . $out";
});
};
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 ];
};
})
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix-update jq gitMinimal
set -euo pipefail
nix-update texlyre
PKG_DIR=$(realpath "$(dirname "$0")")
NIXPKGS_ROOT="$(git rev-parse --show-toplevel)"
SRC_DIR=$(nix-build -E "(import \"$NIXPKGS_ROOT\" {}).texlyre.src" --no-out-link)
ASSETS_SCRIPT="$SRC_DIR/scripts/download-core-assets.cjs"
DRAWIO_VERSION=$(grep -A 2 "name: 'drawio-embed'" "$ASSETS_SCRIPT" | grep "version:" | cut -d "'" -f 2 | sed 's/^v//')
BUSYTEX_VERSION=$(grep -A 2 "name: 'texlyre-busytex'" "$ASSETS_SCRIPT" | grep "version:" | cut -d "'" -f 2 | sed 's/^v//')
echo "Updating: drawio-embed=$DRAWIO_VERSION, busytex=$BUSYTEX_VERSION"
nix-update texlyre.passthru.drawioEmbed --version "$DRAWIO_VERSION"
nix-update texlyre.passthru.busytexAssets --version "$BUSYTEX_VERSION"