diff options
Diffstat (limited to 'systems/eldiron/websites/mail/roundcubemail.nix')
-rw-r--r-- | systems/eldiron/websites/mail/roundcubemail.nix | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/systems/eldiron/websites/mail/roundcubemail.nix b/systems/eldiron/websites/mail/roundcubemail.nix new file mode 100644 index 0000000..21a10fe --- /dev/null +++ b/systems/eldiron/websites/mail/roundcubemail.nix | |||
@@ -0,0 +1,119 @@ | |||
1 | { env, roundcubemail, apacheHttpd, config }: | ||
2 | rec { | ||
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 | ''; | ||
10 | }; | ||
11 | keys."webapps/tools-roundcube" = { | ||
12 | user = apache.user; | ||
13 | group = apache.group; | ||
14 | permissions = "0400"; | ||
15 | text = | ||
16 | let | ||
17 | psql_url = with env.postgresql; "pgsql://${user}:${password}@unix(${socket}:${port})/${database}"; | ||
18 | in '' | ||
19 | <?php | ||
20 | $config['db_dsnw'] = '${psql_url}'; | ||
21 | $config['default_host'] = 'ssl://imap.immae.eu'; | ||
22 | $config['username_domain'] = array( | ||
23 | "imap.immae.eu" => "mail.immae.eu" | ||
24 | ); | ||
25 | $config['imap_conn_options'] = array("ssl" => array("verify_peer" => false)); | ||
26 | $config['smtp_server'] = 'tls://smtp.immae.eu'; | ||
27 | $config['smtp_port'] = '587'; | ||
28 | $config['managesieve_host'] = 'imap.immae.eu'; | ||
29 | $config['managesieve_port'] = '4190'; | ||
30 | $config['managesieve_usetls'] = true; | ||
31 | $config['managesieve_conn_options'] = array("ssl" => array("verify_peer" => false)); | ||
32 | |||
33 | $config['imap_cache'] = 'db'; | ||
34 | $config['messages_cache'] = 'db'; | ||
35 | |||
36 | $config['support_url'] = '''; | ||
37 | |||
38 | $config['des_key'] = '${env.secret}'; | ||
39 | |||
40 | $config['skin'] = 'elastic'; | ||
41 | $config['plugins'] = array( | ||
42 | 'attachment_reminder', | ||
43 | 'emoticons', | ||
44 | 'filesystem_attachments', | ||
45 | 'hide_blockquote', | ||
46 | 'identicon', | ||
47 | 'identity_select', | ||
48 | 'jqueryui', | ||
49 | 'markasjunk', | ||
50 | 'managesieve', | ||
51 | 'newmail_notifier', | ||
52 | 'vcard_attachments', | ||
53 | 'zipdownload', | ||
54 | |||
55 | 'automatic_addressbook', | ||
56 | 'message_highlight', | ||
57 | 'carddav', | ||
58 | // Ne marche pas ?: 'ident_switch', | ||
59 | // Ne marche pas ?: 'thunderbird_labels', | ||
60 | ); | ||
61 | |||
62 | $config['language'] = 'fr_FR'; | ||
63 | |||
64 | $config['drafts_mbox'] = 'Drafts'; | ||
65 | $config['junk_mbox'] = 'Junk'; | ||
66 | $config['sent_mbox'] = 'Sent'; | ||
67 | $config['trash_mbox'] = 'Trash'; | ||
68 | $config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash'); | ||
69 | $config['draft_autosave'] = 60; | ||
70 | $config['enable_installer'] = false; | ||
71 | $config['log_driver'] = 'file'; | ||
72 | $config['temp_dir'] = '${varDir}/cache'; | ||
73 | $config['mime_types'] = '${apacheHttpd}/conf/mime.types'; | ||
74 | ''; | ||
75 | keyDependencies = [ apacheHttpd ]; | ||
76 | }; | ||
77 | webRoot = (roundcubemail.override { roundcube_config = config.secrets.fullPaths."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 ]); | ||
78 | apache = rec { | ||
79 | user = "wwwrun"; | ||
80 | group = "wwwrun"; | ||
81 | modules = [ "proxy_fcgi" ]; | ||
82 | root = webRoot; | ||
83 | vhostConf = socket: '' | ||
84 | Alias /roundcube "${root}" | ||
85 | <Directory "${root}"> | ||
86 | DirectoryIndex index.php | ||
87 | AllowOverride All | ||
88 | Options FollowSymlinks | ||
89 | Require all granted | ||
90 | |||
91 | <FilesMatch "\.php$"> | ||
92 | SetHandler "proxy:unix:${socket}|fcgi://localhost" | ||
93 | </FilesMatch> | ||
94 | </Directory> | ||
95 | ''; | ||
96 | }; | ||
97 | phpFpm = rec { | ||
98 | serviceDeps = [ "postgresql.service" ]; | ||
99 | basedir = builtins.concatStringsSep ":" ( | ||
100 | [ webRoot config.secrets.fullPaths."webapps/tools-roundcube" varDir ] | ||
101 | ++ webRoot.plugins | ||
102 | ++ webRoot.skins); | ||
103 | pool = { | ||
104 | "listen.owner" = apache.user; | ||
105 | "listen.group" = apache.group; | ||
106 | "pm" = "ondemand"; | ||
107 | "pm.max_children" = "60"; | ||
108 | "pm.process_idle_timeout" = "60"; | ||
109 | |||
110 | # Needed to avoid clashes in browser cookies (same domain) | ||
111 | "php_value[session.name]" = "RoundcubemailPHPSESSID"; | ||
112 | "php_admin_value[upload_max_filesize]" = "200M"; | ||
113 | "php_admin_value[post_max_size]" = "200M"; | ||
114 | "php_admin_value[open_basedir]" = "${basedir}:${apacheHttpd}/conf/mime.types:/tmp"; | ||
115 | "php_admin_value[session.save_handler]" = "redis"; | ||
116 | "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=Tools:Roundcubemail:'"; | ||
117 | }; | ||
118 | }; | ||
119 | } | ||