Merge pull request #84940 from symphorien/rouncube-spell

roundcube: use pspell for spellchecking
This commit is contained in:
Maximilian Bosch 2020-04-11 14:33:43 +02:00 committed by GitHub
commit c9504b0b68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -7,6 +7,7 @@ let
fpm = config.services.phpfpm.pools.roundcube;
localDB = cfg.database.host == "localhost";
user = cfg.database.username;
phpWithPspell = pkgs.php.withExtensions (e: [ e.pspell ] ++ pkgs.php.enabledExtensions);
in
{
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 {
type = types.lines;
default = "";
@ -109,6 +119,11 @@ in
$config['plugins'] = [${concatMapStringsSep "," (p: "'${p}'") cfg.plugins}];
$config['des_key'] = file_get_contents('/var/lib/roundcube/des_key');
$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}
'';
@ -172,6 +187,8 @@ in
"pm.max_requests" = 500;
"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" ];
@ -199,7 +216,7 @@ in
${psql} <<< 'TRUNCATE TABLE session;'
fi
${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
${phpWithPspell}/bin/php ${cfg.package}/bin/update.sh
'';
serviceConfig = {
Type = "oneshot";

View File

@ -12,6 +12,7 @@ import ./make-test-python.nix ({ pkgs, ...} : {
database.password = "not production";
package = pkgs.roundcube.withPlugins (plugins: [ plugins.persistent_login ]);
plugins = [ "persistent_login" ];
dicts = with pkgs.aspellDicts; [ en fr de ];
};
services.nginx.virtualHosts.roundcube = {
forceSSL = false;