summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/parsedmarc/default.nix
blob: 3a9252f15d06ab4e8d32e0920cef1a9a0ea64365 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchurl,

  # build-system
  hatchling,

  # dependencies
  azure-identity,
  azure-monitor-ingestion,
  boto3,
  dateparser,
  dnspython,
  elastic-transport,
  elasticsearch-dsl,
  elasticsearch,
  expiringdict,
  geoip2,
  google-api-core,
  google-api-python-client,
  google-auth-httplib2,
  google-auth-oauthlib,
  google-auth,
  imapclient,
  kafka-python-ng,
  lxml,
  mailsuite,
  msgraph-core,
  nixosTests,
  opensearch-py,
  publicsuffixlist,
  pygelf,
  requests,
  tqdm,
  xmltodict,

  # test
  unittestCheckHook,
}:

let
  dashboard = fetchurl {
    url = "https://raw.githubusercontent.com/domainaware/parsedmarc/77331b55c54cb3269205295bd57d0ab680638964/grafana/Grafana-DMARC_Reports.json";
    sha256 = "0wbihyqbb4ndjg79qs8088zgrcg88km8khjhv2474y7nzjzkf43i";
  };
in
buildPythonPackage rec {
  pname = "parsedmarc";
  version = "8.18.6";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "domainaware";
    repo = "parsedmarc";
    tag = version;
    hash = "sha256-wwncnkZnd8GsjvwsuJEgFYCtapzGYYcVBRYoJ1cwVEw=";
  };

  build-system = [
    hatchling
  ];

  pythonRelaxDeps = [
    "elasticsearch"
    "elasticsearch-dsl"
  ];

  dependencies = [
    azure-identity
    azure-monitor-ingestion
    boto3
    dateparser
    dnspython
    elastic-transport
    elasticsearch
    elasticsearch-dsl
    expiringdict
    geoip2
    google-api-core
    google-api-python-client
    google-auth
    google-auth-httplib2
    google-auth-oauthlib
    imapclient
    kafka-python-ng
    lxml
    mailsuite
    msgraph-core
    opensearch-py
    publicsuffixlist
    pygelf
    requests
    tqdm
    xmltodict
  ];

  nativeCheckInputs = [
    unittestCheckHook
  ];

  pythonImportsCheck = [ "parsedmarc" ];

  passthru = {
    inherit dashboard;
    tests = nixosTests.parsedmarc;
  };

  meta = {
    description = "Python module and CLI utility for parsing DMARC reports";
    homepage = "https://domainaware.github.io/parsedmarc/";
    changelog = "https://github.com/domainaware/parsedmarc/blob/${src.tag}/CHANGELOG.md";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ talyz ];
    mainProgram = "parsedmarc";
    # https://github.com/domainaware/parsedmarc/issues/464
    broken = lib.versionAtLeast msgraph-core.version "1.0.0";
  };
}