self-hosting/modules/roundcube.nix

59 lines
1.5 KiB
Nix
Raw Normal View History

2024-12-10 11:39:55 +01:00
{
pkgs,
lib,
config,
...
}:
let
cfg = config.custom.services.roundcube;
in
{
2024-03-26 23:37:53 +01:00
options.custom.services.roundcube = {
enable = lib.mkEnableOption "roundcube";
2021-12-27 16:39:22 +01:00
};
2024-03-26 23:37:53 +01:00
config = lib.mkIf cfg.enable {
sops.secrets = {
pgPassFile = {
owner = "nginx";
key = "roundcube/pg_pass_file";
};
dbPassword = {
owner = "nginx";
key = "roundcube/db_password";
};
2021-12-27 16:39:22 +01:00
};
2024-03-26 23:37:53 +01:00
services.roundcube = {
enable = true;
plugins = [ "managesieve" ];
2024-12-10 11:39:55 +01:00
dicts = with pkgs.aspellDicts; [
en
fr
de
];
2024-03-26 23:37:53 +01:00
hostName = "webmail.banditlair.com";
database = {
2024-12-10 11:39:55 +01:00
host = "127.0.0.1";
2024-03-26 23:37:53 +01:00
username = "roundcube";
dbname = "roundcube";
passwordFile = config.sops.secrets.pgPassFile.path;
};
2021-12-27 16:39:22 +01:00
2024-03-26 23:37:53 +01:00
extraConfig = ''
# This override is required as a workaround for the nixpkgs config because we need a plain password instead of a pgpass file
$password = file_get_contents('${config.sops.secrets.dbPassword.path}');
2024-12-10 11:39:55 +01:00
$config['db_dsnw'] = 'pgsql://roundcube:' . $password . '@127.0.0.1/roundcube';
2021-12-27 16:39:22 +01:00
2024-12-10 11:39:55 +01:00
$config['imap_host'] = 'ssl://mail.banditlair.com:993';
$config['smtp_host'] = 'ssl://%h';
2024-03-26 23:37:53 +01:00
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['identities_level'] = 0;
$config['managesieve_host'] = 'tls://%h';
$config['managesieve_auth_type'] = 'PLAIN';
'';
};
2021-12-27 16:39:22 +01:00
};
}