roundcube: apply code review suggestions

This commit is contained in:
Robin Gloster 2018-11-28 17:33:26 +01:00
parent 9ace7f6409
commit 1262a5ca97
No known key found for this signature in database
GPG Key ID: D5C458DF6DD97EDF
3 changed files with 20 additions and 12 deletions

View File

@ -7,13 +7,13 @@ let
in in
{ {
options.services.roundcube = { options.services.roundcube = {
enable = mkEnableOption "Roundcube"; enable = mkOption {
nginx.enable = mkOption {
type = types.bool; type = types.bool;
default = true; default = false;
description = '' 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>. 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. See <xref linkend="opt-services.nginx.virtualHosts"/> for further information.
''; '';
@ -21,8 +21,8 @@ in
hostName = mkOption { hostName = mkOption {
type = types.str; type = types.str;
example = "webmail"; example = "webmail.example.com";
description = "Host name to use which for the nginx vhost"; description = "Hostname to use for the nginx vhost";
}; };
database = { database = {
@ -34,7 +34,12 @@ in
host = mkOption { host = mkOption {
type = types.str; type = types.str;
default = "localhost"; 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 { password = mkOption {
type = types.str; type = types.str;
@ -51,7 +56,7 @@ in
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
description = '' 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} ${cfg.extraConfig}
''; '';
services.nginx = mkIf cfg.nginx.enable { services.nginx = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {
${cfg.hostName} = { ${cfg.hostName} = {
@ -100,7 +105,7 @@ in
enable = true; enable = true;
}; };
services.phpfpm.poolConfigs.${cfg.hostName} = '' services.phpfpm.poolConfigs.roundcube = ''
listen = /run/phpfpm/roundcube listen = /run/phpfpm/roundcube
listen.owner = nginx listen.owner = nginx
listen.group = nginx listen.group = nginx
@ -139,6 +144,8 @@ in
-h ${cfg.database.host} ${cfg.database.dbname} -h ${cfg.database.host} ${cfg.database.dbname}
touch /var/lib/roundcube/db-created touch /var/lib/roundcube/db-created
fi fi
${pkgs.php}/bin/php ${pkgs.roundcube}/bin/update.sh
''; '';
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
}; };

View File

@ -178,6 +178,7 @@ in
rabbitmq = handleTest ./rabbitmq.nix {}; rabbitmq = handleTest ./rabbitmq.nix {};
radicale = handleTest ./radicale.nix {}; radicale = handleTest ./radicale.nix {};
redmine = handleTest ./redmine.nix {}; redmine = handleTest ./redmine.nix {};
roundcube = handleTest ./roundcube.nix {};
rspamd = handleTest ./rspamd.nix {}; rspamd = handleTest ./rspamd.nix {};
rss2email = handleTest ./rss2email.nix {}; rss2email = handleTest ./rss2email.nix {};
rsyslogd = handleTest ./rsyslogd.nix {}; rsyslogd = handleTest ./rsyslogd.nix {};

View File

@ -9,7 +9,6 @@ import ./make-test.nix ({ pkgs, ...} : {
services.roundcube = { services.roundcube = {
enable = true; enable = true;
hostName = "roundcube"; hostName = "roundcube";
nginx.enable = true;
database.password = "notproduction"; database.password = "notproduction";
}; };
services.nginx.virtualHosts.roundcube = { services.nginx.virtualHosts.roundcube = {
@ -23,6 +22,7 @@ import ./make-test.nix ({ pkgs, ...} : {
$roundcube->start; $roundcube->start;
$roundcube->waitForUnit("postgresql.service"); $roundcube->waitForUnit("postgresql.service");
$roundcube->waitForUnit("phpfpm-roundcube.service"); $roundcube->waitForUnit("phpfpm-roundcube.service");
$roundcube->waitForUnit("nginx.service");
$roundcube->succeed("curl -sSfL http://roundcube/"); $roundcube->succeed("curl -sSfL http://roundcube/");
''; '';
}) })