about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJonas Heinrich <onny@project-insanity.org>2024-05-12 13:12:52 +0200
committerJonas Heinrich <onny@project-insanity.org>2024-05-19 14:17:31 +0200
commit1f4329cde6c6400801443d7a2e783cafe111d76a (patch)
treed1a150535250bd9c83e6adea36ef141fca03be27 /nixos
parentc5cfeb11cdb3864167f36c86d101314f7491500a (diff)
nixos/stalwart-mail: pin module to package version 0.6
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/release-notes/rl-2405.section.md2
-rw-r--r--nixos/modules/services/mail/stalwart-mail.nix31
2 files changed, 32 insertions, 1 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md
index d6b8ffe8609fa..f2f7d8a74b287 100644
--- a/nixos/doc/manual/release-notes/rl-2405.section.md
+++ b/nixos/doc/manual/release-notes/rl-2405.section.md
@@ -591,6 +591,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
 - `buildDubPackage` can now be used to build Programs written in [D](https://dlang.org/) using the `dub` build system and package manager.
   See the [D section](https://nixos.org/manual/nixpkgs/unstable#dlang) in the manual for more information.
 
+- `stalwart-mail` service uses the legacy version 0.6.X as default because newer `stalwart-mail` versions require a [manual upgrade process](https://github.com/stalwartlabs/mail-server/blob/main/UPGRADING.md). Change [`services.stalwart-mail.package`](#opt-services.stalwart-mail.package) to `pkgs.stalwart-mail` if you wish to switch to the new version.
+
 - [`portunus`](https://github.com/majewsky/portunus) has been updated to major version 2.
   This version of Portunus supports strong password hashes, but the legacy hash SHA-256 is also still supported to ensure a smooth migration of existing user accounts.
   After upgrading, follow the instructions on the [upstream release notes](https://github.com/majewsky/portunus/releases/tag/v2.0.0) to upgrade all user accounts to strong password hashes.
diff --git a/nixos/modules/services/mail/stalwart-mail.nix b/nixos/modules/services/mail/stalwart-mail.nix
index 08b07b885b696..c69a2ca400bae 100644
--- a/nixos/modules/services/mail/stalwart-mail.nix
+++ b/nixos/modules/services/mail/stalwart-mail.nix
@@ -7,11 +7,28 @@ let
   configFormat = pkgs.formats.toml { };
   configFile = configFormat.generate "stalwart-mail.toml" cfg.settings;
   dataDir = "/var/lib/stalwart-mail";
+  stalwartAtLeast = versionAtLeast cfg.package.version;
 
 in {
   options.services.stalwart-mail = {
     enable = mkEnableOption "the Stalwart all-in-one email server";
-    package = mkPackageOption pkgs "stalwart-mail" { };
+
+    package = mkOption {
+      type = types.package;
+      description = ''
+        Which package to use for the Stalwart mail server.
+
+        ::: {.note}
+        Upgrading from version 0.6.0 to version 0.7.0 or higher requires manual
+        intervention. See <https://github.com/stalwartlabs/mail-server/blob/main/UPGRADING.md>
+        for upgrade instructions.
+        :::
+      '';
+      default = pkgs.stalwart-mail_0_6;
+      defaultText = lib.literalExpression "pkgs.stalwart-mail_0_6";
+      example = lib.literalExpression "pkgs.stalwart-mail";
+      relatedPackages = [ "stalwart-mail_0_6" "stalwart-mail" ];
+    };
 
     settings = mkOption {
       inherit (configFormat) type;
@@ -26,6 +43,18 @@ in {
   };
 
   config = mkIf cfg.enable {
+
+    warnings = lib.optionals (!stalwartAtLeast "0.7.0") [
+      ''
+        Versions of stalwart-mail < 0.7.0 will get deprecated in NixOS 24.11.
+        Please set services.stalwart-mail.package to pkgs.stalwart-mail to
+        upgrade to the latest version.
+        Please note that upgrading to version >= 0.7 requires manual
+        intervention, see <https://github.com/stalwartlabs/mail-server/blob/main/UPGRADING.md>
+        for upgrade instructions.
+      ''
+    ];
+
     # Default config: all local
     services.stalwart-mail.settings = {
       global.tracing.method = mkDefault "stdout";