nixos/roundcube: add package option
With this option it's possible to specify a custom expression for `roundcube`, i.e. a roundcube environment with third-party plugins as shown in the testcase.
This commit is contained in:
parent
df0d11575c
commit
6fb825b057
@ -25,6 +25,20 @@ in
|
|||||||
description = "Hostname to use for the nginx vhost";
|
description = "Hostname to use for the nginx vhost";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.roundcube;
|
||||||
|
|
||||||
|
example = literalExample ''
|
||||||
|
roundcube.withPlugins (plugins: [ plugins.persistent_login ])
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
The package which contains roundcube's sources. Can be overriden to create
|
||||||
|
an environment which contains roundcube and third-party plugins.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
username = mkOption {
|
username = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@ -86,7 +100,7 @@ in
|
|||||||
forceSSL = mkDefault true;
|
forceSSL = mkDefault true;
|
||||||
enableACME = mkDefault true;
|
enableACME = mkDefault true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
root = pkgs.roundcube;
|
root = cfg.package;
|
||||||
index = "index.php";
|
index = "index.php";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
location ~* \.php$ {
|
location ~* \.php$ {
|
||||||
@ -140,12 +154,12 @@ in
|
|||||||
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create database ${cfg.database.dbname} with owner ${cfg.database.username}";
|
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create database ${cfg.database.dbname} with owner ${cfg.database.username}";
|
||||||
fi
|
fi
|
||||||
PGPASSWORD=${cfg.database.password} ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
|
PGPASSWORD=${cfg.database.password} ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
|
||||||
-f ${pkgs.roundcube}/SQL/postgres.initial.sql \
|
-f ${cfg.package}/SQL/postgres.initial.sql \
|
||||||
-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
|
${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
|
||||||
'';
|
'';
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,8 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||||||
enable = true;
|
enable = true;
|
||||||
hostName = "roundcube";
|
hostName = "roundcube";
|
||||||
database.password = "notproduction";
|
database.password = "notproduction";
|
||||||
|
package = pkgs.roundcube.withPlugins (plugins: [ plugins.persistent_login ]);
|
||||||
|
plugins = [ "persistent_login" ];
|
||||||
};
|
};
|
||||||
services.nginx.virtualHosts.roundcube = {
|
services.nginx.virtualHosts.roundcube = {
|
||||||
forceSSL = false;
|
forceSSL = false;
|
||||||
@ -23,6 +25,6 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||||||
$roundcube->waitForUnit("postgresql.service");
|
$roundcube->waitForUnit("postgresql.service");
|
||||||
$roundcube->waitForUnit("phpfpm-roundcube.service");
|
$roundcube->waitForUnit("phpfpm-roundcube.service");
|
||||||
$roundcube->waitForUnit("nginx.service");
|
$roundcube->waitForUnit("nginx.service");
|
||||||
$roundcube->succeed("curl -sSfL http://roundcube/");
|
$roundcube->succeed("curl -sSfL http://roundcube/ | grep 'Keep me logged in'");
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user