diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-25 23:15:08 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-25 23:15:08 +0100 |
commit | 01f21083a897b86bf148f1d2bb9c8edca4d3786a (patch) | |
tree | 784f04e9b6ef99a49e572c84e4b7ab40b5eb5fde /nixops/modules/websites/tools/tools/roundcubemail.nix | |
parent | bfe3c9c9df0c5112bc8806483292b55ed0f7e02d (diff) | |
download | Nix-01f21083a897b86bf148f1d2bb9c8edca4d3786a.tar.gz Nix-01f21083a897b86bf148f1d2bb9c8edca4d3786a.tar.zst Nix-01f21083a897b86bf148f1d2bb9c8edca4d3786a.zip |
Rename virtual folder to nixops
Fixes https://git.immae.eu/mantisbt/view.php?id=82
Diffstat (limited to 'nixops/modules/websites/tools/tools/roundcubemail.nix')
-rw-r--r-- | nixops/modules/websites/tools/tools/roundcubemail.nix | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/nixops/modules/websites/tools/tools/roundcubemail.nix b/nixops/modules/websites/tools/tools/roundcubemail.nix new file mode 100644 index 0000000..877ea8b --- /dev/null +++ b/nixops/modules/websites/tools/tools/roundcubemail.nix | |||
@@ -0,0 +1,105 @@ | |||
1 | { lib, env, writeText, stdenv, fetchurl }: | ||
2 | let | ||
3 | roundcubemail = let | ||
4 | plugins = {}; | ||
5 | in rec { | ||
6 | varDir = "/var/lib/roundcubemail"; | ||
7 | activationScript = { | ||
8 | deps = [ "wrappers" ]; | ||
9 | text = '' | ||
10 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ | ||
11 | ${varDir}/cache | ||
12 | install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions | ||
13 | ''; | ||
14 | }; | ||
15 | config = writeText "config.php" '' | ||
16 | <?php | ||
17 | $config['db_dsnw'] = '${env.psql_url}'; | ||
18 | $config['default_host'] = 'ssl://mail.immae.eu'; | ||
19 | $config['imap_conn_options'] = array("ssl" => array("verify_peer" => false)); | ||
20 | $config['smtp_server'] = 'tls://mail.immae.eu'; | ||
21 | |||
22 | $config['imap_cache'] = 'db'; | ||
23 | $config['messages_cache'] = 'db'; | ||
24 | |||
25 | $config['support_url'] = '''; | ||
26 | |||
27 | $config['des_key'] = '${env.secret}'; | ||
28 | |||
29 | $config['plugins'] = array(); | ||
30 | |||
31 | $config['language'] = 'fr_FR'; | ||
32 | |||
33 | $config['drafts_mbox'] = 'Mail/Drafts'; | ||
34 | $config['junk_mbox'] = 'Mail/Spam'; | ||
35 | $config['sent_mbox'] = 'Mail/sent'; | ||
36 | $config['trash_mbox'] = '''; | ||
37 | $config['default_folders'] = array('INBOX', 'Mail/Drafts', 'Mail/sent', 'Mail/Spam', '''); | ||
38 | $config['draft_autosave'] = 60; | ||
39 | $config['enable_installer'] = false; | ||
40 | $config['log_driver'] = 'stdout'; | ||
41 | $config['temp_dir'] = '${varDir}/cache'; | ||
42 | $config['debug_level'] = 1; | ||
43 | ''; | ||
44 | webRoot = stdenv.mkDerivation rec { | ||
45 | version = "1.3.8"; | ||
46 | name = "roundcubemail-${version}"; | ||
47 | src= fetchurl { | ||
48 | url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz"; | ||
49 | sha256 = "018djad7ygfl9c9f2l2j42qkg31ml3hs2f01f0dk361zckwk77n4"; | ||
50 | }; | ||
51 | buildPhase = '' | ||
52 | sed -i \ | ||
53 | -e "s|RCUBE_INSTALL_PATH . 'temp.*|'${varDir}/cache';|" \ | ||
54 | config/defaults.inc.php | ||
55 | ''; | ||
56 | installPhase = '' | ||
57 | cp -a . $out | ||
58 | ln -s ${config} $out/config/config.inc.php | ||
59 | ${builtins.concatStringsSep "\n" ( | ||
60 | lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/plugins/${name}") plugins | ||
61 | )} | ||
62 | ''; | ||
63 | }; | ||
64 | apache = { | ||
65 | user = "wwwrun"; | ||
66 | group = "wwwrun"; | ||
67 | modules = [ "proxy_fcgi" ]; | ||
68 | vhostConf = '' | ||
69 | Alias /roundcube "${webRoot}" | ||
70 | <Directory "${webRoot}"> | ||
71 | DirectoryIndex index.php | ||
72 | AllowOverride All | ||
73 | Options FollowSymlinks | ||
74 | Require all granted | ||
75 | |||
76 | <FilesMatch "\.php$"> | ||
77 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | ||
78 | </FilesMatch> | ||
79 | </Directory> | ||
80 | ''; | ||
81 | }; | ||
82 | phpFpm = rec { | ||
83 | basedir = builtins.concatStringsSep ":" ( | ||
84 | [ webRoot config varDir ] | ||
85 | ++ lib.attrsets.mapAttrsToList (name: value: value) plugins); | ||
86 | socket = "/var/run/phpfpm/roundcubemail.sock"; | ||
87 | pool = '' | ||
88 | listen = ${socket} | ||
89 | user = ${apache.user} | ||
90 | group = ${apache.group} | ||
91 | listen.owner = ${apache.user} | ||
92 | listen.group = ${apache.group} | ||
93 | pm = ondemand | ||
94 | pm.max_children = 60 | ||
95 | pm.process_idle_timeout = 60 | ||
96 | |||
97 | ; Needed to avoid clashes in browser cookies (same domain) | ||
98 | php_value[session.name] = RoundcubemailPHPSESSID | ||
99 | php_admin_value[open_basedir] = "${basedir}:/tmp" | ||
100 | php_admin_value[session.save_path] = "${varDir}/phpSessions" | ||
101 | ''; | ||
102 | }; | ||
103 | }; | ||
104 | in | ||
105 | roundcubemail | ||