summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/carbon/default.nix
blob: 76ff891182ec2e9392dbb33c5a967983874c14b9 (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
{
  lib,
  buildPythonPackage,
  cachetools,
  fetchPypi,
  nixosTests,
  setuptools,
  twisted,
  txamqp,
  urllib3,
  whisper,
}:

buildPythonPackage rec {
  pname = "carbon";
  version = "1.1.10";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-wTtbqRHMWBcM2iFN95yzwCf/BQ+EK0vp5MXT4mKX3lw=";
  };

  patches = [
    # imp has been removed from python since version 3.12
    # This patch replaces it with distutils.utils
    ./replace-imp.patch
  ];

  # Carbon-s default installation is /opt/graphite. This env variable ensures
  # carbon is installed as a regular Python module.
  GRAPHITE_NO_PREFIX = "True";

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "cf.readfp(f, 'setup.cfg')" "cf.read(f, 'setup.cfg')"
  '';

  build-system = [ setuptools ];

  dependencies = [
    cachetools
    twisted
    txamqp
    urllib3
    whisper
  ];

  # Tests are not shipped with PyPI
  doCheck = false;

  passthru.tests = {
    inherit (nixosTests) graphite;
  };

  pythonImportsCheck = [
    "carbon"
    "carbon.routers"
  ];

  meta = {
    description = "Backend data caching and persistence daemon for Graphite";
    homepage = "https://github.com/graphite-project/carbon";
    changelog = "https://github.com/graphite-project/carbon/releases/tag/${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      offline
      basvandijk
    ];
  };
}