Compare commits

..

3 commits

Author SHA1 Message Date
a854caaf19 feat(mx): add pg_upgrade script for PostgreSQL 14 → 16 migration
Temporary upgrade script following the official NixOS procedure.
Run `upgrade-pg-cluster --jobs 4 --link` on the server, then switch
the package to postgresql_16 and remove the script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:20:26 +01:00
dc4594333f fix(mx): fix check_root email subject and consolidate systemd attrsets
The check_root service incorrectly used '/boot Disk Space Alert' as
the email subject instead of '/ Disk Space Alert'. Also merged the
duplicate systemd.services and systemd.timers attribute sets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:09:32 +01:00
d11199da10 fix(mx): update stale comment in Roundcube config to reflect SSL/TLS
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:08:55 +01:00
3 changed files with 37 additions and 15 deletions

View file

@ -118,18 +118,6 @@
}; };
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
}; };
};
systemd.timers = {
check_boot = {
timerConfig = {
OnCalendar = "daily";
};
wantedBy = [ "timers.target" ];
};
};
systemd.services = {
check_root = { check_root = {
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
@ -140,7 +128,7 @@
THRESHOLD=85 THRESHOLD=85
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
${pkgs.mailutils}/bin/mail -s '/boot Disk Space Alert' harald << EOF ${pkgs.mailutils}/bin/mail -s '/ Disk Space Alert' harald << EOF
Your root partition remaining free space is critically low. Used: $CURRENT% Your root partition remaining free space is critically low. Used: $CURRENT%
EOF EOF
fi fi
@ -152,6 +140,12 @@
}; };
systemd.timers = { systemd.timers = {
check_boot = {
timerConfig = {
OnCalendar = "daily";
};
wantedBy = [ "timers.target" ];
};
check_root = { check_root = {
timerConfig = { timerConfig = {
OnCalendar = "daily"; OnCalendar = "daily";

View file

@ -242,8 +242,7 @@
hostName = "webmail.hoyer.xyz"; hostName = "webmail.hoyer.xyz";
plugins = [ "managesieve" ]; plugins = [ "managesieve" ];
extraConfig = '' extraConfig = ''
# starttls needed for authentication, so the fqdn required to match # SSL/TLS needed for authentication, so the fqdn must match the certificate
# the certificate
$config['smtp_server'] = "ssl://${config.mailserver.fqdn}:465"; $config['smtp_server'] = "ssl://${config.mailserver.fqdn}:465";
$config['smtp_user'] = "%u"; $config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p"; $config['smtp_pass'] = "%p";

View file

@ -8,4 +8,33 @@
services.postgresql = { services.postgresql = {
package = pkgs.postgresql_14; package = pkgs.postgresql_14;
}; };
# Temporary: upgrade script for PostgreSQL 14 → 16 migration.
# After upgrading, change package above to postgresql_16 and remove this block.
environment.systemPackages = [
(
let
newPostgres = pkgs.postgresql_16;
cfg = config.services.postgresql;
in
pkgs.writeScriptBin "upgrade-pg-cluster" ''
set -eux
systemctl stop postgresql
export NEWDATA="/var/lib/postgresql/${newPostgres.psqlSchema}"
export NEWBIN="${newPostgres}/bin"
export OLDDATA="${cfg.dataDir}"
export OLDBIN="${cfg.finalPackage}/bin"
install -d -m 0700 -o postgres -g postgres "$NEWDATA"
cd "$NEWDATA"
sudo -u postgres "$NEWBIN/initdb" -D "$NEWDATA" ${lib.escapeShellArgs cfg.initdbArgs}
sudo -u postgres "$NEWBIN/pg_upgrade" \
--old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \
--old-bindir "$OLDBIN" --new-bindir "$NEWBIN" \
"$@"
''
)
];
} }