diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-08 13:28:22 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-08 13:28:22 +0100 |
commit | d252d718e9d42fb3a13d64e5b8daa37ca9264211 (patch) | |
tree | 13a86e0c51b49f5a7f0f8b85cbb2701fcd591dcb /virtual | |
parent | eb770e147c5491ca1a2c74f6eef5e28c15394a3d (diff) | |
download | Nix-d252d718e9d42fb3a13d64e5b8daa37ca9264211.tar.gz Nix-d252d718e9d42fb3a13d64e5b8daa37ca9264211.tar.zst Nix-d252d718e9d42fb3a13d64e5b8daa37ca9264211.zip |
Add roundcubemail
Diffstat (limited to 'virtual')
-rw-r--r-- | virtual/eldiron.nix | 4 | ||||
-rw-r--r-- | virtual/packages.nix | 2 | ||||
-rw-r--r-- | virtual/packages/roundcubemail.nix | 110 |
3 files changed, 116 insertions, 0 deletions
diff --git a/virtual/eldiron.nix b/virtual/eldiron.nix index 2152aff..172b369 100644 --- a/virtual/eldiron.nix +++ b/virtual/eldiron.nix | |||
@@ -256,6 +256,7 @@ | |||
256 | nextcloud = mypkgs.nextcloud.phpFpm.pool; | 256 | nextcloud = mypkgs.nextcloud.phpFpm.pool; |
257 | mantisbt = mypkgs.mantisbt.phpFpm.pool; | 257 | mantisbt = mypkgs.mantisbt.phpFpm.pool; |
258 | ttrss = mypkgs.ttrss.phpFpm.pool; | 258 | ttrss = mypkgs.ttrss.phpFpm.pool; |
259 | roundcubemail = mypkgs.roundcubemail.phpFpm.pool; | ||
259 | }; | 260 | }; |
260 | }; | 261 | }; |
261 | 262 | ||
@@ -272,6 +273,7 @@ | |||
272 | aten_prod = mypkgs.aten_prod.activationScript; | 273 | aten_prod = mypkgs.aten_prod.activationScript; |
273 | nextcloud = mypkgs.nextcloud.activationScript; | 274 | nextcloud = mypkgs.nextcloud.activationScript; |
274 | ttrss = mypkgs.ttrss.activationScript; | 275 | ttrss = mypkgs.ttrss.activationScript; |
276 | roundcubemail = mypkgs.roundcubemail.activationScript; | ||
275 | httpd = '' | 277 | httpd = '' |
276 | install -d -m 0755 /var/lib/acme/acme-challenge | 278 | install -d -m 0755 /var/lib/acme/acme-challenge |
277 | install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions | 279 | install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions |
@@ -432,6 +434,7 @@ | |||
432 | mypkgs.git.web.apache.modules ++ | 434 | mypkgs.git.web.apache.modules ++ |
433 | mypkgs.mantisbt.apache.modules ++ | 435 | mypkgs.mantisbt.apache.modules ++ |
434 | mypkgs.ttrss.apache.modules ++ | 436 | mypkgs.ttrss.apache.modules ++ |
437 | mypkgs.roundcubemail.apache.modules ++ | ||
435 | pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules) apacheConfig) ++ | 438 | pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules) apacheConfig) ++ |
436 | [ "macro" ]); | 439 | [ "macro" ]); |
437 | extraConfig = builtins.concatStringsSep "\n" | 440 | extraConfig = builtins.concatStringsSep "\n" |
@@ -458,6 +461,7 @@ | |||
458 | mypkgs.adminer.apache.vhostConf | 461 | mypkgs.adminer.apache.vhostConf |
459 | mypkgs.ympd.apache.vhostConf | 462 | mypkgs.ympd.apache.vhostConf |
460 | mypkgs.ttrss.apache.vhostConf | 463 | mypkgs.ttrss.apache.vhostConf |
464 | mypkgs.roundcubemail.apache.vhostConf | ||
461 | ]; | 465 | ]; |
462 | }) | 466 | }) |
463 | (withConf "eldiron" // { | 467 | (withConf "eldiron" // { |
diff --git a/virtual/packages.nix b/virtual/packages.nix index ee5dc15..ef14e90 100644 --- a/virtual/packages.nix +++ b/virtual/packages.nix | |||
@@ -11,6 +11,7 @@ let | |||
11 | gitweb = callPackage ./packages/gitweb.nix {}; | 11 | gitweb = callPackage ./packages/gitweb.nix {}; |
12 | mantisbt = callPackage ./packages/mantisbt.nix { inherit checkEnv fetchedGithub; }; | 12 | mantisbt = callPackage ./packages/mantisbt.nix { inherit checkEnv fetchedGithub; }; |
13 | ttrss = callPackage ./packages/ttrss.nix { inherit checkEnv fetchedGithub fetchedGit; }; | 13 | ttrss = callPackage ./packages/ttrss.nix { inherit checkEnv fetchedGithub fetchedGit; }; |
14 | roundcubemail = callPackage ./packages/roundcubemail.nix { inherit checkEnv; }; | ||
14 | in | 15 | in |
15 | { | 16 | { |
16 | inherit adminer; | 17 | inherit adminer; |
@@ -28,6 +29,7 @@ in | |||
28 | inherit nextcloud; | 29 | inherit nextcloud; |
29 | inherit mantisbt; | 30 | inherit mantisbt; |
30 | inherit ttrss; | 31 | inherit ttrss; |
32 | inherit roundcubemail; | ||
31 | # FIXME: add buildbot | 33 | # FIXME: add buildbot |
32 | git = { web = gitweb; }; | 34 | git = { web = gitweb; }; |
33 | } | 35 | } |
diff --git a/virtual/packages/roundcubemail.nix b/virtual/packages/roundcubemail.nix new file mode 100644 index 0000000..1aa2d87 --- /dev/null +++ b/virtual/packages/roundcubemail.nix | |||
@@ -0,0 +1,110 @@ | |||
1 | { lib, checkEnv, writeText, stdenv, fetchurl }: | ||
2 | let | ||
3 | roundcubemail = let | ||
4 | plugins = {}; | ||
5 | in rec { | ||
6 | varDir = "/var/lib/roundcubemail"; | ||
7 | # FIXME: initial sync | ||
8 | activationScript = { | ||
9 | deps = [ "wrappers" ]; | ||
10 | text = '' | ||
11 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ | ||
12 | ${varDir}/cache | ||
13 | install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions | ||
14 | ''; | ||
15 | }; | ||
16 | config = | ||
17 | # FIXME: LOG_DESTINATION syslog? | ||
18 | assert checkEnv "NIXOPS_ROUNDCUBEMAIL_PSQL_URL"; | ||
19 | assert checkEnv "NIXOPS_ROUNDCUBEMAIL_SECRET"; | ||
20 | writeText "config.php" '' | ||
21 | <?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'; | ||
26 | |||
27 | $config['imap_cache'] = 'db'; | ||
28 | $config['messages_cache'] = 'db'; | ||
29 | |||
30 | $config['support_url'] = '''; | ||
31 | |||
32 | $config['des_key'] = '${builtins.getEnv "NIXOPS_ROUNDCUBEMAIL_SECRET"}'; | ||
33 | |||
34 | $config['plugins'] = array(); | ||
35 | |||
36 | $config['language'] = 'fr_FR'; | ||
37 | |||
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; | ||
48 | ''; | ||
49 | webRoot = stdenv.mkDerivation rec { | ||
50 | version = "1.3.8"; | ||
51 | name = "roundcubemail-${version}"; | ||
52 | src= fetchurl { | ||
53 | url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz"; | ||
54 | sha256 = "018djad7ygfl9c9f2l2j42qkg31ml3hs2f01f0dk361zckwk77n4"; | ||
55 | }; | ||
56 | buildPhase = '' | ||
57 | sed -i \ | ||
58 | -e "s|RCUBE_INSTALL_PATH . 'temp.*|'${varDir}/cache';|" \ | ||
59 | config/defaults.inc.php | ||
60 | ''; | ||
61 | installPhase = '' | ||
62 | cp -a . $out | ||
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 | ||
66 | )} | ||
67 | ''; | ||
68 | }; | ||
69 | apache = { | ||
70 | user = "wwwrun"; | ||
71 | group = "wwwrun"; | ||
72 | modules = [ "proxy_fcgi" ]; | ||
73 | vhostConf = '' | ||
74 | Alias /roundcube "${webRoot}" | ||
75 | <Directory "${webRoot}"> | ||
76 | DirectoryIndex index.php | ||
77 | AllowOverride All | ||
78 | Options FollowSymlinks | ||
79 | Require all granted | ||
80 | |||
81 | <FilesMatch "\.php$"> | ||
82 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | ||
83 | </FilesMatch> | ||
84 | </Directory> | ||
85 | ''; | ||
86 | }; | ||
87 | phpFpm = rec { | ||
88 | basedir = builtins.concatStringsSep ":" ( | ||
89 | [ webRoot config varDir ] | ||
90 | ++ lib.attrsets.mapAttrsToList (name: value: value) plugins); | ||
91 | socket = "/var/run/phpfpm/roundcubemail.sock"; | ||
92 | pool = '' | ||
93 | listen = ${socket} | ||
94 | user = ${apache.user} | ||
95 | group = ${apache.group} | ||
96 | listen.owner = ${apache.user} | ||
97 | listen.group = ${apache.group} | ||
98 | pm = ondemand | ||
99 | pm.max_children = 60 | ||
100 | pm.process_idle_timeout = 60 | ||
101 | |||
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" | ||
106 | ''; | ||
107 | }; | ||
108 | }; | ||
109 | in | ||
110 | roundcubemail | ||