aboutsummaryrefslogtreecommitdiff
path: root/app/cryptpad/build/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'app/cryptpad/build/default.nix')
-rw-r--r--app/cryptpad/build/default.nix21
1 files changed, 13 insertions, 8 deletions
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 <<EOF
#!${pkgs.stdenv.shell}
- cd $out/opt/
- ${nodejs}/bin/node server.js
+ cd $out_cryptpad
+ exec ${nodejs}/bin/node server.js
EOF
chmod +x $out/bin/cryptpad