about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--flake.nix2
-rw-r--r--modules/by-name/st/stalwart-mail/module.nix50
-rw-r--r--pkgs/by-name/st/stalwart-mail-free/package.nix44
-rw-r--r--pkgs/by-name/st/stalwart-mail-free/patches/build-crates-main-Cargo.toml-Activate-appropriate-de.patch (renamed from modules/by-name/st/stalwart-mail/patches/build-crates-main-Cargo.toml-Activate-appropriate-de.patch)0
-rw-r--r--pkgs/by-name/st/stalwart-mail-free/patches/fix-crates-directory-Guard-all-enterprise-only-featu.patch (renamed from modules/by-name/st/stalwart-mail/patches/fix-crates-directory-Guard-all-enterprise-only-featu.patch)0
-rw-r--r--pkgs/by-name/st/stalwart-mail-free/spam-filter.nix (renamed from modules/by-name/st/stalwart-mail/spam-filter.nix)0
-rw-r--r--pkgs/default.nix3
7 files changed, 49 insertions, 50 deletions
diff --git a/flake.nix b/flake.nix
index 6f780d0..4d127f1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -135,7 +135,7 @@
     ];
 
     tests = import ./tests {inherit pkgs specialArgs nixLib;};
-    vhackPackages = import ./pkgs {inherit pkgs nixLib;};
+    vhackPackages = import ./pkgs {inherit pkgs nixLib pkgsUnstable;};
 
     hosts = import ./hosts {inherit pkgs nixLib nixpkgs specialArgs extraModules deployPackage;};
 
diff --git a/modules/by-name/st/stalwart-mail/module.nix b/modules/by-name/st/stalwart-mail/module.nix
index e5a681e..4595c21 100644
--- a/modules/by-name/st/stalwart-mail/module.nix
+++ b/modules/by-name/st/stalwart-mail/module.nix
@@ -2,8 +2,7 @@
   lib,
   config,
   pkgs,
-  pkgsUnstable,
-  nixLib,
+  vhackPackages,
   ...
 }: let
   cfg = config.vhack.stalwart-mail;
@@ -11,46 +10,6 @@
 
   configFormat = pkgs.formats.toml {};
   configFile = configFormat.generate "stalwart-mail.toml" topCfg.settings;
-
-  spamfilter = pkgs.callPackage ./spam-filter.nix {};
-
-  stalwart-mail = 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
-      '';
-  });
 in {
   imports = [
     ./settings.nix
@@ -59,12 +18,7 @@ in {
   options.vhack.stalwart-mail = {
     enable = lib.mkEnableOption "starwart-mail";
 
-    # package = lib.mkPackageOption pkgsUnstable "stalwart-mail" {pkgsText = "pkgsUnstable";};
-    package = lib.mkOption {
-      description = "The stalwart-mail package to use";
-      type = lib.types.package;
-      default = stalwart-mail;
-    };
+    package = lib.mkPackageOption vhackPackages "stalwart-mail-free" {};
 
     fqdn = lib.mkOption {
       type = lib.types.str;
diff --git a/pkgs/by-name/st/stalwart-mail-free/package.nix b/pkgs/by-name/st/stalwart-mail-free/package.nix
new file mode 100644
index 0000000..64fb2d6
--- /dev/null
+++ b/pkgs/by-name/st/stalwart-mail-free/package.nix
@@ -0,0 +1,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
+      '';
+  })
diff --git a/modules/by-name/st/stalwart-mail/patches/build-crates-main-Cargo.toml-Activate-appropriate-de.patch b/pkgs/by-name/st/stalwart-mail-free/patches/build-crates-main-Cargo.toml-Activate-appropriate-de.patch
index bfea568..bfea568 100644
--- a/modules/by-name/st/stalwart-mail/patches/build-crates-main-Cargo.toml-Activate-appropriate-de.patch
+++ b/pkgs/by-name/st/stalwart-mail-free/patches/build-crates-main-Cargo.toml-Activate-appropriate-de.patch
diff --git a/modules/by-name/st/stalwart-mail/patches/fix-crates-directory-Guard-all-enterprise-only-featu.patch b/pkgs/by-name/st/stalwart-mail-free/patches/fix-crates-directory-Guard-all-enterprise-only-featu.patch
index 80c4b60..80c4b60 100644
--- a/modules/by-name/st/stalwart-mail/patches/fix-crates-directory-Guard-all-enterprise-only-featu.patch
+++ b/pkgs/by-name/st/stalwart-mail-free/patches/fix-crates-directory-Guard-all-enterprise-only-featu.patch
diff --git a/modules/by-name/st/stalwart-mail/spam-filter.nix b/pkgs/by-name/st/stalwart-mail-free/spam-filter.nix
index ce3466d..ce3466d 100644
--- a/modules/by-name/st/stalwart-mail/spam-filter.nix
+++ b/pkgs/by-name/st/stalwart-mail-free/spam-filter.nix
diff --git a/pkgs/default.nix b/pkgs/default.nix
index e665eb2..5456ad4 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -1,6 +1,7 @@
 {
   pkgs,
   nixLib,
+  pkgsUnstable,
 }: let
   inherit (pkgs) lib;
 
@@ -10,7 +11,7 @@
     lib.callPackageWith
     (nixLib.warnMerge
       pkgs
-      vhackPkgs
+      (nixLib.warnMerge vhackPkgs {inherit nixLib pkgsUnstable;} wMM)
       wMM);
 
   vhackPkgs = nixLib.mkByName {