about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-06 21:37:46 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-06 21:37:46 +0200
commitfccc098fa6d5636a6dad9a393414d7a1dfbac8ec (patch)
treef6c4b0d0be00c67edcc994c2bf3dd076d3ffbdaf
parenthosts/server2: Enable atuin-sync (diff)
downloadnixos-server-fccc098fa6d5636a6dad9a393414d7a1dfbac8ec.zip
pkgs/stalwart-mail: Update to nixos 25.05
Now the stalwart-mail package is by default free. As such, we could drop
the respective patches.
-rw-r--r--modules/by-name/st/stalwart-mail/module.nix2
-rw-r--r--pkgs/by-name/st/stalwart-mail-free/package.nix77
-rw-r--r--pkgs/by-name/st/stalwart-mail-free/patches/crates-main-Cargo.toml-Use-libre-features.patch25
-rw-r--r--pkgs/by-name/st/stalwart-mail-patched/mail-send.nix (renamed from pkgs/by-name/st/stalwart-mail-free/mail-send.nix)0
-rw-r--r--pkgs/by-name/st/stalwart-mail-patched/package.nix61
-rw-r--r--pkgs/by-name/st/stalwart-mail-patched/patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch (renamed from pkgs/by-name/st/stalwart-mail-free/patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch)0
-rw-r--r--pkgs/by-name/st/stalwart-mail-patched/spam-filter.nix (renamed from pkgs/by-name/st/stalwart-mail-free/spam-filter.nix)0
7 files changed, 62 insertions, 103 deletions
diff --git a/modules/by-name/st/stalwart-mail/module.nix b/modules/by-name/st/stalwart-mail/module.nix
index 7bd985f..4565bf4 100644
--- a/modules/by-name/st/stalwart-mail/module.nix
+++ b/modules/by-name/st/stalwart-mail/module.nix
@@ -18,7 +18,7 @@ in {
   options.vhack.stalwart-mail = {
     enable = lib.mkEnableOption "starwart-mail";
 
-    package = lib.mkPackageOption vhackPackages "stalwart-mail-free" {};
+    package = lib.mkPackageOption vhackPackages "stalwart-mail-patched" {};
 
     admin = lib.mkOption {
       description = ''
diff --git a/pkgs/by-name/st/stalwart-mail-free/package.nix b/pkgs/by-name/st/stalwart-mail-free/package.nix
deleted file mode 100644
index 19405c7..0000000
--- a/pkgs/by-name/st/stalwart-mail-free/package.nix
+++ /dev/null
@@ -1,77 +0,0 @@
-{
-  pkgsUnstable,
-  callPackage,
-  nixLib,
-}: let
-  spamfilter = callPackage ./spam-filter.nix {};
-
-  mail-send = callPackage ./mail-send.nix {};
-
-  # Need to use the newer `rustPlatform`
-  inherit (pkgsUnstable) rustPlatform;
-in
-  pkgsUnstable.stalwart-mail.override {
-    rustPlatform =
-      rustPlatform
-      // {
-        buildRustPackage = prev:
-          rustPlatform.buildRustPackage (
-            prev
-            // {
-              pname = "stalwart-mail-free";
-              passthru = nixLib.warnMerge (prev.passthru or {}) {
-                inherit spamfilter;
-              } "stalwart-mail passthru";
-
-              useFetchCargoVendor = true;
-              cargoHash = "sha256-FCRsmH9ZGYaf9ss3ECjZQkknIxAaDj9cedW32dWmBGY=";
-
-              # The tests should check if this works.
-              # And this shaves of around 50% of the build time.
-              doCheck = false;
-
-              buildNoDefaultFeatures = true;
-              buildFeatures = [
-                "rocks"
-                "redis"
-              ];
-
-              postUnpack =
-                (prev.postUnpack or "")
-                + ''
-                  cp --recursive "${mail-send}" ./source/crates/mail-send
-                  chmod --recursive +w "./source/crates/mail-send"
-                '';
-
-              cargoPatches =
-                (prev.cargoPatches or [])
-                ++ [
-                  # `stalwart-mail` does enable their `enterprise` feature per default.
-                  # We want a AGPL only build (i.e., without unfree dependencies), therefore disable the
-                  # `enterprise` feature here.
-                  # We cannot use the `buildFeatures` attribute because it does not actually change the
-                  # correct features. As such we simply patch the correct `Cargo.toml` file.
-                  ./patches/crates-main-Cargo.toml-Use-libre-features.patch
-
-                  # `stalwart-mail` uses their bundled store, which makes it impossible to use our
-                  # own CA certificate (e.g., for tests). Thus use a native version.
-                  ./patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch
-                ];
-
-              # Check that the enterprise feature is really disabled.
-              postCheck =
-                (prev.postCheck or "")
-                +
-                # bash
-                ''
-                  if grep "enterprise" ./target/*/release/stalwart-mail.d; then
-                    echo "ERROR: Proprietary 'enterprise' feature active."
-                    exit 1
-                  fi
-                '';
-
-              meta.mainProgram = prev.meta.mainProgram or "stalwart-mail";
-            }
-          );
-      };
-  }
diff --git a/pkgs/by-name/st/stalwart-mail-free/patches/crates-main-Cargo.toml-Use-libre-features.patch b/pkgs/by-name/st/stalwart-mail-free/patches/crates-main-Cargo.toml-Use-libre-features.patch
deleted file mode 100644
index 5844793..0000000
--- a/pkgs/by-name/st/stalwart-mail-free/patches/crates-main-Cargo.toml-Use-libre-features.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 763d22e53a9c99addbd7f9ca84f0083733f3d10d Mon Sep 17 00:00:00 2001
-From: Benedikt Peetz <benedikt.peetz@b-peetz.de>
-Date: Tue, 4 Mar 2025 19:00:15 +0100
-Subject: [PATCH] crates/main/Cargo.toml: Use libre features
-
----
- crates/main/Cargo.toml | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/crates/main/Cargo.toml b/crates/main/Cargo.toml
-index 036d2dcf..709ae5da 100644
---- a/crates/main/Cargo.toml
-+++ b/crates/main/Cargo.toml
-@@ -35,7 +35,7 @@ jemallocator = "0.5.0"
- 
- [features]
- #default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis", "azure", "enterprise"]
--default = ["rocks", "enterprise"]
-+default = ["rocks", "redis"]
- sqlite = ["store/sqlite"]
- foundationdb = ["store/foundation", "common/foundation"]
- postgres = ["store/postgres"]
--- 
-2.47.2
-
diff --git a/pkgs/by-name/st/stalwart-mail-free/mail-send.nix b/pkgs/by-name/st/stalwart-mail-patched/mail-send.nix
index e0d8c57..e0d8c57 100644
--- a/pkgs/by-name/st/stalwart-mail-free/mail-send.nix
+++ b/pkgs/by-name/st/stalwart-mail-patched/mail-send.nix
diff --git a/pkgs/by-name/st/stalwart-mail-patched/package.nix b/pkgs/by-name/st/stalwart-mail-patched/package.nix
new file mode 100644
index 0000000..5b1c409
--- /dev/null
+++ b/pkgs/by-name/st/stalwart-mail-patched/package.nix
@@ -0,0 +1,61 @@
+{
+  stalwart-mail,
+  callPackage,
+  nixLib,
+}: let
+  spamfilter = callPackage ./spam-filter.nix {};
+
+  mail-send = callPackage ./mail-send.nix {};
+in
+  stalwart-mail.overrideAttrs (final: prev: {
+    pname = "stalwart-mail-patched";
+
+    passthru = nixLib.warnMerge (prev.passthru or {}) {
+      inherit spamfilter;
+    } "stalwart-mail passthru";
+
+    # The NixOS build tests should check if this works.
+    # And this shaves of around 50% of the build time.
+    doCheck = false;
+
+    # We are already overriding it, so shaving of some unused features is okay.
+    buildNoDefaultFeatures = true;
+    buildFeatures = [
+      # "sqlite"
+      # "postgres"
+      # "mysql"
+      "rocks"
+      # "elastic"
+      # "s3"
+      "redis"
+    ];
+
+    postUnpack =
+      (prev.postUnpack or "")
+      + ''
+        cp --recursive "${mail-send}" ./source/crates/mail-send
+        chmod --recursive +w "./source/crates/mail-send"
+      '';
+
+    cargoPatches =
+      (prev.cargoPatches or [])
+      ++ [
+        # `stalwart-mail` uses their bundled store, which makes it impossible to use our
+        # own CA certificate (e.g., for tests). Thus use a native version.
+        ./patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch
+      ];
+
+    # Check that the enterprise feature is really disabled.
+    postCheck =
+      (prev.postCheck or "")
+      +
+      # bash
+      ''
+        if grep "enterprise" ./target/*/release/stalwart-mail.d; then
+          echo "ERROR: Proprietary 'enterprise' feature active."
+          exit 1
+        fi
+      '';
+
+    meta.mainProgram = prev.meta.mainProgram or "stalwart-mail";
+  })
diff --git a/pkgs/by-name/st/stalwart-mail-free/patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch b/pkgs/by-name/st/stalwart-mail-patched/patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch
index e6c3d4b..e6c3d4b 100644
--- a/pkgs/by-name/st/stalwart-mail-free/patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch
+++ b/pkgs/by-name/st/stalwart-mail-patched/patches/crates-Use-the-platform-CA-bundle-instead-of-the-bun.patch
diff --git a/pkgs/by-name/st/stalwart-mail-free/spam-filter.nix b/pkgs/by-name/st/stalwart-mail-patched/spam-filter.nix
index ce3466d..ce3466d 100644
--- a/pkgs/by-name/st/stalwart-mail-free/spam-filter.nix
+++ b/pkgs/by-name/st/stalwart-mail-patched/spam-filter.nix