-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
fetchFromGitHub, | ||
gitUpdater, | ||
pnpm, | ||
makeWrapper, | ||
nodejs, | ||
}: | ||
|
||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "etherpad-lite"; | ||
version = "2.2.6"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "ether"; | ||
repo = "etherpad-lite"; | ||
rev = "v${finalAttrs.version}"; | ||
hash = "sha256-B//EwfXS0BXxkksvB1EZZaZuPuruTZ3FySj9B5y0iBw="; | ||
}; | ||
|
||
pnpmDeps = pnpm.fetchDeps { | ||
inherit (finalAttrs) pname version src; | ||
hash = "sha256-IdnlJmjgOMR04WwAEabepD4DWJyXii7XzS5v27Y1LHY="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
pnpm.configHook | ||
makeWrapper | ||
]; | ||
|
||
buildInputs = [ | ||
nodejs | ||
]; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
NODE_ENV="production" pnpm run build:etherpad | ||
runHook postBuild | ||
''; | ||
|
||
# Upstream scripts uses `pnpm run prod` which is equivalent to | ||
# `cross-env NODE_ENV=production node --require tsx/cjs node/server.ts` | ||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/{lib,bin} | ||
cp -r node_modules ui src doc admin $out/lib | ||
makeWrapper ${lib.getExe nodejs} $out/bin/etherpad-lite \ | ||
--inherit-argv0 \ | ||
--add-flags "--require tsx/cjs $out/lib/node_modules/ep_etherpad-lite/node/server.ts" \ | ||
--set NODE_PATH "$out/lib/node_modules/ep_etherpad-lite/node_modules" \ | ||
--set-default NODE_ENV production | ||
runHook postInstall | ||
''; | ||
|
||
passthru.updateScript = gitUpdater { }; | ||
|
||
meta = with lib; { | ||
description = "A modern really-real-time collaborative document editor."; | ||
longDescription = '' | ||
Etherpad is a real-time collaborative editor scalable to thousands of simultaneous real time users. | ||
It provides full data export capabilities, and runs on your server, under your control. | ||
''; | ||
homepage = "https://etherpad.org/"; | ||
changelog = "https://github.com/ether/etherpad-lite/blob/${finalAttrs.src.rev}/CHANGELOG.md"; | ||
maintainers = with maintainers; [ erdnaxe ]; | ||
license = licenses.asl20; | ||
mainProgram = "etherpad-lite"; | ||
platforms = lib.platforms.unix; | ||
}; | ||
}) |