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