Mail : Expunge old mail.

This commit is contained in:
Dmitry Voronin 2024-08-31 19:15:32 +03:00
parent 82407d5c30
commit 2ea6a04b6d
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
3 changed files with 73 additions and 52 deletions

View file

@ -32,7 +32,7 @@ in {
services.cloudflare-dyndns = { services.cloudflare-dyndns = {
enable = true; enable = true;
apiTokenFile = "/data/token"; apiTokenFile = "/data/token";
deleteMissing = true; deleteMissing = false;
ipv4 = true; ipv4 = true;
ipv6 = false; ipv6 = false;
proxied = false; proxied = false;
@ -46,10 +46,6 @@ in {
"paste" "paste"
"play" "play"
"vpn" "vpn"
"fmp-git"
"fmp-cloud"
"fmp-dev"
"fmp-master"
]; ];
}; };
}; };

View file

@ -144,7 +144,7 @@ in {
Junk = { Junk = {
auto = "subscribe"; auto = "subscribe";
specialUse = "Junk"; specialUse = "Junk";
autoexpunge = "7d"; # autoexpunge = "3d";
}; };
Sent = { Sent = {
auto = "subscribe"; auto = "subscribe";
@ -153,7 +153,7 @@ in {
Trash = { Trash = {
auto = "subscribe"; auto = "subscribe";
specialUse = "Trash"; specialUse = "Trash";
autoexpunge = "30d"; # autoexpunge = "30d";
}; };
}; };
@ -170,31 +170,54 @@ in {
# }; # };
}; };
services.roundcube = { services = {
enable = true; roundcube = {
dicts = with pkgs.aspellDicts; [ en ru ]; enable = true;
hostName = cfg.domain; dicts = with pkgs.aspellDicts; [ en ru ];
plugins = [ hostName = cfg.domain;
"managesieve" plugins = [
]; "managesieve"
extraConfig = '' ];
# starttls needed for authentication, so the fqdn required to match extraConfig = ''
# the certificate # starttls needed for authentication, so the fqdn required to match
# $config['smtp_server'] = "tls://${config.mailserver.fqdn}"; # the certificate
# $config['smtp_server'] = "tls://localhost"; # $config['smtp_server'] = "tls://${config.mailserver.fqdn}";
$config['smtp_server'] = "localhost:25"; # $config['smtp_server'] = "tls://localhost";
$config['smtp_auth_type'] = null; $config['smtp_server'] = "localhost:25";
$config['smtp_user'] = ""; $config['smtp_auth_type'] = null;
$config['smtp_pass'] = ""; $config['smtp_user'] = "";
# $config['smtp_user'] = "%u"; $config['smtp_pass'] = "";
# $config['smtp_pass'] = "%p"; # $config['smtp_user'] = "%u";
''; # $config['smtp_pass'] = "%p";
'';
};
nginx = {
virtualHosts.${cfg.domain} = {
forceSSL = false;
enableACME = false;
};
};
}; };
services.nginx = { systemd = {
virtualHosts.${cfg.domain} = { services.autoexpunge = {
forceSSL = false; description = "Delete old mail";
enableACME = false; serviceConfig.Type = "oneshot";
path = [ pkgs.dovecot ];
script = ''
doveadm expunge -A mailbox Junk SENTBEFORE 7d
doveadm expunge -A mailbox Trash SENTBEFORE 30d
'';
};
timers.autoexpunge = {
timerConfig = {
OnCalendar = "daily";
Persistent = true;
Unit = "autoexpunge.service";
};
wantedBy = [ "timers.target" ];
}; };
}; };
}; };

View file

@ -23,29 +23,31 @@ in {
variables.OLLAMA_MODEL = cfg.primaryModel; variables.OLLAMA_MODEL = cfg.primaryModel;
}; };
# Enable Ollama server. systemd.services = {
systemd.services.ollama = { # Enable Ollama server.
description = "Ollama LLM server."; ollama = {
wantedBy = [ "multi-user.target" ]; description = "Ollama LLM server.";
wants = [ "NetworkManager-wait-online.service" ]; wantedBy = [ "multi-user.target" ];
after = [ "NetworkManager-wait-online.service" ]; wants = [ "NetworkManager-wait-online.service" ];
serviceConfig.Type = "simple"; after = [ "NetworkManager-wait-online.service" ];
script = '' serviceConfig.Type = "simple";
HOME=/root ${getExe pkgs.ollama} serve script = ''
''; HOME=/root ${getExe pkgs.ollama} serve
}; '';
};
# Download Ollama models. # Download Ollama models.
systemd.services.ollamamodel = { ollamamodel = {
description = "Ollama LLM model."; description = "Ollama LLM model.";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "ollama.service" ]; wants = [ "ollama.service" ];
after = [ "ollama.service" ]; after = [ "ollama.service" ];
serviceConfig.Type = "simple"; serviceConfig.Type = "simple";
script = '' script = ''
sleep 5 sleep 5
${getExe pkgs.ollama} pull ${concatStringsSep " " cfg.models} ${getExe pkgs.ollama} pull ${concatStringsSep " " cfg.models}
''; '';
};
}; };
}; };
} }