11{
22 lib ,
3+ stdenv ,
4+ pkgs ,
35 buildPythonPackage ,
4- python ,
6+ fetchFromGitHub ,
7+
8+ # dependencies
59 cairocffi ,
610 django ,
711 django-tagging ,
8- fetchFromGitHub ,
9- fetchpatch ,
1012 gunicorn ,
11- mock ,
1213 pyparsing ,
1314 python-memcached ,
14- pythonOlder ,
1515 pytz ,
1616 six ,
1717 txamqp ,
1818 urllib3 ,
1919 whisper ,
20+
21+ # tests
22+ mock ,
23+ redis ,
24+ rrdtool ,
25+ writableTmpDirAsHomeHook ,
26+ python ,
27+
28+ # passthru
2029 nixosTests ,
2130} :
2231
23- buildPythonPackage rec {
32+ buildPythonPackage {
2433 pname = "graphite-web" ;
25- version = "1.1.10" ;
26- format = "setuptools" ;
27-
28- disabled = pythonOlder "3.7" ;
34+ version = "1.1.10-unstable-2025-02-24" ;
35+ pyproject = true ;
2936
3037 src = fetchFromGitHub {
3138 owner = "graphite-project" ;
32- repo = pname ;
33- rev = version ;
34- hash = "sha256-2HgCBKwLfxJLKMopoIdsEW5k/j3kNAiifWDnJ98a7Qo =" ;
39+ repo = "graphite-web" ;
40+ rev = "49c28e2015d605ad9ec93524f7076dd924a4731a" ;
41+ hash = "sha256-TxsQPhnI5WhQvKKkDEYZ8xnyg/qf+N9Icej6d6A0jC0 =" ;
3542 } ;
3643
37- patches = [
38- ( fetchpatch {
39- name = "CVE-2022-4730.CVE-2022-4729.CVE-2022-4728.part-1.patch" ;
40- url = "https://github.com/graphite-project/graphite-web/commit/9c626006eea36a9fd785e8f811359aebc9774970.patch" ;
41- hash = "sha256-JMmdhLqsaRhUG2FsH+yPNl+cR7O2YLfKFliL2GU0aAk=" ;
42- } )
43- ( fetchpatch {
44- name = "CVE-2022-4730.CVE-2022-4729.CVE-2022-4728.part-2.patch" ;
45- url = "https://github.com/graphite-project/graphite-web/commit/2f178f490e10efc03cd1d27c72f64ecab224eb23.patch" ;
46- hash = "sha256-NL7K5uekf3NlLa58aFFRPJT9ktjqBeNlWC4Htd0fRQ0=" ;
47- } )
48- ] ;
44+ postPatch =
45+ ''
46+ substituteInPlace webapp/graphite/settings.py \
47+ --replace-fail \
48+ "join(WEBAPP_DIR, 'content')" \
49+ "join('$out/webapp', 'content')"
50+ ''
51+ + lib . optionalString stdenv . hostPlatform . isDarwin ''
52+ substituteInPlace webapp/tests/test_dashboard.py \
53+ --replace-fail "test_dashboard_email" "_dont_test_dashboard_email"
54+ substituteInPlace webapp/tests/test_render.py \
55+ --replace-fail "test_render_view" "_dont_test_render_view"
56+ '' ;
4957
50- propagatedBuildInputs = [
58+ dependencies = [
5159 cairocffi
5260 django
5361 django-tagging
@@ -61,49 +69,63 @@ buildPythonPackage rec {
6169 whisper
6270 ] ;
6371
64- postPatch = ''
65- substituteInPlace setup.py \
66- --replace "Django>=1.8,<3.1" "Django" \
67- --replace "django-tagging==0.4.3" "django-tagging"
68- '' ;
72+ pythonRelaxDeps = [
73+ "django"
74+ "django-tagging"
75+ ] ;
6976
70- # Carbon-s default installation is /opt/graphite. This env variable ensures
71- # carbon is installed as a regular Python module.
72- GRAPHITE_NO_PREFIX = "True" ;
77+ env = {
78+ # Carbon-s default installation is /opt/graphite. This env variable ensures
79+ # carbon is installed as a regular Python module.
80+ GRAPHITE_NO_PREFIX = "True" ;
7381
74- preConfigure = ''
75- substituteInPlace webapp/graphite/settings.py \
76- --replace "join(WEBAPP_DIR, 'content')" "join('$out', 'webapp', 'content')"
77- '' ;
82+ REDIS_HOST = "127.0.0.1" ;
83+ } ;
84+
85+ nativeCheckInputs = [
86+ mock
87+ redis
88+ rrdtool
89+ writableTmpDirAsHomeHook
90+ ] ;
91+
92+ preCheck =
93+ # Start a redis server
94+ ''
95+ ${ pkgs . valkey } /bin/redis-server &
96+ REDIS_PID=$!
97+ '' ;
7898
79- checkInputs = [ mock ] ;
8099 checkPhase = ''
81100 runHook preCheck
82101
83102 pushd webapp/
84103 # avoid confusion with installed module
85104 rm -r graphite
86- # redis not practical in test environment
87- substituteInPlace tests/test_tags.py \
88- --replace test_redis_tagdb _dont_test_redis_tagdb
89105
90106 DJANGO_SETTINGS_MODULE=tests.settings ${ python . interpreter } manage.py test
91107 popd
92108
93109 runHook postCheck
94110 '' ;
95111
112+ postCheck = ''
113+ kill $REDIS_PID
114+ '' ;
115+
116+ __darwinAllowLocalNetworking = true ;
117+
96118 pythonImportsCheck = [ "graphite" ] ;
97119
98120 passthru . tests = {
99121 inherit ( nixosTests ) graphite ;
100122 } ;
101123
102- meta = with lib ; {
124+ meta = {
103125 description = "Enterprise scalable realtime graphing" ;
104126 homepage = "http://graphiteapp.org/" ;
105- license = licenses . asl20 ;
106- maintainers = with maintainers ; [
127+ license = lib . licenses . asl20 ;
128+ maintainers = with lib . maintainers ; [
107129 offline
108130 basvandijk
109131 ] ;
0 commit comments