about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-05-02 11:16:27 +0200
committerGitHub <noreply@github.com>2024-05-02 11:16:27 +0200
commit4a2f53b67a7f5e4dfd435a23b2483a4802c10f00 (patch)
tree1755015df5e6bac822d91cb22cb8ad6ffdbea8aa
parent33489534cf8a8a36e8b2b19b05fe99799de56c35 (diff)
parent896919ded57b9c8fbccc88f2e69cf44a8fe3e356 (diff)
Merge pull request #280940 from e1mo/fix-parsedmarc-smtp-to
-rw-r--r--nixos/modules/services/monitoring/parsedmarc.nix8
-rw-r--r--pkgs/by-name/pa/parsedmarc/package.nix41
-rw-r--r--pkgs/development/python-modules/parsedmarc/default.nix19
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 56 insertions, 14 deletions
diff --git a/nixos/modules/services/monitoring/parsedmarc.nix b/nixos/modules/services/monitoring/parsedmarc.nix
index 9191a4a697e0b..a14ade59c29eb 100644
--- a/nixos/modules/services/monitoring/parsedmarc.nix
+++ b/nixos/modules/services/monitoring/parsedmarc.nix
@@ -301,7 +301,7 @@ in
               description = ''
                 The addresses to send outgoing mail to.
               '';
-              apply = x: if x == [] then null else lib.concatStringsSep "," x;
+              apply = x: if x == [] || x == null then null else lib.concatStringsSep "," x;
             };
           };
 
@@ -438,7 +438,7 @@ in
             ];
         dashboards.settings.providers = lib.mkIf cfg.provision.grafana.dashboard [{
           name = "parsedmarc";
-          options.path = "${pkgs.python3Packages.parsedmarc.dashboard}";
+          options.path = "${pkgs.parsedmarc.dashboard}";
         }];
       };
     };
@@ -446,7 +446,7 @@ in
     services.parsedmarc.settings = lib.mkMerge [
       (lib.mkIf cfg.provision.elasticsearch {
         elasticsearch = {
-          hosts = [ "localhost:9200" ];
+          hosts = [ "http://localhost:9200" ];
           ssl = false;
         };
       })
@@ -530,7 +530,7 @@ in
             MemoryDenyWriteExecute = true;
             LockPersonality = true;
             SystemCallArchitectures = "native";
-            ExecStart = "${pkgs.python3Packages.parsedmarc}/bin/parsedmarc -c /run/parsedmarc/parsedmarc.ini";
+            ExecStart = "${lib.getExe pkgs.parsedmarc} -c /run/parsedmarc/parsedmarc.ini";
           };
         };
 
diff --git a/pkgs/by-name/pa/parsedmarc/package.nix b/pkgs/by-name/pa/parsedmarc/package.nix
new file mode 100644
index 0000000000000..fab1e01e8ba40
--- /dev/null
+++ b/pkgs/by-name/pa/parsedmarc/package.nix
@@ -0,0 +1,41 @@
+{ lib
+, python3
+, fetchFromGitHub
+}:
+
+let
+  python = python3.override {
+    packageOverrides = self: super: {
+      # https://github.com/domainaware/parsedmarc/issues/464
+      msgraph-core = super.msgraph-core.overridePythonAttrs (old: rec {
+        version = "0.2.2";
+
+        src = fetchFromGitHub {
+          owner = "microsoftgraph";
+          repo = "msgraph-sdk-python-core";
+          rev = "v${version}";
+          hash = "sha256-eRRlG3GJX3WeKTNJVWgNTTHY56qiUGOlxtvEZ2xObLA=";
+        };
+
+        nativeBuildInputs = with self; [
+          flit-core
+        ];
+
+        propagatedBuildInputs = with self; [
+          requests
+        ];
+
+        nativeCheckInputs = with self; [
+          pytestCheckHook
+          responses
+        ];
+
+        disabledTestPaths = [
+          "tests/integration"
+        ];
+
+        pythonImportsCheck = [ "msgraph.core" ];
+      });
+    };
+  };
+in with python.pkgs; toPythonApplication parsedmarc
diff --git a/pkgs/development/python-modules/parsedmarc/default.nix b/pkgs/development/python-modules/parsedmarc/default.nix
index a5c59338fcdce..b9d4df1d58ee5 100644
--- a/pkgs/development/python-modules/parsedmarc/default.nix
+++ b/pkgs/development/python-modules/parsedmarc/default.nix
@@ -24,11 +24,12 @@
 , mailsuite
 , msgraph-core
 , nixosTests
+, opensearch-py
 , publicsuffixlist
 , pythonOlder
+, pythonRelaxDepsHook
 , requests
 , tqdm
-, urllib3
 , xmltodict
 }:
 
@@ -50,14 +51,14 @@ buildPythonPackage rec {
     hash = "sha256-tK/cxOw50awcDAGRDTQ+Nxb9aJl2+zLZHuJq88xNmXM=";
   };
 
-  postPatch = ''
-    substituteInPlace pyproject.toml \
-      --replace "elasticsearch<7.14.0" "elasticsearch" \
-      --replace "elasticsearch-dsl==7.4.0" "elasticsearch-dsl"
-  '';
-
   nativeBuildInputs = [
     hatchling
+    pythonRelaxDepsHook
+  ];
+
+  pythonRelaxDeps = [
+    "elasticsearch"
+    "elasticsearch-dsl"
   ];
 
   propagatedBuildInputs = [
@@ -84,8 +85,8 @@ buildPythonPackage rec {
     publicsuffixlist
     requests
     tqdm
-    urllib3
     xmltodict
+    opensearch-py
   ];
 
   # no tests on PyPI, no tags on GitHub
@@ -108,5 +109,7 @@ buildPythonPackage rec {
     license = licenses.asl20;
     maintainers = with maintainers; [ talyz ];
     mainProgram = "parsedmarc";
+    # https://github.com/domainaware/parsedmarc/issues/464
+    broken = lib.versionAtLeast msgraph-core.version "1.0.0";
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c0054b6f0a942..fba7380ebdfe9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -40014,8 +40014,6 @@ with pkgs;
 
   OSCAR = qt5.callPackage ../applications/misc/OSCAR { };
 
-  parsedmarc = with python3Packages; toPythonApplication parsedmarc;
-
   pgmanage = callPackage ../applications/misc/pgmanage { };
 
   pgadmin4 = callPackage ../tools/admin/pgadmin { };