1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchurl,
6
7 # build-system
8 hatchling,
9
10 # dependencies
11 azure-identity,
12 azure-monitor-ingestion,
13 boto3,
14 dateparser,
15 dnspython,
16 elastic-transport,
17 elasticsearch-dsl,
18 elasticsearch,
19 expiringdict,
20 geoip2,
21 google-api-core,
22 google-api-python-client,
23 google-auth-httplib2,
24 google-auth-oauthlib,
25 google-auth,
26 imapclient,
27 kafka-python-ng,
28 lxml,
29 mailsuite,
30 msgraph-core,
31 nixosTests,
32 opensearch-py,
33 publicsuffixlist,
34 pygelf,
35 requests,
36 tqdm,
37 xmltodict,
38
39 # test
40 unittestCheckHook,
41}:
42
43let
44 dashboard = fetchurl {
45 url = "https://raw.githubusercontent.com/domainaware/parsedmarc/77331b55c54cb3269205295bd57d0ab680638964/grafana/Grafana-DMARC_Reports.json";
46 sha256 = "0wbihyqbb4ndjg79qs8088zgrcg88km8khjhv2474y7nzjzkf43i";
47 };
48in
49buildPythonPackage rec {
50 pname = "parsedmarc";
51 version = "6.18.7";
52 pyproject = true;
53
54 src = fetchFromGitHub {
55 owner = "domainaware";
56 repo = "parsedmarc";
57 tag = version;
58 hash = "sha256-AjRYd3uN76Zl7IEXqFK+qssAvuS+TbT+mZL+pPlxDwc=";
59 };
60
61 build-system = [
62 hatchling
63 ];
64
65 pythonRelaxDeps = [
66 "elasticsearch"
67 "elasticsearch-dsl"
68 ];
69
70 dependencies = [
71 azure-identity
72 azure-monitor-ingestion
73 boto3
74 dateparser
75 dnspython
76 elastic-transport
77 elasticsearch
78 elasticsearch-dsl
79 expiringdict
80 geoip2
81 google-api-core
82 google-api-python-client
83 google-auth
84 google-auth-httplib2
85 google-auth-oauthlib
86 imapclient
87 kafka-python-ng
88 lxml
89 mailsuite
90 msgraph-core
91 opensearch-py
92 publicsuffixlist
93 pygelf
94 requests
95 tqdm
96 xmltodict
97 ];
98
99 nativeCheckInputs = [
100 unittestCheckHook
101 ];
102
103 pythonImportsCheck = [ "parsedmarc" ];
104
105 passthru = {
106 inherit dashboard;
107 tests = nixosTests.parsedmarc;
108 };
109
110 meta = {
111 description = "Python module and CLI utility for parsing DMARC reports";
112 homepage = "https://domainaware.github.io/parsedmarc/";
113 changelog = "https://github.com/domainaware/parsedmarc/blob/${src.tag}/CHANGELOG.md";
114 license = lib.licenses.asl20;
115 maintainers = with lib.maintainers; [ talyz ];
116 mainProgram = "parsedmarc";
117 # https://github.com/domainaware/parsedmarc/issues/464
118 broken = lib.versionAtLeast msgraph-core.version "1.0.0";
119 };
120}