summary refs log tree commit diff
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2018-08-02 16:39:57 +0200
committerRobert Schütz <rschuetz17@gmail.com>2018-08-02 16:39:57 +0200
commit0aae3fda066752a84762ccc5438cae1b22f07b5e (patch)
tree883be1af541724b0c9641c8e174a11cfbe1600c3
parent86b5b1e1742293eb5ce0c47dacdb72a3b10b43ac (diff)
downloadnixlib-0aae3fda066752a84762ccc5438cae1b22f07b5e.tar
nixlib-0aae3fda066752a84762ccc5438cae1b22f07b5e.tar.gz
nixlib-0aae3fda066752a84762ccc5438cae1b22f07b5e.tar.bz2
nixlib-0aae3fda066752a84762ccc5438cae1b22f07b5e.tar.lz
nixlib-0aae3fda066752a84762ccc5438cae1b22f07b5e.tar.xz
nixlib-0aae3fda066752a84762ccc5438cae1b22f07b5e.tar.zst
nixlib-0aae3fda066752a84762ccc5438cae1b22f07b5e.zip
graphite: 1.0.2 -> 1.1.3 & moved dependencies to python-modules (#44276)
Fixes #30891

* Upgrade `graphite-web`, `carbon` and `whisper` from 1.0.2 -> 1.1.3.

* Replaced the deprecated `pythonPackages.graphite_influxdb` with
  `pythonPackages.influxgraph.`

* Renamed `pythonPackages.graphite_web` to `pythonPackages.graphite-web`
  to be consistent with the Python package name.

* Replaced the unmaintained `pythonPackages.graphite_pager` with
  `pythonPackages.graphitepager`

* Moved all new packages from `python-packages.nix` to
  `pkgs/development/python-modules`
-rw-r--r--nixos/modules/services/monitoring/graphite.nix14
-rw-r--r--nixos/tests/graphite.nix5
-rw-r--r--pkgs/development/python-modules/carbon/default.nix24
-rw-r--r--pkgs/development/python-modules/graphite-web/default.nix54
-rw-r--r--pkgs/development/python-modules/graphite_beacon/default.nix25
-rw-r--r--pkgs/development/python-modules/graphitepager/default.nix32
-rw-r--r--pkgs/development/python-modules/influxgraph/default.nix30
-rw-r--r--pkgs/development/python-modules/whisper/default.nix20
-rw-r--r--pkgs/top-level/python-packages.nix171
9 files changed, 207 insertions, 168 deletions
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index 7ad26c137e51..cdfd746bc5a3 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -136,7 +136,7 @@ in {
       finders = mkOption {
         description = "List of finder plugins to load.";
         default = [];
-        example = literalExample "[ pkgs.python27Packages.graphite_influxdb ]";
+        example = literalExample "[ pkgs.python27Packages.influxgraph ]";
         type = types.listOf types.package;
       };
 
@@ -485,7 +485,7 @@ in {
           PYTHONPATH = let
               penv = pkgs.python.buildEnv.override {
                 extraLibs = [
-                  pythonPackages.graphite_web
+                  pythonPackages.graphite-web
                   pythonPackages.pysqlite
                 ];
               };
@@ -524,16 +524,16 @@ in {
           fi
 
           # Only collect static files when graphite_web changes.
-          if ! [ "${dataDir}/current_graphite_web" -ef "${pythonPackages.graphite_web}" ]; then
+          if ! [ "${dataDir}/current_graphite_web" -ef "${pythonPackages.graphite-web}" ]; then
             mkdir -p ${staticDir}
             ${pkgs.pythonPackages.django_1_8}/bin/django-admin.py collectstatic  --noinput --clear
             chown -R graphite:graphite ${staticDir}
-            ln -sfT "${pythonPackages.graphite_web}" "${dataDir}/current_graphite_web"
+            ln -sfT "${pythonPackages.graphite-web}" "${dataDir}/current_graphite_web"
           fi
         '';
       };
 
-      environment.systemPackages = [ pythonPackages.graphite_web ];
+      environment.systemPackages = [ pythonPackages.graphite-web ];
     }))
 
     (mkIf cfg.api.enable {
@@ -607,7 +607,7 @@ in {
           GRAPHITE_URL = cfg.pager.graphiteUrl;
         };
         serviceConfig = {
-          ExecStart = "${pkgs.pythonPackages.graphite_pager}/bin/graphite-pager --config ${pagerConfig}";
+          ExecStart = "${pkgs.pythonPackages.graphitepager}/bin/graphite-pager --config ${pagerConfig}";
           User = "graphite";
           Group = "graphite";
         };
@@ -615,7 +615,7 @@ in {
 
       services.redis.enable = mkDefault true;
 
-      environment.systemPackages = [ pkgs.pythonPackages.graphite_pager ];
+      environment.systemPackages = [ pkgs.pythonPackages.graphitepager ];
     })
 
     (mkIf cfg.beacon.enable {
diff --git a/nixos/tests/graphite.nix b/nixos/tests/graphite.nix
index 1fe4357191e3..27a87bdbb9f2 100644
--- a/nixos/tests/graphite.nix
+++ b/nixos/tests/graphite.nix
@@ -1,4 +1,4 @@
-import ./make-test.nix ({ ... } :
+import ./make-test.nix ({ pkgs, ... } :
 {
   name = "graphite";
   nodes = {
@@ -11,10 +11,12 @@ import ./make-test.nix ({ ... } :
           api = {
             enable = true;
             port = 8082;
+            finders = [ pkgs.python27Packages.influxgraph ];
           };
           carbon.enableCache = true;
           seyren.enable = true;
           pager.enable = true;
+          beacon.enable = true;
         };
       };
   };
@@ -25,6 +27,7 @@ import ./make-test.nix ({ ... } :
     $one->waitForUnit("graphiteWeb.service");
     $one->waitForUnit("graphiteApi.service");
     $one->waitForUnit("graphitePager.service");
+    $one->waitForUnit("graphite-beacon.service");
     $one->waitForUnit("carbonCache.service");
     $one->waitForUnit("seyren.service");
     # The services above are of type "simple". systemd considers them active immediately
diff --git a/pkgs/development/python-modules/carbon/default.nix b/pkgs/development/python-modules/carbon/default.nix
new file mode 100644
index 000000000000..df14f44f0b00
--- /dev/null
+++ b/pkgs/development/python-modules/carbon/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, buildPythonPackage, fetchPypi, isPy3k
+, twisted, whisper, txamqp, cachetools, urllib3
+}:
+
+buildPythonPackage rec {
+  pname = "carbon";
+  version = "1.1.3";
+
+  disabled = isPy3k;
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1s7327p30w4l9ak4gc7m5ga521233179n2lr3j0ggfbmfhd6blky";
+  };
+
+  propagatedBuildInputs = [ twisted whisper txamqp cachetools urllib3 ];
+
+  meta = with stdenv.lib; {
+    homepage = http://graphite.wikidot.com/;
+    description = "Backend data caching and persistence daemon for Graphite";
+    maintainers = with maintainers; [ rickynils offline basvandijk ];
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/development/python-modules/graphite-web/default.nix b/pkgs/development/python-modules/graphite-web/default.nix
new file mode 100644
index 000000000000..791eb1b8cf0f
--- /dev/null
+++ b/pkgs/development/python-modules/graphite-web/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, buildPythonPackage, fetchPypi, isPy3k, which
+, django, django_tagging, whisper, pycairo, cairocffi, ldap, memcached, pytz, urllib3, scandir
+}:
+if django.version != "1.8.18"
+|| django_tagging.version != "0.4.3"
+then throw "graphite-web should be build with django_1_8 and django_tagging_0_4_3"
+else buildPythonPackage rec {
+  pname = "graphite-web";
+  version = "1.1.3";
+
+  disabled = isPy3k;
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0nvyq1859abdch2l90avsjk9vb03s7wgxgrjsqvjhf2b9c1ncsfh";
+  };
+
+  propagatedBuildInputs = [
+    django django_tagging whisper pycairo cairocffi
+    ldap memcached pytz urllib3 scandir
+  ];
+
+  postInstall = ''
+    wrapProgram $out/bin/run-graphite-devel-server.py \
+      --prefix PATH : ${which}/bin
+  '';
+
+  preConfigure = ''
+    # graphite is configured by storing a local_settings.py file inside the
+    # graphite python package. Since that package is stored in the immutable
+    # Nix store we can't modify it. So how do we configure graphite?
+    #
+    # First of all we rename "graphite.local_settings" to
+    # "graphite_local_settings" so that the settings are not looked up in the
+    # graphite package anymore. Secondly we place a directory containing a
+    # graphite_local_settings.py on the PYTHONPATH in the graphite module
+    # <nixpkgs/nixos/modules/services/monitoring/graphite.nix>.
+    substituteInPlace webapp/graphite/settings.py \
+      --replace "graphite.local_settings" " graphite_local_settings"
+
+    substituteInPlace webapp/graphite/settings.py \
+      --replace "join(WEBAPP_DIR, 'content')" "join('$out', 'webapp', 'content')"
+  '';
+
+  # error: invalid command 'test'
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    homepage = http://graphite.wikidot.com/;
+    description = "Enterprise scalable realtime graphing";
+    maintainers = with maintainers; [ rickynils offline basvandijk ];
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/development/python-modules/graphite_beacon/default.nix b/pkgs/development/python-modules/graphite_beacon/default.nix
new file mode 100644
index 000000000000..b94a92bc02fc
--- /dev/null
+++ b/pkgs/development/python-modules/graphite_beacon/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, buildPythonPackage, fetchPypi
+, tornado, pyyaml, funcparserlib
+}:
+buildPythonPackage rec {
+  pname = "graphite_beacon";
+  version = "0.27.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "03bp4wyfn3xhcqyvs5hnk1n87m4smsmm1p7qp459m7j8hwpbq2ks";
+  };
+
+  propagatedBuildInputs = [ tornado pyyaml funcparserlib ];
+
+  postPatch = ''
+    substituteInPlace requirements.txt --replace "==" ">="
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A simple alerting application for Graphite metrics";
+    homepage = https://github.com/klen/graphite-beacon;
+    maintainers = [ maintainers.offline ];
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/development/python-modules/graphitepager/default.nix b/pkgs/development/python-modules/graphitepager/default.nix
new file mode 100644
index 000000000000..d2ab8d547fdb
--- /dev/null
+++ b/pkgs/development/python-modules/graphitepager/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, buildPythonPackage, fetchPypi
+, jinja2, markupsafe, pagerduty, pushbullet, python_magic, python-simple-hipchat
+, pyyaml, redis, requests, six, websocket_client, nose
+}:
+buildPythonPackage rec {
+  pname = "graphitepager";
+  version = "0.2.11";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0v3g1qcgnkpgjzh6phnv13lnk8qjrcs9sq2qg6k0dk5ik31jfk3d";
+  };
+
+  propagatedBuildInputs = [
+    jinja2 markupsafe pagerduty pushbullet python_magic python-simple-hipchat
+    pyyaml redis requests six websocket_client
+  ];
+
+  postPatch = ''
+    substituteInPlace requirements.txt --replace "==" ">="
+  '';
+
+  checkInputs = [ nose ];
+  checkPhase = "nosetests";
+
+  meta = with stdenv.lib; {
+    description = "A simple alerting application for Graphite metrics";
+    homepage = https://github.com/seatgeek/graphite-pager;
+    maintainers = with maintainers; [ offline basvandijk ];
+    license = licenses.bsd2;
+  };
+}
diff --git a/pkgs/development/python-modules/influxgraph/default.nix b/pkgs/development/python-modules/influxgraph/default.nix
new file mode 100644
index 000000000000..4f7ba65a27f3
--- /dev/null
+++ b/pkgs/development/python-modules/influxgraph/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, buildPythonPackage, fetchPypi, isPy3k
+, influxdb, graphite_api, memcached, gnugrep
+}:
+
+buildPythonPackage rec {
+  pname = "influxgraph";
+  version = "1.5.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0l33sfwdh4bfprmzp2kx0d9098g6yxbnhyyx9qr3kzczpm0jg9vy";
+  };
+
+  patchPhase = stdenv.lib.optionalString isPy3k ''
+    sed 's/python-memcached/python3-memcached/' \
+      -i ./influxgraph.egg-info/requires.txt    \
+      -i ./setup.py
+  '';
+
+  propagatedBuildInputs = [ influxdb graphite_api memcached ];
+
+  passthru.moduleName = "influxgraph.InfluxDBFinder";
+
+  meta = with stdenv.lib; {
+    description = "InfluxDB storage plugin for Graphite-API";
+    homepage = https://github.com/InfluxGraph/influxgraph;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ basvandijk ];
+  };
+}
diff --git a/pkgs/development/python-modules/whisper/default.nix b/pkgs/development/python-modules/whisper/default.nix
new file mode 100644
index 000000000000..4d48b63da54a
--- /dev/null
+++ b/pkgs/development/python-modules/whisper/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, buildPythonPackage, fetchPypi, six }:
+
+buildPythonPackage rec {
+  pname = "whisper";
+  version = "1.1.3";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1ahzsxk52ws8k3kdq52qbsbsx2r9z350j8gg9adw4x5fjwksz4r8";
+  };
+
+  propagatedBuildInputs = [ six ];
+
+  meta = with stdenv.lib; {
+    homepage = http://graphite.wikidot.com/;
+    description = "Fixed size round-robin style database";
+    maintainers = with maintainers; [ rickynils offline basvandijk ];
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 614736ce744a..757849dd2e93 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -69,8 +69,6 @@ let
   # See build-setupcfg/default.nix for documentation.
   buildSetupcfg = import ../build-support/build-setupcfg self;
 
-  graphiteVersion = "1.0.2";
-
   fetchPypi = makeOverridable( {format ? "setuptools", ... } @attrs:
     let
       fetchWheel = {pname, version, sha256, python ? "py2.py3", abi ? "none", platform ? "any"}:
@@ -4782,13 +4780,14 @@ in {
   django_tagging = callPackage ../development/python-modules/django_tagging { };
 
   django_tagging_0_4_3 = if
-       self.django != self.django_1_8
+       self.django.version != "1.8.18"
   then throw "django_tagging_0_4_3 should be build with django_1_8"
   else (callPackage ../development/python-modules/django_tagging {}).overrideAttrs (attrs: rec {
-    name = "django-tagging-0.4.3";
+    pname = "django-tagging";
+    version = "0.4.3";
 
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/d/django-tagging/${name}.tar.gz";
+    src = fetchPypi {
+      inherit pname version;
       sha256 = "0617azpmp6jpg3d88v2ir97qrc9aqcs2s9gyvv9bgf2cp55khxhs";
     };
     propagatedBuildInputs = with self; [ django ];
@@ -15401,24 +15400,7 @@ EOF
 
   whichcraft = callPackage ../development/python-modules/whichcraft { };
 
-  whisper = buildPythonPackage rec {
-    name = "whisper-${version}";
-    version = graphiteVersion;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/w/whisper/${name}.tar.gz";
-      sha256 = "1v1bi3fl1i6p4z4ki692bykrkw6907dn3mfq0151f70lvi3zpns3";
-    };
-
-    # error: invalid command 'test'
-    doCheck = false;
-
-    meta = {
-      homepage = http://graphite.wikidot.com/;
-      description = "Fixed size round-robin style database";
-      maintainers = with maintainers; [ rickynils offline ];
-    };
-  };
+  whisper = callPackage ../development/python-modules/whisper { };
 
   worldengine = buildPythonPackage rec {
     name = "worldengine-${version}";
@@ -15468,27 +15450,7 @@ EOF
     };
   };
 
-  carbon = buildPythonPackage rec {
-    name = "carbon-${version}";
-    version = graphiteVersion;
-
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/c/carbon/${name}.tar.gz";
-      sha256 = "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn";
-    };
-
-    propagatedBuildInputs = with self; [ whisper txamqp zope_interface twisted ];
-
-    meta = {
-      homepage = http://graphite.wikidot.com/;
-      description = "Backend data caching and persistence daemon for Graphite";
-      maintainers = with maintainers; [ rickynils offline ];
-      license = licenses.asl20;
-    };
-  };
-
+  carbon = callPackage ../development/python-modules/carbon { };
 
   ujson = buildPythonPackage rec {
     name = "ujson-1.35";
@@ -15616,126 +15578,15 @@ EOF
     };
   };
 
-  graphite_web = if
-          self.django != self.django_1_8
-       || self.django_tagging != self.django_tagging_0_4_3
-  then throw "graphite_web should be build with django_1_8 and django_tagging_0_4_3"
-  else buildPythonPackage rec {
-    name = "graphite-web-${version}";
-    disabled = isPy3k;
-    version = graphiteVersion;
-
-    src = pkgs.fetchurl rec {
-      url = "mirror://pypi/g/graphite-web/${name}.tar.gz";
-      sha256 = "0q8bwlj75jqyzmazfsi5sa26xl58ssa8wdxm2l4j0jqyn8xpfnmc";
-    };
-
-    propagatedBuildInputs = with self; [
-      django django_tagging whisper pycairo cairocffi
-      ldap memcached pytz urllib3 scandir
-    ];
-
-    postInstall = ''
-      wrapProgram $out/bin/run-graphite-devel-server.py \
-        --prefix PATH : ${pkgs.which}/bin
-    '';
-
-    preConfigure = ''
-      # graphite is configured by storing a local_settings.py file inside the
-      # graphite python package. Since that package is stored in the immutable
-      # Nix store we can't modify it. So how do we configure graphite?
-      #
-      # First of all we rename "graphite.local_settings" to
-      # "graphite_local_settings" so that the settings are not looked up in the
-      # graphite package anymore. Secondly we place a directory containing a
-      # graphite_local_settings.py on the PYTHONPATH in the graphite module
-      # <nixpkgs/nixos/modules/services/monitoring/graphite.nix>.
-      substituteInPlace webapp/graphite/settings.py \
-        --replace "graphite.local_settings" " graphite_local_settings"
-
-      substituteInPlace webapp/graphite/settings.py \
-        --replace "join(WEBAPP_DIR, 'content')" "join('$out', 'webapp', 'content')"
-    '';
-
-    # error: invalid command 'test'
-    doCheck = false;
-
-    meta = {
-      homepage = http://graphite.wikidot.com/;
-      description = "Enterprise scalable realtime graphing";
-      maintainers = with maintainers; [ rickynils offline ];
-    };
-  };
+  graphite-web = callPackage ../development/python-modules/graphite-web { };
 
   graphite_api = callPackage ../development/python-modules/graphite-api { };
 
-  graphite_beacon = buildPythonPackage rec {
-    name = "graphite_beacon-0.27.0";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/g/graphite_beacon/${name}.tar.gz";
-      sha256 = "03bp4wyfn3xhcqyvs5hnk1n87m4smsmm1p7qp459m7j8hwpbq2ks";
-    };
-
-    propagatedBuildInputs = [ self.tornado self.pyyaml self.funcparserlib ];
-
-    preBuild = "> requirements.txt";
-
-    meta = {
-      description = "A simple alerting application for Graphite metrics";
-      homepage = https://github.com/klen/graphite-beacon;
-      maintainers = [ maintainers.offline ];
-      license = licenses.mit;
-    };
-  };
-
-  graphite_influxdb = buildPythonPackage rec {
-    name = "graphite-influxdb-0.3";
-
-    src = pkgs.fetchgit {
-      url = "https://github.com/vimeo/graphite-influxdb.git";
-      rev = "2273d12a24e1d804685a36debfd4224b7416b62f";
-      sha256 = "1v00fgrnmsd9c0ahggyw9sia5m7dyzz16i5pa4vy6w2sbfyrmm4v";
-    };
-
-    propagatedBuildInputs = with self; [ influxdb graphite_api ];
-
-    passthru.moduleName = "graphite_influxdb.InfluxdbFinder";
+  graphite_beacon = callPackage ../development/python-modules/graphite_beacon { };
 
-    meta = {
-      description = "An influxdb backend for Graphite-web and graphite-api";
-      homepage = https://github.com/vimeo/graphite-influxdb;
-      license = licenses.asl20;
-    };
-  };
-
-  graphite_pager = buildPythonPackage rec {
-    name = "graphite-pager-${version}";
-    version = "2bbfe91220ec1e0ca1cdf4b5564386482a44ed7d";
-
-    src = pkgs.fetchgit {
-      url = "https://github.com/offlinehacker/graphite-pager.git";
-      sha256 = "0ylal0vkc2yrjvssfz1gls84yk9vkvvkx3pyv4lx15jm2qqzdmxd";
-      rev = version;
-    };
-
-    buildInputs = with self; [ nose mock ];
-    propagatedBuildInputs = with self; [
-      jinja2 pyyaml redis requests pagerduty
-      python-simple-hipchat pushbullet
-    ];
-
-    patchPhase = "> requirements.txt";
-    checkPhase = "nosetests";
-
-    meta = {
-      description = "A simple alerting application for Graphite metrics";
-      homepage = https://github.com/seatgeek/graphite-pager;
-      maintainers = with maintainers; [ offline ];
-      license = licenses.bsd2;
-    };
-  };
+  influxgraph = callPackage ../development/python-modules/influxgraph { };
 
+  graphitepager = callPackage ../development/python-modules/graphitepager { };
 
   pyspotify = buildPythonPackage rec {
     name = "pyspotify-${version}";