From 8cd2f72926293a8bca1b42fe7bccb2b9e61740d1 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 10 May 2022 15:17:55 +0200 Subject: [PATCH] Working cryptpad --- app/cryptpad/build/common.nix | 6 ++-- app/cryptpad/build/default.nix | 21 +++++++----- app/cryptpad/build/docker.nix | 2 +- app/cryptpad/config/application_config.js | 40 +++++++++++++++++++++++ app/cryptpad/config/config.js | 8 ++--- app/cryptpad/deploy/cryptpad.hcl | 39 ++++++++++------------ 6 files changed, 78 insertions(+), 38 deletions(-) create mode 100644 app/cryptpad/config/application_config.js diff --git a/app/cryptpad/build/common.nix b/app/cryptpad/build/common.nix index 980e821..957d381 100644 --- a/app/cryptpad/build/common.nix +++ b/app/cryptpad/build/common.nix @@ -1,6 +1,6 @@ rec { - cryptpadVersion = "4.14.1"; - cryptpadCommit = "5979aafdee90aab232658374b11aca8331fd0421"; + cryptpadVersion = "4.14.1+2"; + cryptpadCommit = "18c371bb5bda068a5d962dd7c4f0726320eea5e9"; pkgsSrc = fetchTarball { # Latest commit on https://github.com/NixOS/nixpkgs/tree/nixos-21.11 @@ -9,7 +9,7 @@ rec { sha256 = "sha256:1d7zg96xw4qsqh7c89pgha9wkq3rbi9as3k3d88jlxy2z0ns0cy2"; }; cryptpadSrc = builtins.fetchGit { - url = "https://github.com/xwiki-labs/cryptpad"; + url = "https://github.com/superboum/cryptpad"; ref = "refs/tags/${cryptpadVersion}"; rev = cryptpadCommit; }; diff --git a/app/cryptpad/build/default.nix b/app/cryptpad/build/default.nix index 7e31110..f0a5c00 100644 --- a/app/cryptpad/build/default.nix +++ b/app/cryptpad/build/default.nix @@ -39,30 +39,35 @@ in find node_modules -type f ! -path 'node_modules/gar/*' -executable -print | tee >(xargs -n 20 rm) # Remove only office that IS BIG - rm -rf www/common/onlyoffice + # COMMENTED as it is not as easy as planned. + # rm -rf www/common/onlyoffice ''; installPhase = '' mkdir -p $out/{bin,opt} + out_cryptpad=$out/opt/ + # copy the source code - cp -r .bowerrc bower.json package.json package-lock.json customize.dist lib server.js www $out/opt/ + cp -r .bowerrc bower.json package.json package-lock.json customize.dist lib server.js www $out_cryptpad # mount node_modules - cp -r node_modules $out/opt/node_modules + cp -r node_modules $out_cryptpad/node_modules + # patch + substituteInPlace $out_cryptpad/lib/workers/index.js --replace "lib/workers/db-worker" "$out_cryptpad/lib/workers/db-worker" # mount bower, based on the .bowerrc file at the git repo root - cp -r ${bower}/bower_components $out/opt/www/ + cp -r ${bower}/bower_components $out_cryptpad/www/ # cryptpad is bugged with absolute path, this is a workaround to use absolute path as relative path - ln -s / $out/opt/root + ln -s / $out_cryptpad/root - # start script + # start script, cryptpad is lost if its working directory is not its source directory cat > $out/bin/cryptpad <