about summary refs log tree commit diff stats
path: root/pkgs/by-name/st/stalwart-mail-patched/package.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/st/stalwart-mail-patched/package.nix (renamed from pkgs/by-name/st/stalwart-mail-free/package.nix)46
1 files changed, 19 insertions, 27 deletions
diff --git a/pkgs/by-name/st/stalwart-mail-free/package.nix b/pkgs/by-name/st/stalwart-mail-patched/package.nix
index bb2c1db..062ab2c 100644
--- a/pkgs/by-name/st/stalwart-mail-free/package.nix
+++ b/pkgs/by-name/st/stalwart-mail-patched/package.nix
@@ -1,61 +1,53 @@
 {
-  pkgsUnstable,
+  stalwart-mail,
   callPackage,
   nixLib,
+  rustPlatform,
+  lib,
 }: 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 {
+  stalwart-mail.override {
     rustPlatform =
       rustPlatform
       // {
         buildRustPackage = prev:
           rustPlatform.buildRustPackage (
+            lib.attrsets.recursiveUpdate
             prev
-            // {
-              pname = "stalwart-mail-free";
+            {
+              pname = "stalwart-mail-patched";
+
               passthru = nixLib.warnMerge (prev.passthru or {}) {
+                # Use a reproducible source for the spamfilter instead of fetching it at runtime from GitHub.
                 inherit spamfilter;
               } "stalwart-mail passthru";
 
-              useFetchCargoVendor = true;
-              cargoHash = "sha256-Qg01QXP/ImRCUw3aXcZbnM1hysHUwozCdQ7LecjUa0o=";
+              cargoHash = "sha256-Rq18JumjKYt97WKIqnLakS+FQwsjt70irlYBYAYm3H8=";
 
-              # The tests should check if this works.
+              # 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"
+                "tls-native-roots"
               ];
 
-              postUnpack =
-                (prev.postUnpack or "")
-                + ''
-                  cp --recursive "${mail-send}" ./source/crates/mail-send
-                  chmod -R +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
+                  ./patches/0001-Allow-to-switch-to-operating-system-CA-root-store.patch
                 ];
 
               # Check that the enterprise feature is really disabled.