Wrap service options in service

This commit is contained in:
niten 2023-09-23 17:18:40 -07:00
parent 2faf1a8a02
commit 765792dc54
1 changed files with 47 additions and 35 deletions

View File

@ -188,6 +188,7 @@ in {
in {
smtp = {
service = {
networks = [
"internal_network"
# Needs access to internet to forward emails
@ -198,6 +199,7 @@ in {
"${cfg.smtp.ssl-directory}:/run/certs/smtp"
];
ports = [ "25:25" "587:587" "465:465" "2525:2525" ];
};
nixos = {
useSystemd = true;
configuration = [
@ -250,6 +252,7 @@ in {
};
};
imap = {
service = {
networks = [ "internal_network" ];
ports = [ "143:143" "993:993" ];
user = mkUserMap "mailserver-dovecot";
@ -258,6 +261,7 @@ in {
"${hostSecrets.dovecotLdapConfig.target-file}:/run/dovecot2/conf.d/ldap.conf:ro"
"${cfg.imap.ssl-directory}:/run/certs/imap"
];
};
nixos = {
useSystemd = true;
configuration = [
@ -302,11 +306,13 @@ in {
envFile = hostSecrets.mailLdapProxyEnv.target-file;
};
antispam = {
service = {
networks = [
"internal_network"
# Needs external access for blacklist checks
"external_network"
];
};
nixos = {
useSystemd = true;
configuration = [
@ -331,6 +337,7 @@ in {
};
};
antivirus = {
service = {
networks = [
"internal_network"
# Needs external access for database updates
@ -338,6 +345,7 @@ in {
];
user = mkUserMap "mailserver-antivirus";
volumes = [ "${cfg.state-directory}/antivirus:/state" ];
};
nixos = {
useSystemd = true;
configuration = [
@ -355,9 +363,11 @@ in {
};
};
dkim = {
service = {
networks = [ "internal_network" ];
user = mkUserMap "mailserver-dkim";
volumes = [ "${cfg.state-directory}/dkim:/state" ];
};
nixos = {
useSystemd = true;
configuration = [
@ -377,8 +387,10 @@ in {
};
};
metrics-proxy = {
service = {
networks = [ "internal_network" ];
ports = [ "${toString cfg.metricsPort}:80" ];
};
nixos = {
useSystemd = true;
configuration = {