blob: c85bd7efe5c73abf9772a65bed330c9e44cdb463 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
{ session_key ? "/etc/etherpad-lite/SESSIONKEY.txt"
, api_key ? "/etc/etherpad-lite/APIKEY.txt"
, stdenv, mylibs, cacert, nodejs, python, fetchurl }:
let
jquery = fetchurl {
url = https://code.jquery.com/jquery-1.9.1.js;
sha256 = "0h4dk67yc9d0kadqxb6b33585f3x3559p6qmp70l00qwq030vn3v";
};
withModules = modules: package.overrideAttrs(old: {
buildPhase = old.buildPhase +
builtins.concatStringsSep "\n"
(map (n: "npm install ${n}; touch node_modules/${n}/.ep_initialized") modules);
# FIXME: ln -s don’t seem to work, etherpad seems
# unable to "touch" them after initialization
passthru = old.passthru // {
inherit modules;
withModules = moreModules: old.withModules (moreModules ++ modules);
};
});
package = stdenv.mkDerivation (mylibs.fetchedGithub ./etherpad-lite.json // rec {
__noChroot = true;
patches = [ ./libreoffice_patch.diff ];
buildPhase = ''
export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
export HOME=$PWD
touch src/.ep_initialized
cp -v src/static/custom/js.template src/static/custom/index.js
cp -v src/static/custom/js.template src/static/custom/pad.js
cp -v src/static/custom/js.template src/static/custom/timeslider.js
cp -v src/static/custom/css.template src/static/custom/index.css
cp -v src/static/custom/css.template src/static/custom/pad.css
cp -v src/static/custom/css.template src/static/custom/timeslider.css
sed -i 's/var\/dirty.db/\/var\/lib\/etherpad-lite\/dirty.db/g' \
settings.json.template
mkdir -v node_modules
ln -s ../src node_modules/ep_etherpad-lite
node bin/doc/generate doc/index.md --format=html \
--template=doc/template.html > documentation.html
cd src
npm install
cd ..
'';
installPhase = ''
mkdir -p $out
install -t $out/src/ -vDm 644 src/.ep_initialized
cp -a node_modules $out/
cp -a src/* $out/src/
ln -sf ${session_key} $out/SESSIONKEY.txt
ln -sf ${api_key} $out/APIKEY.txt
cp ${jquery} $out/src/static/js/jquery.js
mkdir $out/doc
install -t "$out/doc/" \
-vDm 644 {CHANGELOG,CONTRIBUTING,README}.md \
-vDm 644 documentation.html
'';
buildInputs = [ nodejs python ];
passthru = {
modules = [];
inherit withModules;
};
});
in package
|