about summary refs log tree commit diff
path: root/pkgs/servers/monitoring/prometheus/dmarc-metrics-exporter/default.nix
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2022-05-26 19:21:06 +0000
committerRobert Schütz <nix@dotlambda.de>2022-05-31 23:25:18 +0000
commitaff15c41fc902d06410897d968fe61c6f83211f2 (patch)
treeb1cb02b305cda674ed8ff225de5fb196482d43b8 /pkgs/servers/monitoring/prometheus/dmarc-metrics-exporter/default.nix
parentd88f9f6a3be6833c0bf0925c6521f02ee64a7d20 (diff)
dmarc-metrics-exporter: rename from prometheus-dmarc-exporter
Also stop using poetry2nix.
Diffstat (limited to 'pkgs/servers/monitoring/prometheus/dmarc-metrics-exporter/default.nix')
-rw-r--r--pkgs/servers/monitoring/prometheus/dmarc-metrics-exporter/default.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/servers/monitoring/prometheus/dmarc-metrics-exporter/default.nix b/pkgs/servers/monitoring/prometheus/dmarc-metrics-exporter/default.nix
new file mode 100644
index 0000000000000..ca5ce804e171e
--- /dev/null
+++ b/pkgs/servers/monitoring/prometheus/dmarc-metrics-exporter/default.nix
@@ -0,0 +1,69 @@
+{ lib
+, python3
+, fetchpatch
+}:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "dmarc-metrics-exporter";
+  version = "0.5.1";
+
+  disabled = python3.pythonOlder "3.7";
+
+  format = "pyproject";
+
+  src = python3.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "22ec361f9a4c86abefbfab541f588597e21bf4fbedf2911f230e560b2ec3503a";
+  };
+
+  patches = [
+    # https://github.com/jgosmann/dmarc-metrics-exporter/pull/23
+    (fetchpatch {
+      url = "https://github.com/jgosmann/dmarc-metrics-exporter/commit/3fe401f5dfb9e0304601a2a89ac987ff853b7cba.patch";
+      hash = "sha256-MjVLlFQMp2r3AhBMu1lEmRm0Y2H9FdvCfPgAK5kvwWE=";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace pyproject.toml \
+      --replace 'python = "^3.7,<3.10"' 'python = "^3.7,<3.11"' \
+      --replace poetry.masonry.api poetry.core.masonry.api \
+      --replace '"^' '">='
+  '';
+
+  nativeBuildInputs = with python3.pkgs; [
+    poetry-core
+  ];
+
+  propagatedBuildInputs = with python3.pkgs; [
+    bite-parser
+    dataclasses-serialization
+    prometheus-client
+    typing-extensions
+    uvicorn
+    xsdata
+  ];
+
+  checkInputs = with python3.pkgs; [
+    aiohttp
+    pytest-asyncio
+    pytestCheckHook
+    requests
+  ];
+
+  disabledTestPaths = [
+    # require networking
+    "dmarc_metrics_exporter/tests/test_e2e.py"
+    "dmarc_metrics_exporter/tests/test_imap_client.py"
+    "dmarc_metrics_exporter/tests/test_imap_queue.py"
+  ];
+
+  pythonImportsCheck = [ "dmarc_metrics_exporter" ];
+
+  meta = {
+    description = "Export Prometheus metrics from DMARC reports";
+    homepage = "https://github.com/jgosmann/dmarc-metrics-exporter";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ ma27 ];
+  };
+}