From 86a6784fcaad8a17e242b2d566ae70277b9ca3c7 Mon Sep 17 00:00:00 2001
From: tv <tv@krebsco.de>
Date: Thu, 5 Oct 2017 19:48:28 +0200
Subject: [PATCH 01/43] kdeApplication: kill unused file kde-locale-5.nix

---
 pkgs/applications/kde/kde-locale-5.nix | 24 ------------------------
 pkgs/applications/kde/l10n.nix         |  1 -
 2 files changed, 25 deletions(-)
 delete mode 100644 pkgs/applications/kde/kde-locale-5.nix

diff --git a/pkgs/applications/kde/kde-locale-5.nix b/pkgs/applications/kde/kde-locale-5.nix
deleted file mode 100644
index 76d601cbdc0..00000000000
--- a/pkgs/applications/kde/kde-locale-5.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-name: args:
-
-{ mkDerivation, cmake, extra-cmake-modules, gettext, kdoctools }:
-
-mkDerivation (args // {
-  sname = "kde-l10n-${name}";
-  name = "kde-l10n-${name}-qt5";
-
-  outputs = [ "out" ];
-
-  nativeBuildInputs =
-    [ cmake extra-cmake-modules gettext kdoctools ]
-    ++ (args.nativeBuildInputs or []);
-
-  preConfigure = ''
-    sed -e 's/add_subdirectory(4)//' -i CMakeLists.txt
-    ${args.preConfigure or ""}
-  '';
-
-  preFixup = ''
-    propagatedBuildInputs=
-    propagatedNativeBuildInputs=
-  '';
-})
diff --git a/pkgs/applications/kde/l10n.nix b/pkgs/applications/kde/l10n.nix
index 403db98c0f3..10a8472d5a9 100644
--- a/pkgs/applications/kde/l10n.nix
+++ b/pkgs/applications/kde/l10n.nix
@@ -3,7 +3,6 @@
 let
 
   kdeLocale4 = import ./kde-locale-4.nix;
-  kdeLocale5 = import ./kde-locale-5.nix;
 
 in
 

From 68b2eeb1cbc1a674c65362ea45f4cdb0c0bf12b4 Mon Sep 17 00:00:00 2001
From: tilpner <till@hoeppner.ws>
Date: Sun, 29 Oct 2017 02:04:16 +0200
Subject: [PATCH 02/43] chez: 9.4 -> 9.5

---
 pkgs/development/compilers/chez/default.nix | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/compilers/chez/default.nix b/pkgs/development/compilers/chez/default.nix
index e4ceb40cad6..b85d32326a1 100644
--- a/pkgs/development/compilers/chez/default.nix
+++ b/pkgs/development/compilers/chez/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name    = "chez-scheme-${version}";
-  version = "9.4-${dver}";
-  dver    = "20160507";
+  version = "9.5-${dver}";
+  dver    = "20171012";
 
   src = fetchgit {
     url    = "https://github.com/cisco/chezscheme.git";
-    rev    = "65df1d1f7c37f5b5a93cd7e5b475dda9dbafe03c";
-    sha256 = "1b273il3njnn04z55w1hnygvcqllc6p5qg9mcwh10w39fwsd8fbs";
+    rev    = "adb3b7bb22ddaa1ba91b98b6f4a647427c3a4d9b";
+    sha256 = "0hiynf7g0q77ipqxjsqdm2zb0m15bl1hhp615fn3i2hv0qz5a4xr";
     fetchSubmodules = true;
   };
 
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   */
   patchPhase = ''
     substituteInPlace ./configure \
-      --replace "git submodule init && git submodule update || exit 1" ""
+      --replace "git submodule init && git submodule update || exit 1" "true"
 
     substituteInPlace ./workarea \
       --replace "/bin/ln" "${coreutils}/bin/ln" \

From 335add9e0c187e070e349328f2a2c5cfb992544d Mon Sep 17 00:00:00 2001
From: Andreas Rammhold <andreas@rammhold.de>
Date: Sun, 29 Oct 2017 09:31:15 +0100
Subject: [PATCH 03/43] vdirsyncer: added requests_oauthlib to
 propagatedBuildInputs

vdirsyncer requires `requests_oauthlib` in order to work with google
calendar sync services
---
 pkgs/tools/misc/vdirsyncer/default.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pkgs/tools/misc/vdirsyncer/default.nix b/pkgs/tools/misc/vdirsyncer/default.nix
index 731a194cc6a..17798057ec3 100644
--- a/pkgs/tools/misc/vdirsyncer/default.nix
+++ b/pkgs/tools/misc/vdirsyncer/default.nix
@@ -18,6 +18,7 @@ pythonPackages.buildPythonApplication rec {
     click click-log click-threading
     requests_toolbelt
     requests
+    requests_oauthlib # required for google oauth sync
     atomicwrites
   ];
 

From 208e5c99c46fd9d9f2300931a44cd698edc8d0b9 Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Sun, 29 Oct 2017 11:20:31 +0100
Subject: [PATCH 04/43] pyte: init at 0.7.0

---
 .../python-modules/pyte/default.nix           | 28 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            |  2 ++
 2 files changed, 30 insertions(+)
 create mode 100644 pkgs/development/python-modules/pyte/default.nix

diff --git a/pkgs/development/python-modules/pyte/default.nix b/pkgs/development/python-modules/pyte/default.nix
new file mode 100644
index 00000000000..2bd71070581
--- /dev/null
+++ b/pkgs/development/python-modules/pyte/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, buildPythonPackage, fetchPypi, pytest, pytestrunner, wcwidth }:
+
+buildPythonPackage rec {
+  pname = "pyte";
+  version = "0.7.0";
+  name  = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1an54hvyjm8gncx8cgabz9mkpgjkdb0bkyjlkh7g7f94nr3wnfl7";
+  };
+
+  propagatedBuildInputs = [ wcwidth ];
+
+  checkInputs = [ pytest pytestrunner ];
+
+  # tries to write to os.path.dirname(__file__) in test_input_output
+  checkPhase = ''
+    py.test -k "not test_input_output"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Simple VTXXX-compatible linux terminal emulator";
+    homepage = https://github.com/selectel/pyte;
+    license = licenses.lgpl3;
+    maintainers = with maintainers; [ flokli ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index cf670a40c6c..7887cd75754 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -12493,6 +12493,8 @@ in {
     };
   };
 
+  pyte = callPackage ../development/python-modules/pyte { };
+
   graphviz = buildPythonPackage rec {
     name = "graphviz-${version}";
     version = "0.5.2";

From 11bba268fe886968617c20c2c394139e7c92b807 Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Sun, 29 Oct 2017 11:21:18 +0100
Subject: [PATCH 05/43] curtsies: init at 0.2.11

---
 .../python-modules/curtsies/default.nix       | 27 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            |  2 ++
 2 files changed, 29 insertions(+)
 create mode 100644 pkgs/development/python-modules/curtsies/default.nix

diff --git a/pkgs/development/python-modules/curtsies/default.nix b/pkgs/development/python-modules/curtsies/default.nix
new file mode 100644
index 00000000000..a1e5f235235
--- /dev/null
+++ b/pkgs/development/python-modules/curtsies/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, buildPythonPackage, fetchPypi, blessings, mock, nose, pyte, pytest, wcwidth }:
+
+buildPythonPackage rec {
+  pname = "curtsies";
+  version = "0.2.11";
+  name  = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1vljmw3sy6lrqahhpyg4gk13mzcx3mwhvg8s41698ms3cpgkjipc";
+  };
+
+  propagatedBuildInputs = [ blessings wcwidth pyte ];
+
+  checkInputs = [ nose mock pytest ];
+
+  checkPhase = ''
+    py.test
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Curses-like terminal wrapper, with colored strings!";
+    homepage = https://pypi.python.org/pypi/curtsies;
+    license = licenses.mit;
+    maintainers = with maintainers; [ flokli ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 7887cd75754..de92d478c22 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -3367,6 +3367,8 @@ in {
     doCheck = false;
   };
 
+  curtsies = callPackage ../development/python-modules/curtsies { };
+
   oslo-vmware = buildPythonPackage rec {
     name = "oslo.vmware-${version}";
     version = "1.22.0";

From c463a8e0c5bbc7e18215278d290f4b977eafd473 Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Sun, 29 Oct 2017 12:12:42 +0100
Subject: [PATCH 06/43] urwid: move into separate file, use fetchPypi instead
 of fetchurl

---
 .../python-modules/urwid/default.nix          | 20 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 20 +------------------
 2 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 pkgs/development/python-modules/urwid/default.nix

diff --git a/pkgs/development/python-modules/urwid/default.nix b/pkgs/development/python-modules/urwid/default.nix
new file mode 100644
index 00000000000..129f4821e87
--- /dev/null
+++ b/pkgs/development/python-modules/urwid/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, buildPythonPackage, fetchPypi }:
+
+buildPythonPackage (rec {
+  pname = "urwid";
+  version = "1.3.1";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "18cnd1wdjcas08x5qwa5ayw6jsfcn33w4d9f7q3s29fy6qzc1kng";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A full-featured console (xterm et al.) user interface library";
+    homepage = http://excess.org/urwid;
+    repositories.git = git://github.com/wardi/urwid.git;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ garbas ];
+  };
+})
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index de92d478c22..e4e1560f227 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -21977,25 +21977,7 @@ in {
 
   urlgrabber = callPackage ../development/python-modules/urlgrabber {};
 
-  urwid = buildPythonPackage (rec {
-    name = "urwid-1.3.1";
-
-    # multiple:  NameError: name 'evl' is not defined
-    doCheck = false;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/u/urwid/${name}.tar.gz";
-      sha256 = "18cnd1wdjcas08x5qwa5ayw6jsfcn33w4d9f7q3s29fy6qzc1kng";
-    };
-
-    meta = {
-      description = "A full-featured console (xterm et al.) user interface library";
-      homepage = http://excess.org/urwid;
-      repositories.git = git://github.com/wardi/urwid.git;
-      license = licenses.lgpl21;
-      maintainers = with maintainers; [ garbas ];
-    };
-  });
+  urwid = callPackage ../development/python-modules/urwid {};
 
   urwidtrees = buildPythonPackage rec {
     name = "urwidtrees-${rev}";

From 978a9ba0cd649e65cb8abe720570f0e6c9dad7a2 Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Sun, 29 Oct 2017 11:21:40 +0100
Subject: [PATCH 07/43] bpython: 0.12 -> 0.17

---
 .../python-modules/bpython/default.nix        | 27 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 18 +------------
 2 files changed, 28 insertions(+), 17 deletions(-)
 create mode 100644 pkgs/development/python-modules/bpython/default.nix

diff --git a/pkgs/development/python-modules/bpython/default.nix b/pkgs/development/python-modules/bpython/default.nix
new file mode 100644
index 00000000000..515494b5f93
--- /dev/null
+++ b/pkgs/development/python-modules/bpython/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, buildPythonPackage, fetchurl, pygments, greenlet, curtsies, urwid, requests, mock }:
+
+buildPythonPackage rec {
+  pname = "bpython";
+  version = "0.17";
+  name  = "${pname}-${version}";
+
+  # 0.17 is still missing on PyPI, https://github.com/bpython/bpython/issues/706
+  src = fetchurl {
+    url = "https://bpython-interpreter.org/releases/${pname}-${version}.tar.gz";
+    sha256 = "13fyyx06645ikvmj9zmkixr12kzk1c3a3f9s9i2rvaczjycn82lz";
+  };
+
+  propagatedBuildInputs = [ curtsies greenlet pygments requests urwid ];
+
+  checkInputs = [ mock ];
+
+  # tests fail: https://github.com/bpython/bpython/issues/712
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "A fancy curses interface to the Python interactive interpreter";
+    homepage = "https://bpython-interpreter.org/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ flokli ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index e4e1560f227..f9bcff478e4 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2078,23 +2078,7 @@ in {
     };
   };
 
-
-  bpython = buildPythonPackage rec {
-     name = "bpython-0.12";
-     src = pkgs.fetchurl {
-       url = "http://www.bpython-interpreter.org/releases/bpython-0.12.tar.gz";
-       sha256 = "1ilf58qq7sazmcgg4f1wswbhcn2gb8qbbrpgm6gf0j2lbm60gabl";
-     };
-
-     propagatedBuildInputs = with self; [ pygments ];
-     doCheck = false;
-
-     meta = {
-       description = "UNKNOWN";
-       homepage = "UNKNOWN";
-       maintainers = with maintainers; [ domenkozar ];
-     };
-   };
+  bpython = callPackage ../development/python-modules/bpython {};
 
   bsddb3 = buildPythonPackage rec {
     name = "bsddb3-${version}";

From dccfe68ade164c6d3242bf1ba24d5482d02fb88e Mon Sep 17 00:00:00 2001
From: Christian Kauhaus <kc@flyingcircus.io>
Date: Sun, 29 Oct 2017 12:16:03 +0100
Subject: [PATCH 08/43] ZODB 5.3.0: fix broken tests

Re #30892
---
 .../zodb/ZODB-5.3.0-fix-tests.patch           | 29 +++++++++++++++++++
 .../python-modules/zodb/default.nix           |  4 +++
 2 files changed, 33 insertions(+)
 create mode 100644 pkgs/development/python-modules/zodb/ZODB-5.3.0-fix-tests.patch

diff --git a/pkgs/development/python-modules/zodb/ZODB-5.3.0-fix-tests.patch b/pkgs/development/python-modules/zodb/ZODB-5.3.0-fix-tests.patch
new file mode 100644
index 00000000000..b6bcedea91a
--- /dev/null
+++ b/pkgs/development/python-modules/zodb/ZODB-5.3.0-fix-tests.patch
@@ -0,0 +1,29 @@
+Tests are kind of broken in ZODB-5.3.0. Fix setup code and disable one
+especially problematic test.
+
+diff -u ZODB-5.3.0/setup.py ZODB-5.3.0/setup.py
+--- ZODB-5.3.0/setup.py	2017-08-30 14:55:10.000000000 +0200
++++ ZODB-5.3.0/setup.py	2017-10-29 11:34:17.277953730 +0100
+@@ -85,7 +85,10 @@
+                     mod = __import__(
+                         _modname(dirpath, base, os.path.splitext(filename)[0]),
+                         {}, {}, ['*'])
+-                    _unittests_only(suite, mod.test_suite())
++                    try:
++                        _unittests_only(suite, mod.test_suite())
++                    except AttributeError:
++                        pass
+         elif 'tests.py' in filenames:
+             mod = __import__(_modname(dirpath, base, 'tests'), {}, {}, ['*'])
+             _unittests_only(suite, mod.test_suite())
+diff -u ZODB-5.3.0/src/ZODB/scripts/tests/test_repozo.py ZODB-5.3.0/src/ZODB/scripts/tests/test_repozo.py
+--- ZODB-5.3.0/src/ZODB/scripts/tests/test_repozo.py	2017-08-30 14:55:10.000000000 +0200
++++ ZODB-5.3.0/src/ZODB/scripts/tests/test_repozo.py	2017-10-29 11:35:10.348240386 +0100
+@@ -1184,7 +1184,4 @@
+         #unittest.makeSuite(Test_do_backup),  #TODO
+         unittest.makeSuite(Test_do_recover),
+         unittest.makeSuite(Test_do_verify),
+-        # N.B.:  this test take forever to run (~40sec on a fast laptop),
+-        # *and* it is non-deterministic.
+-        unittest.makeSuite(MonteCarloTests),
+     ])
diff --git a/pkgs/development/python-modules/zodb/default.nix b/pkgs/development/python-modules/zodb/default.nix
index 5a318b5d040..232acaec506 100644
--- a/pkgs/development/python-modules/zodb/default.nix
+++ b/pkgs/development/python-modules/zodb/default.nix
@@ -25,6 +25,10 @@ buildPythonPackage rec {
       sha256 = "633c2f89481d8ebc55639b59216f7d16d07b44a94758850c0b887006967214f3";
     };
 
+    patches = [
+      ./ZODB-5.3.0-fix-tests.patch
+    ];
+
     propagatedBuildInputs = [
       manuel
       transaction

From a3b1f775332a1fd91b58bd5149409f3da7142dd2 Mon Sep 17 00:00:00 2001
From: Evan Wallace <mankarse.git@alethrea.net>
Date: Sun, 29 Oct 2017 12:54:26 +0000
Subject: [PATCH 09/43] lua5_3: 5.3.0 -> 5.3.4 Updated to latest upstream
 version

---
 pkgs/development/interpreters/lua-5/5.3.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/interpreters/lua-5/5.3.nix b/pkgs/development/interpreters/lua-5/5.3.nix
index c1d313a3656..a512a251313 100644
--- a/pkgs/development/interpreters/lua-5/5.3.nix
+++ b/pkgs/development/interpreters/lua-5/5.3.nix
@@ -5,11 +5,11 @@
 stdenv.mkDerivation rec {
   name = "lua-${version}";
   luaversion = "5.3";
-  version = "${luaversion}.0";
+  version = "${luaversion}.4";
 
   src = fetchurl {
-    url = "http://www.lua.org/ftp/${name}.tar.gz";
-    sha256 = "00fv1p6dv4701pyjrlvkrr6ykzxqy9hy1qxzj6qmwlb0ssr5wjmf";
+    url = "https://www.lua.org/ftp/${name}.tar.gz";
+    sha256 = "0320a8dg3aci4hxla380dx1ifkw8gj4gbw5c4dz41g1kh98sm0gn";
   };
 
   nativeBuildInputs = [ readline ];

From 8a77a30bc18761de935bcb58fe1074a048741725 Mon Sep 17 00:00:00 2001
From: Samuel Leathers <sam@appliedtrust.com>
Date: Sun, 29 Oct 2017 00:20:52 +0200
Subject: [PATCH 10/43] install documentation: document
 boot.loader.grub.useOSProber

---
 nixos/doc/manual/installation/installing.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/nixos/doc/manual/installation/installing.xml b/nixos/doc/manual/installation/installing.xml
index 94d8e9d2e1a..b0674307a56 100644
--- a/nixos/doc/manual/installation/installing.xml
+++ b/nixos/doc/manual/installation/installing.xml
@@ -140,6 +140,11 @@
     the GRUB boot loader is to be installed.  Without it, NixOS cannot
     boot.</para>
 
+    <para>If there are other operating systems running on the machine before
+    installing NixOS, the
+    <option>boot.loader.grub.useOSProber</option> option can be set to
+    <literal>true</literal> to automatically add them to the grub menu.</para>
+
     <para>Another critical option is <option>fileSystems</option>,
     specifying the file systems that need to be mounted by NixOS.
     However, you typically don’t need to set it yourself, because

From 1450f6cdb3010c407c6ca0e3aa9dae64edae842a Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sun, 29 Oct 2017 15:13:57 +0100
Subject: [PATCH 11/43] python.pkgs.requests_download: add missing file, fixes
 eval

---
 .../requests_download/default.nix             | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 pkgs/development/python-modules/requests_download/default.nix

diff --git a/pkgs/development/python-modules/requests_download/default.nix b/pkgs/development/python-modules/requests_download/default.nix
new file mode 100644
index 00000000000..4e2646eb6ab
--- /dev/null
+++ b/pkgs/development/python-modules/requests_download/default.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, requests
+}:
+
+buildPythonPackage rec {
+  pname = "requests_download";
+  version = "0.1.1";
+  name = "${pname}-${version}";
+
+  format = "wheel";
+
+  #src = pkgs.fetchurl {
+  #  url = https://files.pythonhosted.org/packages/60/af/10f899f0574a81cbc511124c08d7c7dc46c20d4f956a6a3c793ad4330bb4/requests_download-0.1.1-py2.py3-none-any.whl;
+  #  sha256 = "07832a93314bcd619aaeb08611ae245728e66672efb930bc2a300a115a47dab7";
+  #};
+
+  src = fetchPypi {
+    inherit pname version format;
+    sha256 = "07832a93314bcd619aaeb08611ae245728e66672efb930bc2a300a115a47dab7";
+  };
+
+  propagatedBuildInputs = [ requests ];
+
+  meta = {
+    description = "Download files using requests and save them to a target path";
+    homepage = https://www.github.com/takluyver/requests_download;
+    license = lib.licenses.mit;
+    maintainer = lib.maintainers.fridh;
+  };
+}
\ No newline at end of file

From afc66e121d124a2229b56aa37102034136c70f7e Mon Sep 17 00:00:00 2001
From: Christian Kauhaus <kc@flyingcircus.io>
Date: Sun, 29 Oct 2017 12:27:58 +0100
Subject: [PATCH 12/43] vulnix: 1.2.2 -> 1.3.4

The build needs the ZODB fix in PR #30925 to succeed.
---
 lib/maintainers.nix                    |  1 +
 pkgs/tools/security/vulnix/default.nix | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 29b7b589fef..7c3a845c00c 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -116,6 +116,7 @@
   christopherpoole = "Christopher Mark Poole <mail@christopherpoole.net>";
   ciil = "Simon Lackerbauer <simon@lackerbauer.com>";
   ckampka = "Christian Kampka <christian@kampka.net>";
+  ckauhaus = "Christian Kauhaus <christian@kauhaus.de>";
   cko = "Christine Koppelt <christine.koppelt@gmail.com>";
   cleverca22 = "Michael Bishop <cleverca22@gmail.com>";
   cmcdragonkai = "Roger Qiu <roger.qiu@matrix.ai>";
diff --git a/pkgs/tools/security/vulnix/default.nix b/pkgs/tools/security/vulnix/default.nix
index 1beb2268fc6..c86891d8ccd 100644
--- a/pkgs/tools/security/vulnix/default.nix
+++ b/pkgs/tools/security/vulnix/default.nix
@@ -3,19 +3,15 @@
 pythonPackages.buildPythonApplication rec {
   name = "${pname}-${version}";
   pname = "vulnix";
-  version = "1.2.2";
+  version = "1.3.4";
 
   src = pythonPackages.fetchPypi {
     inherit pname version;
-    sha256 = "1ia9plziwach0bxnlcd33q30kcsf8sv0nf2jc78gsmrqnxjabr12";
+    sha256 = "1js1i86pgkkqc9yzp1rck7rmaz79klv4048r9z7v56fam0a6sg05";
   };
 
   buildInputs = with pythonPackages; [ flake8 pytest pytestcov ];
 
-  postPatch = ''
-    sed -i -e 's/==\([^=]\+\)/>=\1/g' setup.py
-  '';
-
   propagatedBuildInputs = [
     nix
   ] ++ (with pythonPackages; [
@@ -27,12 +23,16 @@ pythonPackages.buildPythonApplication rec {
     zodb
   ]);
 
+  postPatch = ''
+    sed -i -e 's/==\([^=]\+\)/>=\1/g' setup.py
+  '';
+
   checkPhase = "py.test";
 
   meta = with stdenv.lib; {
     description = "NixOS vulnerability scanner";
     homepage = https://github.com/flyingcircusio/vulnix;
     license = licenses.bsd2;
-    maintainers = with maintainers; [ plumps ];
+    maintainers = with maintainers; [ ckauhaus plumps ];
   };
 }

From 3afcba3e0a92522e42d3243df9235c30de4889e6 Mon Sep 17 00:00:00 2001
From: Ingo Blechschmidt <iblech@web.de>
Date: Sun, 29 Oct 2017 17:19:18 +0100
Subject: [PATCH 13/43] mupdf: correct license meta information

The website of MuPDF says that MuPDF is licensed under the terms of the GNU
Affero General Public License. However, I didn't see which version of that
license they mean.

A clear statement that MuPDF is licensed under the terms of AGPL >= 3 is
included in the README file of their Git repository:

    git://git.ghostscript.com/mupdf.git
---
 pkgs/applications/misc/mupdf/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/applications/misc/mupdf/default.nix b/pkgs/applications/misc/mupdf/default.nix
index a111e76df0c..b50d99466f8 100644
--- a/pkgs/applications/misc/mupdf/default.nix
+++ b/pkgs/applications/misc/mupdf/default.nix
@@ -103,7 +103,7 @@ stdenv.mkDerivation rec {
     homepage = http://mupdf.com;
     repositories.git = git://git.ghostscript.com/mupdf.git;
     description = "Lightweight PDF, XPS, and E-book viewer and toolkit written in portable C";
-    license = licenses.gpl3Plus;
+    license = licenses.agpl3Plus;
     maintainers = with maintainers; [ viric vrthra fpletz ];
     platforms = platforms.linux;
   };

From defebc885019e0219f93ded13d7dc9528fbe77e6 Mon Sep 17 00:00:00 2001
From: Jon Banafato <jon@jonafato.com>
Date: Sun, 29 Oct 2017 14:10:13 -0400
Subject: [PATCH 14/43] corebird: 1.6 -> 1.7.1

Update corebird to the latest release.
---
 pkgs/applications/networking/corebird/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/networking/corebird/default.nix b/pkgs/applications/networking/corebird/default.nix
index 412335094ff..54fc72fbfae 100644
--- a/pkgs/applications/networking/corebird/default.nix
+++ b/pkgs/applications/networking/corebird/default.nix
@@ -3,14 +3,14 @@
 , glib_networking }:
 
 stdenv.mkDerivation rec {
-  version = "1.6";
+  version = "1.7.1";
   name = "corebird-${version}";
 
   src = fetchFromGitHub {
     owner = "baedert";
     repo = "corebird";
     rev = version;
-    sha256 = "1bxjlamdy5d2j3xdahmxf6lwc7f6xdfxbzi712ppvh1dwggw654v";
+    sha256 = "1g6wkzrl6j0mmgafpv0jpqa906s1x7p5hmiqdgs9qwm7q2wlwrqd";
   };
 
   preConfigure = ''

From 9e37df185c75a2ba7724ae4ce5ce3c356c1ce225 Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Sun, 29 Oct 2017 14:42:55 -0400
Subject: [PATCH 15/43] fwupd: Remove manual rpath settings now that meson is
 fixed.

Thanks @yegortimoshenko!
---
 .../tools/build-managers/meson/default.nix    |  2 +-
 .../linux/firmware/fwupd/default.nix          | 31 ++-----------------
 2 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
index 1c2e726cdc5..8e4c5d4801a 100644
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ b/pkgs/development/tools/build-managers/meson/default.nix
@@ -22,7 +22,7 @@ python3Packages.buildPythonApplication rec {
     sed -i -e 's|e.fix_rpath(install_rpath)||' mesonbuild/scripts/meson_install.py
   '';
 
-  setupHook = ./setup-hook.sh;    
+  setupHook = ./setup-hook.sh;
 
   meta = with lib; {
     homepage = http://mesonbuild.com;
diff --git a/pkgs/os-specific/linux/firmware/fwupd/default.nix b/pkgs/os-specific/linux/firmware/fwupd/default.nix
index 455defa5823..09ca05484f7 100644
--- a/pkgs/os-specific/linux/firmware/fwupd/default.nix
+++ b/pkgs/os-specific/linux/firmware/fwupd/default.nix
@@ -1,30 +1,10 @@
 { stdenv, fetchurl, gtk_doc, pkgconfig, gobjectIntrospection, intltool
 , libgudev, polkit, appstream-glib, gusb, sqlite, libarchive
 , libsoup, docbook2x, gpgme, libxslt, libelf, libsmbios, efivar
-, fwupdate, libgpgerror, libyaml, valgrind, meson, libuuid, pygobject3
-, pillow, ninja, gcab, makeWrapper, glib, gdk_pixbuf
+, fwupdate, libyaml, valgrind, meson, libuuid, pygobject3
+, pillow, ninja, gcab
 }:
 let version = "0.9.6";
-    rpath = stdenv.lib.makeLibraryPath
-      [ libuuid.out
-        appstream-glib
-        glib
-        libsoup
-        gdk_pixbuf
-        libarchive.lib
-        gcab
-        sqlite.out
-        gusb
-        polkit.out
-        gpgme
-        libgpgerror
-        libelf
-        efivar
-        libsmbios
-        fwupdate
-        libgudev
-        "$out"
-      ];
 in
   stdenv.mkDerivation
     { name = "fwupd-${version}";
@@ -36,18 +16,13 @@ in
         [ gtk_doc pkgconfig gobjectIntrospection intltool libgudev
           polkit appstream-glib gusb sqlite libarchive libsoup
           docbook2x libxslt libelf libsmbios fwupdate libyaml valgrind
-          meson gpgme libuuid pygobject3 pillow ninja gcab makeWrapper
+          meson gpgme libuuid pygobject3 pillow ninja gcab
         ];
       patches = [ ./fix-missing-deps.patch ];
       preConfigure = ''
         export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${efivar}/include/efivar"
       '';
       mesonFlags = [ "-Denable-colorhug=false" "-Denable-man=false" "-Denable-tests=false" "--localstatedir=/var" "-Denable-doc=false" "-Dwith-bootdir=/boot" ];
-      postFixup = ''
-        for prog in $out/bin/* $out/libexec/fwupd/*; do
-          wrapProgram "$prog" --prefix LD_LIBRARY_PATH : ${rpath}
-        done
-      '';
       enableParallelBuilding = true;
       meta =
         { license = [ stdenv.lib.licenses.gpl2 ];

From 36ff83402aa8d5a06d06140d1a6216e9f5bb6382 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:13:52 +0100
Subject: [PATCH 16/43] pythonPackages.autopep8: move to python-modules/

---
 .../python-modules/autopep8/default.nix       | 24 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 23 +-----------------
 2 files changed, 25 insertions(+), 22 deletions(-)
 create mode 100644 pkgs/development/python-modules/autopep8/default.nix

diff --git a/pkgs/development/python-modules/autopep8/default.nix b/pkgs/development/python-modules/autopep8/default.nix
new file mode 100644
index 00000000000..6dc091624c5
--- /dev/null
+++ b/pkgs/development/python-modules/autopep8/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, buildPythonPackage, pep8 }:
+
+buildPythonPackage rec {
+  name = "autopep8-1.0.4";
+
+  src = fetchurl {
+    url = "mirror://pypi/a/autopep8/${name}.tar.gz";
+    sha256 = "17lydqm8y9a5qadp6iifxrb5mb0g9fr1vxn5qy1fjpyhazxaw8n1";
+  };
+
+  propagatedBuildInputs = [ pep8 ];
+
+  # One test fails:
+  # FAIL: test_recursive_should_not_crash_on_unicode_filename (test.test_autopep8.CommandLineTests)
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "A tool that automatically formats Python code to conform to the PEP 8 style guide";
+    homepage = https://pypi.python.org/pypi/autopep8/;
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 7da6d973a81..75ed9bf9cc0 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -674,28 +674,7 @@ in {
     };
   };
 
-  autopep8 = buildPythonPackage (rec {
-    name = "autopep8-1.0.4";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/a/autopep8/${name}.tar.gz";
-      sha256 = "17lydqm8y9a5qadp6iifxrb5mb0g9fr1vxn5qy1fjpyhazxaw8n1";
-    };
-
-    propagatedBuildInputs = with self; [ pep8 ];
-
-    # One test fails:
-    # FAIL: test_recursive_should_not_crash_on_unicode_filename (test.test_autopep8.CommandLineTests)
-    doCheck = false;
-
-    meta = {
-      description = "A tool that automatically formats Python code to conform to the PEP 8 style guide";
-      homepage = https://pypi.python.org/pypi/autopep8/;
-      license = licenses.mit;
-      platforms = platforms.all;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  });
+  autopep8 = callPackage ../development/python-modules/autopep8 { };
 
   av = buildPythonPackage rec {
     name = "av-${version}";

From 4c0582d47dbed105ca9c7507a4f365a7ae0e8b5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:26:15 +0100
Subject: [PATCH 17/43] pythonPackages.blockdiag: move to python-modules/

---
 .../python-modules/blockdiag/default.nix      | 30 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 28 +----------------
 2 files changed, 31 insertions(+), 27 deletions(-)
 create mode 100644 pkgs/development/python-modules/blockdiag/default.nix

diff --git a/pkgs/development/python-modules/blockdiag/default.nix b/pkgs/development/python-modules/blockdiag/default.nix
new file mode 100644
index 00000000000..fed6f6e9219
--- /dev/null
+++ b/pkgs/development/python-modules/blockdiag/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, buildPythonPackage, pep8, nose, unittest2, docutils
+, pillow, webcolors, funcparserlib
+}:
+
+buildPythonPackage rec {
+  name = "blockdiag-${version}";
+  version = "1.5.3";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/blockdiag/blockdiag/get/${version}.tar.bz2";
+    sha256 = "0r0qbmv0ijnqidsgm2rqs162y9aixmnkmzgnzgk52hiy7ydm4k8f";
+  };
+
+  buildInputs = [ pep8 nose unittest2 docutils ];
+
+  propagatedBuildInputs = [ pillow webcolors funcparserlib ];
+
+  # One test fails:
+  #   ...
+  #   FAIL: test_auto_font_detection (blockdiag.tests.test_boot_params.TestBootParams)
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Generate block-diagram image from spec-text file (similar to Graphviz)";
+    homepage = http://blockdiag.com/;
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 75ed9bf9cc0..67ea140586d 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2012,33 +2012,7 @@ in {
     };
   };
 
-
-  blockdiag = buildPythonPackage rec {
-    name = "blockdiag-${version}";
-    version = "1.5.3";
-
-    src = pkgs.fetchurl {
-      url = "https://bitbucket.org/blockdiag/blockdiag/get/${version}.tar.bz2";
-      sha256 = "0r0qbmv0ijnqidsgm2rqs162y9aixmnkmzgnzgk52hiy7ydm4k8f";
-    };
-
-    buildInputs = with self; [ pep8 nose unittest2 docutils ];
-
-    propagatedBuildInputs = with self; [ pillow webcolors funcparserlib ];
-
-    # One test fails:
-    #   ...
-    #   FAIL: test_auto_font_detection (blockdiag.tests.test_boot_params.TestBootParams)
-    doCheck = false;
-
-    meta = {
-      description = "Generate block-diagram image from spec-text file (similar to Graphviz)";
-      homepage = http://blockdiag.com/;
-      license = licenses.asl20;
-      platforms = platforms.unix;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  blockdiag = callPackage ../development/python-modules/blockdiag { };
 
   bpython = callPackage ../development/python-modules/bpython {};
 

From 0bc9f75dc16442abab86abcbab67dfe885378f95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:32:12 +0100
Subject: [PATCH 18/43] pythonPackages.construct: move to python-modules/

---
 .../python-modules/construct/default.nix      | 27 ++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 28 +------------------
 2 files changed, 28 insertions(+), 27 deletions(-)
 create mode 100644 pkgs/development/python-modules/construct/default.nix

diff --git a/pkgs/development/python-modules/construct/default.nix b/pkgs/development/python-modules/construct/default.nix
new file mode 100644
index 00000000000..1845d7ec94f
--- /dev/null
+++ b/pkgs/development/python-modules/construct/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, buildPythonPackage, fetchFromGitHub, six, pythonOlder }:
+
+buildPythonPackage rec {
+  name = "construct-${version}";
+  version = "2.8.10";
+
+  src = fetchFromGitHub {
+    owner = "construct";
+    repo = "construct";
+    rev = "v${version}";
+    sha256 = "1xfmmc5pihn3ql9f7blrciy06y2bwczqvkbcpvh96dmgqwc3wys3";
+  };
+
+  propagatedBuildInputs = [ six ];
+
+  # Tests fail with the following error on Python 3.5+
+  # TypeError: not all arguments converted during string formatting
+  doCheck = pythonOlder "3.5";
+
+  meta = with stdenv.lib; {
+    description = "Powerful declarative parser (and builder) for binary data";
+    homepage = http://construct.readthedocs.org/;
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 67ea140586d..472f84c274d 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -3044,33 +3044,7 @@ in {
 
   confluent-kafka = callPackage ../development/python-modules/confluent-kafka {};
 
-
-  construct = buildPythonPackage rec {
-    name = "construct-${version}";
-    version = "2.8.10";
-
-    src = pkgs.fetchFromGitHub {
-      owner = "construct";
-      repo = "construct";
-      rev = "v${version}";
-      sha256 = "1xfmmc5pihn3ql9f7blrciy06y2bwczqvkbcpvh96dmgqwc3wys3";
-    };
-
-    propagatedBuildInputs = with self; [ six ];
-
-    # Tests fail with the following error on Python 3.5+
-    # TypeError: not all arguments converted during string formatting
-    doCheck = pythonOlder "3.5";
-
-    meta = {
-      description = "Powerful declarative parser (and builder) for binary data";
-      homepage = http://construct.readthedocs.org/;
-      license = licenses.mit;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
-
+  construct = callPackage ../development/python-modules/construct {};
 
   consul = buildPythonPackage (rec {
     name = "python-consul-0.7.0";

From 95f29282fb57060adc8f7083ad0b4e3348ddf643 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:37:00 +0100
Subject: [PATCH 19/43] pythonPackages.pycollada: move to python-modules/

---
 .../python-modules/pycollada/default.nix      | 24 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 23 +-----------------
 2 files changed, 25 insertions(+), 22 deletions(-)
 create mode 100644 pkgs/development/python-modules/pycollada/default.nix

diff --git a/pkgs/development/python-modules/pycollada/default.nix b/pkgs/development/python-modules/pycollada/default.nix
new file mode 100644
index 00000000000..fec32b86aaf
--- /dev/null
+++ b/pkgs/development/python-modules/pycollada/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, buildPythonPackage, numpy, isPy3k, dateutil, dateutil_1_5 }:
+
+buildPythonPackage rec {
+  name = "pycollada-0.4.1";
+
+  src = fetchurl {
+    url = "mirror://pypi/p/pycollada/${name}.tar.gz";
+    sha256 = "0i50lh98550pwr95zgzrgiqzsspm09wl52xlv83y5nrsz4mblylv";
+  };
+
+  buildInputs = [ numpy ] ++ (if isPy3k then [dateutil] else [dateutil_1_5]);
+
+  # Some tests fail because they refer to test data files that don't exist
+  # (upstream packaging issue)
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Python library for reading and writing collada documents";
+    homepage = http://pycollada.github.io/;
+    license = "BSD"; # they don't specify which BSD variant
+    platforms = with platforms; linux ++ darwin;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 472f84c274d..bfaae8485a3 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -3643,28 +3643,7 @@ in {
 
   cffi = callPackage ../development/python-modules/cffi { };
 
-  pycollada = buildPythonPackage rec {
-    name = "pycollada-0.4.1";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/p/pycollada/${name}.tar.gz";
-      sha256 = "0i50lh98550pwr95zgzrgiqzsspm09wl52xlv83y5nrsz4mblylv";
-    };
-
-    buildInputs = with self; [ numpy ] ++ (if isPy3k then [dateutil] else [dateutil_1_5]);
-
-    # Some tests fail because they refer to test data files that don't exist
-    # (upstream packaging issue)
-    doCheck = false;
-
-    meta = {
-      description = "Python library for reading and writing collada documents";
-      homepage = http://pycollada.github.io/;
-      license = "BSD"; # they don't specify which BSD variant
-      platforms = with platforms; linux ++ darwin;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  pycollada = callPackage ../development/python-modules/pycollada { };
 
   pycontracts = buildPythonPackage rec {
     version = "1.7.9";

From 34dbc6c01cc0adb64f2e825032ba63e8670c113b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:42:50 +0100
Subject: [PATCH 20/43] pythonPackages.dpkt: move to python-modules/

---
 .../python-modules/dpkt/default.nix           | 22 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 21 +-----------------
 2 files changed, 23 insertions(+), 20 deletions(-)
 create mode 100644 pkgs/development/python-modules/dpkt/default.nix

diff --git a/pkgs/development/python-modules/dpkt/default.nix b/pkgs/development/python-modules/dpkt/default.nix
new file mode 100644
index 00000000000..87b5bd6b812
--- /dev/null
+++ b/pkgs/development/python-modules/dpkt/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, buildPythonPackage, isPy3k }:
+
+buildPythonPackage rec {
+  name = "dpkt-1.8";
+  disabled = isPy3k;
+
+  src = fetchurl {
+    url = "https://dpkt.googlecode.com/files/${name}.tar.gz";
+    sha256 = "01q5prynymaqyfsfi2296xncicdpid2hs3yyasim8iigvkwy4vf5";
+  };
+
+  # error: invalid command 'test'
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols";
+    homepage = https://code.google.com/p/dpkt/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ bjornfor ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index bfaae8485a3..02b4239349c 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -4906,26 +4906,7 @@ in {
     };
   };
 
-  dpkt = buildPythonPackage rec {
-    name = "dpkt-1.8";
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "https://dpkt.googlecode.com/files/${name}.tar.gz";
-      sha256 = "01q5prynymaqyfsfi2296xncicdpid2hs3yyasim8iigvkwy4vf5";
-    };
-
-    # error: invalid command 'test'
-    doCheck = false;
-
-    meta = {
-      description = "Fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols";
-      homepage = https://code.google.com/p/dpkt/;
-      license = licenses.bsd3;
-      maintainers = with maintainers; [ bjornfor ];
-      platforms = platforms.all;
-    };
-  };
+  dpkt = callPackage ../development/python-modules/dpkt {};
 
   urllib3 = callPackage ../development/python-modules/urllib3 {};
 

From 9e76c950a70f0482abe10b9a34ce43edfae5031a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:51:29 +0100
Subject: [PATCH 21/43] pythonPackages.gevent: move to python-modules/

---
 .../python-modules/gevent/default.nix         | 36 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 35 +-----------------
 2 files changed, 37 insertions(+), 34 deletions(-)
 create mode 100644 pkgs/development/python-modules/gevent/default.nix

diff --git a/pkgs/development/python-modules/gevent/default.nix b/pkgs/development/python-modules/gevent/default.nix
new file mode 100644
index 00000000000..8a3d3b3d09b
--- /dev/null
+++ b/pkgs/development/python-modules/gevent/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, buildPythonPackage, isPyPy, python, libev, greenlet }:
+
+buildPythonPackage rec {
+  name = "gevent-1.1.2";
+
+  src = fetchurl {
+    url = "mirror://pypi/g/gevent/${name}.tar.gz";
+    sha256 = "cb15cf73d69a2eeefed330858f09634e2c50bf46da9f9e7635730fcfb872c02c";
+  };
+
+  # Why do we have this patch?
+  postPatch = ''
+    substituteInPlace libev/ev.c --replace \
+      "ecb_inline void ecb_unreachable (void) ecb_noreturn" \
+      "ecb_inline ecb_noreturn void ecb_unreachable (void)"
+  '';
+
+  buildInputs = [ libev ];
+  propagatedBuildInputs = stdenv.lib.optionals (!isPyPy) [ greenlet ];
+
+  checkPhase = ''
+    cd greentest
+    ${python.interpreter} testrunner.py
+  '';
+
+  # Bunch of failures.
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Coroutine-based networking library";
+    homepage = http://www.gevent.org/;
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 02b4239349c..625dfba69aa 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -9445,40 +9445,7 @@ in {
     };
   };
 
-  gevent = buildPythonPackage rec {
-    name = "gevent-1.1.2";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/g/gevent/${name}.tar.gz";
-      sha256 = "cb15cf73d69a2eeefed330858f09634e2c50bf46da9f9e7635730fcfb872c02c";
-    };
-
-    # Why do we have this patch?
-    postPatch = ''
-      substituteInPlace libev/ev.c --replace \
-        "ecb_inline void ecb_unreachable (void) ecb_noreturn" \
-        "ecb_inline ecb_noreturn void ecb_unreachable (void)"
-    '';
-
-    buildInputs = with self; [ pkgs.libev ];
-    propagatedBuildInputs = with self; optionals (!isPyPy) [ greenlet ];
-
-    checkPhase = ''
-      cd greentest
-      ${python.interpreter} testrunner.py
-    '';
-
-    # Bunch of failures.
-    doCheck = false;
-
-    meta = {
-      description = "Coroutine-based networking library";
-      homepage = http://www.gevent.org/;
-      license = licenses.mit;
-      platforms = platforms.unix;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  gevent = callPackage ../development/python-modules/gevent { };
 
   geventhttpclient = buildPythonPackage rec {
     name = "geventhttpclient-${version}";

From afd4a17ee5abada65616b0f3566813c08b7c4376 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:22:33 +0100
Subject: [PATCH 22/43] pythonPackages.nwdiag: move to python-modules/

---
 pkgs/top-level/python-packages.nix | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 625dfba69aa..9b14717bd00 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -13012,29 +13012,7 @@ in {
 
   numtraits = callPackage ../development/python-modules/numtraits { };
 
-  nwdiag = buildPythonPackage rec {
-    name = "nwdiag-1.0.3";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/n/nwdiag/${name}.tar.gz";
-      sha256 = "0n7ary1fngxk8bk15vabc8fhnmxlh098piciwaviwn7l4a5q1zys";
-    };
-
-    buildInputs = with self; [ pep8 nose unittest2 docutils ];
-
-    propagatedBuildInputs = with self; [ blockdiag ];
-
-    # tests fail
-    doCheck = false;
-
-    meta = {
-      description = "Generate network-diagram image from spec-text file (similar to Graphviz)";
-      homepage = http://blockdiag.com/;
-      license = licenses.asl20;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  nwdiag = callPackage ../development/python-modules/nwdiag { };
 
   dynd = buildPythonPackage rec {
     version = "0.7.2";

From 6de28d760acec6f664ad5f20d508594cd62a894c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:25:44 +0100
Subject: [PATCH 23/43] pythonPackages.Pyro: move to python-modules/

---
 .../python-modules/pyro/default.nix           | 19 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 18 +-----------------
 2 files changed, 20 insertions(+), 17 deletions(-)
 create mode 100644 pkgs/development/python-modules/pyro/default.nix

diff --git a/pkgs/development/python-modules/pyro/default.nix b/pkgs/development/python-modules/pyro/default.nix
new file mode 100644
index 00000000000..dbad83bef7e
--- /dev/null
+++ b/pkgs/development/python-modules/pyro/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, buildPythonPackage, isPy3k }:
+
+buildPythonPackage rec {
+  name = "Pyro-3.16";
+  disabled = isPy3k;
+
+  src = fetchurl {
+    url = "mirror://pypi/P/Pyro/${name}.tar.gz";
+    sha256 = "1bed508453ef7a7556b51424a58101af2349b662baab7e7331c5cb85dbe7e578";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Distributed object middleware for Python (IPC/RPC)";
+    homepage = http://pythonhosted.org/Pyro/;
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 9b14717bd00..6359f3e16d8 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -16818,23 +16818,7 @@ in {
     };
   });
 
-  Pyro = buildPythonPackage (rec {
-    name = "Pyro-3.16";
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/P/Pyro/${name}.tar.gz";
-      sha256 = "1bed508453ef7a7556b51424a58101af2349b662baab7e7331c5cb85dbe7e578";
-    };
-
-    meta = {
-      description = "Distributed object middleware for Python (IPC/RPC)";
-      homepage = http://pythonhosted.org/Pyro/;
-      license = licenses.mit;
-      platforms = platforms.unix;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  });
+  Pyro = callPackage ../development/python-modules/pyro { };
 
   pyrsistent = buildPythonPackage (rec {
     name = "pyrsistent-0.11.12";

From 3ab65ef6bf0206a4d9f85ef283dcd90e9d4d2a5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:28:59 +0100
Subject: [PATCH 24/43] pythonPackages.robomachine: move to python-modules/

---
 .../python-modules/robomachine/default.nix    | 28 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 27 +-----------------
 2 files changed, 29 insertions(+), 26 deletions(-)
 create mode 100644 pkgs/development/python-modules/robomachine/default.nix

diff --git a/pkgs/development/python-modules/robomachine/default.nix b/pkgs/development/python-modules/robomachine/default.nix
new file mode 100644
index 00000000000..1e7b020cd51
--- /dev/null
+++ b/pkgs/development/python-modules/robomachine/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, buildPythonPackage, pyparsing, argparse, robotframework }:
+
+buildPythonPackage rec {
+  name = "robomachine-0.6";
+
+  src = fetchurl {
+    url = "mirror://pypi/R/RoboMachine/RoboMachine-0.6.tar.gz";
+    sha256 = "6c9a9bae7bffa272b2a09b05df06c29a3a776542c70cae8041a8975a061d2e54";
+  };
+
+  propagatedBuildInputs = [ pyparsing argparse robotframework ];
+
+  # Remove Windows .bat files
+  postInstall = ''
+    rm "$out/bin/"*.bat
+  '';
+
+  postPatch = ''
+    substituteInPlace setup.py --replace "argparse" ""
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Test data generator for Robot Framework";
+    homepage = https://github.com/mkorpela/RoboMachine;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 6359f3e16d8..c110ce8a3a5 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -18246,32 +18246,7 @@ in {
 
   restructuredtext_lint = callPackage ../development/python-modules/restructuredtext_lint { };
 
-  robomachine = buildPythonPackage rec {
-    name = "robomachine-0.6";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/R/RoboMachine/RoboMachine-0.6.tar.gz";
-      sha256 = "6c9a9bae7bffa272b2a09b05df06c29a3a776542c70cae8041a8975a061d2e54";
-    };
-
-    propagatedBuildInputs = with self; [ pyparsing argparse robotframework ];
-
-    # Remove Windows .bat files
-    postInstall = ''
-      rm "$out/bin/"*.bat
-    '';
-
-    postPatch = ''
-      substituteInPlace setup.py --replace "argparse" ""
-    '';
-
-    meta = {
-      description = "Test data generator for Robot Framework";
-      homepage = https://github.com/mkorpela/RoboMachine;
-      license = licenses.asl20;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  robomachine = callPackage ../development/python-modules/robomachine { };
 
   robotframework = buildPythonPackage rec {
     version = "3.0.2";

From b6d345c4b0791408ae69d7e34e9f3f4bf5fe5c89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:40:13 +0100
Subject: [PATCH 25/43] pythonPackages.robotframework: move to python-modules/

---
 .../python-modules/robotframework/default.nix | 20 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 20 +------------------
 2 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 pkgs/development/python-modules/robotframework/default.nix

diff --git a/pkgs/development/python-modules/robotframework/default.nix b/pkgs/development/python-modules/robotframework/default.nix
new file mode 100644
index 00000000000..e0a05eb2e25
--- /dev/null
+++ b/pkgs/development/python-modules/robotframework/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, buildPythonPackage, isPy3k }:
+
+buildPythonPackage rec {
+  version = "3.0.2";
+  name = "robotframework-${version}";
+  disabled = isPy3k;
+
+  src = fetchurl {
+    url = "mirror://pypi/r/robotframework/${name}.tar.gz";
+    sha256 = "1xqzxv00lxf9xi4vdxdsyd1bfmx18gi96vrnijpzj9w2aqrz4610";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Generic test automation framework";
+    homepage = http://robotframework.org/;
+    license = licenses.asl20;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index c110ce8a3a5..dc8559acd48 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -18248,25 +18248,7 @@ in {
 
   robomachine = callPackage ../development/python-modules/robomachine { };
 
-  robotframework = buildPythonPackage rec {
-    version = "3.0.2";
-    name = "robotframework-${version}";
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/r/robotframework/${name}.tar.gz";
-      sha256 = "1xqzxv00lxf9xi4vdxdsyd1bfmx18gi96vrnijpzj9w2aqrz4610";
-    };
-
-    meta = {
-      description = "Generic test automation framework";
-      homepage = http://robotframework.org/;
-      license = licenses.asl20;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
-
+  robotframework = callPackage ../development/python-modules/robotframework { };
 
   robotframework-selenium2library = buildPythonPackage rec {
     version = "1.6.0";

From fb3973a43e5475c63463fc30fbdbf3e3cecf7c68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:43:01 +0100
Subject: [PATCH 26/43] pythonPackages.robotframework-ride: move to
 python-modules/

---
 .../robotframework-ride/default.nix           | 32 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 31 +-----------------
 2 files changed, 33 insertions(+), 30 deletions(-)
 create mode 100644 pkgs/development/python-modules/robotframework-ride/default.nix

diff --git a/pkgs/development/python-modules/robotframework-ride/default.nix b/pkgs/development/python-modules/robotframework-ride/default.nix
new file mode 100644
index 00000000000..a9b536fc76e
--- /dev/null
+++ b/pkgs/development/python-modules/robotframework-ride/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, buildPythonPackage, isPy3k, pygments, wxPython }:
+
+buildPythonPackage rec {
+  version = "1.2.3";
+  name = "robotframework-ride-${version}";
+  disabled = isPy3k;
+
+  src = fetchurl {
+    url = "https://robotframework-ride.googlecode.com/files/${name}.tar.gz";
+    sha256 = "1lf5f4x80f7d983bmkx12sxcizzii21kghs8kf63a1mj022a5x5j";
+  };
+
+  propagatedBuildInputs = [ pygments wxPython ];
+
+  # ride_postinstall.py checks that needed deps are installed and creates a
+  # desktop shortcut. We don't really need it and it clutters up bin/ so
+  # remove it.
+  postInstall = ''
+    rm -f "$out/bin/ride_postinstall.py"
+  '';
+
+  # error: invalid command 'test'
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Light-weight and intuitive editor for Robot Framework test case files";
+    homepage = https://code.google.com/p/robotframework-ride/;
+    license = licenses.asl20;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index dc8559acd48..d20c8fdd3ce 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -18293,36 +18293,7 @@ in {
 
   robotsuite = callPackage ../development/python-modules/robotsuite { };
 
-  robotframework-ride = buildPythonPackage rec {
-    version = "1.2.3";
-    name = "robotframework-ride-${version}";
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "https://robotframework-ride.googlecode.com/files/${name}.tar.gz";
-      sha256 = "1lf5f4x80f7d983bmkx12sxcizzii21kghs8kf63a1mj022a5x5j";
-    };
-
-    propagatedBuildInputs = with self; [ pygments wxPython ];
-
-    # ride_postinstall.py checks that needed deps are installed and creates a
-    # desktop shortcut. We don't really need it and it clutters up bin/ so
-    # remove it.
-    postInstall = ''
-      rm -f "$out/bin/ride_postinstall.py"
-    '';
-
-    # error: invalid command 'test'
-    doCheck = false;
-
-    meta = {
-      description = "Light-weight and intuitive editor for Robot Framework test case files";
-      homepage = https://code.google.com/p/robotframework-ride/;
-      license = licenses.asl20;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  robotframework-ride = callPackage ../development/python-modules/robotframework-ride { };
 
   robotframework-requests = buildPythonPackage rec {
     version = "0.4.6";

From 628e1b9b4ee59ba992af37c8d8786e1957d07849 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:45:15 +0100
Subject: [PATCH 27/43] pythonPackages.seqdiag: move to python-modules/

---
 .../python-modules/seqdiag/default.nix        | 29 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 26 +----------------
 2 files changed, 30 insertions(+), 25 deletions(-)
 create mode 100644 pkgs/development/python-modules/seqdiag/default.nix

diff --git a/pkgs/development/python-modules/seqdiag/default.nix b/pkgs/development/python-modules/seqdiag/default.nix
new file mode 100644
index 00000000000..98a81873a71
--- /dev/null
+++ b/pkgs/development/python-modules/seqdiag/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, buildPythonPackage, pep8, nose, unittest2, docutils
+, blockdiag
+}:
+
+buildPythonPackage rec {
+  name = "seqdiag-0.9.4";
+
+  src = fetchurl {
+    url = "mirror://pypi/s/seqdiag/${name}.tar.gz";
+    sha256 = "1qa7d0m1wahvmrj95rxkb6128cbwd4w3gy8gbzncls66h46bifiz";
+  };
+
+  buildInputs = [ pep8 nose unittest2 docutils ];
+
+  propagatedBuildInputs = [ blockdiag ];
+
+  # Tests fail:
+  #   ...
+  #   ERROR: Failure: OSError ([Errno 2] No such file or directory: '/tmp/nix-build-python2.7-seqdiag-0.9.0.drv-0/seqdiag-0.9.0/src/seqdiag/tests/diagrams/')
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Generate sequence-diagram image from spec-text file (similar to Graphviz)";
+    homepage = http://blockdiag.com/;
+    license = licenses.asl20;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index d20c8fdd3ce..0be1c2e484b 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -18636,31 +18636,7 @@ in {
     };
   };
 
-  seqdiag = buildPythonPackage rec {
-    name = "seqdiag-0.9.4";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/s/seqdiag/${name}.tar.gz";
-      sha256 = "1qa7d0m1wahvmrj95rxkb6128cbwd4w3gy8gbzncls66h46bifiz";
-    };
-
-    buildInputs = with self; [ pep8 nose unittest2 docutils ];
-
-    propagatedBuildInputs = with self; [ blockdiag ];
-
-    # Tests fail:
-    #   ...
-    #   ERROR: Failure: OSError ([Errno 2] No such file or directory: '/tmp/nix-build-python2.7-seqdiag-0.9.0.drv-0/seqdiag-0.9.0/src/seqdiag/tests/diagrams/')
-    doCheck = false;
-
-    meta = {
-      description = "Generate sequence-diagram image from spec-text file (similar to Graphviz)";
-      homepage = http://blockdiag.com/;
-      license = licenses.asl20;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  seqdiag = callPackage ../development/python-modules/seqdiag { };
 
   pysendfile = buildPythonPackage rec {
     name = "pysendfile-${version}";

From 086ad07ed675475916f100e76107d7399f71f78b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:47:17 +0100
Subject: [PATCH 28/43] pythonPackages.scapy: move to python-modules/

---
 .../python-modules/scapy/default.nix          | 20 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 19 +-----------------
 2 files changed, 21 insertions(+), 18 deletions(-)
 create mode 100644 pkgs/development/python-modules/scapy/default.nix

diff --git a/pkgs/development/python-modules/scapy/default.nix b/pkgs/development/python-modules/scapy/default.nix
new file mode 100644
index 00000000000..5241b632f12
--- /dev/null
+++ b/pkgs/development/python-modules/scapy/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, buildPythonPackage, isPy3k, isPyPy }:
+
+buildPythonPackage rec {
+  name = "scapy-2.2.0";
+
+  disabled = isPy3k || isPyPy;
+
+  src = fetchurl {
+    url = "http://www.secdev.org/projects/scapy/files/${name}.tar.gz";
+    sha256 = "1bqmp0xglkndrqgmybpwmzkv462mir8qlkfwsxwbvvzh9li3ndn5";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Powerful interactive network packet manipulation program";
+    homepage = http://www.secdev.org/projects/scapy/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 0be1c2e484b..452357334cd 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -18693,24 +18693,7 @@ in {
 
   sampledata = callPackage ../development/python-modules/sampledata { };
 
-  scapy = buildPythonPackage rec {
-    name = "scapy-2.2.0";
-
-    disabled = isPy3k || isPyPy;
-
-    src = pkgs.fetchurl {
-      url = "http://www.secdev.org/projects/scapy/files/${name}.tar.gz";
-      sha256 = "1bqmp0xglkndrqgmybpwmzkv462mir8qlkfwsxwbvvzh9li3ndn5";
-    };
-
-    meta = {
-      description = "Powerful interactive network packet manipulation program";
-      homepage = http://www.secdev.org/projects/scapy/;
-      license = licenses.gpl2;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  scapy = callPackage ../development/python-modules/scapy { };
 
   scipy = callPackage ../development/python-modules/scipy { };
 

From aaa3608b4b2dd1a799bdbc01af993057308edd5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:49:20 +0100
Subject: [PATCH 29/43] pythonPackages.pyusb: move to python-modules/

---
 .../python-modules/pyusb/default.nix          | 30 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 30 +------------------
 2 files changed, 31 insertions(+), 29 deletions(-)
 create mode 100644 pkgs/development/python-modules/pyusb/default.nix

diff --git a/pkgs/development/python-modules/pyusb/default.nix b/pkgs/development/python-modules/pyusb/default.nix
new file mode 100644
index 00000000000..0651192344a
--- /dev/null
+++ b/pkgs/development/python-modules/pyusb/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, buildPythonPackage, libusb, libusb1 }:
+
+buildPythonPackage rec {
+  name = "pyusb-1.0.0";
+
+  src = fetchurl {
+    url = "https://pypi.python.org/packages/8a/19/66fb48a4905e472f5dfeda3a1bafac369fbf6d6fc5cf55b780864962652d/PyUSB-1.0.0.tar.gz";
+    sha256 = "0s2k4z06fapd5vp1gnrlf8a9sjpc03p9974lzw5k6ky39akzyd2v";
+  };
+
+  # Fix the USB backend library lookup
+  postPatch =
+    ''
+      libusb=${libusb1.out}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}
+      test -f $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; }
+      sed -i -e "s|find_library=None|find_library=lambda _:\"$libusb\"|" usb/backend/libusb1.py
+    '';
+
+  propagatedBuildInputs = [ libusb ];
+
+  # No tests included
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Python USB access module (wraps libusb 1.0)";  # can use other backends
+    homepage = http://pyusb.sourceforge.net/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 452357334cd..2f7e51ee117 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -22812,35 +22812,7 @@ EOF
 
   unidecode = callPackage ../development/python-modules/unidecode {};
 
-  pyusb = buildPythonPackage rec {
-    name = "pyusb-1.0.0";
-
-    src = pkgs.fetchurl {
-      url = "https://pypi.python.org/packages/8a/19/66fb48a4905e472f5dfeda3a1bafac369fbf6d6fc5cf55b780864962652d/PyUSB-1.0.0.tar.gz";
-      sha256 = "0s2k4z06fapd5vp1gnrlf8a9sjpc03p9974lzw5k6ky39akzyd2v";
-    };
-
-    # Fix the USB backend library lookup
-    postPatch =
-      ''
-        libusb=${pkgs.libusb1.out}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}
-        test -f $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; }
-        sed -i -e "s|find_library=None|find_library=lambda _:\"$libusb\"|" usb/backend/libusb1.py
-      '';
-
-    propagatedBuildInputs = [ pkgs.libusb ];
-
-    # No tests included
-    doCheck = false;
-
-    meta = {
-      description = "Python USB access module (wraps libusb 1.0)";  # can use other backends
-      homepage = http://pyusb.sourceforge.net/;
-      license = licenses.bsd3;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
-
+  pyusb = callPackage ../development/python-modules/pyusb {};
 
   BlinkStick = buildPythonPackage rec {
     name = "BlinkStick-${version}";

From 05bf2bdba12c7d0870706e1424ffd6a36b26bd84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:51:20 +0100
Subject: [PATCH 30/43] pythonPackages.usbtmc: move to python-modules/

---
 .../python-modules/usbtmc/default.nix         | 20 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 20 +------------------
 2 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 pkgs/development/python-modules/usbtmc/default.nix

diff --git a/pkgs/development/python-modules/usbtmc/default.nix b/pkgs/development/python-modules/usbtmc/default.nix
new file mode 100644
index 00000000000..3d1fa3be41f
--- /dev/null
+++ b/pkgs/development/python-modules/usbtmc/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, buildPythonPackage, pyusb }:
+
+buildPythonPackage rec {
+  name = "usbtmc-${version}";
+  version = "0.6";
+
+  src = fetchurl {
+    url = "https://github.com/python-ivi/python-usbtmc/archive/v${version}.tar.gz";
+    sha256 = "1wnw6ndc3s1i8zpbikz5zc40ijvpraqdb0xn8zmqlyn95xxfizw2";
+  };
+
+  propagatedBuildInputs = [ pyusb ];
+
+  meta = with stdenv.lib; {
+    description = "Python implementation of the USBTMC instrument control protocol";
+    homepage = http://alexforencich.com/wiki/en/python-usbtmc/start;
+    license = licenses.mit;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 2f7e51ee117..5b5071cab2d 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -22839,25 +22839,7 @@ EOF
     };
   };
 
-
-  usbtmc = buildPythonPackage rec {
-    name = "usbtmc-${version}";
-    version = "0.6";
-
-    src = pkgs.fetchurl {
-      url = "https://github.com/python-ivi/python-usbtmc/archive/v${version}.tar.gz";
-      sha256 = "1wnw6ndc3s1i8zpbikz5zc40ijvpraqdb0xn8zmqlyn95xxfizw2";
-    };
-
-    propagatedBuildInputs = with self; [ pyusb ];
-
-    meta = {
-      description = "Python implementation of the USBTMC instrument control protocol";
-      homepage = http://alexforencich.com/wiki/en/python-usbtmc/start;
-      license = licenses.mit;
-      maintainers = with maintainers; [ bjornfor ];
-    };
-  };
+  usbtmc = callPackage ../development/python-modules/usbtmc {};
 
   txgithub = buildPythonPackage rec {
     name = "${pname}-${version}";

From 140243639529209db37f7c79c8c44dea1db90542 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:53:44 +0100
Subject: [PATCH 31/43] pythonPackages.pyev: move to python-modules/

---
 .../python-modules/pyev/default.nix           | 29 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 29 +------------------
 2 files changed, 30 insertions(+), 28 deletions(-)
 create mode 100644 pkgs/development/python-modules/pyev/default.nix

diff --git a/pkgs/development/python-modules/pyev/default.nix b/pkgs/development/python-modules/pyev/default.nix
new file mode 100644
index 00000000000..db06fedd68c
--- /dev/null
+++ b/pkgs/development/python-modules/pyev/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, buildPythonPackage, libev }:
+
+buildPythonPackage rec {
+  name = "pyev-0.9.0";
+
+  src = fetchurl {
+    url = "mirror://pypi/p/pyev/${name}.tar.gz";
+    sha256 = "0rf603lc0s6zpa1nb25vhd8g4y337wg2wyz56i0agsdh7jchl0sx";
+  };
+
+  buildInputs = [ libev ];
+
+  libEvSharedLibrary =
+    if !stdenv.isDarwin
+    then "${libev}/lib/libev.so.4"
+    else "${libev}/lib/libev.4.dylib";
+
+  postPatch = ''
+    test -f "${libEvSharedLibrary}" || { echo "ERROR: File ${libEvSharedLibrary} does not exist, please fix nix expression for pyev"; exit 1; }
+    sed -i -e "s|libev_dll_name = find_library(\"ev\")|libev_dll_name = \"${libEvSharedLibrary}\"|" setup.py
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Python bindings for libev";
+    homepage = https://code.google.com/p/pyev/;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 5b5071cab2d..cb03a13f6e0 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -16274,34 +16274,7 @@ in {
     };
   };
 
-
-  pyev = buildPythonPackage rec {
-    name = "pyev-0.9.0";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/p/pyev/${name}.tar.gz";
-      sha256 = "0rf603lc0s6zpa1nb25vhd8g4y337wg2wyz56i0agsdh7jchl0sx";
-    };
-
-    buildInputs = [ pkgs.libev ];
-
-    libEvSharedLibrary =
-      if !stdenv.isDarwin
-      then "${pkgs.libev}/lib/libev.so.4"
-      else "${pkgs.libev}/lib/libev.4.dylib";
-
-    postPatch = ''
-      test -f "${libEvSharedLibrary}" || { echo "ERROR: File ${libEvSharedLibrary} does not exist, please fix nix expression for pyev"; exit 1; }
-      sed -i -e "s|libev_dll_name = find_library(\"ev\")|libev_dll_name = \"${libEvSharedLibrary}\"|" setup.py
-    '';
-
-    meta = {
-      description = "Python bindings for libev";
-      homepage = https://code.google.com/p/pyev/;
-      license = licenses.gpl3;
-      maintainers = [ maintainers.bjornfor ];
-    };
-  };
+  pyev = callPackage ../development/python-modules/pyev { };
 
   pyexcelerator = buildPythonPackage rec {
     name = "pyexcelerator-${version}";

From adac3e43fd271dbb9c50cd2f9d42588b5b93e9bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 15:57:39 +0100
Subject: [PATCH 32/43] pythonPackages.llfuse: move to python-modules/

---
 .../python-modules/llfuse/default.nix         | 32 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 29 ++---------------
 2 files changed, 34 insertions(+), 27 deletions(-)
 create mode 100644 pkgs/development/python-modules/llfuse/default.nix

diff --git a/pkgs/development/python-modules/llfuse/default.nix b/pkgs/development/python-modules/llfuse/default.nix
new file mode 100644
index 00000000000..7c907d1e5ef
--- /dev/null
+++ b/pkgs/development/python-modules/llfuse/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, buildPythonPackage, pkgconfig, pytest, fuse, attr, which
+, contextlib2
+}:
+
+buildPythonPackage rec {
+  name = "llfuse-1.0";
+
+  src = fetchurl {
+    url = "mirror://pypi/l/llfuse/${name}.tar.bz2";
+    sha256 = "1li7q04ljrvwharw4fblcbfhvk6s0l3lnv8yqb4c22lcgbkiqlps";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ pytest fuse attr which ];
+
+  propagatedBuildInputs = [ contextlib2 ];
+
+  checkPhase = ''
+    py.test
+  '';
+
+  # FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin'
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Python bindings for the low-level FUSE API";
+    homepage = https://code.google.com/p/python-llfuse/;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index cb03a13f6e0..d83ac0df11b 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -10938,33 +10938,8 @@ in {
 
   livereload = callPackage ../development/python-modules/livereload { };
 
-  llfuse = buildPythonPackage rec {
-    name = "llfuse-1.0";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/l/llfuse/${name}.tar.bz2";
-      sha256 = "1li7q04ljrvwharw4fblcbfhvk6s0l3lnv8yqb4c22lcgbkiqlps";
-    };
-
-    nativeBuildInputs = [ pkgs.pkgconfig ];
-    buildInputs = with self; [ pytest pkgs.fuse pkgs.attr pkgs.which ];
-
-    propagatedBuildInputs = with self; [ contextlib2 ];
-
-    checkPhase = ''
-      py.test
-    '';
-
-    # FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin'
-    doCheck = false;
-
-    meta = {
-      description = "Python bindings for the low-level FUSE API";
-      homepage = https://code.google.com/p/python-llfuse/;
-      license = licenses.lgpl2Plus;
-      platforms = platforms.unix;
-      maintainers = with maintainers; [ bjornfor ];
-    };
+  llfuse = callPackage ../development/python-modules/llfuse {
+    fuse = pkgs.fuse;  # use "real" fuse, not the python module
   };
 
   locustio = buildPythonPackage rec {

From 41b89d15779c74e9a705841c0bb54f375575ca27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:18:17 +0100
Subject: [PATCH 33/43] pythonPackages.autopep8: 1.0.4 -> 1.3.3

The pep8 package is renamed to pycodestyle and autopep8 references the
new name.

(Also, fetchurl -> fetchPypi.)
---
 .../python-modules/autopep8/default.nix            | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/pkgs/development/python-modules/autopep8/default.nix b/pkgs/development/python-modules/autopep8/default.nix
index 6dc091624c5..06ad939cfa8 100644
--- a/pkgs/development/python-modules/autopep8/default.nix
+++ b/pkgs/development/python-modules/autopep8/default.nix
@@ -1,14 +1,16 @@
-{ stdenv, fetchurl, buildPythonPackage, pep8 }:
+{ stdenv, fetchPypi, buildPythonPackage, pycodestyle }:
 
 buildPythonPackage rec {
-  name = "autopep8-1.0.4";
+  pname = "autopep8";
+  version = "1.3.3";
+  name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "mirror://pypi/a/autopep8/${name}.tar.gz";
-    sha256 = "17lydqm8y9a5qadp6iifxrb5mb0g9fr1vxn5qy1fjpyhazxaw8n1";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0c1gl648g2xnz3j0rsp71ld4i32zlglmqjvqf4q8r08jp3zpny7z";
   };
 
-  propagatedBuildInputs = [ pep8 ];
+  propagatedBuildInputs = [ pycodestyle ];
 
   # One test fails:
   # FAIL: test_recursive_should_not_crash_on_unicode_filename (test.test_autopep8.CommandLineTests)

From 454ad93a358a99e2c1c9dd7c45fd0568f93fad85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:33:18 +0100
Subject: [PATCH 34/43] pythonPackages.construct: 2.8.10 -> 2.8.16

---
 pkgs/development/python-modules/construct/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/python-modules/construct/default.nix b/pkgs/development/python-modules/construct/default.nix
index 1845d7ec94f..9d8e61d1f45 100644
--- a/pkgs/development/python-modules/construct/default.nix
+++ b/pkgs/development/python-modules/construct/default.nix
@@ -2,13 +2,13 @@
 
 buildPythonPackage rec {
   name = "construct-${version}";
-  version = "2.8.10";
+  version = "2.8.16";
 
   src = fetchFromGitHub {
     owner = "construct";
     repo = "construct";
     rev = "v${version}";
-    sha256 = "1xfmmc5pihn3ql9f7blrciy06y2bwczqvkbcpvh96dmgqwc3wys3";
+    sha256 = "0lzz1dy419n254qccch7yx4nkpwd0fsyjhnsnaf6ysgwzqxxv63j";
   };
 
   propagatedBuildInputs = [ six ];

From 5065f0f258b4d91a2a05bfbb7695f499e5f76de8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:40:37 +0100
Subject: [PATCH 35/43] pythonPackages.pycollada: 0.4.1 -> 0.5

* fetchurl -> fetchPypi
---
 .../development/python-modules/pycollada/default.nix | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/python-modules/pycollada/default.nix b/pkgs/development/python-modules/pycollada/default.nix
index fec32b86aaf..948d9741bd8 100644
--- a/pkgs/development/python-modules/pycollada/default.nix
+++ b/pkgs/development/python-modules/pycollada/default.nix
@@ -1,11 +1,13 @@
-{ stdenv, fetchurl, buildPythonPackage, numpy, isPy3k, dateutil, dateutil_1_5 }:
+{ stdenv, fetchPypi, buildPythonPackage, numpy, isPy3k, dateutil, dateutil_1_5 }:
 
 buildPythonPackage rec {
-  name = "pycollada-0.4.1";
+  pname = "pycollada";
+  version = "0.5";
+  name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "mirror://pypi/p/pycollada/${name}.tar.gz";
-    sha256 = "0i50lh98550pwr95zgzrgiqzsspm09wl52xlv83y5nrsz4mblylv";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1g96maw2c25l4i3ks51784h33zf7s18vrn6iyz4ca34iy4sl7yq9";
   };
 
   buildInputs = [ numpy ] ++ (if isPy3k then [dateutil] else [dateutil_1_5]);

From 4b3f72917269173b8b22e783b2a043496d3ccd6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 14:44:50 +0100
Subject: [PATCH 36/43] pythonPackages.dpkt: 1.8 -> 1.9.1

* fetchurl -> fetchPypi
* Tests work now.
* Package is py3k compatible now.
---
 pkgs/development/python-modules/dpkt/default.nix | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/pkgs/development/python-modules/dpkt/default.nix b/pkgs/development/python-modules/dpkt/default.nix
index 87b5bd6b812..43c318fc7c3 100644
--- a/pkgs/development/python-modules/dpkt/default.nix
+++ b/pkgs/development/python-modules/dpkt/default.nix
@@ -1,17 +1,15 @@
-{ stdenv, fetchurl, buildPythonPackage, isPy3k }:
+{ stdenv, fetchPypi, buildPythonPackage }:
 
 buildPythonPackage rec {
-  name = "dpkt-1.8";
-  disabled = isPy3k;
+  pname = "dpkt";
+  version = "1.9.1";
+  name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "https://dpkt.googlecode.com/files/${name}.tar.gz";
-    sha256 = "01q5prynymaqyfsfi2296xncicdpid2hs3yyasim8iigvkwy4vf5";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0rr9ygczhxkfb61778jx0cxs0sq46zwlcj5l3wn6xmd3iy3yx9y6";
   };
 
-  # error: invalid command 'test'
-  doCheck = false;
-
   meta = with stdenv.lib; {
     description = "Fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols";
     homepage = https://code.google.com/p/dpkt/;

From 82ababbd833651d319e604091edc4d585f9035e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 16:08:28 +0100
Subject: [PATCH 37/43] pythonPackages.pyusb: 1.0.0 -> 1.0.2

Also, fetchurl -> fetchPypi.
---
 pkgs/development/python-modules/pyusb/default.nix | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/python-modules/pyusb/default.nix b/pkgs/development/python-modules/pyusb/default.nix
index 0651192344a..6ba6794bfd1 100644
--- a/pkgs/development/python-modules/pyusb/default.nix
+++ b/pkgs/development/python-modules/pyusb/default.nix
@@ -1,11 +1,13 @@
-{ stdenv, fetchurl, buildPythonPackage, libusb, libusb1 }:
+{ stdenv, fetchPypi, buildPythonPackage, libusb, libusb1 }:
 
 buildPythonPackage rec {
-  name = "pyusb-1.0.0";
+  pname = "pyusb";
+  version = "1.0.2";
+  name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "https://pypi.python.org/packages/8a/19/66fb48a4905e472f5dfeda3a1bafac369fbf6d6fc5cf55b780864962652d/PyUSB-1.0.0.tar.gz";
-    sha256 = "0s2k4z06fapd5vp1gnrlf8a9sjpc03p9974lzw5k6ky39akzyd2v";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0qkk2jn270jwwl1x26hmdhb14m9kkbrzzwzizdjcl1a29b6756sf";
   };
 
   # Fix the USB backend library lookup

From ccc1f9a5406688e00100f9594e49a01c10a8dde1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 16:04:38 +0100
Subject: [PATCH 38/43] pythonPackages.usbtmc: 0.6 -> 0.8

---
 pkgs/development/python-modules/usbtmc/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/python-modules/usbtmc/default.nix b/pkgs/development/python-modules/usbtmc/default.nix
index 3d1fa3be41f..0c684274907 100644
--- a/pkgs/development/python-modules/usbtmc/default.nix
+++ b/pkgs/development/python-modules/usbtmc/default.nix
@@ -2,11 +2,11 @@
 
 buildPythonPackage rec {
   name = "usbtmc-${version}";
-  version = "0.6";
+  version = "0.8";
 
   src = fetchurl {
     url = "https://github.com/python-ivi/python-usbtmc/archive/v${version}.tar.gz";
-    sha256 = "1wnw6ndc3s1i8zpbikz5zc40ijvpraqdb0xn8zmqlyn95xxfizw2";
+    sha256 = "14f4j77ljr45crnjwlp1dqbxwa45s20y2fpq5rg59r60w15al4yw";
   };
 
   propagatedBuildInputs = [ pyusb ];

From aa12eddb6c9683145160c4b75604a259478fef54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sun, 29 Oct 2017 22:53:27 +0100
Subject: [PATCH 39/43] pythonPackages.nwdiag: unbreak eval

Oops, this should have been part of commit afd4a17ee5abada65616b0f3566813c08b7c4376
("pythonPackages.nwdiag: move to python-modules/"). I noticed 2 seconds
to late!
---
 .../python-modules/nwdiag/default.nix         | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 pkgs/development/python-modules/nwdiag/default.nix

diff --git a/pkgs/development/python-modules/nwdiag/default.nix b/pkgs/development/python-modules/nwdiag/default.nix
new file mode 100644
index 00000000000..ebf7ce944c1
--- /dev/null
+++ b/pkgs/development/python-modules/nwdiag/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, buildPythonPackage, pep8, nose, unittest2, docutils
+, blockdiag
+}:
+
+buildPythonPackage rec {
+  name = "nwdiag-1.0.3";
+
+  src = fetchurl {
+    url = "mirror://pypi/n/nwdiag/${name}.tar.gz";
+    sha256 = "0n7ary1fngxk8bk15vabc8fhnmxlh098piciwaviwn7l4a5q1zys";
+  };
+
+  buildInputs = [ pep8 nose unittest2 docutils ];
+
+  propagatedBuildInputs = [ blockdiag ];
+
+  # tests fail
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Generate network-diagram image from spec-text file (similar to Graphviz)";
+    homepage = http://blockdiag.com/;
+    license = licenses.asl20;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ bjornfor ];
+  };
+}

From e697f10fc4e5343c9fc3c253efb910fecb6f84da Mon Sep 17 00:00:00 2001
From: Christopher Singley <csingley@gmail.com>
Date: Sun, 29 Oct 2017 19:28:16 -0500
Subject: [PATCH 40/43] PlexPy: init at 1.4.25

---
 lib/maintainers.nix             |  1 +
 pkgs/servers/plexpy/default.nix | 41 +++++++++++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix |  2 ++
 3 files changed, 44 insertions(+)
 create mode 100644 pkgs/servers/plexpy/default.nix

diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 7c3a845c00c..dc2281401e0 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -136,6 +136,7 @@
   cryptix = "Henry Bubert <cryptix@riseup.net>";
   CrystalGamma = "Jona Stubbe <nixos@crystalgamma.de>";
   cstrahan = "Charles Strahan <charles@cstrahan.com>";
+  csingley = "Christopher Singley <csingley@gmail.com>";
   cwoac = "Oliver Matthews <oliver@codersoffortune.net>";
   DamienCassou = "Damien Cassou <damien@cassou.me>";
   danbst = "Danylo Hlynskyi <abcz2.uprola@gmail.com>";
diff --git a/pkgs/servers/plexpy/default.nix b/pkgs/servers/plexpy/default.nix
new file mode 100644
index 00000000000..2875ecc5240
--- /dev/null
+++ b/pkgs/servers/plexpy/default.nix
@@ -0,0 +1,41 @@
+{stdenv, fetchFromGitHub, python}:
+
+stdenv.mkDerivation rec {
+  version = "1.4.25";
+  pname = "plexpy";
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "JonnyWong16";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0a4ynrfamlwkgqil4n61v47p21czxpjdzg0mias4kdjam2nnwnjx";
+  };
+
+  buildPhase = ":";
+
+  installPhase = ''
+    mkdir -p $out
+    cp -R * $out/
+
+    # Remove superfluous Python checks from main script;
+    # prepend shebang
+    echo "#!${python.interpreter}" > $out/PlexPy.py
+    tail -n +7 PlexPy.py >> $out/PlexPy.py
+
+    mkdir $out/bin
+    # Can't just symlink to the main script, since it uses __file__ to
+    # import bundled packages and manage the service
+    echo "#!/bin/bash" > $out/bin/plexpy
+    echo "$out/PlexPy.py \$*" >> $out/bin/plexpy
+    chmod +x $out/bin/plexpy
+  '';
+
+  meta  = with stdenv.lib; {
+    description = "A Python based monitoring and tracking tool for Plex Media Server.";
+    homepage = http://jonnywong16.github.io/plexpy/;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with stdenv.lib.maintainers; [ csingley ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 596051f4ea7..762f217fcbe 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3966,6 +3966,8 @@ with pkgs;
 
   plex = callPackage ../servers/plex { enablePlexPass = config.plex.enablePlexPass or false; };
 
+  plexpy = callPackage ../servers/plexpy { python = python2; };
+
   ploticus = callPackage ../tools/graphics/ploticus {
     libpng = libpng12;
   };

From 95dc36235ce21ab8563f1ba61a5d80e6c2ea9e3b Mon Sep 17 00:00:00 2001
From: Christopher Singley <csingley@gmail.com>
Date: Sun, 29 Oct 2017 19:29:25 -0500
Subject: [PATCH 41/43] PlexPy service

---
 nixos/modules/module-list.nix          |  1 +
 nixos/modules/services/misc/plexpy.nix | 81 ++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 nixos/modules/services/misc/plexpy.nix

diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 6f00a97dd3f..44bcec5aec2 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -328,6 +328,7 @@
   ./services/misc/parsoid.nix
   ./services/misc/phd.nix
   ./services/misc/plex.nix
+  ./services/misc/plexpy.nix
   ./services/misc/pykms.nix
   ./services/misc/radarr.nix
   ./services/misc/redmine.nix
diff --git a/nixos/modules/services/misc/plexpy.nix b/nixos/modules/services/misc/plexpy.nix
new file mode 100644
index 00000000000..df9f1258124
--- /dev/null
+++ b/nixos/modules/services/misc/plexpy.nix
@@ -0,0 +1,81 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.services.plexpy;
+in
+{
+  options = {
+    services.plexpy = {
+      enable = mkEnableOption "PlexPy Plex Monitor";
+
+      dataDir = mkOption {
+        type = types.str;
+        default = "/var/lib/plexpy";
+        description = "The directory where PlexPy stores its data files.";
+      };
+
+      configFile = mkOption {
+        type = types.str;
+        default = "/var/lib/plexpy/config.ini";
+        description = "The location of PlexPy's config file.";
+      };
+
+      port = mkOption {
+        type = types.int;
+        default = 8181;
+        description = "TCP port where PlexPy listens.";
+      };
+
+      user = mkOption {
+        type = types.str;
+        default = "plexpy";
+        description = "User account under which PlexPy runs.";
+      };
+
+      group = mkOption {
+        type = types.str;
+        default = "nogroup";
+        description = "Group under which PlexPy runs.";
+      };
+
+      package = mkOption {
+        type = types.package;
+        default = pkgs.plexpy;
+        defaultText = "pkgs.plexpy";
+        description = ''
+          The PlexPy package to use.
+        '';
+      };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.services.plexpy = {
+      description = "PlexPy Plex Monitor";
+      after = [ "network.target" ];
+      wantedBy = [ "multi-user.target" ];
+      preStart = ''
+        test -d "${cfg.dataDir}" || {
+          echo "Creating initial PlexPy data directory in \"${cfg.dataDir}\"."
+          mkdir -p "${cfg.dataDir}"
+          chown ${cfg.user}:${cfg.group} "${cfg.dataDir}"
+        }
+     '';
+      serviceConfig = {
+        Type = "simple";
+        User = cfg.user;
+        Group = cfg.group;
+        PermissionsStartOnly = "true";
+        GuessMainPID = "false";
+        ExecStart = "${cfg.package}/bin/plexpy --datadir ${cfg.dataDir} --config ${cfg.configFile} --port ${toString cfg.port} --pidfile ${cfg.dataDir}/plexpy.pid --nolaunch";
+        Restart = "on-failure";
+      };
+    };
+
+    users.extraUsers = mkIf (cfg.user == "plexpy") {
+      plexpy = { group = cfg.group; uid = config.ids.uids.plexpy; };
+    };
+  };
+}

From 51e68732f95049a04789a7a021533765d39ce110 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20D=C3=A9n=C3=A8s?= <mail@maximedenes.fr>
Date: Sun, 22 Oct 2017 22:45:03 +0200
Subject: [PATCH 42/43] coqPackages.dpdgraph: remove support for coq 8.7

coqPackages_8_7.dpdgraph won't build since Coq 8.7.0 is not yet supported
upstream.
---
 pkgs/development/coq-modules/dpdgraph/default.nix | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/pkgs/development/coq-modules/dpdgraph/default.nix b/pkgs/development/coq-modules/dpdgraph/default.nix
index aec3828f323..65be1f4e066 100644
--- a/pkgs/development/coq-modules/dpdgraph/default.nix
+++ b/pkgs/development/coq-modules/dpdgraph/default.nix
@@ -1,11 +1,6 @@
 { stdenv, fetchFromGitHub, autoreconfHook, coq, ocamlPackages }:
 
 let param = {
-  "8.7" = {
-    version = "0.6.1";
-    rev = "c3b87af6bfa338e18b83f014ebd0e56e1f611663";
-    sha256 = "1jaafkwsb5450378nprjsds1illgdaq60gryi8kspw0i25ykz2c9";
-  };
   "8.6" = {
     version = "0.6.1";
     rev = "c3b87af6bfa338e18b83f014ebd0e56e1f611663";

From 8af79c8adc53909923164cf315913facfe5499ba Mon Sep 17 00:00:00 2001
From: adisbladis <adis@blad.is>
Date: Mon, 30 Oct 2017 12:06:07 +0800
Subject: [PATCH 43/43] pythonPackages.ofxclient: Depend on beautifulsoup4
 instead of beautifulsoup3

---
 pkgs/development/python-modules/ofxclient/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/python-modules/ofxclient/default.nix b/pkgs/development/python-modules/ofxclient/default.nix
index c7877675530..3b5fa1f531a 100644
--- a/pkgs/development/python-modules/ofxclient/default.nix
+++ b/pkgs/development/python-modules/ofxclient/default.nix
@@ -1,5 +1,5 @@
 { stdenv, buildPythonPackage, fetchPypi,
- ofxhome, ofxparse, beautifulsoup, lxml, keyring
+ ofxhome, ofxparse, beautifulsoup4, lxml, keyring
 }:
 
 buildPythonPackage rec {
@@ -19,7 +19,7 @@ buildPythonPackage rec {
   # ImportError: No module named tests
   doCheck = false;
 
-  propagatedBuildInputs = [ ofxhome ofxparse beautifulsoup lxml keyring ];
+  propagatedBuildInputs = [ ofxhome ofxparse beautifulsoup4 lxml keyring ];
 
   meta = with stdenv.lib; {
     homepage = https://github.com/captin411/ofxclient;