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"
33 keys.tools-etherpad = {
34 destDir = "/run/keys/webapps";
37 # Make sure we’re not rebuilding whole libreoffice just because of a
39 let libreoffice = (import <nixpkgs> {}).libreoffice-fresh;
44 "favicon": "favicon.ico",
47 "port" : ${env.listenPort},
48 "showSettingsInAdminPage" : false,
49 "dbType" : "postgres",
51 "user" : "${env.postgresql.user}",
52 "host" : "${env.postgresql.socket}",
53 "password": "${env.postgresql.password}",
54 "database": "${env.postgresql.database}",
58 "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",
63 "showLineNumbers": true,
64 "useMonospaceFont": false,
68 "alwaysShowChat": false,
69 "chatAndUsers": false,
73 "suppressErrorsInPadText" : false,
74 "requireSession" : false,
76 "sessionNoPassword" : false,
80 "soffice" : "${libreoffice}/bin/soffice",
81 "tidyHtml" : "${pkgs.html-tidy}/bin/tidy",
82 "allowUnknownFileEnds" : true,
83 "requireAuthentication" : false,
84 "requireAuthorization" : false,
86 "disableIPlogging" : false,
87 "automaticReconnectionTimeout" : 0,
88 "scrollWhenFocusLineIsOutOfViewport": {
90 "editionAboveViewport": 0,
91 "editionBelowViewport": 0
94 "scrollWhenCaretIsInTheLastLineOfViewport": false,
95 "percentageToScrollWhenUserPressesArrowUp": 0
99 "url": "ldaps://${env.ldap.host}",
100 "accountBase": "${env.ldap.base}",
101 "accountPattern": "(&(memberOf=cn=users,cn=etherpad,ou=services,dc=immae,dc=eu)(uid={{username}}))",
102 "displayNameAttribute": "cn",
103 "searchDN": "cn=etherpad,ou=services,dc=immae,dc=eu",
104 "searchPWD": "${env.ldap.password}",
105 "groupSearchBase": "${env.ldap.base}",
106 "groupAttribute": "member",
107 "groupAttributeIsDN": true,
108 "searchScope": "sub",
109 "groupSearch": "(memberOf=cn=groups,cn=etherpad,ou=services,dc=immae,dc=eu)",
110 "anonymousReadonly": false
113 "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
115 "indentationOnNewLine": false,
118 ["bold", "italic", "underline", "strikethrough"],
119 ["orderedlist", "unorderedlist", "indent", "outdent"],
124 ["importexport", "timeslider", "savedrevision"],
125 ["settings", "embed"],
129 ["timeslider_export", "timeslider_returnToPad"]
133 "logconfig" : { "appenders": [ { "type": "console" } ] }
137 webappDir = stdenv.mkDerivation (fetchedGithub ./etherpad-lite.json // rec {
139 patches = [ ./libreoffice_patch.diff ];
141 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
142 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
145 touch src/.ep_initialized
146 cp -v src/static/custom/js.template src/static/custom/index.js
147 cp -v src/static/custom/js.template src/static/custom/pad.js
148 cp -v src/static/custom/js.template src/static/custom/timeslider.js
149 cp -v src/static/custom/css.template src/static/custom/index.css
150 cp -v src/static/custom/css.template src/static/custom/pad.css
151 cp -v src/static/custom/css.template src/static/custom/timeslider.css
153 sed -i 's/var\/dirty.db/\/var\/lib\/etherpad-lite\/dirty.db/g' \
154 settings.json.template
156 mkdir -v node_modules
157 ln -s ../src node_modules/ep_etherpad-lite
159 node bin/doc/generate doc/index.md --format=html \
160 --template=doc/template.html > documentation.html
165 ${builtins.concatStringsSep "\n"
166 (map (n: "npm install ${n}; touch node_modules/${n}/.ep_initialized") etherpad_modules)}
170 install -t $out/src/ -vDm 644 src/.ep_initialized
171 cp -a node_modules $out/
172 cp -a src/* $out/src/
173 ln -sf ${sessionkey} $out/SESSIONKEY.txt
174 ln -sf ${apikey} $out/APIKEY.txt
175 cp ${jquery} $out/src/static/js/jquery.js
178 install -t "$out/doc/" \
179 -vDm 644 {CHANGELOG,CONTRIBUTING,README}.md \
180 -vDm 644 documentation.html
182 buildInputs = [ pkgs.nodejs pkgs.python ];
186 inherit webappDir keys listenPort;