about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/cyclonedx-python/default.nix
blob: fa5be39000af3e2d08f6edef7e351f68bc4e9cc5 (plain) (blame)
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
{ lib
, fetchFromGitHub
, python3
}:

let
  py = python3.override {
    packageOverrides = self: super: {

      # Requires 'cyclonedx-python-lib = ">= 2.0.0, < 4.0.0"'
      cyclonedx-python-lib = super.cyclonedx-python-lib.overridePythonAttrs (oldAttrs: rec {
        version = "3.1.5";
        src = fetchFromGitHub {
          owner = "CycloneDX";
          repo = "cyclonedx-python-lib";
          rev = "refs/tags/v${version}";
          hash = "sha256-4lA8OdmvQD94jTeDf+Iz7ZyEQ9fZzCxnXQG9Ir8FKhk=";
        };
      });
    };
  };
in
with py.pkgs;

python3.pkgs.buildPythonApplication rec {
  pname = "cyclonedx-python";
  version = "3.11.7";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "CycloneDX";
    repo = "cyclonedx-python";
    rev = "refs/tags/v${version}";
    sha256 = "sha256-jU/0FkQCyph59TnEE+lckJXsU9whfvWp7dkdfzprYw8=";
  };

  nativeBuildInputs = with py.pkgs; [
    poetry-core
    pythonRelaxDepsHook
  ];

  propagatedBuildInputs = with py.pkgs; [
    chardet
    cyclonedx-python-lib
    packageurl-python
    pip-requirements-parser
    setuptools
    toml
  ];

  # The tests want access to the cyclonedx binary
  doCheck = false;

  pythonImportsCheck = [
    "cyclonedx"
  ];

  meta = with lib; {
    description = "Creates CycloneDX Software Bill of Materials (SBOM) from Python projects";
    homepage = "https://github.com/CycloneDX/cyclonedx-python";
    changelog = "https://github.com/CycloneDX/cyclonedx-python/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ ];
    mainProgram = "cyclonedx-py";
  };
}