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 'pkgs/by-name/st/stalwart-mail-patched/package.nix')
-rw-r--r--pkgs/by-name/st/stalwart-mail-patched/package.nix97
1 files changed, 56 insertions, 41 deletions
diff --git a/pkgs/by-name/st/stalwart-mail-patched/package.nix b/pkgs/by-name/st/stalwart-mail-patched/package.nix
index 85ab840..062ab2c 100644
--- a/pkgs/by-name/st/stalwart-mail-patched/package.nix
+++ b/pkgs/by-name/st/stalwart-mail-patched/package.nix
@@ -2,53 +2,68 @@
   stalwart-mail,
   callPackage,
   nixLib,
+  rustPlatform,
+  lib,
 }: let
   spamfilter = callPackage ./spam-filter.nix {};
 in
-  stalwart-mail.overrideAttrs (final: prev: {
-    pname = "stalwart-mail-patched";
+  stalwart-mail.override {
+    rustPlatform =
+      rustPlatform
+      // {
+        buildRustPackage = prev:
+          rustPlatform.buildRustPackage (
+            lib.attrsets.recursiveUpdate
+            prev
+            {
+              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";
+              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";
 
-    # The NixOS build tests should check if this works.
-    # And this shaves of around 50% of the build time.
-    doCheck = false;
+              cargoHash = "sha256-Rq18JumjKYt97WKIqnLakS+FQwsjt70irlYBYAYm3H8=";
 
-    # 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"
-    ];
+              # The NixOS build tests should check if this works.
+              # And this shaves of around 50% of the build time.
+              doCheck = false;
 
-    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/use-platform-ca-roots.patch
-      ];
+              # 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"
+              ];
 
-    # 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
-      '';
+              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/0001-Allow-to-switch-to-operating-system-CA-root-store.patch
+                ];
 
-    meta.mainProgram = prev.meta.mainProgram or "stalwart-mail";
-  })
+              # 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";
+            }
+          );
+      };
+  }