1{
2 lib,
3 buildPythonPackage,
4 cachetools,
5 fetchPypi,
6 nixosTests,
7 setuptools,
8 twisted,
9 txamqp,
10 urllib3,
11 whisper,
12}:
13
14buildPythonPackage rec {
15 pname = "carbon";
16 version = "1.1.10";
17 pyproject = true;
18
19 src = fetchPypi {
20 inherit pname version;
21 hash = "sha256-wTtbqRHMWBcM2iFN95yzwCf/BQ+EK0vp5MXT4mKX3lw=";
22 };
23
24 patches = [
25 # imp has been removed from python since version 3.12
26 # This patch replaces it with distutils.utils
27 ./replace-imp.patch
28 ];
29
30 # Carbon-s default installation is /opt/graphite. This env variable ensures
31 # carbon is installed as a regular Python module.
32 GRAPHITE_NO_PREFIX = "True";
33
34 postPatch = ''
35 substituteInPlace setup.py \
36 --replace-fail "cf.readfp(f, 'setup.cfg')" "cf.read(f, 'setup.cfg')"
37 '';
38
39 build-system = [ setuptools ];
40
41 dependencies = [
42 cachetools
43 twisted
44 txamqp
45 urllib3
46 whisper
47 ];
48
49 # Tests are not shipped with PyPI
50 doCheck = false;
51
52 passthru.tests = {
53 inherit (nixosTests) graphite;
54 };
55
56 pythonImportsCheck = [
57 "carbon"
58 "carbon.routers"
59 ];
60
61 meta = {
62 description = "Backend data caching and persistence daemon for Graphite";
63 homepage = "https://github.com/graphite-project/carbon";
64 changelog = "https://github.com/graphite-project/carbon/releases/tag/${version}";
65 license = lib.licenses.asl20;
66 maintainers = with lib.maintainers; [
67 offline
68 basvandijk
69 ];
70 };
71}