2022-08-26 15:28:14 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
2022-08-28 13:12:04 +00:00
|
|
|
lib,
|
2022-08-26 15:28:14 +00:00
|
|
|
...
|
|
|
|
}: {
|
2022-01-20 08:57:32 +00:00
|
|
|
services.postfixadmin = {
|
|
|
|
enable = true;
|
|
|
|
adminEmail = "lotte@chir.rs";
|
|
|
|
database = {
|
|
|
|
dbname = "postfix";
|
|
|
|
host = "localhost";
|
|
|
|
passwordFile = "/run/secrets/services/postfixadmin/dbpassword";
|
|
|
|
username = "postfixadmin";
|
|
|
|
};
|
|
|
|
hostName = "mail.chir.rs";
|
|
|
|
setupPasswordFile = "/run/secrets/services/postfixadmin/setupPassword";
|
2022-01-22 14:29:32 +00:00
|
|
|
extraConfig = ''
|
2022-01-22 14:37:01 +00:00
|
|
|
$CONF['encrypt'] = 'dovecot:ARGON2ID';
|
2022-01-22 14:29:32 +00:00
|
|
|
$CONF['dovecotpw'] = '${pkgs.dovecot}/bin/doveadm pw';
|
|
|
|
'';
|
2022-01-20 08:57:32 +00:00
|
|
|
};
|
|
|
|
sops.secrets."services/postfixadmin/dbpassword" = {
|
2022-01-20 09:24:06 +00:00
|
|
|
owner = "postfixadmin";
|
2022-01-20 08:57:32 +00:00
|
|
|
};
|
|
|
|
sops.secrets."services/postfixadmin/setupPassword" = {
|
2022-01-20 09:24:06 +00:00
|
|
|
owner = "postfixadmin";
|
2022-01-20 08:57:32 +00:00
|
|
|
};
|
2022-06-12 15:39:15 +00:00
|
|
|
services.postgresql.ensureDatabases = ["postfix"];
|
2022-01-20 08:57:32 +00:00
|
|
|
services.postgresql.ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "postfixadmin";
|
|
|
|
ensurePermissions = {
|
|
|
|
"DATABASE \"postfix\"" = "ALL PRIVILEGES";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2022-08-26 15:28:14 +00:00
|
|
|
services.caddy.virtualHosts."mail.chir.rs" = {
|
|
|
|
useACMEHost = "chir.rs";
|
|
|
|
extraConfig = ''
|
|
|
|
import baseConfig
|
|
|
|
|
2022-08-28 13:12:04 +00:00
|
|
|
root * ${pkgs.postfixadmin}/public
|
2022-08-26 15:54:16 +00:00
|
|
|
php_fastcgi unix:${config.services.phpfpm.pools.postfixadmin.socket}
|
2022-08-26 15:28:14 +00:00
|
|
|
'';
|
2022-01-20 08:57:32 +00:00
|
|
|
};
|
2022-01-20 09:18:07 +00:00
|
|
|
services.phpfpm.pools.postfixadmin.settings."listen.group" = "acme"; # there is no nginx group
|
2022-03-06 13:42:51 +00:00
|
|
|
services.phpfpm.pools.postfixadmin.group = "dovecot";
|
2022-01-20 08:57:32 +00:00
|
|
|
}
|