about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2018-11-28 17:33:26 +0100
committerRobin Gloster <mail@glob.in>2018-11-28 18:53:37 +0100
commit1262a5ca975b26fe113b5a03cddbc184cc7a4f58 (patch)
treee30d891c083b078e1f169421d4a5cf90b31b0b33 /nixos
parent9ace7f640996bb3e95f8233a74ef980af3a35559 (diff)
downloadnixlib-1262a5ca975b26fe113b5a03cddbc184cc7a4f58.tar
nixlib-1262a5ca975b26fe113b5a03cddbc184cc7a4f58.tar.gz
nixlib-1262a5ca975b26fe113b5a03cddbc184cc7a4f58.tar.bz2
nixlib-1262a5ca975b26fe113b5a03cddbc184cc7a4f58.tar.lz
nixlib-1262a5ca975b26fe113b5a03cddbc184cc7a4f58.tar.xz
nixlib-1262a5ca975b26fe113b5a03cddbc184cc7a4f58.tar.zst
nixlib-1262a5ca975b26fe113b5a03cddbc184cc7a4f58.zip
roundcube: apply code review suggestions
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/mail/roundcube.nix29
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/roundcube.nix2
3 files changed, 20 insertions, 12 deletions
diff --git a/nixos/modules/services/mail/roundcube.nix b/nixos/modules/services/mail/roundcube.nix
index b4ab429b5200..6d81c7374f4d 100644
--- a/nixos/modules/services/mail/roundcube.nix
+++ b/nixos/modules/services/mail/roundcube.nix
@@ -7,13 +7,13 @@ let
 in
 {
   options.services.roundcube = {
-    enable = mkEnableOption "Roundcube";
-
-    nginx.enable = mkOption {
+    enable = mkOption {
       type = types.bool;
-      default = true;
+      default = false;
       description = ''
-        Whether to enable nginx virtual host management.
+        Whether to enable roundcube.
+
+        Also enables nginx virtual host management.
         Further nginx configuration can be done by adapting <literal>services.nginx.virtualHosts.&lt;name&gt;</literal>.
         See <xref linkend="opt-services.nginx.virtualHosts"/> for further information.
       '';
@@ -21,8 +21,8 @@ in
 
     hostName = mkOption {
       type = types.str;
-      example = "webmail";
-      description = "Host name to use which for the nginx vhost";
+      example = "webmail.example.com";
+      description = "Hostname to use for the nginx vhost";
     };
 
     database = {
@@ -34,7 +34,12 @@ in
       host = mkOption {
         type = types.str;
         default = "localhost";
-        description = "Host of the postgresql server";
+        description = ''
+          Host of the postgresql server. If this is not set to
+          <literal>localhost</literal>, you have to create the
+          postgresql user and database yourself, with appropriate
+          permissions.
+        '';
       };
       password = mkOption {
         type = types.str;
@@ -51,7 +56,7 @@ in
       type = types.listOf types.str;
       default = [];
       description = ''
-        List of roundcube plugins to enable.
+        List of roundcube plugins to enable. Currently, only those directly shipped with Roundcube are supported.
       '';
     };
 
@@ -74,7 +79,7 @@ in
       ${cfg.extraConfig}
     '';
 
-    services.nginx = mkIf cfg.nginx.enable {
+    services.nginx = {
       enable = true;
       virtualHosts = {
         ${cfg.hostName} = {
@@ -100,7 +105,7 @@ in
       enable = true;
     };
 
-    services.phpfpm.poolConfigs.${cfg.hostName} = ''
+    services.phpfpm.poolConfigs.roundcube = ''
       listen = /run/phpfpm/roundcube
       listen.owner = nginx
       listen.group = nginx
@@ -139,6 +144,8 @@ in
             -h ${cfg.database.host} ${cfg.database.dbname}
           touch /var/lib/roundcube/db-created
         fi
+
+        ${pkgs.php}/bin/php ${pkgs.roundcube}/bin/update.sh
       '';
       serviceConfig.Type = "oneshot";
     };
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 7bf261b58d66..feffdb97c18f 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -178,6 +178,7 @@ in
   rabbitmq = handleTest ./rabbitmq.nix {};
   radicale = handleTest ./radicale.nix {};
   redmine = handleTest ./redmine.nix {};
+  roundcube = handleTest ./roundcube.nix {};
   rspamd = handleTest ./rspamd.nix {};
   rss2email = handleTest ./rss2email.nix {};
   rsyslogd = handleTest ./rsyslogd.nix {};
diff --git a/nixos/tests/roundcube.nix b/nixos/tests/roundcube.nix
index faa5f3fa0df0..178134fd9b30 100644
--- a/nixos/tests/roundcube.nix
+++ b/nixos/tests/roundcube.nix
@@ -9,7 +9,6 @@ import ./make-test.nix ({ pkgs, ...} : {
       services.roundcube = {
         enable = true;
         hostName = "roundcube";
-        nginx.enable = true;
         database.password = "notproduction";
       };
       services.nginx.virtualHosts.roundcube = {
@@ -23,6 +22,7 @@ import ./make-test.nix ({ pkgs, ...} : {
     $roundcube->start;
     $roundcube->waitForUnit("postgresql.service");
     $roundcube->waitForUnit("phpfpm-roundcube.service");
+    $roundcube->waitForUnit("nginx.service");
     $roundcube->succeed("curl -sSfL http://roundcube/");
   '';
 })