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"
34 # Make sure we’re not rebuilding whole libreoffice just because of a
36 let libreoffice = (import <nixpkgs> {}).libreoffice-fresh;
38 writeText "settings.json" ''
41 "favicon": "favicon.ico",
44 "port" : ${env.listenPort},
45 "showSettingsInAdminPage" : false,
46 "dbType" : "postgres",
48 "user" : "${env.postgresql.user}",
49 "host" : "${env.postgresql.socket}",
50 "password": "${env.postgresql.password}",
51 "database": "${env.postgresql.database}",
55 "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",
60 "showLineNumbers": true,
61 "useMonospaceFont": false,
65 "alwaysShowChat": false,
66 "chatAndUsers": false,
70 "suppressErrorsInPadText" : false,
71 "requireSession" : false,
73 "sessionNoPassword" : false,
77 "soffice" : "${libreoffice}/bin/soffice",
78 "tidyHtml" : "${pkgs.html-tidy}/bin/tidy",
79 "allowUnknownFileEnds" : true,
80 "requireAuthentication" : false,
81 "requireAuthorization" : false,
83 "disableIPlogging" : false,
84 "automaticReconnectionTimeout" : 0,
85 "scrollWhenFocusLineIsOutOfViewport": {
87 "editionAboveViewport": 0,
88 "editionBelowViewport": 0
91 "scrollWhenCaretIsInTheLastLineOfViewport": false,
92 "percentageToScrollWhenUserPressesArrowUp": 0
96 "url": "ldaps://${env.ldap.host}",
97 "accountBase": "${env.ldap.base}",
98 "accountPattern": "(&(memberOf=cn=users,cn=etherpad,ou=services,dc=immae,dc=eu)(uid={{username}}))",
99 "displayNameAttribute": "cn",
100 "searchDN": "cn=etherpad,ou=services,dc=immae,dc=eu",
101 "searchPWD": "${env.ldap.password}",
102 "groupSearchBase": "${env.ldap.base}",
103 "groupAttribute": "member",
104 "groupAttributeIsDN": true,
105 "searchScope": "sub",
106 "groupSearch": "(memberOf=cn=groups,cn=etherpad,ou=services,dc=immae,dc=eu)",
107 "anonymousReadonly": false
110 "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
112 "indentationOnNewLine": false,
115 ["bold", "italic", "underline", "strikethrough"],
116 ["orderedlist", "unorderedlist", "indent", "outdent"],
121 ["importexport", "timeslider", "savedrevision"],
122 ["settings", "embed"],
126 ["timeslider_export", "timeslider_returnToPad"]
130 "logconfig" : { "appenders": [ { "type": "console" } ] }
133 webappDir = stdenv.mkDerivation (fetchedGithub ./etherpad-lite.json // rec {
135 patches = [ ./libreoffice_patch.diff ];
137 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
138 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
141 touch src/.ep_initialized
142 cp -v src/static/custom/js.template src/static/custom/index.js
143 cp -v src/static/custom/js.template src/static/custom/pad.js
144 cp -v src/static/custom/js.template src/static/custom/timeslider.js
145 cp -v src/static/custom/css.template src/static/custom/index.css
146 cp -v src/static/custom/css.template src/static/custom/pad.css
147 cp -v src/static/custom/css.template src/static/custom/timeslider.css
149 sed -i 's/var\/dirty.db/\/var\/lib\/etherpad-lite\/dirty.db/g' \
150 settings.json.template
152 mkdir -v node_modules
153 ln -s ../src node_modules/ep_etherpad-lite
155 node bin/doc/generate doc/index.md --format=html \
156 --template=doc/template.html > documentation.html
161 ${builtins.concatStringsSep "\n"
162 (map (n: "npm install ${n}; touch node_modules/${n}/.ep_initialized") etherpad_modules)}
166 install -t $out/src/ -vDm 644 src/.ep_initialized
167 cp -a node_modules $out/
168 cp -a src/* $out/src/
169 ln -sf ${sessionkey} $out/SESSIONKEY.txt
170 ln -sf ${apikey} $out/APIKEY.txt
171 cp ${jquery} $out/src/static/js/jquery.js
174 install -t "$out/doc/" \
175 -vDm 644 {CHANGELOG,CONTRIBUTING,README}.md \
176 -vDm 644 documentation.html
178 buildInputs = [ pkgs.nodejs pkgs.python ];
182 inherit webappDir config listenPort;