roundcube: use pspell for spellchecking
By default, upstream enables a third party service in the cloud: https://github.com/roundcube/roundcubemail/blob/1.4.3/config/defaults.inc.php#L790-L798
This commit is contained in:
parent
9b0d2f3fd1
commit
9e417bc9e3
|
@ -7,6 +7,7 @@ let
|
||||||
fpm = config.services.phpfpm.pools.roundcube;
|
fpm = config.services.phpfpm.pools.roundcube;
|
||||||
localDB = cfg.database.host == "localhost";
|
localDB = cfg.database.host == "localhost";
|
||||||
user = cfg.database.username;
|
user = cfg.database.username;
|
||||||
|
phpWithPspell = pkgs.php.withExtensions (e: [ e.pspell ] ++ pkgs.php.enabledExtensions);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.roundcube = {
|
options.services.roundcube = {
|
||||||
|
@ -85,6 +86,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dicts = mkOption {
|
||||||
|
type = types.listOf types.package;
|
||||||
|
default = [];
|
||||||
|
example = literalExample "with pkgs.aspellDicts; [ en fr de ]";
|
||||||
|
description = ''
|
||||||
|
List of aspell dictionnaries for spell checking. If empty, spell checking is disabled.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -109,6 +119,11 @@ in
|
||||||
$config['plugins'] = [${concatMapStringsSep "," (p: "'${p}'") cfg.plugins}];
|
$config['plugins'] = [${concatMapStringsSep "," (p: "'${p}'") cfg.plugins}];
|
||||||
$config['des_key'] = file_get_contents('/var/lib/roundcube/des_key');
|
$config['des_key'] = file_get_contents('/var/lib/roundcube/des_key');
|
||||||
$config['mime_types'] = '${pkgs.nginx}/conf/mime.types';
|
$config['mime_types'] = '${pkgs.nginx}/conf/mime.types';
|
||||||
|
$config['enable_spellcheck'] = ${if cfg.dicts == [] then "false" else "true"};
|
||||||
|
# by default, spellchecking uses a third-party cloud services
|
||||||
|
$config['spellcheck_engine'] = 'pspell';
|
||||||
|
$config['spellcheck_languages'] = array(${lib.concatMapStringsSep ", " (dict: let p = builtins.parseDrvName dict.shortName; in "'${p.name}' => '${dict.fullName}'") cfg.dicts});
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -172,6 +187,8 @@ in
|
||||||
"pm.max_requests" = 500;
|
"pm.max_requests" = 500;
|
||||||
"catch_workers_output" = true;
|
"catch_workers_output" = true;
|
||||||
};
|
};
|
||||||
|
phpPackage = phpWithPspell;
|
||||||
|
phpEnv.ASPELL_CONF = "dict-dir ${pkgs.aspellWithDicts (_: cfg.dicts)}/lib/aspell";
|
||||||
};
|
};
|
||||||
systemd.services.phpfpm-roundcube.after = [ "roundcube-setup.service" ];
|
systemd.services.phpfpm-roundcube.after = [ "roundcube-setup.service" ];
|
||||||
|
|
||||||
|
@ -199,7 +216,7 @@ in
|
||||||
${psql} <<< 'TRUNCATE TABLE session;'
|
${psql} <<< 'TRUNCATE TABLE session;'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
|
${phpWithPspell}/bin/php ${cfg.package}/bin/update.sh
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
|
|
|
@ -12,6 +12,7 @@ import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
database.password = "not production";
|
database.password = "not production";
|
||||||
package = pkgs.roundcube.withPlugins (plugins: [ plugins.persistent_login ]);
|
package = pkgs.roundcube.withPlugins (plugins: [ plugins.persistent_login ]);
|
||||||
plugins = [ "persistent_login" ];
|
plugins = [ "persistent_login" ];
|
||||||
|
dicts = with pkgs.aspellDicts; [ en fr de ];
|
||||||
};
|
};
|
||||||
services.nginx.virtualHosts.roundcube = {
|
services.nginx.virtualHosts.roundcube = {
|
||||||
forceSSL = false;
|
forceSSL = false;
|
||||||
|
|
Loading…
Reference in New Issue