1 { env, fetchedGithub, fetchurl, stdenv, writeText, pkgs, cacert }:
3 listenPort = env.listenPort;
4 sessionkey = writeText "SESSIONKEY.txt" env.session_key;
5 apikey = writeText "APIKEY.txt" env.api_key;
7 url = https://code.jquery.com/jquery-1.9.1.js;
8 sha256 = "0h4dk67yc9d0kadqxb6b33585f3x3559p6qmp70l00qwq030vn3v";
11 "ep_aa_file_menu_toolbar"
17 "ep_copy_paste_select_all"
30 "ep_subscript_and_superscript"
35 dest = "webapps/tools-etherpad-apikey";
40 dest = "webapps/tools-etherpad-sessionkey";
42 text = env.session_key;
45 dest = "webapps/tools-etherpad";
48 # Make sure we’re not rebuilding whole libreoffice just because of a
50 let libreoffice = (import <nixpkgs> {}).libreoffice-fresh;
55 "favicon": "favicon.ico",
58 "port" : ${env.listenPort},
59 "showSettingsInAdminPage" : false,
60 "dbType" : "postgres",
62 "user" : "${env.postgresql.user}",
63 "host" : "${env.postgresql.socket}",
64 "password": "${env.postgresql.password}",
65 "database": "${env.postgresql.database}",
69 "defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n",
74 "showLineNumbers": true,
75 "useMonospaceFont": false,
79 "alwaysShowChat": false,
80 "chatAndUsers": false,
84 "suppressErrorsInPadText" : false,
85 "requireSession" : false,
87 "sessionNoPassword" : false,
91 "soffice" : "${libreoffice}/bin/soffice",
92 "tidyHtml" : "${pkgs.html-tidy}/bin/tidy",
93 "allowUnknownFileEnds" : true,
94 "requireAuthentication" : false,
95 "requireAuthorization" : false,
97 "disableIPlogging" : false,
98 "automaticReconnectionTimeout" : 0,
99 "scrollWhenFocusLineIsOutOfViewport": {
101 "editionAboveViewport": 0,
102 "editionBelowViewport": 0
105 "scrollWhenCaretIsInTheLastLineOfViewport": false,
106 "percentageToScrollWhenUserPressesArrowUp": 0
110 "url": "ldaps://${env.ldap.host}",
111 "accountBase": "${env.ldap.base}",
112 "accountPattern": "(&(memberOf=cn=users,cn=etherpad,ou=services,dc=immae,dc=eu)(uid={{username}}))",
113 "displayNameAttribute": "cn",
114 "searchDN": "cn=etherpad,ou=services,dc=immae,dc=eu",
115 "searchPWD": "${env.ldap.password}",
116 "groupSearchBase": "${env.ldap.base}",
117 "groupAttribute": "member",
118 "groupAttributeIsDN": true,
119 "searchScope": "sub",
120 "groupSearch": "(memberOf=cn=groups,cn=etherpad,ou=services,dc=immae,dc=eu)",
121 "anonymousReadonly": false
124 "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
126 "indentationOnNewLine": false,
129 ["bold", "italic", "underline", "strikethrough"],
130 ["orderedlist", "unorderedlist", "indent", "outdent"],
135 ["importexport", "timeslider", "savedrevision"],
136 ["settings", "embed"],
140 ["timeslider_export", "timeslider_returnToPad"]
144 "logconfig" : { "appenders": [ { "type": "console" } ] }
149 webappDir = stdenv.mkDerivation (fetchedGithub ./etherpad-lite.json // rec {
151 patches = [ ./libreoffice_patch.diff ];
153 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
154 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
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
165 sed -i 's/var\/dirty.db/\/var\/lib\/etherpad-lite\/dirty.db/g' \
166 settings.json.template
168 mkdir -v node_modules
169 ln -s ../src node_modules/ep_etherpad-lite
171 node bin/doc/generate doc/index.md --format=html \
172 --template=doc/template.html > documentation.html
177 ${builtins.concatStringsSep "\n"
178 (map (n: "npm install ${n}; touch node_modules/${n}/.ep_initialized") etherpad_modules)}
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
190 install -t "$out/doc/" \
191 -vDm 644 {CHANGELOG,CONTRIBUTING,README}.md \
192 -vDm 644 documentation.html
194 buildInputs = [ pkgs.nodejs pkgs.python ];
198 inherit webappDir keys listenPort;