1 { session_key ? "/etc/etherpad-lite/SESSIONKEY.txt"
2 , api_key ? "/etc/etherpad-lite/APIKEY.txt"
3 , stdenv, mylibs, cacert, nodejs, python, fetchurl }:
6 url = https://code.jquery.com/jquery-1.9.1.js;
7 sha256 = "0h4dk67yc9d0kadqxb6b33585f3x3559p6qmp70l00qwq030vn3v";
9 withModules = modules: package.overrideAttrs(old: {
10 buildPhase = old.buildPhase +
11 builtins.concatStringsSep "\n"
12 (map (n: "npm install ${n}; touch node_modules/${n}/.ep_initialized") modules);
13 # FIXME: ln -s don’t seem to work, etherpad seems
14 # unable to "touch" them after initialization
15 passthru = old.passthru // {
17 withModules = moreModules: old.withModules (moreModules ++ modules);
20 package = stdenv.mkDerivation (mylibs.fetchedGithub ./etherpad-lite.json // rec {
22 patches = [ ./libreoffice_patch.diff ];
24 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
25 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
28 touch src/.ep_initialized
29 cp -v src/static/custom/js.template src/static/custom/index.js
30 cp -v src/static/custom/js.template src/static/custom/pad.js
31 cp -v src/static/custom/js.template src/static/custom/timeslider.js
32 cp -v src/static/custom/css.template src/static/custom/index.css
33 cp -v src/static/custom/css.template src/static/custom/pad.css
34 cp -v src/static/custom/css.template src/static/custom/timeslider.css
36 sed -i 's/var\/dirty.db/\/var\/lib\/etherpad-lite\/dirty.db/g' \
37 settings.json.template
40 ln -s ../src node_modules/ep_etherpad-lite
42 node bin/doc/generate doc/index.md --format=html \
43 --template=doc/template.html > documentation.html
51 install -t $out/src/ -vDm 644 src/.ep_initialized
52 cp -a node_modules $out/
54 ln -sf ${session_key} $out/SESSIONKEY.txt
55 ln -sf ${api_key} $out/APIKEY.txt
56 cp ${jquery} $out/src/static/js/jquery.js
59 install -t "$out/doc/" \
60 -vDm 644 {CHANGELOG,CONTRIBUTING,README}.md \
61 -vDm 644 documentation.html
63 buildInputs = [ nodejs python ];