2024-04-18 16:56:19 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
|
|
|
|
|
|
|
, buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
2024-07-02 18:22:04 +00:00
|
|
|
, fetchzip
|
2024-04-18 16:56:19 +00:00
|
|
|
|
|
|
|
, nodejs
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
, withOnlyOffice ? true
|
|
|
|
}: let
|
|
|
|
onlyOfficeVersions = {
|
|
|
|
v1 = {
|
|
|
|
rev = "4f370bebe96e3a0d4054df87412ee5b2c6ed8aaa";
|
|
|
|
hash = "sha256-TE/99qOx4wT2s0op9wi+SHwqTPYq/H+a9Uus9Zj4iSY=";
|
|
|
|
};
|
|
|
|
v2b = {
|
|
|
|
rev = "d9da72fda95daf93b90ffa345757c47eb5b919dd";
|
|
|
|
hash = "sha256-SiRDRc2vnLwCVnvtk+C8PKw7IeuSzHBaJmZHogRe3hQ=";
|
|
|
|
};
|
|
|
|
v4 = {
|
|
|
|
rev = "6ebc6938b6841440ffad2efc1e23f1dc1ceda964";
|
|
|
|
hash = "sha256-eto1+8Tk/s3kbUCpbUh8qCS8EOq700FYG1/KiHyynaA=";
|
|
|
|
};
|
|
|
|
v5 = {
|
|
|
|
rev = "88a356f08ded2f0f4620bda66951caf1d7f02c21";
|
|
|
|
hash = "sha256-8j1rlAyHlKx6oAs2pIhjPKcGhJFj6ZzahOcgenyeOCc=";
|
|
|
|
};
|
|
|
|
v6 = {
|
|
|
|
rev = "abd8a309f6dd37289f950cd8cea40df4492d8a15";
|
|
|
|
hash = "sha256-BZdExj2q/bqUD3k9uluOot2dlrWKA+vpad49EdgXKww=";
|
|
|
|
};
|
|
|
|
v7 = {
|
2024-07-26 14:42:20 +00:00
|
|
|
rev = "e1267803ea749cd93e9d5f81438011ea620d04af";
|
|
|
|
hash = "sha256-iIds0GnCHAyeIEdSD4aCCgDtnnwARh3NE470CywseS0=";
|
2024-04-18 16:56:19 +00:00
|
|
|
};
|
2022-05-06 15:34:30 +00:00
|
|
|
};
|
2024-04-18 16:56:19 +00:00
|
|
|
mkOnlyOffice = {
|
|
|
|
pname, version
|
|
|
|
}: stdenvNoCC.mkDerivation (final: {
|
|
|
|
pname = "${pname}-onlyoffice";
|
|
|
|
inherit version;
|
|
|
|
|
2024-07-02 18:22:04 +00:00
|
|
|
x2t = let
|
|
|
|
version = "v7.3+1";
|
|
|
|
in fetchzip {
|
|
|
|
url = "https://github.com/cryptpad/onlyoffice-x2t-wasm/releases/download/${version}/x2t.zip";
|
|
|
|
hash = "sha256-d5raecsTOflo0UpjSEZW5lker4+wdkTb6IyHNq5iBg8=";
|
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
srcs = lib.mapAttrsToList (version: { rev, hash ? lib.fakeHash }: fetchFromGitHub {
|
|
|
|
name = "${final.pname}-${version}-source";
|
|
|
|
owner = "cryptpad";
|
|
|
|
repo = "onlyoffice-builds";
|
|
|
|
inherit rev hash;
|
|
|
|
}) onlyOfficeVersions;
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
2022-05-06 15:34:30 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2024-04-18 16:56:19 +00:00
|
|
|
mkdir -p $out
|
|
|
|
${lib.concatLines (map
|
|
|
|
(version: "cp -Tr ${final.pname}-${version}-source $out/${version}")
|
|
|
|
(builtins.attrNames onlyOfficeVersions)
|
|
|
|
)}
|
2024-07-02 18:22:04 +00:00
|
|
|
cp -Tr $x2t $out/x2t
|
2024-04-18 16:56:19 +00:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
in buildNpmPackage rec {
|
|
|
|
pname = "cryptpad";
|
2024-10-02 15:49:26 +00:00
|
|
|
version = "2024.9.0";
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cryptpad";
|
|
|
|
repo = "cryptpad";
|
|
|
|
rev = version;
|
2024-10-02 15:49:26 +00:00
|
|
|
hash = "sha256-OUtWaDVLRUbKS0apwY0aNq4MalGFv+fH9VA7LvWWYRs=";
|
2024-04-18 16:56:19 +00:00
|
|
|
};
|
2022-05-10 13:17:55 +00:00
|
|
|
|
2024-10-02 15:49:26 +00:00
|
|
|
npmDepsHash = "sha256-pK0b7q1kJja9l8ANwudbfo3jpldwuO56kuulS8X9A5s=";
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
inherit nodejs;
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
onlyOffice = lib.optional withOnlyOffice (mkOnlyOffice {
|
|
|
|
inherit pname version;
|
|
|
|
});
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
makeCacheWritable = true;
|
|
|
|
dontFixup = true;
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
preBuild = ''
|
|
|
|
npm run install:components
|
|
|
|
'' + lib.optionalString withOnlyOffice ''
|
|
|
|
ln -s $onlyOffice www/common/onlyoffice/dist
|
|
|
|
'';
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
postBuild = ''
|
|
|
|
rm -rf customize
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R . $out/
|
2022-05-06 15:34:30 +00:00
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
substituteInPlace $out/lib/workers/index.js \
|
|
|
|
--replace-warn "lib/workers/db-worker" "$out/lib/workers/db-worker"
|
|
|
|
|
|
|
|
makeWrapper ${lib.getExe nodejs} $out/bin/cryptpad-server \
|
|
|
|
--chdir $out \
|
|
|
|
--add-flags server.js
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2024-07-02 18:22:04 +00:00
|
|
|
passthru = {
|
|
|
|
inherit onlyOffice;
|
|
|
|
};
|
|
|
|
|
2024-04-18 16:56:19 +00:00
|
|
|
meta = {
|
2024-05-23 20:22:07 +00:00
|
|
|
description = "Collaborative office suite, end-to-end encrypted and open-source.";
|
2024-04-18 16:56:19 +00:00
|
|
|
homepage = "https://cryptpad.org";
|
2024-05-23 20:22:07 +00:00
|
|
|
changelog = "https://github.com/cryptpad/cryptpad/releases/tag/${version}";
|
|
|
|
license = lib.licenses.agpl3Plus;
|
|
|
|
platforms = lib.platforms.all;
|
2024-04-18 16:56:19 +00:00
|
|
|
mainProgram = "cryptpad-server";
|
|
|
|
};
|
|
|
|
}
|