2023-11-25 21:23:06 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.roundcube;
|
2024-04-10 23:31:04 +02:00
|
|
|
domain = "webmail.pvv.ntnu.no";
|
2024-08-04 02:30:25 +02:00
|
|
|
in
|
2023-11-25 21:23:06 +01:00
|
|
|
{
|
|
|
|
services.roundcube = {
|
2023-11-26 05:04:49 +01:00
|
|
|
enable = true;
|
2023-11-25 21:23:06 +01:00
|
|
|
|
2023-11-26 05:04:49 +01:00
|
|
|
package = pkgs.roundcube.withPlugins (plugins: with plugins; [
|
|
|
|
persistent_login
|
|
|
|
thunderbird_labels
|
|
|
|
contextmenu
|
|
|
|
custom_from
|
|
|
|
]);
|
|
|
|
|
|
|
|
dicts = with pkgs.aspellDicts; [ en en-science en-computers nb nn fr de it ];
|
|
|
|
maxAttachmentSize = 20;
|
|
|
|
hostName = "roundcubeplaceholder.example.com";
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
$config['enable_installer'] = false;
|
|
|
|
$config['default_host'] = "ssl://imap.pvv.ntnu.no";
|
|
|
|
$config['default_port'] = 993;
|
|
|
|
$config['smtp_server'] = "ssl://smtp.pvv.ntnu.no";
|
|
|
|
$config['smtp_port'] = 465;
|
|
|
|
$config['mail_domain'] = "pvv.ntnu.no";
|
|
|
|
$config['smtp_user'] = "%u";
|
|
|
|
$config['support_url'] = "";
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."roundcubeplaceholder.example.com" = lib.mkForce { };
|
|
|
|
|
|
|
|
services.nginx.virtualHosts.${domain} = {
|
2024-04-10 22:01:19 +02:00
|
|
|
kTLS = true;
|
2023-11-26 05:04:49 +01:00
|
|
|
locations."/roundcube" = {
|
|
|
|
tryFiles = "$uri $uri/ =404";
|
|
|
|
index = "index.php";
|
|
|
|
root = pkgs.runCommandLocal "roundcube-dir" { } ''
|
|
|
|
mkdir -p $out
|
|
|
|
ln -s ${cfg.package} $out/roundcube
|
|
|
|
'';
|
2023-11-25 21:23:06 +01:00
|
|
|
extraConfig = ''
|
2023-11-26 05:04:49 +01:00
|
|
|
location ~ ^/roundcube/(${builtins.concatStringsSep "|" [
|
|
|
|
# https://wiki.archlinux.org/title/Roundcube
|
|
|
|
"README"
|
|
|
|
"INSTALL"
|
|
|
|
"LICENSE"
|
|
|
|
"CHANGELOG"
|
|
|
|
"UPGRADING"
|
|
|
|
"bin"
|
|
|
|
"SQL"
|
|
|
|
".+\\.md"
|
|
|
|
"\\."
|
|
|
|
"config"
|
|
|
|
"temp"
|
|
|
|
"logs"
|
|
|
|
]})/? {
|
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/roundcube/(.+\.php)(/?.*)$ {
|
|
|
|
fastcgi_split_path_info ^/roundcube(/.+\.php)(/.+)$;
|
|
|
|
include ${config.services.nginx.package}/conf/fastcgi_params;
|
|
|
|
include ${config.services.nginx.package}/conf/fastcgi.conf;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
fastcgi_pass unix:${config.services.phpfpm.pools.roundcube.socket};
|
|
|
|
}
|
2023-11-25 21:23:06 +01:00
|
|
|
'';
|
2023-11-26 05:04:49 +01:00
|
|
|
};
|
|
|
|
};
|
2023-11-25 21:23:06 +01:00
|
|
|
}
|