1 { lib, checkEnv, writeText, stdenv, fetchurl }:
6 varDir = "/var/lib/roundcubemail";
10 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
12 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
16 assert checkEnv "NIXOPS_ROUNDCUBEMAIL_PSQL_URL";
17 assert checkEnv "NIXOPS_ROUNDCUBEMAIL_SECRET";
18 writeText "config.php" ''
20 $config['db_dsnw'] = '${builtins.getEnv "NIXOPS_ROUNDCUBEMAIL_PSQL_URL"}';
21 $config['default_host'] = 'ssl://mail.immae.eu';
22 $config['imap_conn_options'] = array("ssl" => array("verify_peer" => false));
23 $config['smtp_server'] = 'tls://mail.immae.eu';
25 $config['imap_cache'] = 'db';
26 $config['messages_cache'] = 'db';
28 $config['support_url'] = ''';
30 $config['des_key'] = '${builtins.getEnv "NIXOPS_ROUNDCUBEMAIL_SECRET"}';
32 $config['plugins'] = array();
34 $config['language'] = 'fr_FR';
36 $config['drafts_mbox'] = 'Mail/Drafts';
37 $config['junk_mbox'] = 'Mail/Spam';
38 $config['sent_mbox'] = 'Mail/sent';
39 $config['trash_mbox'] = ''';
40 $config['default_folders'] = array('INBOX', 'Mail/Drafts', 'Mail/sent', 'Mail/Spam', ''');
41 $config['draft_autosave'] = 60;
42 $config['enable_installer'] = false;
43 $config['log_driver'] = 'stdout';
44 $config['temp_dir'] = '${varDir}/cache';
45 $config['debug_level'] = 1;
47 webRoot = stdenv.mkDerivation rec {
49 name = "roundcubemail-${version}";
51 url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz";
52 sha256 = "018djad7ygfl9c9f2l2j42qkg31ml3hs2f01f0dk361zckwk77n4";
56 -e "s|RCUBE_INSTALL_PATH . 'temp.*|'${varDir}/cache';|" \
57 config/defaults.inc.php
61 ln -s ${config} $out/config/config.inc.php
62 ${builtins.concatStringsSep "\n" (
63 lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/plugins/${name}") plugins
70 modules = [ "proxy_fcgi" ];
72 Alias /roundcube "${webRoot}"
73 <Directory "${webRoot}">
74 DirectoryIndex index.php
76 Options FollowSymlinks
80 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
86 basedir = builtins.concatStringsSep ":" (
87 [ webRoot config varDir ]
88 ++ lib.attrsets.mapAttrsToList (name: value: value) plugins);
89 socket = "/var/run/phpfpm/roundcubemail.sock";
93 group = ${apache.group}
94 listen.owner = ${apache.user}
95 listen.group = ${apache.group}
98 pm.process_idle_timeout = 60
100 ; Needed to avoid clashes in browser cookies (same domain)
101 php_value[session.name] = RoundcubemailPHPSESSID
102 php_admin_value[open_basedir] = "${basedir}:/tmp"
103 php_admin_value[session.save_path] = "${varDir}/phpSessions"