etherpad-lite: init at 2.3.0

same as #353814, but newer version

Isa 9ef6ff72 b08e86e1

+166
+19
pkgs/by-name/et/etherpad-lite/dont-fail-on-plugins-json.patch
··· 1 + diff --git a/src/static/js/pluginfw/installer.ts b/src/static/js/pluginfw/installer.ts 2 + index c605378e1..27e3e487b 100644 3 + --- a/src/static/js/pluginfw/installer.ts 4 + +++ b/src/static/js/pluginfw/installer.ts 5 + @@ -83,7 +83,13 @@ export const checkForMigration = async () => { 6 + try { 7 + await fs.access(installedPluginsPath, fs.constants.F_OK); 8 + } catch (err) { 9 + - await migratePluginsFromNodeModules(); 10 + + logger.info(`${installedPluginsPath} not found, creating using current node modules`); 11 + + try { 12 + + await migratePluginsFromNodeModules(); 13 + + } catch (err2) { 14 + + logger.warn(`unable to create ${installedPluginsPath}, skipping plugin migrations`); 15 + + return; 16 + + } 17 + } 18 + 19 + /*
+51
pkgs/by-name/et/etherpad-lite/outdir.patch
··· 1 + From e881a383b38d4d80ee28c17a14b5de58889245de Mon Sep 17 00:00:00 2001 2 + From: Alexandre Iooss <erdnaxe@crans.org> 3 + Date: Tue, 5 Nov 2024 16:30:33 +0100 4 + Subject: [PATCH] Use temporary directory for esbuild 5 + 6 + --- 7 + src/node/hooks/express/specialpages.ts | 11 +++++------ 8 + 9 + diff --git a/src/node/hooks/express/specialpages.ts b/src/node/hooks/express/specialpages.ts 10 + index 2e26eaa0cee..31d5138e67c 100644 11 + --- a/src/node/hooks/express/specialpages.ts 12 + +++ b/src/node/hooks/express/specialpages.ts 13 + @@ -3,6 +3,7 @@ 14 + import path from 'node:path'; 15 + const eejs = require('../../eejs') 16 + import fs from 'node:fs'; 17 + +import os from 'node:os'; 18 + const fsp = fs.promises; 19 + const toolbar = require('../../utils/toolbar'); 20 + const hooks = require('../../../static/js/pluginfw/hooks'); 21 + @@ -89,7 +90,7 @@ const convertTypescript = (content: string) => { 22 + const outputRaw = buildSync({ 23 + stdin: { 24 + contents: content, 25 + - resolveDir: path.join(settings.root, 'var','js'), 26 + + resolveDir: settings.root, 27 + loader: 'js' 28 + }, 29 + alias:{ 30 + @@ -222,7 +223,7 @@ const convertTypescriptWatched = (content: string, cb: (output:string, hash: str 31 + build({ 32 + stdin: { 33 + contents: content, 34 + - resolveDir: path.join(settings.root, 'var','js'), 35 + + resolveDir: settings.root, 36 + loader: 'js' 37 + }, 38 + alias:{ 39 + @@ -276,10 +277,8 @@ exports.expressCreateServer = async (hookName: string, args: ArgsExpressType, cb 40 + settings, 41 + }) 42 + 43 + - 44 + - 45 + - const outdir = path.join(settings.root, 'var','js') 46 + - // Create the outdir if it doesn't exist 47 + + // Create a temporary directory to store runtime-built JS files 48 + + const outdir = path.join(os.tmpdir(), 'js'); 49 + if (!fs.existsSync(outdir)) { 50 + fs.mkdirSync(outdir); 51 + }
+96
pkgs/by-name/et/etherpad-lite/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + nix-update-script, 6 + pnpm_9, 7 + makeWrapper, 8 + nodejs, 9 + }: 10 + 11 + let 12 + pnpm = pnpm_9; 13 + in 14 + stdenv.mkDerivation (finalAttrs: { 15 + pname = "etherpad-lite"; 16 + version = "2.3.0"; 17 + 18 + src = fetchFromGitHub { 19 + owner = "ether"; 20 + repo = "etherpad-lite"; 21 + tag = "v${finalAttrs.version}"; 22 + hash = "sha256-OomZ1oziEGgLJfYyfkHZOPRHfrrWc4XLAsZA4cn0btA="; 23 + }; 24 + 25 + patches = [ 26 + ./outdir.patch 27 + # etherpad expects to read and write $out/lib/var/installed_plugins.json 28 + # FIXME: this patch disables plugin support 29 + ./dont-fail-on-plugins-json.patch 30 + ]; 31 + 32 + pnpmDeps = pnpm.fetchDeps { 33 + inherit (finalAttrs) pname version src; 34 + hash = "sha256-nhiPopGLCeCHiqEQ3solwuLwkDnHTH3otbxIJmbuQAA="; 35 + }; 36 + 37 + nativeBuildInputs = [ 38 + pnpm.configHook 39 + makeWrapper 40 + ]; 41 + 42 + buildInputs = [ 43 + nodejs 44 + ]; 45 + 46 + buildPhase = '' 47 + runHook preBuild 48 + NODE_ENV="production" pnpm run build:etherpad 49 + runHook postBuild 50 + ''; 51 + 52 + preInstall = '' 53 + # remove unnecessary files 54 + rm node_modules/.modules.yaml 55 + pnpm prune --prod --ignore-scripts 56 + find -type f \( -name "*.d.ts" -o -name "*.map" \) -exec rm -rf {} + 57 + 58 + # remove non-deterministic files 59 + rm node_modules/.modules.yaml 60 + ''; 61 + 62 + # Upstream scripts uses `pnpm run prod` which is equivalent to 63 + # `cross-env NODE_ENV=production node --require tsx/cjs node/server.ts` 64 + installPhase = '' 65 + runHook preInstall 66 + mkdir -p $out/{lib/etherpad-lite,bin} 67 + cp -r node_modules ui src doc admin $out/lib/etherpad-lite 68 + makeWrapper ${lib.getExe nodejs} $out/bin/etherpad-lite \ 69 + --inherit-argv0 \ 70 + --add-flags "--require tsx/cjs $out/lib/etherpad-lite/node_modules/ep_etherpad-lite/node/server.ts" \ 71 + --suffix PATH : "${lib.makeBinPath [ pnpm ]}" \ 72 + --set NODE_PATH "$out/lib/node_modules:$out/lib/etherpad-lite/node_modules/ep_etherpad-lite/node_modules" \ 73 + --set-default NODE_ENV production 74 + find $out/lib -xtype l -delete 75 + runHook postInstall 76 + ''; 77 + 78 + passthru.updateScript = nix-update-script { }; 79 + 80 + meta = { 81 + description = "Modern really-real-time collaborative document editor"; 82 + longDescription = '' 83 + Etherpad is a real-time collaborative editor scalable to thousands of simultaneous real time users. 84 + It provides full data export capabilities, and runs on your server, under your control. 85 + ''; 86 + homepage = "https://etherpad.org/"; 87 + changelog = "https://github.com/ether/etherpad-lite/blob/${finalAttrs.src.rev}/CHANGELOG.md"; 88 + maintainers = with lib.maintainers; [ 89 + erdnaxe 90 + f2k1de 91 + ]; 92 + license = lib.licenses.asl20; 93 + mainProgram = "etherpad-lite"; 94 + platforms = lib.platforms.unix; 95 + }; 96 + })