]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/tools/ether/etherpad_lite.nix
c6f3704c5f4fa324d5dfa5584287cb9adc5d01d3
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / ether / etherpad_lite.nix
1 { env, etherpad-lite, etherpad-lite-modules, writeText, pkgs }:
2 let
3 listenPort = env.listenPort;
4 sessionkey = writeText "SESSIONKEY.txt" env.session_key;
5 apikey = writeText "APIKEY.txt" env.api_key;
6 keys = [
7 {
8 dest = "webapps/tools-etherpad-apikey";
9 permissions = "0400";
10 text = env.api_key;
11 }
12 {
13 dest = "webapps/tools-etherpad-sessionkey";
14 permissions = "0400";
15 text = env.session_key;
16 }
17 {
18 dest = "webapps/tools-etherpad";
19 permissions = "0400";
20 text =
21 # Make sure we’re not rebuilding whole libreoffice just because of a
22 # dependency
23 let libreoffice = (import <nixpkgs> { overlays = []; }).libreoffice-fresh;
24 in
25 ''
26 {
27 "title": "Etherpad",
28 "favicon": "favicon.ico",
29
30 "ip": "127.0.0.1",
31 "port" : ${env.listenPort},
32 "showSettingsInAdminPage" : false,
33 "dbType" : "postgres",
34 "dbSettings" : {
35 "user" : "${env.postgresql.user}",
36 "host" : "${env.postgresql.socket}",
37 "password": "${env.postgresql.password}",
38 "database": "${env.postgresql.database}",
39 "charset" : "utf8mb4"
40 },
41
42 "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",
43 "padOptions": {
44 "noColors": false,
45 "showControls": true,
46 "showChat": true,
47 "showLineNumbers": true,
48 "useMonospaceFont": false,
49 "userName": false,
50 "userColor": false,
51 "rtl": false,
52 "alwaysShowChat": false,
53 "chatAndUsers": false,
54 "lang": "en-gb"
55 },
56
57 "suppressErrorsInPadText" : false,
58 "requireSession" : false,
59 "editOnly" : false,
60 "sessionNoPassword" : false,
61 "minify" : true,
62 "maxAge" : 21600,
63 "abiword" : null,
64 "soffice" : "${libreoffice}/bin/soffice",
65 "tidyHtml" : "${pkgs.html-tidy}/bin/tidy",
66 "allowUnknownFileEnds" : true,
67 "requireAuthentication" : false,
68 "requireAuthorization" : false,
69 "trustProxy" : false,
70 "disableIPlogging" : false,
71 "automaticReconnectionTimeout" : 0,
72 "scrollWhenFocusLineIsOutOfViewport": {
73 "percentage": {
74 "editionAboveViewport": 0,
75 "editionBelowViewport": 0
76 },
77 "duration": 0,
78 "scrollWhenCaretIsInTheLastLineOfViewport": false,
79 "percentageToScrollWhenUserPressesArrowUp": 0
80 },
81 "users": {
82 "ldapauth": {
83 "url": "ldaps://${env.ldap.host}",
84 "accountBase": "${env.ldap.base}",
85 "accountPattern": "(&(memberOf=cn=users,cn=etherpad,ou=services,dc=immae,dc=eu)(uid={{username}}))",
86 "displayNameAttribute": "cn",
87 "searchDN": "cn=etherpad,ou=services,dc=immae,dc=eu",
88 "searchPWD": "${env.ldap.password}",
89 "groupSearchBase": "${env.ldap.base}",
90 "groupAttribute": "member",
91 "groupAttributeIsDN": true,
92 "searchScope": "sub",
93 "groupSearch": "(memberOf=cn=groups,cn=etherpad,ou=services,dc=immae,dc=eu)",
94 "anonymousReadonly": false
95 }
96 },
97 "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
98 "loadTest": false,
99 "indentationOnNewLine": false,
100 "toolbar": {
101 "left": [
102 ["bold", "italic", "underline", "strikethrough"],
103 ["orderedlist", "unorderedlist", "indent", "outdent"],
104 ["undo", "redo"],
105 ["clearauthorship"]
106 ],
107 "right": [
108 ["importexport", "timeslider", "savedrevision"],
109 ["settings", "embed"],
110 ["showusers"]
111 ],
112 "timeslider": [
113 ["timeslider_export", "timeslider_returnToPad"]
114 ]
115 },
116 "loglevel": "INFO",
117 "logconfig" : { "appenders": [ { "type": "console" } ] }
118 }
119 '';
120 }
121 ];
122 webappDir = etherpad-lite.withModules (builtins.attrValues etherpad-lite-modules);
123 in
124 {
125 inherit webappDir keys listenPort;
126 }