]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/mail/roundcubemail.nix
Adjust load warnings for monitoring
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / mail / roundcubemail.nix
CommitLineData
34c7b88e 1{ env, roundcubemail, apacheHttpd }:
fffbbb56
IB
2rec {
3 varDir = "/var/lib/roundcubemail";
4 activationScript = {
5 deps = [ "wrappers" ];
6 text = ''
7 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
8 ${varDir}/cache ${varDir}/logs
9 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
10 '';
11 };
12 keys = [{
13 dest = "webapps/tools-roundcube";
14 user = apache.user;
15 group = apache.group;
16 permissions = "0400";
ab8f306d
IB
17 text =
18 let
19 psql_url = with env.postgresql; "pgsql://${user}:${password}@unix(${socket}:${port})/${database}";
20 in ''
fffbbb56 21 <?php
ab8f306d 22 $config['db_dsnw'] = '${psql_url}';
7ccde67a
IB
23 $config['default_host'] = 'ssl://imap.immae.eu';
24 $config['username_domain'] = array(
25 "imap.immae.eu" => "mail.immae.eu"
26 );
fffbbb56 27 $config['imap_conn_options'] = array("ssl" => array("verify_peer" => false));
05f8c21a
IB
28 $config['smtp_server'] = 'tls://smtp.immae.eu';
29 $config['smtp_port'] = '587';
30 $config['managesieve_host'] = 'imap.immae.eu';
fffbbb56
IB
31 $config['managesieve_port'] = '4190';
32 $config['managesieve_usetls'] = true;
33 $config['managesieve_conn_options'] = array("ssl" => array("verify_peer" => false));
d252d718 34
fffbbb56
IB
35 $config['imap_cache'] = 'db';
36 $config['messages_cache'] = 'db';
d252d718 37
fffbbb56 38 $config['support_url'] = ''';
d252d718 39
fffbbb56 40 $config['des_key'] = '${env.secret}';
d252d718 41
fffbbb56
IB
42 $config['skin'] = 'elastic';
43 $config['plugins'] = array(
44 'attachment_reminder',
45 'emoticons',
46 'filesystem_attachments',
47 'hide_blockquote',
48 'identicon',
49 'identity_select',
50 'jqueryui',
a929614f 51 'markasjunk',
fffbbb56
IB
52 'managesieve',
53 'newmail_notifier',
54 'vcard_attachments',
55 'zipdownload',
e2ca51b2 56
fffbbb56
IB
57 'automatic_addressbook',
58 'message_highlight',
59 'carddav',
60 // Ne marche pas ?: 'ident_switch',
61 // Ne marche pas ?: 'thunderbird_labels',
62 );
d252d718 63
fffbbb56 64 $config['language'] = 'fr_FR';
d252d718 65
a929614f
IB
66 $config['drafts_mbox'] = 'Drafts';
67 $config['junk_mbox'] = 'Junk';
68 $config['sent_mbox'] = 'Sent';
69 $config['trash_mbox'] = 'Trash';
70 $config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
fffbbb56
IB
71 $config['draft_autosave'] = 60;
72 $config['enable_installer'] = false;
73 $config['log_driver'] = 'file';
74 $config['temp_dir'] = '${varDir}/cache';
75 $config['mime_types'] = '${apacheHttpd}/conf/mime.types';
76 '';
77 }];
34c7b88e 78 webRoot = (roundcubemail.override { roundcube_config = "/var/secrets/webapps/tools-roundcube"; }).withPlugins (p: [ p.automatic_addressbook p.carddav p.contextmenu p.contextmenu_folder p.html5_notifier p.ident_switch p.message_highlight p.thunderbird_labels ]);
fffbbb56
IB
79 apache = rec {
80 user = "wwwrun";
81 group = "wwwrun";
82 modules = [ "proxy_fcgi" ];
83 webappName = "tools_roundcubemail";
84 root = "/run/current-system/webapps/${webappName}";
5400b9b6 85 vhostConf = socket: ''
fffbbb56
IB
86 Alias /roundcube "${root}"
87 <Directory "${root}">
88 DirectoryIndex index.php
89 AllowOverride All
90 Options FollowSymlinks
91 Require all granted
92
93 <FilesMatch "\.php$">
5400b9b6 94 SetHandler "proxy:unix:${socket}|fcgi://localhost"
fffbbb56
IB
95 </FilesMatch>
96 </Directory>
d252d718 97 '';
fffbbb56
IB
98 };
99 phpFpm = rec {
100 serviceDeps = [ "postgresql.service" ];
101 basedir = builtins.concatStringsSep ":" (
102 [ webRoot "/var/secrets/webapps/tools-roundcube" varDir ]
103 ++ webRoot.plugins
104 ++ webRoot.skins);
5400b9b6
IB
105 pool = {
106 "listen.owner" = apache.user;
107 "listen.group" = apache.group;
108 "pm" = "ondemand";
109 "pm.max_children" = "60";
110 "pm.process_idle_timeout" = "60";
d252d718 111
5400b9b6
IB
112 # Needed to avoid clashes in browser cookies (same domain)
113 "php_value[session.name]" = "RoundcubemailPHPSESSID";
114 "php_admin_value[upload_max_filesize]" = "200M";
115 "php_admin_value[post_max_size]" = "200M";
116 "php_admin_value[open_basedir]" = "${basedir}:${apacheHttpd}/conf/mime.types:/tmp";
117 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
118 };
d252d718 119 };
fffbbb56 120}