]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/mail/roundcubemail.nix
Fix Backup mailboxes expunging
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / mail / roundcubemail.nix
CommitLineData
fffbbb56
IB
1{ env, roundcubemail, roundcubemail-plugins, roundcubemail-skins, phpPackages, apacheHttpd }:
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 }];
78 webRoot = (roundcubemail.override { roundcube_config = "/var/secrets/webapps/tools-roundcube"; }).withPlugins
79 (builtins.attrValues roundcubemail-plugins) (builtins.attrValues roundcubemail-skins);
80 apache = rec {
81 user = "wwwrun";
82 group = "wwwrun";
83 modules = [ "proxy_fcgi" ];
84 webappName = "tools_roundcubemail";
85 root = "/run/current-system/webapps/${webappName}";
86 vhostConf = ''
87 Alias /roundcube "${root}"
88 <Directory "${root}">
89 DirectoryIndex index.php
90 AllowOverride All
91 Options FollowSymlinks
92 Require all granted
93
94 <FilesMatch "\.php$">
95 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
96 </FilesMatch>
97 </Directory>
d252d718 98 '';
fffbbb56
IB
99 };
100 phpFpm = rec {
101 serviceDeps = [ "postgresql.service" ];
102 basedir = builtins.concatStringsSep ":" (
103 [ webRoot "/var/secrets/webapps/tools-roundcube" varDir ]
104 ++ webRoot.plugins
105 ++ webRoot.skins);
106 phpConfig = ''
107 date.timezone = 'CET'
108 extension=${phpPackages.imagick}/lib/php/extensions/imagick.so
d252d718 109 '';
fffbbb56
IB
110 socket = "/var/run/phpfpm/roundcubemail.sock";
111 pool = ''
fffbbb56
IB
112 user = ${apache.user}
113 group = ${apache.group}
114 listen.owner = ${apache.user}
115 listen.group = ${apache.group}
116 pm = ondemand
117 pm.max_children = 60
118 pm.process_idle_timeout = 60
d252d718 119
fffbbb56
IB
120 ; Needed to avoid clashes in browser cookies (same domain)
121 php_value[session.name] = RoundcubemailPHPSESSID
122 php_admin_value[upload_max_filesize] = 200M
123 php_admin_value[post_max_size] = 200M
124 php_admin_value[open_basedir] = "${basedir}:${apacheHttpd}/conf/mime.types:/tmp"
125 php_admin_value[session.save_path] = "${varDir}/phpSessions"
126 '';
d252d718 127 };
fffbbb56 128}