1{
2 lib,
3 appdirs,
4 apsw,
5 buildPythonPackage,
6 cvss,
7 fetchFromGitHub,
8 httpx,
9 msgpack,
10 orjson,
11 packageurl-python,
12 pydantic,
13 pytestCheckHook,
14 pytest-cov-stub,
15 rich,
16 semver,
17 setuptools,
18 tabulate,
19 writableTmpDirAsHomeHook,
20}:
21
22buildPythonPackage rec {
23 pname = "appthreat-vulnerability-db";
24 version = "6.4.4";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "AppThreat";
29 repo = "vulnerability-db";
30 tag = "v${version}";
31 hash = "sha256-bzr3RlTtWTH/P6hgiXjWvR1IbVtVSqbtrZHQ91o/V/E=";
32 };
33
34 pythonRelaxDeps = [
35 "msgpack"
36 "semver"
37 ];
38
39 build-system = [ setuptools ];
40
41 dependencies = [
42 appdirs
43 apsw
44 cvss
45 httpx
46 msgpack
47 orjson
48 packageurl-python
49 pydantic
50 rich
51 semver
52 tabulate
53 ]
54 ++ httpx.optional-dependencies.http2;
55
56 nativeCheckInputs = [
57 pytest-cov-stub
58 pytestCheckHook
59 writableTmpDirAsHomeHook
60 ];
61
62 preCheck = ''
63 export HOME=$(mktemp -d);
64 '';
65
66 disabledTests = [
67 # Tests require network access
68 "test_bulk_search"
69 "test_download_recent"
70 "test_parse_purl"
71 ];
72
73 pythonImportsCheck = [ "vdb" ];
74
75 meta = with lib; {
76 description = "Vulnerability database and package search for sources such as OSV, NVD, GitHub and npm";
77 homepage = "https://github.com/appthreat/vulnerability-db";
78 changelog = "https://github.com/AppThreat/vulnerability-db/releases/tag/${src.tag}";
79 license = licenses.mit;
80 maintainers = with maintainers; [ fab ];
81 mainProgram = "vdb";
82 };
83}