summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/dnsight/default.nix
blob: f7773a9a68d964058e24183100041cbad950e4c3 (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
{
  lib,
  stdenv,
  buildPythonPackage,
  cryptography,
  dnspython,
  fetchFromGitHub,
  hatch-vcs,
  hatchling,
  httpx,
  hypothesis,
  iana-etc,
  libredirect,
  pydantic,
  pytest-asyncio,
  pytest-cov-stub,
  pytestCheckHook,
  pyyaml,
  rich,
  typer,
}:

buildPythonPackage (finalAttrs: {
  pname = "dnsight";
  version = "1.0.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "dnsight";
    repo = "dnsight";
    tag = "v${finalAttrs.version}";
    hash = "sha256-TirYLziPa1xRm7D54Unl5oVjsnsv6Gl0LRVUXzd9o/E=";
  };

  pythonRelaxDeps = [ "typer" ];

  build-system = [
    hatch-vcs
    hatchling
  ];

  dependencies = [
    cryptography
    dnspython
    httpx
    pydantic
    pyyaml
    rich
    typer
  ];

  nativeCheckInputs = [
    hypothesis
    pytest-asyncio
    pytest-cov-stub
    pytestCheckHook
  ];

  pythonImportsCheck = [ "dnsight" ];

  preCheck = lib.optionalString stdenv.hostPlatform.isLinux ''
    echo "nameserver 127.0.0.1" > resolv.conf
    export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
    export LD_PRELOAD=${libredirect}/lib/libredirect.so
  '';

  postCheck = ''
    unset NIX_REDIRECTS LD_PRELOAD
  '';

  disabledTests = [
    # AssertionError
    "test_audit_explicit_domains_honour_global_config_path"
    "test_audit_manifest_runs_only_configured_checks"
    # AssertionError: assert (None is not None)
    "test_check_dmarc_async_config_slice_overrides_config"
    "test_check_dmarc_sync_config_slice_overrides_config"
    "test_check_spf_sync_with_mgr"
    "test_run_check_for_target_matches_run_zone"
    "test_run_check_sync_dmarc"
    "test_run_check_sync_programmatic_config_no_file"
    "test_run_check_sync_yaml_plus_overlay_merge"
  ];

  meta = {
    description = "SDK and CLI tool for DNS, email and web security hygiene";
    homepage = "https://github.com/dnsight/dnsight";
    changelog = "https://github.com/dnsight/dnsight/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
    mainProgram = "dnsight";
  };
})