diff options
Diffstat (limited to 'nixops/modules/websites/tools/ether/etherpad_lite.nix')
-rw-r--r-- | nixops/modules/websites/tools/ether/etherpad_lite.nix | 80 |
1 files changed, 5 insertions, 75 deletions
diff --git a/nixops/modules/websites/tools/ether/etherpad_lite.nix b/nixops/modules/websites/tools/ether/etherpad_lite.nix index e67497b..35220ee 100644 --- a/nixops/modules/websites/tools/ether/etherpad_lite.nix +++ b/nixops/modules/websites/tools/ether/etherpad_lite.nix | |||
@@ -1,35 +1,8 @@ | |||
1 | { env, fetchedGithub, fetchurl, stdenv, writeText, pkgs, cacert }: | 1 | { env, etherpad-lite, etherpad-lite-modules, writeText, pkgs }: |
2 | let | 2 | let |
3 | listenPort = env.listenPort; | 3 | listenPort = env.listenPort; |
4 | sessionkey = writeText "SESSIONKEY.txt" env.session_key; | 4 | sessionkey = writeText "SESSIONKEY.txt" env.session_key; |
5 | apikey = writeText "APIKEY.txt" env.api_key; | 5 | apikey = writeText "APIKEY.txt" env.api_key; |
6 | jquery = fetchurl { | ||
7 | url = https://code.jquery.com/jquery-1.9.1.js; | ||
8 | sha256 = "0h4dk67yc9d0kadqxb6b33585f3x3559p6qmp70l00qwq030vn3v"; | ||
9 | }; | ||
10 | etherpad_modules = [ | ||
11 | "ep_aa_file_menu_toolbar" | ||
12 | "ep_adminpads" | ||
13 | "ep_align" | ||
14 | "ep_bookmark" | ||
15 | "ep_clear_formatting" | ||
16 | "ep_colors" | ||
17 | "ep_copy_paste_select_all" | ||
18 | "ep_cursortrace" | ||
19 | "ep_embedmedia" | ||
20 | "ep_font_family" | ||
21 | "ep_font_size" | ||
22 | "ep_headings2" | ||
23 | "ep_ldapauth" | ||
24 | "ep_line_height" | ||
25 | "ep_markdown" | ||
26 | "ep_previewimages" | ||
27 | "ep_ruler" | ||
28 | "ep_scrollto" | ||
29 | "ep_set_title_on_pad" | ||
30 | "ep_subscript_and_superscript" | ||
31 | "ep_timesliderdiff" | ||
32 | ]; | ||
33 | keys = [ | 6 | keys = [ |
34 | { | 7 | { |
35 | dest = "webapps/tools-etherpad-apikey"; | 8 | dest = "webapps/tools-etherpad-apikey"; |
@@ -146,53 +119,10 @@ let | |||
146 | ''; | 119 | ''; |
147 | } | 120 | } |
148 | ]; | 121 | ]; |
149 | webappDir = stdenv.mkDerivation (fetchedGithub ./etherpad-lite.json // rec { | 122 | webappDir = (etherpad-lite.override { |
150 | __noChroot = true; | 123 | session_key = "/var/secrets/webapps/tools-etherpad-sessionkey"; |
151 | patches = [ ./libreoffice_patch.diff ]; | 124 | api_key = "/var/secrets/webapps/tools-etherpad-apikey"; |
152 | buildPhase = '' | 125 | }).withModules etherpad-lite-modules; |
153 | export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt | ||
154 | export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt | ||
155 | export HOME=$PWD | ||
156 | |||
157 | touch src/.ep_initialized | ||
158 | cp -v src/static/custom/js.template src/static/custom/index.js | ||
159 | cp -v src/static/custom/js.template src/static/custom/pad.js | ||
160 | cp -v src/static/custom/js.template src/static/custom/timeslider.js | ||
161 | cp -v src/static/custom/css.template src/static/custom/index.css | ||
162 | cp -v src/static/custom/css.template src/static/custom/pad.css | ||
163 | cp -v src/static/custom/css.template src/static/custom/timeslider.css | ||
164 | |||
165 | sed -i 's/var\/dirty.db/\/var\/lib\/etherpad-lite\/dirty.db/g' \ | ||
166 | settings.json.template | ||
167 | |||
168 | mkdir -v node_modules | ||
169 | ln -s ../src node_modules/ep_etherpad-lite | ||
170 | |||
171 | node bin/doc/generate doc/index.md --format=html \ | ||
172 | --template=doc/template.html > documentation.html | ||
173 | |||
174 | cd src | ||
175 | npm install | ||
176 | cd .. | ||
177 | ${builtins.concatStringsSep "\n" | ||
178 | (map (n: "npm install ${n}; touch node_modules/${n}/.ep_initialized") etherpad_modules)} | ||
179 | ''; | ||
180 | installPhase = '' | ||
181 | mkdir -p $out | ||
182 | install -t $out/src/ -vDm 644 src/.ep_initialized | ||
183 | cp -a node_modules $out/ | ||
184 | cp -a src/* $out/src/ | ||
185 | ln -sf /var/secrets/webapps/tools-etherpad-sessionkey $out/SESSIONKEY.txt | ||
186 | ln -sf /var/secrets/webapps/tools-etherpad-apikey $out/APIKEY.txt | ||
187 | cp ${jquery} $out/src/static/js/jquery.js | ||
188 | |||
189 | mkdir $out/doc | ||
190 | install -t "$out/doc/" \ | ||
191 | -vDm 644 {CHANGELOG,CONTRIBUTING,README}.md \ | ||
192 | -vDm 644 documentation.html | ||
193 | ''; | ||
194 | buildInputs = [ pkgs.nodejs pkgs.python ]; | ||
195 | }); | ||
196 | in | 126 | in |
197 | { | 127 | { |
198 | inherit webappDir keys listenPort; | 128 | inherit webappDir keys listenPort; |