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 pythonOlder,
15 rich,
16 semver,
17 setuptools,
18 tabulate,
19}:
20
21buildPythonPackage rec {
22 pname = "appthreat-vulnerability-db";
23 version = "6.0.8";
24 pyproject = true;
25
26 disabled = pythonOlder "3.10";
27
28 src = fetchFromGitHub {
29 owner = "AppThreat";
30 repo = "vulnerability-db";
31 rev = "refs/tags/v${version}";
32 hash = "sha256-lgt609UDuHTGQTTrpvxNvgUk6GU+TYqwc19dzatI4Io=";
33 };
34
35 postPatch = ''
36 substituteInPlace pyproject.toml \
37 --replace-fail " --cov-report=term-missing --no-cov-on-fail --cov vdb" ""
38 '';
39
40 pythonRelaxDeps = [
41 "msgpack"
42 "semver"
43 ];
44
45 build-system = [ setuptools ];
46
47
48 dependencies = [
49 appdirs
50 apsw
51 cvss
52 httpx
53 msgpack
54 orjson
55 packageurl-python
56 pydantic
57 rich
58 semver
59 tabulate
60 ] ++ httpx.optional-dependencies.http2;
61
62 nativeCheckInputs = [ pytestCheckHook ];
63
64 preCheck = ''
65 export HOME=$(mktemp -d);
66 '';
67
68 disabledTests = [
69 # Tests require network access
70 "test_bulk_search"
71 "test_download_recent"
72 ];
73
74 pythonImportsCheck = [ "vdb" ];
75
76 meta = with lib; {
77 description = "Vulnerability database and package search for sources such as OSV, NVD, GitHub and npm";
78 homepage = "https://github.com/appthreat/vulnerability-db";
79 changelog = "https://github.com/AppThreat/vulnerability-db/releases/tag/v${version}";
80 license = with licenses; [ mit ];
81 maintainers = with maintainers; [ fab ];
82 mainProgram = "vdb";
83 };
84}