]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/tools/ether/etherpad_lite.nix
Make etherpad derivation pure
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / ether / etherpad_lite.nix
CommitLineData
a8bfce17 1{ env, etherpad-lite, etherpad-lite-modules, writeText, pkgs }:
17146204 2let
bfe3c9c9 3 listenPort = env.listenPort;
17146204
IB
4 sessionkey = writeText "SESSIONKEY.txt" env.session_key;
5 apikey = writeText "APIKEY.txt" env.api_key;
32c84ff8
IB
6 keys = [
7 {
8 dest = "webapps/tools-etherpad-apikey";
e905cd0b
IB
9 permissions = "0400";
10 text = env.api_key;
32c84ff8
IB
11 }
12 {
13 dest = "webapps/tools-etherpad-sessionkey";
e905cd0b
IB
14 permissions = "0400";
15 text = env.session_key;
32c84ff8
IB
16 }
17 {
18 dest = "webapps/tools-etherpad";
e905cd0b
IB
19 permissions = "0400";
20 text =
21 # Make sure we’re not rebuilding whole libreoffice just because of a
22 # dependency
fdf6f74d 23 let libreoffice = (import <nixpkgs> { overlays = []; }).libreoffice-fresh;
e905cd0b
IB
24 in
25 ''
26 {
27 "title": "Etherpad",
28 "favicon": "favicon.ico",
17146204 29
e905cd0b
IB
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 },
17146204 41
e905cd0b
IB
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 },
17146204 56
e905cd0b
IB
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
51900e34 80 },
e905cd0b
IB
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 '';
32c84ff8
IB
120 }
121 ];
1247e537 122 webappDir = etherpad-lite.withModules (builtins.attrValues etherpad-lite-modules);
17146204
IB
123in
124 {
51900e34 125 inherit webappDir keys listenPort;
17146204 126 }