1 { lib, env, writeText, stdenv, fetchurl, fetchedGithub, phpPackages, apacheHttpd }:
8 if [ -d skins -a -d skins/larry -a ! -d skins/elastic ]; then
9 ln -s larry skins/elastic
12 buildPlugin = { appName, version, url, sha256, installPhase ? defaultInstall }:
13 stdenv.mkDerivation rec {
14 name = "roundcube-${appName}-${version}";
16 phases = "unpackPhase installPhase";
18 src = fetchurl { inherit url sha256; };
21 carddav = buildPlugin rec {
24 url = "https://github.com/blind-coder/rcmcarddav/releases/download/v${version}/${appName}-${version}.tar.bz2";
25 sha256 = "0cf5rnqkhhag2vdy808zfpr4l5586fn43nvcia8ac1ha58azrxal";
27 contextmenu = buildPlugin rec {
28 appName = "contextmenu";
30 url = "https://github.com/johndoh/roundcube-${appName}/archive/${version}.tar.gz";
31 sha256 = "1rb8n821ylfniiiccfskc534vd6rczhk3g82455ks3m09q6l8hif";
33 contextmenu_folder = buildPlugin rec {
34 appName = "contextmenu_folder";
36 url = "https://github.com/random-cuber/${appName}/archive/${version}.tar.gz";
37 sha256 = "1ngfws1v8qrpa52rjh7kirc98alchk2vbqwra86h00agyjjlcc57";
39 automatic_addressbook = buildPlugin rec {
40 appName = "automatic_addressbook";
42 url = "https://github.com/sblaisot/${appName}/archive/${version}.tar.gz";
43 sha256 = "0bx5qjzp3a3wc72fr295bvgsy5n15949c041hq76n6c7sqdn7inc";
45 message_highlight = buildPlugin rec {
46 appName = "message_highlight";
48 url = "https://github.com/corbosman/${appName}/archive/${version}.tar.gz";
49 sha256 = "12c4x47y70xdl5pgm8csh5i4yiyhpi232lvjbixmca6di4lkhh9j";
51 thunderbird_labels = buildPlugin rec {
52 appName = "thunderbird_labels";
54 url = "https://github.com/mike-kfed/roundcube-${appName}/archive/${version}.tar.gz";
55 sha256 = "1q4x30w66m02v3lw2n8020g0158rmyfzs6gydfk89pa1hs28k9bg";
57 html5_notifier = buildPlugin rec {
58 appName = "html5_notifier";
60 url = "https://github.com/stremlau/${appName}/archive/${version}.tar.gz";
61 sha256 = "0s1wq9ira4bcd8jvhn93nhxiqzpp92i0za2kw37kf7ksyhr0xslq";
63 ident_switch = buildPlugin rec {
64 appName = "ident_switch";
66 url = "https://bitbucket.org/BoresExpress/${appName}/get/${version}.tar.gz";
67 sha256 = "1zyy40lfq2kn7hkghbl8lgp18fb634zr4fxmmxvb1wqyvqdpdpyk";
72 varDir = "/var/lib/roundcubemail";
74 deps = [ "wrappers" ];
76 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
77 ${varDir}/cache ${varDir}/logs
78 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
82 dest = "webapps/tools-roundcube";
88 $config['db_dsnw'] = '${env.psql_url}';
89 $config['default_host'] = 'ssl://mail.immae.eu';
90 $config['imap_conn_options'] = array("ssl" => array("verify_peer" => false));
91 $config['smtp_server'] = 'tls://mail.immae.eu';
92 $config['smtp_port'] = '25';
93 $config['managesieve_host'] = 'mail.immae.eu';
94 $config['managesieve_port'] = '4190';
95 $config['managesieve_usetls'] = true;
96 $config['managesieve_conn_options'] = array("ssl" => array("verify_peer" => false));
98 $config['imap_cache'] = 'db';
99 $config['messages_cache'] = 'db';
101 $config['support_url'] = ''';
103 $config['des_key'] = '${env.secret}';
105 $config['skin'] = 'elastic';
106 $config['plugins'] = array(
107 'attachment_reminder',
109 'filesystem_attachments',
119 'automatic_addressbook',
122 // Ne marche pas ?: 'ident_switch',
123 // Ne marche pas ?: 'thunderbird_labels',
126 $config['language'] = 'fr_FR';
128 $config['drafts_mbox'] = 'Mail/Drafts';
129 $config['junk_mbox'] = 'Mail/Spam';
130 $config['sent_mbox'] = 'Mail/sent';
131 $config['trash_mbox'] = ''';
132 $config['default_folders'] = array('INBOX', 'Mail/Drafts', 'Mail/sent', 'Mail/Spam', ''');
133 $config['draft_autosave'] = 60;
134 $config['enable_installer'] = false;
135 $config['log_driver'] = 'file';
136 $config['temp_dir'] = '${varDir}/cache';
137 $config['mime_types'] = '${apacheHttpd}/conf/mime.types';
140 webRoot = stdenv.mkDerivation rec {
142 name = "roundcubemail-${version}";
144 url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz";
145 sha256 = "0p18wffwi2prh6vxhx1bc69qd1vwybggm8gvg3shahfdknxci9i4";
149 -e "s|RCUBE_INSTALL_PATH . 'temp.*|'${varDir}/cache';|" \
150 config/defaults.inc.php
152 -e "s|RCUBE_INSTALL_PATH . 'logs.*|'${varDir}/logs';|" \
153 config/defaults.inc.php
157 ln -s /var/secrets/webapps/tools-roundcube $out/config/config.inc.php
158 ${builtins.concatStringsSep "\n" (
159 lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/plugins/${name}") plugins
161 ${builtins.concatStringsSep "\n" (
162 lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/skins/${name}") skins
169 modules = [ "proxy_fcgi" ];
170 webappName = "tools_roundcubemail";
171 root = "/run/current-system/webapps/${webappName}";
173 Alias /roundcube "${root}"
174 <Directory "${root}">
175 DirectoryIndex index.php
177 Options FollowSymlinks
180 <FilesMatch "\.php$">
181 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
187 serviceDeps = [ "postgresql.service" ];
188 basedir = builtins.concatStringsSep ":" (
189 [ webRoot "/var/secrets/webapps/tools-roundcube" varDir ]
190 ++ lib.attrsets.mapAttrsToList (name: value: value) plugins
191 ++ lib.attrsets.mapAttrsToList (name: value: value) skins);
193 date.timezone = 'CET'
194 extension=${phpPackages.imagick}/lib/php/extensions/imagick.so
196 socket = "/var/run/phpfpm/roundcubemail.sock";
199 user = ${apache.user}
200 group = ${apache.group}
201 listen.owner = ${apache.user}
202 listen.group = ${apache.group}
205 pm.process_idle_timeout = 60
207 ; Needed to avoid clashes in browser cookies (same domain)
208 php_value[session.name] = RoundcubemailPHPSESSID
209 php_admin_value[upload_max_filesize] = 200M
210 php_admin_value[post_max_size] = 200M
211 php_admin_value[open_basedir] = "${basedir}:${apacheHttpd}/conf/mime.types:/tmp"
212 php_admin_value[session.save_path] = "${varDir}/phpSessions"