about summary refs log tree commit diff stats
path: root/pkgs/by-name/st/stalwart-mail-free/package.nix
blob: 64fb2d68d0e6c612eae401a2e55fb09dba3d19ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  pkgsUnstable,
  callPackage,
  nixLib,
}: let
  spamfilter = callPackage ./spam-filter.nix {};
in
  pkgsUnstable.stalwart-mail.overrideAttrs (final: prev: {
    passthru = nixLib.warnMerge (prev.passthru or {}) {
      inherit spamfilter;
    } "stalwart-mail passthru";

    checkFlags =
      (prev.checkFlags or [])
      ++ [
        # This started to fail?
        # TODO(@bpeetz): Find out why. <2025-02-08>
        "--skip=smtp::outbound::lmtp::lmtp_delivery"
      ];

    # `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 =
      (prev.patches or [])
      ++ [
        ./patches/build-crates-main-Cargo.toml-Activate-appropriate-de.patch
        ./patches/fix-crates-directory-Guard-all-enterprise-only-featu.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
      '';
  })