From edd3e17785b080615bbd7bf23e3e6f3f43facda0 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Fri, 16 Aug 2019 23:05:16 -0500
Subject: [PATCH 01/54] xauth: 1.0.10 -> 1.1

https://lists.x.org/archives/xorg-announce/2019-July/003005.html
---
 pkgs/servers/x11/xorg/default.nix   | 6 +++---
 pkgs/servers/x11/xorg/tarballs.list | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index 3be672c29f17..40eb8c7b8f9b 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -1379,11 +1379,11 @@ lib.makeScope newScope (self: with self; {
   }) {};
 
   xauth = callPackage ({ stdenv, pkgconfig, fetchurl, libX11, libXau, libXext, libXmu, xorgproto }: stdenv.mkDerivation {
-    name = "xauth-1.0.10";
+    name = "xauth-1.1";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xauth-1.0.10.tar.bz2;
-      sha256 = "0kgwz9rmxjfdvi2syf8g0ms5rr5cgyqx4n0n1m960kyz7k745zjs";
+      url = mirror://xorg/individual/app/xauth-1.1.tar.bz2;
+      sha256 = "032klzzw8r09z36x1272ssd79bcisz8j5p8gbdy111fiknvx27bd";
     };
     hardeningDisable = [ "bindnow" "relro" ];
     nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/servers/x11/xorg/tarballs.list b/pkgs/servers/x11/xorg/tarballs.list
index 426b848a138d..42af2e205920 100644
--- a/pkgs/servers/x11/xorg/tarballs.list
+++ b/pkgs/servers/x11/xorg/tarballs.list
@@ -26,7 +26,7 @@ mirror://xorg/individual/app/transset-1.0.2.tar.bz2
 mirror://xorg/individual/app/twm-1.0.10.tar.bz2
 mirror://xorg/individual/app/viewres-1.0.5.tar.bz2
 mirror://xorg/individual/app/x11perf-1.6.1.tar.bz2
-mirror://xorg/individual/app/xauth-1.0.10.tar.bz2
+mirror://xorg/individual/app/xauth-1.1.tar.bz2
 mirror://xorg/individual/app/xbacklight-1.2.2.tar.bz2
 mirror://xorg/individual/app/xcalc-1.1.0.tar.bz2
 mirror://xorg/individual/app/xclock-1.0.8.tar.bz2

From f61b3e02c05d36c58cb5f5fc793c38df5a79e490 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 15:19:36 +0200
Subject: [PATCH 02/54] glib-networking: format with nixpkgs-fmt

---
 .../libraries/glib-networking/default.nix     | 39 ++++++++++++++-----
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 4f853e9821ff..95a1a5a2804e 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -1,15 +1,24 @@
-{ stdenv, fetchurl, meson, ninja, pkgconfig, glib, gettext, python3, gnutls, p11-kit, libproxy, gnome3
-, gsettings-desktop-schemas }:
+{ stdenv
+, fetchurl
+, meson
+, ninja
+, pkgconfig
+, glib
+, gettext
+, python3
+, gnutls
+, p11-kit
+, libproxy
+, gnome3
+, gsettings-desktop-schemas
+}:
 
-let
+stdenv.mkDerivation rec {
   pname = "glib-networking";
   version = "2.60.3";
-in
-stdenv.mkDerivation rec {
-  name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm";
   };
 
@@ -23,10 +32,20 @@ stdenv.mkDerivation rec {
   '';
 
   nativeBuildInputs = [
-    meson ninja pkgconfig gettext
-    python3 # install_script
+    meson
+    ninja
+    pkgconfig
+    gettext
+    python3 # for install_script
+  ];
+
+  propagatedBuildInputs = [
+    glib
+    gnutls
+    p11-kit
+    libproxy
+    gsettings-desktop-schemas
   ];
-  propagatedBuildInputs = [ glib gnutls p11-kit libproxy gsettings-desktop-schemas ];
 
   mesonFlags = [
     # Default auto detection doesn't work

From 84f318e323989435d5dd54b4038b0af728f20c85 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 15:23:33 +0200
Subject: [PATCH 03/54] glib-networking: drop unnecessary flag

auto_features are now enabled by default.
---
 pkgs/development/libraries/glib-networking/default.nix | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 95a1a5a2804e..2d64bb861789 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -47,11 +47,6 @@ stdenv.mkDerivation rec {
     gsettings-desktop-schemas
   ];
 
-  mesonFlags = [
-    # Default auto detection doesn't work
-    "-Dgnutls=enabled"
-  ];
-
   doCheck = false; # tests need to access the certificates (among other things)
 
   passthru = {

From 8c7be1b927d3185bbdadf11694640a020def52b7 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 15:24:12 +0200
Subject: [PATCH 04/54] glib-networking: improve meta

* Add maintainers
* Add homepage
* Correct license as per https://gitlab.gnome.org/GNOME/glib-networking/commit/b9c0324376a5e23b5f8210b0dd76858206baef26
---
 pkgs/development/libraries/glib-networking/default.nix | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 2d64bb861789..812cfbda8ffd 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -57,7 +57,9 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "Network-related giomodules for glib";
-    license = licenses.lgpl2Plus;
+    homepage = https://gitlab.gnome.org/GNOME/glib-networking;
+    license = licenses.lgpl21Plus;
+    maintainers = gnome3.maintainers;
     platforms = platforms.unix;
   };
 }

From cb1cc757ff6d91323d2f5a70a4da684810970cb9 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 18:50:24 +0200
Subject: [PATCH 05/54] glib-networking: stop propagating dependencies

This was done from the beginning for no apparent reason:
https://github.com/NixOS/nixpkgs/commit/cc6ecaeeef96e4c09581b9bdb067269861b94c60
---
 pkgs/development/libraries/glib-networking/default.nix | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 812cfbda8ffd..780ed5e592fc 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -22,8 +22,6 @@ stdenv.mkDerivation rec {
     sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm";
   };
 
-  outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs
-
   PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "${placeholder "out"}/lib/gio/modules";
 
   postPatch = ''
@@ -39,7 +37,7 @@ stdenv.mkDerivation rec {
     python3 # for install_script
   ];
 
-  propagatedBuildInputs = [
+  buildInputs = [
     glib
     gnutls
     p11-kit

From 897a09f5e3159d25b2b3289b34c25a35dad6e682 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 18:51:52 +0200
Subject: [PATCH 06/54] glib-networking: clean up

---
 pkgs/development/libraries/glib-networking/default.nix | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 780ed5e592fc..c2eae0a7e70a 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -22,8 +22,6 @@ stdenv.mkDerivation rec {
     sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm";
   };
 
-  PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "${placeholder "out"}/lib/gio/modules";
-
   postPatch = ''
     chmod +x meson_post_install.py # patchShebangs requires executable file
     patchShebangs meson_post_install.py

From ce4036177bfb716cdc89d565c5dd57fac7b2116a Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 18:55:29 +0200
Subject: [PATCH 07/54] glib-networking: hardcode GSettings path to gnomeproxy
 module

So that this can be loaded from programs not depending on gsettings-desktop-schemas.

Currently, this patch is much uglier than it could be due to
https://gitlab.gnome.org/GNOME/glib/issues/1884
---
 .../libraries/glib-networking/default.nix     |   8 +
 .../glib-networking/hardcode-gsettings.patch  | 341 ++++++++++++++++++
 2 files changed, 349 insertions(+)
 create mode 100644 pkgs/development/libraries/glib-networking/hardcode-gsettings.patch

diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index c2eae0a7e70a..21fbd94d1bca 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -1,5 +1,6 @@
 { stdenv
 , fetchurl
+, substituteAll
 , meson
 , ninja
 , pkgconfig
@@ -22,6 +23,13 @@ stdenv.mkDerivation rec {
     sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm";
   };
 
+  patches = [
+    (substituteAll {
+      src = ./hardcode-gsettings.patch;
+      gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas;
+    })
+  ];
+
   postPatch = ''
     chmod +x meson_post_install.py # patchShebangs requires executable file
     patchShebangs meson_post_install.py
diff --git a/pkgs/development/libraries/glib-networking/hardcode-gsettings.patch b/pkgs/development/libraries/glib-networking/hardcode-gsettings.patch
new file mode 100644
index 000000000000..0a091b2344dc
--- /dev/null
+++ b/pkgs/development/libraries/glib-networking/hardcode-gsettings.patch
@@ -0,0 +1,341 @@
+diff --git a/proxy/gnome/gproxyresolvergnome.c b/proxy/gnome/gproxyresolvergnome.c
+index 50b63cd..4364116 100644
+--- a/proxy/gnome/gproxyresolvergnome.c
++++ b/proxy/gnome/gproxyresolvergnome.c
+@@ -156,23 +156,79 @@
+ 
+   resolver->base_resolver = g_simple_proxy_resolver_new (NULL, NULL);
+ 
+-  resolver->proxy_settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA,
++                                             FALSE);
++    resolver->proxy_settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_signal_connect (resolver->proxy_settings, "changed",
+                     G_CALLBACK (gsettings_changed), resolver);
+-  resolver->http_settings = g_settings_get_child (resolver->proxy_settings,
+-                                                  GNOME_PROXY_HTTP_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA,
++                                             FALSE);
++    resolver->http_settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_signal_connect (resolver->http_settings, "changed",
+                     G_CALLBACK (gsettings_changed), resolver);
+-  resolver->https_settings = g_settings_get_child (resolver->proxy_settings,
+-                                                   GNOME_PROXY_HTTPS_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTPS_CHILD_SCHEMA,
++                                             FALSE);
++    resolver->https_settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_signal_connect (resolver->https_settings, "changed",
+                     G_CALLBACK (gsettings_changed), resolver);
+-  resolver->ftp_settings = g_settings_get_child (resolver->proxy_settings,
+-                                                 GNOME_PROXY_FTP_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_FTP_CHILD_SCHEMA,
++                                             FALSE);
++    resolver->ftp_settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_signal_connect (resolver->ftp_settings, "changed",
+                     G_CALLBACK (gsettings_changed), resolver);
+-  resolver->socks_settings = g_settings_get_child (resolver->proxy_settings,
+-                                                   GNOME_PROXY_SOCKS_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_SOCKS_CHILD_SCHEMA,
++                                             FALSE);
++    resolver->socks_settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_signal_connect (resolver->socks_settings, "changed",
+                     G_CALLBACK (gsettings_changed), resolver);
+ 
+diff --git a/proxy/tests/gnome.c b/proxy/tests/gnome.c
+index f76b094..54751e3 100644
+--- a/proxy/tests/gnome.c
++++ b/proxy/tests/gnome.c
+@@ -55,26 +55,86 @@
+ {
+   GSettings *settings, *child;
+ 
+-  settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA,
++                                             FALSE);
++    settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_reset (settings, GNOME_PROXY_MODE_KEY);
+   g_settings_reset (settings, GNOME_PROXY_USE_SAME_PROXY_KEY);
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_HTTP_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_reset (child, GNOME_PROXY_HTTP_HOST_KEY);
+   g_settings_reset (child, GNOME_PROXY_HTTP_PORT_KEY);
+   g_object_unref (child);
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_HTTPS_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTPS_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_reset (child, GNOME_PROXY_HTTPS_HOST_KEY);
+   g_settings_reset (child, GNOME_PROXY_HTTPS_PORT_KEY);
+   g_object_unref (child);
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_FTP_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_FTP_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_reset (child, GNOME_PROXY_FTP_HOST_KEY);
+   g_settings_reset (child, GNOME_PROXY_FTP_PORT_KEY);
+   g_object_unref (child);
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_SOCKS_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_SOCKS_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_reset (child, GNOME_PROXY_SOCKS_HOST_KEY);
+   g_settings_reset (child, GNOME_PROXY_SOCKS_PORT_KEY);
+   g_object_unref (child);
+@@ -88,21 +148,69 @@
+ {
+   GSettings *settings, *child;
+ 
+-  settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA,
++                                             FALSE);
++    settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_enum (settings, GNOME_PROXY_MODE_KEY, G_DESKTOP_PROXY_MODE_MANUAL);
+   g_settings_set_boolean (settings, GNOME_PROXY_USE_SAME_PROXY_KEY, TRUE);
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_HTTP_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_string (child, GNOME_PROXY_HTTP_HOST_KEY, "proxy.example.com");
+   g_settings_set_int (child, GNOME_PROXY_HTTP_PORT_KEY, 8080);
+   g_object_unref (child);
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_HTTPS_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTPS_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_string (child, GNOME_PROXY_HTTPS_HOST_KEY, "proxy-s.example.com");
+   g_settings_set_int (child, GNOME_PROXY_HTTPS_PORT_KEY, 7070);
+   g_object_unref (child);
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_FTP_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_FTP_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_string (child, GNOME_PROXY_FTP_HOST_KEY, "proxy-f.example.com");
+   g_settings_set_int (child, GNOME_PROXY_FTP_PORT_KEY, 6060);
+   g_object_unref (child);
+@@ -119,12 +227,36 @@
+   GSettings *settings, *child;
+   const gchar *ignore_hosts[2] = { "127.0.0.1", NULL };
+ 
+-  settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA,
++                                             FALSE);
++    settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_enum (settings, GNOME_PROXY_MODE_KEY, G_DESKTOP_PROXY_MODE_MANUAL);
+   g_settings_set (settings, GNOME_PROXY_IGNORE_HOSTS_KEY,
+                   "@as", g_variant_new_strv (ignore_hosts, -1));
+ 
+-  child = g_settings_get_child (settings, GNOME_PROXY_SOCKS_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_SOCKS_CHILD_SCHEMA,
++                                             FALSE);
++    child = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_string (child, GNOME_PROXY_SOCKS_HOST_KEY, "proxy.example.com");
+   g_settings_set_int (child, GNOME_PROXY_SOCKS_PORT_KEY, 1234);
+   g_object_unref (child);
+@@ -139,12 +271,36 @@
+ {
+   GSettings *settings, *http;
+ 
+-  settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA,
++                                             FALSE);
++    settings = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_enum (settings, GNOME_PROXY_MODE_KEY, G_DESKTOP_PROXY_MODE_MANUAL);
+   g_settings_set (settings, GNOME_PROXY_IGNORE_HOSTS_KEY,
+                   "@as", g_variant_new_strv (ignore_hosts, n_ignore_hosts));
+ 
+-  http = g_settings_get_child (settings, GNOME_PROXY_HTTP_CHILD_SCHEMA);
++  {
++    GSettingsSchemaSource *schema_source;
++    GSettingsSchema *schema;
++    schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@",
++                                                                g_settings_schema_source_get_default(),
++                                                                TRUE, NULL);
++    schema = g_settings_schema_source_lookup(schema_source,
++                                             GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA,
++                                             FALSE);
++    http = g_settings_new_full(schema, NULL, NULL);
++    g_settings_schema_source_unref(schema_source);
++    g_settings_schema_unref(schema);
++  }
+   g_settings_set_string (http, GNOME_PROXY_HTTP_HOST_KEY, "localhost");
+   g_settings_set_int (http, GNOME_PROXY_HTTP_PORT_KEY, 8080);
+ 

From ecf6f4aeb1f82d869a52a1cf414a6b02caec1538 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 19:06:54 +0200
Subject: [PATCH 08/54] glib-networking: add installed tests

---
 nixos/tests/all-tests.nix                     |  1 +
 nixos/tests/glib-networking.nix               | 17 +++++++++++++
 .../libraries/glib-networking/default.nix     | 24 ++++++++++++++++++
 .../installed-tests-path.patch                | 25 +++++++++++++++++++
 4 files changed, 67 insertions(+)
 create mode 100644 nixos/tests/glib-networking.nix
 create mode 100644 pkgs/development/libraries/glib-networking/installed-tests-path.patch

diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 557ee78df7c6..713abbc422bd 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -94,6 +94,7 @@ in
   gitlab = handleTest ./gitlab.nix {};
   gitolite = handleTest ./gitolite.nix {};
   gjs = handleTest ./gjs.nix {};
+  glib-networking = handleTest ./glib-networking.nix {};
   glusterfs = handleTest ./glusterfs.nix {};
   gnome3-xorg = handleTest ./gnome3-xorg.nix {};
   gnome3 = handleTest ./gnome3.nix {};
diff --git a/nixos/tests/glib-networking.nix b/nixos/tests/glib-networking.nix
new file mode 100644
index 000000000000..c0bbb2b3554b
--- /dev/null
+++ b/nixos/tests/glib-networking.nix
@@ -0,0 +1,17 @@
+# run installed tests
+import ./make-test.nix ({ pkgs, ... }:
+
+{
+  name = "glib-networking";
+  meta = {
+    maintainers = pkgs.glib-networking.meta.maintainers;
+  };
+
+  machine = { pkgs, ... }: {
+    environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
+  };
+
+  testScript = ''
+    $machine->succeed("gnome-desktop-testing-runner -d '${pkgs.glib-networking.installedTests}/share'");
+  '';
+})
diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 21fbd94d1bca..ae386f46bffc 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -3,9 +3,11 @@
 , substituteAll
 , meson
 , ninja
+, nixosTests
 , pkgconfig
 , glib
 , gettext
+, makeWrapper
 , python3
 , gnutls
 , p11-kit
@@ -18,6 +20,8 @@ stdenv.mkDerivation rec {
   pname = "glib-networking";
   version = "2.60.3";
 
+  outputs = [ "out" "installedTests" ];
+
   src = fetchurl {
     url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm";
@@ -28,6 +32,8 @@ stdenv.mkDerivation rec {
       src = ./hardcode-gsettings.patch;
       gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas;
     })
+
+    ./installed-tests-path.patch
   ];
 
   postPatch = ''
@@ -40,6 +46,7 @@ stdenv.mkDerivation rec {
     ninja
     pkgconfig
     gettext
+    makeWrapper
     python3 # for install_script
   ];
 
@@ -53,10 +60,27 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # tests need to access the certificates (among other things)
 
+  mesonFlags = [
+    "-Dinstalled_tests=true"
+    "-Dinstalled_test_prefix=${placeholder "installedTests"}"
+  ];
+
+  postFixup = ''
+    find "$installedTests/libexec" "$out/libexec" -type f -executable -print0 \
+      | while IFS= read -r -d "" file; do
+      echo "Wrapping program '$file'"
+      wrapProgram "$file" --prefix GIO_EXTRA_MODULES : "$out/lib/gio/modules"
+    done
+  '';
+
   passthru = {
     updateScript = gnome3.updateScript {
       packageName = pname;
     };
+
+    tests = {
+      installedTests = nixosTests.glib-networking;
+    };
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/glib-networking/installed-tests-path.patch b/pkgs/development/libraries/glib-networking/installed-tests-path.patch
new file mode 100644
index 000000000000..942ca053dd4f
--- /dev/null
+++ b/pkgs/development/libraries/glib-networking/installed-tests-path.patch
@@ -0,0 +1,25 @@
+diff --git a/meson.build b/meson.build
+index 4d91677..aaaeb2b 100644
+--- a/meson.build
++++ b/meson.build
+@@ -12,8 +12,8 @@
+ libexecdir = join_paths(prefix, get_option('libexecdir'))
+ localedir = join_paths(prefix, get_option('localedir'))
+ 
+-installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name())
+-installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name())
++installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', meson.project_name())
++installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', meson.project_name())
+ 
+ cc = meson.get_compiler('c')
+ host_system = host_machine.system()
+diff --git a/meson_options.txt b/meson_options.txt
+index 3a525dd..fc86302 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -3,4 +3,5 @@
+ option('libproxy', type: 'feature', value: 'auto', description: 'support for libproxy proxy configration')
+ option('gnome_proxy', type: 'feature', value: 'auto', description: 'support for GNOME desktop proxy configuration')
+ option('installed_tests', type: 'boolean', value: false, description: 'enable installed tests')
++option('installed_test_prefix', type: 'string', value: '', description: 'Prefix for installed tests')
+ option('static_modules', type: 'boolean', value: false, description: 'build static modules')

From a01a8544f7059c5ed13dde55dc70e6d4ff24092b Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 22:21:27 +0200
Subject: [PATCH 09/54] libproxy: remove outdated comment

We no longer propagate dependencies so the comment is not relevant.
---
 pkgs/development/libraries/libproxy/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix
index 09bb0e4aa3f2..1e906fbeac10 100644
--- a/pkgs/development/libraries/libproxy/default.nix
+++ b/pkgs/development/libraries/libproxy/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "10swd3x576pinx33iwsbd4h15fbh2snmfxzcmab4c56nb08qlbrs";
   };
 
-  outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs
+  outputs = [ "out" "dev" ];
 
   nativeBuildInputs = [ pkgconfig cmake ];
 

From d0ddf6415a6db51695620bce3d3c793b450ad6c6 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 22:22:12 +0200
Subject: [PATCH 10/54] libproxy: split python outputs

---
 pkgs/development/libraries/libproxy/default.nix | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix
index 1e906fbeac10..78709edff644 100644
--- a/pkgs/development/libraries/libproxy/default.nix
+++ b/pkgs/development/libraries/libproxy/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "10swd3x576pinx33iwsbd4h15fbh2snmfxzcmab4c56nb08qlbrs";
   };
 
-  outputs = [ "out" "dev" ];
+  outputs = [ "out" "dev" "py2" "py3" ];
 
   nativeBuildInputs = [ pkgconfig cmake ];
 
@@ -22,13 +22,11 @@ stdenv.mkDerivation rec {
             then [ SystemConfiguration CoreFoundation JavaScriptCore ]
             else [ spidermonkey_38 dbus networkmanager ]);
 
-  preConfigure = ''
-    cmakeFlagsArray+=(
-      "-DWITH_MOZJS=ON"
-      "-DPYTHON2_SITEPKG_DIR=$out/${python2.sitePackages}"
-      "-DPYTHON3_SITEPKG_DIR=$out/${python3.sitePackages}"
-    )
-  '';
+  cmakeFlags = [
+    "-DWITH_MOZJS=ON"
+    "-DPYTHON2_SITEPKG_DIR=${placeholder "py2"}/${python2.sitePackages}"
+    "-DPYTHON3_SITEPKG_DIR=${placeholder "py3"}/${python3.sitePackages}"
+  ];
 
   patches = stdenv.lib.optional stdenv.isDarwin
     (fetchpatch {

From e9953b602c673f1d0524b4df06bd796d8a89feb8 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 22:37:31 +0200
Subject: [PATCH 11/54] libproxy: format with nixpkgs-fmt

---
 .../libraries/libproxy/default.nix            | 47 +++++++++++++++----
 1 file changed, 37 insertions(+), 10 deletions(-)

diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix
index 78709edff644..16c90d0a1501 100644
--- a/pkgs/development/libraries/libproxy/default.nix
+++ b/pkgs/development/libraries/libproxy/default.nix
@@ -1,6 +1,19 @@
-{ stdenv, fetchFromGitHub, pkgconfig, cmake, zlib, fetchpatch
-, dbus, networkmanager, spidermonkey_38, pcre, python2, python3
-, SystemConfiguration, CoreFoundation, JavaScriptCore }:
+{ stdenv
+, fetchFromGitHub
+, pkgconfig
+, cmake
+, zlib
+, fetchpatch
+, dbus
+, networkmanager
+, spidermonkey_38
+, pcre
+, python2
+, python3
+, SystemConfiguration
+, CoreFoundation
+, JavaScriptCore
+}:
 
 stdenv.mkDerivation rec {
   pname = "libproxy";
@@ -15,12 +28,25 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "py2" "py3" ];
 
-  nativeBuildInputs = [ pkgconfig cmake ];
+  nativeBuildInputs = [
+    pkgconfig
+    cmake
+  ];
 
-  buildInputs = [ pcre python2 python3 zlib ]
-        ++ (if stdenv.hostPlatform.isDarwin
-            then [ SystemConfiguration CoreFoundation JavaScriptCore ]
-            else [ spidermonkey_38 dbus networkmanager ]);
+  buildInputs = [
+    pcre
+    python2
+    python3
+    zlib
+  ] ++ (if stdenv.hostPlatform.isDarwin then [
+    SystemConfiguration
+    CoreFoundation
+    JavaScriptCore
+  ] else [
+    spidermonkey_38
+    dbus
+    networkmanager
+  ]);
 
   cmakeFlags = [
     "-DWITH_MOZJS=ON"
@@ -28,11 +54,12 @@ stdenv.mkDerivation rec {
     "-DPYTHON3_SITEPKG_DIR=${placeholder "py3"}/${python3.sitePackages}"
   ];
 
-  patches = stdenv.lib.optional stdenv.isDarwin
+  patches = stdenv.lib.optionals stdenv.isDarwin [
     (fetchpatch {
       url = "https://github.com/libproxy/libproxy/commit/44158f03f8522116758d335688ed840dfcb50ac8.patch";
       sha256 = "0axfvb6j7gcys6fkwi9dkn006imhvm3kqr83gpwban8419n0q5v1";
-    });
+    })
+  ];
 
   doCheck = false; # fails 1 out of 10 tests
 

From 0aa934aa2daaae81f2f1e6073c92ee0582687a46 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 22:39:24 +0200
Subject: [PATCH 12/54] libproxy: wrap GSetings helper

Add GSettings schemas required for GNOME helper.
---
 pkgs/development/libraries/libproxy/default.nix | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix
index 16c90d0a1501..844d626f49e3 100644
--- a/pkgs/development/libraries/libproxy/default.nix
+++ b/pkgs/development/libraries/libproxy/default.nix
@@ -8,6 +8,9 @@
 , networkmanager
 , spidermonkey_38
 , pcre
+, gsettings-desktop-schemas
+, glib
+, makeWrapper
 , python2
 , python3
 , SystemConfiguration
@@ -31,6 +34,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     pkgconfig
     cmake
+    makeWrapper
   ];
 
   buildInputs = [
@@ -43,6 +47,7 @@ stdenv.mkDerivation rec {
     CoreFoundation
     JavaScriptCore
   ] else [
+    glib
     spidermonkey_38
     dbus
     networkmanager
@@ -61,6 +66,11 @@ stdenv.mkDerivation rec {
     })
   ];
 
+  postFixup = ''
+    # config_gnome3 uses the helper to find GNOME proxy settings
+    wrapProgram $out/libexec/pxgsettings --prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
+  '';
+
   doCheck = false; # fails 1 out of 10 tests
 
   meta = with stdenv.lib; {

From e01d33a99dc62aed1c97a1f82c094ae3b05bde8f Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 12:47:43 +0200
Subject: [PATCH 13/54] =?UTF-8?q?libgdata:=200.17.10=20=E2=86=92=200.17.11?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://download.gnome.org/sources/libgdata/0.17/libgdata-0.17.11.news
---
 .../libraries/libgdata/default.nix            | 20 ++-----------------
 .../libgdata/installed-tests-path.patch       | 18 ++++++++---------
 2 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/pkgs/development/libraries/libgdata/default.nix b/pkgs/development/libraries/libgdata/default.nix
index f61283aec4a0..580326868f92 100644
--- a/pkgs/development/libraries/libgdata/default.nix
+++ b/pkgs/development/libraries/libgdata/default.nix
@@ -1,6 +1,5 @@
 { stdenv
 , fetchurl
-, fetchpatch
 , pkgconfig
 , meson
 , ninja
@@ -22,32 +21,17 @@
 
 stdenv.mkDerivation rec {
   pname = "libgdata";
-  version = "0.17.10";
+  version = "0.17.11";
 
   outputs = [ "out" "dev" "installedTests" ];
 
   src = fetchurl {
     url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
-    sha256 = "04mh2p5x2iidfx0d1cablxbi3hvna8cmlddc1mm4387n0grx3ly1";
+    sha256 = "11m99sh2k679rnsvqsi95s1l0r8lkvj61dmwg1pnxvsd5q91g6bb";
   };
 
   patches = [
     ./installed-tests-path.patch
-    (fetchpatch {
-      # Meson fixes
-      url = "https://gitlab.gnome.org/GNOME/libgdata/commit/f6d0e3f3b6fa8e8ee9569372c5709c1fb84af2c1.diff";
-      sha256 = "00yrppn0s21i41r9mwzvrrv7j5dida09kh7i44kv8hrbrlfag7bm";
-    })
-    (fetchpatch {
-      # Meson minor fixes
-      url = "https://gitlab.gnome.org/GNOME/libgdata/commit/b653f602b3c2b518101c5d909e1651534c22757a.diff";
-      sha256 = "1bn0rffsvkzjl59aw8dmq1wil58x1fshz0m6xabpn79ffvbjld8j";
-    })
-    (fetchpatch {
-      # Meson: Fix G_LOG_DOMAIN
-      url = "https://gitlab.gnome.org/GNOME/libgdata/commit/5d318e0bf905d0f1a8b3fe1e47ee7847739082e3.diff";
-      sha256 = "11i2blq811d53433kdq4hhsscgkrq5f50d9ih4ixgs3j47hg7b1w";
-    })
   ];
 
   nativeBuildInputs = [
diff --git a/pkgs/development/libraries/libgdata/installed-tests-path.patch b/pkgs/development/libraries/libgdata/installed-tests-path.patch
index 18669817cfed..f8c0a1293a1f 100644
--- a/pkgs/development/libraries/libgdata/installed-tests-path.patch
+++ b/pkgs/development/libraries/libgdata/installed-tests-path.patch
@@ -1,5 +1,5 @@
 diff --git a/gdata/tests/meson.build b/gdata/tests/meson.build
-index 52154e7a..1a44d1d8 100644
+index 05184deb..3a9392d4 100644
 --- a/gdata/tests/meson.build
 +++ b/gdata/tests/meson.build
 @@ -1,5 +1,12 @@
@@ -17,17 +17,17 @@ index 52154e7a..1a44d1d8 100644
  
  tests_sources = files(
    'common.c',
-@@ -48,7 +55,7 @@ foreach test_name, extra_args: tests
+@@ -49,7 +56,7 @@ foreach test_name, extra_args: tests
      dependencies: common_deps + extra_args.get('dependencies', []),
      sources: tests_sources,
-     install: install_tests,
+     install: install_tests and not should_fail,
 -    install_dir: tests_execdir,
 +    install_dir: tests_bindir,
    )
  
    test(
-@@ -63,7 +70,7 @@ if install_tests
-   foreach test_name, extra_args: tests
+@@ -65,7 +72,7 @@ if install_tests
+     should_fail = extra_args.get('should_fail', false)
      tests_conf = {
        'TEST_TYPE': 'session',
 -      'TEST_ABS_PATH': gdata_prefix / tests_execdir / test_name,
@@ -35,10 +35,10 @@ index 52154e7a..1a44d1d8 100644
      }
  
      configure_file (
-@@ -71,13 +78,13 @@ if install_tests
+@@ -73,13 +80,13 @@ if install_tests
        output: test_name + '.test',
        configuration: tests_conf,
-       install: true,
+       install: not should_fail,
 -      install_dir: tests_metadir,
 +      install_dir: tests_datadir,
      )
@@ -51,7 +51,7 @@ index 52154e7a..1a44d1d8 100644
    )
  
    test_data = [
-@@ -96,6 +103,6 @@ if install_tests
+@@ -98,6 +105,6 @@ if install_tests
  
    install_data(
      test_data,
@@ -60,7 +60,7 @@ index 52154e7a..1a44d1d8 100644
    )
  endif
 diff --git a/meson.build b/meson.build
-index 7d2f5254..bed3e189 100644
+index 50441abb..5fc773b1 100644
 --- a/meson.build
 +++ b/meson.build
 @@ -20,9 +20,9 @@ gdata_api_version_minor = 0

From d1f9fcbbbc8e334d78953900ff04cd2e58e2917f Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 2 Sep 2019 13:44:34 +0200
Subject: [PATCH 14/54] libgdata.tests: add installedTests

---
 nixos/tests/all-tests.nix                     |  1 +
 nixos/tests/libgdata.nix                      | 21 +++++++++++++++++++
 .../libraries/libgdata/default.nix            |  5 +++++
 3 files changed, 27 insertions(+)
 create mode 100644 nixos/tests/libgdata.nix

diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 6964d5261fc4..41f088549057 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -145,6 +145,7 @@ in
   latestKernel.login = handleTest ./login.nix { latestKernel = true; };
   ldap = handleTest ./ldap.nix {};
   leaps = handleTest ./leaps.nix {};
+  libgdata = handleTest ./libgdata.nix {};
   libxmlb = handleTest ./libxmlb.nix {};
   lidarr = handleTest ./lidarr.nix {};
   lightdm = handleTest ./lightdm.nix {};
diff --git a/nixos/tests/libgdata.nix b/nixos/tests/libgdata.nix
new file mode 100644
index 000000000000..10a3ca97dd22
--- /dev/null
+++ b/nixos/tests/libgdata.nix
@@ -0,0 +1,21 @@
+# run installed tests
+import ./make-test.nix ({ pkgs, ... }:
+
+{
+  name = "libgdata";
+
+  meta = {
+    maintainers = pkgs.libgdata.meta.maintainers;
+  };
+
+  machine = { pkgs, ... }: {
+    environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
+    # # GLib-GIO-DEBUG: _g_io_module_get_default: Found default implementation dummy (GDummyTlsBackend) for ‘gio-tls-backend’
+    # Bail out! libgdata:ERROR:../gdata/tests/common.c:134:gdata_test_init: assertion failed (child_error == NULL): TLS support is not available (g-tls-error-quark, 0)
+    services.gnome3.glib-networking.enable = true;
+  };
+
+  testScript = ''
+    $machine->succeed("gnome-desktop-testing-runner -d '${pkgs.libgdata.installedTests}/share'");
+  '';
+})
diff --git a/pkgs/development/libraries/libgdata/default.nix b/pkgs/development/libraries/libgdata/default.nix
index 580326868f92..3c38fe619d9a 100644
--- a/pkgs/development/libraries/libgdata/default.nix
+++ b/pkgs/development/libraries/libgdata/default.nix
@@ -3,6 +3,7 @@
 , pkgconfig
 , meson
 , ninja
+, nixosTests
 , vala
 , gettext
 , libxml2
@@ -71,6 +72,10 @@ stdenv.mkDerivation rec {
       packageName = pname;
       versionPolicy = "none"; # Stable version has not been updated for a long time.
     };
+
+    tests = {
+      installedTests = nixosTests.libgdata;
+    };
   };
 
   meta = with stdenv.lib; {

From 59ed1d94c9cf7f6ae2e8da467b499fd66f15f6cd Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Mon, 2 Sep 2019 17:48:22 -0500
Subject: [PATCH 15/54] glib: 2.60.6 -> 2.60.7

https://gitlab.gnome.org/GNOME/glib/-/tags/2.60.7
---
 pkgs/development/libraries/glib/default.nix | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 29360585b7e5..de7505e6cde1 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -46,16 +46,15 @@ let
   '';
 
   binPrograms = optional (!stdenv.isDarwin) "gapplication" ++ [ "gdbus" "gio" "gsettings" ];
-  version = "2.60.6";
 in
 
 stdenv.mkDerivation rec {
   pname = "glib";
-  inherit version;
+  version = "2.60.7";
 
   src = fetchurl {
     url = "mirror://gnome/sources/glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
-    sha256 = "0v7vpx2md1gn0wwiirn7g4bhf2csfvcr03y96q2zv97ain6sp3zz";
+    sha256 = "0433m0na8nc4cf0gidf4gfzz8k5d3dsssmh541qkpzcsaspw04lb";
   };
 
   patches = optional stdenv.isDarwin ./darwin-compilation.patch

From 04ddfc59b488e7897202f082bade861e52f11d12 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Thu, 29 Aug 2019 23:41:39 -0500
Subject: [PATCH 16/54] webkitgtk: 2.24.3 -> 2.24.4 (security!)

https://webkitgtk.org/2019/08/28/webkitgtk2.24.4-released.html
https://webkitgtk.org/security/WSA-2019-0004.html
---
 pkgs/development/libraries/webkitgtk/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/webkitgtk/default.nix b/pkgs/development/libraries/webkitgtk/default.nix
index 71b30960bacd..55acbee69e9f 100644
--- a/pkgs/development/libraries/webkitgtk/default.nix
+++ b/pkgs/development/libraries/webkitgtk/default.nix
@@ -15,7 +15,7 @@ assert stdenv.isDarwin -> !enableGtk2Plugins;
 with stdenv.lib;
 stdenv.mkDerivation rec {
   pname = "webkitgtk";
-  version = "2.24.3";
+  version = "2.24.4";
 
   meta = {
     description = "Web content rendering engine, GTK+ port";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "https://webkitgtk.org/releases/${pname}-${version}.tar.xz";
-    sha256 = "0lbcrw5axwrbrajxq7fqywfyh0djqi23ynzb5wi5ghw2grnp83cl";
+    sha256 = "1n3x5g1z6rg9n1ssna7wi0z6zlprjm4wzk544v14wqi6q0lv2s46";
   };
 
   patches = optionals stdenv.isDarwin [

From 86a112585a740884916ec7f3be519d47b31a48fa Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Tue, 25 Jun 2019 19:42:10 -0500
Subject: [PATCH 17/54] sessreg: 1.1.1 -> 1.1.2

---
 pkgs/servers/x11/xorg/default.nix   | 6 +++---
 pkgs/servers/x11/xorg/tarballs.list | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index 38d175d04bcf..44c6f175a519 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -1275,11 +1275,11 @@ lib.makeScope newScope (self: with self; {
   }) {};
 
   sessreg = callPackage ({ stdenv, pkgconfig, fetchurl, xorgproto }: stdenv.mkDerivation {
-    name = "sessreg-1.1.1";
+    name = "sessreg-1.1.2";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/sessreg-1.1.1.tar.bz2;
-      sha256 = "1qd66mg2bnppqz4xgdjzif2488zl82vx2c26ld3nb8pnyginm9vq";
+      url = mirror://xorg/individual/app/sessreg-1.1.2.tar.bz2;
+      sha256 = "0crczl25zynkrslmm8sjaxszhrh4i33m7h5fg4wfdb3k8aarxjyz";
     };
     hardeningDisable = [ "bindnow" "relro" ];
     nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/servers/x11/xorg/tarballs.list b/pkgs/servers/x11/xorg/tarballs.list
index 50c87b4dda04..a9337c909cb7 100644
--- a/pkgs/servers/x11/xorg/tarballs.list
+++ b/pkgs/servers/x11/xorg/tarballs.list
@@ -19,7 +19,7 @@ mirror://xorg/individual/app/ico-1.0.5.tar.bz2
 mirror://xorg/individual/app/listres-1.0.4.tar.bz2
 mirror://xorg/individual/app/mkfontscale-1.2.1.tar.bz2
 mirror://xorg/individual/app/oclock-1.0.4.tar.bz2
-mirror://xorg/individual/app/sessreg-1.1.1.tar.bz2
+mirror://xorg/individual/app/sessreg-1.1.2.tar.bz2
 mirror://xorg/individual/app/setxkbmap-1.3.1.tar.bz2
 mirror://xorg/individual/app/smproxy-1.0.6.tar.bz2
 mirror://xorg/individual/app/transset-1.0.2.tar.bz2

From cdb4ee80788a71b092c63a2fca7dc5e23b5b9209 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Tue, 25 Jun 2019 19:40:51 -0500
Subject: [PATCH 18/54] encodings: 1.0.4 -> 1.0.5

---
 pkgs/servers/x11/xorg/default.nix   | 6 +++---
 pkgs/servers/x11/xorg/tarballs.list | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index 38d175d04bcf..ba0701481190 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -58,11 +58,11 @@ lib.makeScope newScope (self: with self; {
   }) {};
 
   encodings = callPackage ({ stdenv, pkgconfig, fetchurl }: stdenv.mkDerivation {
-    name = "encodings-1.0.4";
+    name = "encodings-1.0.5";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/font/encodings-1.0.4.tar.bz2;
-      sha256 = "0ffmaw80vmfwdgvdkp6495xgsqszb6s0iira5j0j6pd4i0lk3mnf";
+      url = mirror://xorg/individual/font/encodings-1.0.5.tar.bz2;
+      sha256 = "0caafx0yqqnqyvbalxhh3mb0r9v36xmcy5zjhygb2i508dhy35mx";
     };
     hardeningDisable = [ "bindnow" "relro" ];
     nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/servers/x11/xorg/tarballs.list b/pkgs/servers/x11/xorg/tarballs.list
index 50c87b4dda04..f0d67255ce65 100644
--- a/pkgs/servers/x11/xorg/tarballs.list
+++ b/pkgs/servers/x11/xorg/tarballs.list
@@ -132,7 +132,7 @@ mirror://xorg/individual/driver/xf86-video-vmware-13.3.0.tar.bz2
 mirror://xorg/individual/driver/xf86-video-voodoo-1.2.5.tar.bz2
 mirror://xorg/individual/driver/xf86-video-wsfb-0.4.0.tar.bz2
 mirror://xorg/individual/driver/xf86-video-xgi-1.6.1.tar.bz2
-mirror://xorg/individual/font/encodings-1.0.4.tar.bz2
+mirror://xorg/individual/font/encodings-1.0.5.tar.bz2
 mirror://xorg/individual/font/font-adobe-100dpi-1.0.3.tar.bz2
 mirror://xorg/individual/font/font-adobe-75dpi-1.0.3.tar.bz2
 mirror://xorg/individual/font/font-adobe-utopia-100dpi-1.0.4.tar.bz2

From 743f96d3a2be50a548b0ebe112d980e6e605a236 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Thu, 22 Aug 2019 14:35:28 -0500
Subject: [PATCH 19/54] nsd: 4.2.1 -> 4.2.2

---
 pkgs/servers/dns/nsd/default.nix | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkgs/servers/dns/nsd/default.nix b/pkgs/servers/dns/nsd/default.nix
index 4fa32050c682..531e00e578f8 100644
--- a/pkgs/servers/dns/nsd/default.nix
+++ b/pkgs/servers/dns/nsd/default.nix
@@ -15,11 +15,12 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "nsd-4.2.1";
+  pname = "nsd";
+  version = "4.2.2";
 
   src = fetchurl {
-    url = "https://www.nlnetlabs.nl/downloads/nsd/${name}.tar.gz";
-    sha256 = "07w753lfrmpf2rv0115pak2zqywv57mq6bwzwwmypc4cjsihwz6i";
+    url = "https://www.nlnetlabs.nl/downloads/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "1ys608jyp5scc957q4brm094c97sxlwymina7d2nvzi51aa37cw3";
   };
 
   prePatch = ''

From 2207378c9e67dead15040e53d17888af7881ac28 Mon Sep 17 00:00:00 2001
From: Matthieu Coudron <mattator@gmail.com>
Date: Wed, 21 Aug 2019 22:14:31 +0900
Subject: [PATCH 20/54] linux: clearer origin for settings configuration

adds _file so that nix may have a chance to display what file the conflictings settings come
from.
---
 pkgs/os-specific/linux/kernel/generic.nix       | 4 ++--
 pkgs/os-specific/linux/kernel/manual-config.nix | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index 2c01dcb97312..e6e1bd842363 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -151,8 +151,8 @@ let
       moduleStructuredConfig = (lib.evalModules {
         modules = [
           module
-          { settings = commonStructuredConfig; }
-          { settings = structuredExtraConfig; }
+          { settings = commonStructuredConfig; _file = "pkgs/os-specific/linux/kernel/common-config.nix"; }
+          { settings = structuredExtraConfig; _file = "structuredExtraConfig"; }
         ]
         ++  structuredConfigFromPatches
         ;
diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix
index 7a663fca6948..257aec751429 100644
--- a/pkgs/os-specific/linux/kernel/manual-config.nix
+++ b/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -278,7 +278,8 @@ in
 assert stdenv.lib.versionAtLeast version "4.14" -> libelf != null;
 assert stdenv.lib.versionAtLeast version "4.15" -> utillinux != null;
 stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // {
-  name = "linux-${version}";
+  pname = "linux";
+  inherit version;
 
   enableParallelBuilding = true;
 

From 9ec4a264ed04f31c5d276afa905ab0718f35434c Mon Sep 17 00:00:00 2001
From: Orivej Desh <orivej@gmx.fr>
Date: Thu, 5 Sep 2019 00:16:52 +0000
Subject: [PATCH 21/54] libjpeg-turbo: 2.0.2 -> 2.0.3

---
 pkgs/development/libraries/libjpeg-turbo/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index 191c375f3be8..cb32b22f45e4 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -3,11 +3,11 @@
 stdenv.mkDerivation rec {
 
   pname = "libjpeg-turbo";
-  version = "2.0.2";
+  version = "2.0.3";
 
   src = fetchurl {
     url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
-    sha256 = "1v9gx1gdzgxf51nd55ncq7rghmj4x9x91rby50ag36irwngmkf5c";
+    sha256 = "1ds16bnj17v6hzd43w8pzijz3imd9am4hw75ir0fxm240m8dwij2";
   };
 
   patches =

From 7d3b44c9be008a34a3f36a0303fd8d3f20191244 Mon Sep 17 00:00:00 2001
From: Benjamin Hipple <bhipple@protonmail.com>
Date: Fri, 6 Sep 2019 00:22:45 -0400
Subject: [PATCH 22/54] waf: 2.0.15 -> 2.0.18

---
 pkgs/development/tools/build-managers/waf/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/tools/build-managers/waf/default.nix b/pkgs/development/tools/build-managers/waf/default.nix
index 6f50907665fe..f8bbda61627a 100644
--- a/pkgs/development/tools/build-managers/waf/default.nix
+++ b/pkgs/development/tools/build-managers/waf/default.nix
@@ -8,13 +8,13 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "waf";
-  version = "2.0.15";
+  version = "2.0.18";
 
   src = fetchFromGitLab {
     owner = "ita1024";
     repo = "waf";
     rev = "${pname}-${version}";
-    sha256 = "0i86dbn6l01n4h4rzyl4mvizqabbqn5w7fywh83z7fxpha13c3bz";
+    sha256 = "1ifcanm2x2i8qwgfkwgdxwaqcdwsx5jg8bd1d6sqjps3pz7s5qxx";
   };
 
   patches = [

From f7e28bf5d8181926e600a222cb70180519d09726 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Wed, 17 Jul 2019 20:36:47 +0200
Subject: [PATCH 23/54] Split buildPythonPackage into setup hooks

This commit splits the `buildPythonPackage` into multiple setup hooks.

Generally, Python packages are built from source to wheels using `setuptools`.
The wheels are then installed with `pip`. Tests were often called with
`python setup.py test` but this is less common nowadays. Most projects
now use a different entry point for running tests, typically `pytest`
or `nosetests`.

Since the wheel format was introduced more tools were built to generate these,
e.g. `flit`. Since PEP 517 is provisionally accepted, defining a build-system
independent format (`pyproject.toml`), `pip` can now use that format to
execute the correct build-system.

In the past I've added support for PEP 517 (`pyproject`) to the Python
builder, resulting in a now rather large builder. Furthermore, it was not possible
to reuse components elsewhere. Therefore, the builder is now split into multiple
setup hooks.

The `setuptoolsCheckHook` is included now by default but in time it should
be removed from `buildPythonPackage` to make it easier to use another hook
(curently one has to pass in `dontUseSetuptoolsCheck`).
---
 doc/languages-frameworks/python.section.md    | 19 +++-
 .../python/build-python-package-common.nix    | 31 ------
 .../python/build-python-package-flit.nix      | 22 -----
 .../python/build-python-package-pyproject.nix | 56 -----------
 .../build-python-package-setuptools.nix       | 60 ------------
 .../python/build-python-package-wheel.nix     | 20 ----
 .../python/build-python-package.nix           | 48 ----------
 .../interpreters/python/hooks/default.nix     | 95 +++++++++++++++++++
 .../python/hooks/flit-build-hook.sh           | 15 +++
 .../python/hooks/pip-build-hook.sh            | 42 ++++++++
 .../python/hooks/pip-install-hook.sh          | 24 +++++
 .../python/hooks/pytest-check-hook.sh         | 49 ++++++++++
 .../hooks/python-catch-conflicts-hook.sh      | 10 ++
 .../python/hooks/python-imports-check-hook.sh | 16 ++++
 .../hooks/python-remove-bin-bytecode-hook.sh  | 17 ++++
 .../python/hooks/setuptools-build-hook.sh     | 47 +++++++++
 .../python/hooks/setuptools-check-hook.sh     | 18 ++++
 .../python/hooks/wheel-unpack-hook.sh         | 18 ++++
 .../python/mk-python-derivation.nix           | 80 ++++++++++++----
 .../python-modules/atomicwrites/default.nix   |  6 +-
 .../bootstrapped-pip/default.nix              | 18 +++-
 .../python-modules/pip/default.nix            |  9 +-
 .../development/python-modules/py/default.nix |  6 +-
 .../python-modules/pytest/default.nix         | 11 ++-
 .../python-modules/setuptools/default.nix     | 25 ++---
 .../python-modules/setuptools_scm/default.nix |  2 -
 .../python-modules/wheel/default.nix          | 10 +-
 pkgs/top-level/python-packages.nix            | 20 ++--
 28 files changed, 500 insertions(+), 294 deletions(-)
 delete mode 100644 pkgs/development/interpreters/python/build-python-package-common.nix
 delete mode 100644 pkgs/development/interpreters/python/build-python-package-flit.nix
 delete mode 100644 pkgs/development/interpreters/python/build-python-package-pyproject.nix
 delete mode 100644 pkgs/development/interpreters/python/build-python-package-setuptools.nix
 delete mode 100644 pkgs/development/interpreters/python/build-python-package-wheel.nix
 delete mode 100644 pkgs/development/interpreters/python/build-python-package.nix
 create mode 100644 pkgs/development/interpreters/python/hooks/default.nix
 create mode 100644 pkgs/development/interpreters/python/hooks/flit-build-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/pip-build-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/pip-install-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/pytest-check-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh
 create mode 100644 pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh

diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md
index 4963c97a6c9a..88dc42ebc6c2 100644
--- a/doc/languages-frameworks/python.section.md
+++ b/doc/languages-frameworks/python.section.md
@@ -540,7 +540,8 @@ and the aliases
 #### `buildPythonPackage` function
 
 The `buildPythonPackage` function is implemented in
-`pkgs/development/interpreters/python/build-python-package.nix`
+`pkgs/development/interpreters/python/mk-python-derivation`
+using setup hooks.
 
 The following is an example:
 ```nix
@@ -797,6 +798,22 @@ such as `ignoreCollisions = true` or `postBuild`. If you need them, you have to
 Python 2 namespace packages may provide `__init__.py` that collide. In that case `python.buildEnv`
 should be used with `ignoreCollisions = true`.
 
+#### Setup hooks
+
+The following are setup hooks specifically for Python packages. Most of these are
+used in `buildPythonPackage`.
+
+- `flitBuildHook` to build a wheel using `flit`.
+- `pipBuildHook` to build a wheel using `pip` and PEP 517. Note a build system (e.g. `setuptools` or `flit`) should still be added as `nativeBuildInput`.
+- `pipInstallHook` to install wheels.
+- `pytestCheckHook` to run tests with `pytest`.
+- `pythonCatchConflictsHook` to check whether a Python package is not already existing.
+- `pythonImportsCheckHook` to check whether importing the listed modules works.
+- `pythonRemoveBinBytecode` to remove bytecode from the `/bin` folder.
+- `setuptoolsBuildHook` to build a wheel using `setuptools`.
+- `setuptoolsCheckHook` to run tests with `python setup.py test`.
+- `wheelUnpackHook` to move a wheel to the correct folder so it can be installed with the `pipInstallHook`.
+
 ### Development mode
 
 Development or editable mode is supported. To develop Python packages
diff --git a/pkgs/development/interpreters/python/build-python-package-common.nix b/pkgs/development/interpreters/python/build-python-package-common.nix
deleted file mode 100644
index 0f8e088d434a..000000000000
--- a/pkgs/development/interpreters/python/build-python-package-common.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-# This function provides generic bits to install a Python wheel.
-
-{ python
-}:
-
-{ buildInputs ? []
-# Additional flags to pass to "pip install".
-, installFlags ? []
-, ... } @ attrs:
-
-attrs // {
-  buildInputs = buildInputs ++ [ python.pythonForBuild.pkgs.bootstrapped-pip ];
-
-  configurePhase = attrs.configurePhase or ''
-    runHook preConfigure
-    runHook postConfigure
-  '';
-
-  installPhase = attrs.installPhase or ''
-    runHook preInstall
-
-    mkdir -p "$out/${python.sitePackages}"
-    export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
-
-    pushd dist
-    ${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild
-    popd
-
-    runHook postInstall
-  '';
-}
diff --git a/pkgs/development/interpreters/python/build-python-package-flit.nix b/pkgs/development/interpreters/python/build-python-package-flit.nix
deleted file mode 100644
index b0f9e0380211..000000000000
--- a/pkgs/development/interpreters/python/build-python-package-flit.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-# This function provides specific bits for building a flit-based Python package.
-
-{ python
-, flit
-}:
-
-{ ... } @ attrs:
-
-attrs // {
-  nativeBuildInputs = [ flit ];
-  buildPhase = attrs.buildPhase or ''
-    runHook preBuild
-    flit build --format wheel
-    runHook postBuild
-  '';
-
-  # Flit packages, like setuptools packages, might have tests.
-  installCheckPhase = attrs.checkPhase or ''
-    ${python.interpreter} -m unittest discover
-  '';
-  doCheck = attrs.doCheck or true;
-}
diff --git a/pkgs/development/interpreters/python/build-python-package-pyproject.nix b/pkgs/development/interpreters/python/build-python-package-pyproject.nix
deleted file mode 100644
index 085db44f3e82..000000000000
--- a/pkgs/development/interpreters/python/build-python-package-pyproject.nix
+++ /dev/null
@@ -1,56 +0,0 @@
-# This function provides specific bits for building a setuptools-based Python package.
-
-{ lib
-, python
-}:
-
-{
-# Global options passed to "python setup.py"
-  setupPyGlobalFlags ? []
-# Build options passed to "build_ext"
-# https://github.com/pypa/pip/issues/881
-# Rename to `buildOptions` because it is not setuptools specific?
-, setupPyBuildFlags ? []
-# Execute before shell hook
-, preShellHook ? ""
-# Execute after shell hook
-, postShellHook ? ""
-, ... } @ attrs:
-
-let
-  pipGlobalFlagsString = lib.concatMapStringsSep " " (option: "--global-option ${option}") setupPyGlobalFlags;
-  pipBuildFlagsString = lib.concatMapStringsSep " " (option: "--build-option ${option}") setupPyBuildFlags;
-in attrs // {
-  buildPhase = attrs.buildPhase or ''
-    runHook preBuild
-    mkdir -p dist
-    echo "Creating a wheel..."
-    ${python.pythonForBuild.interpreter} -m pip wheel --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist ${pipGlobalFlagsString} ${pipBuildFlagsString} .
-    echo "Finished creating a wheel..."
-    runHook postBuild
-  '';
-
-  installCheckPhase = ''
-    runHook preCheck
-    echo "No checkPhase defined. Either provide a checkPhase or disable tests in case tests are not available."; exit 1
-    runHook postCheck
-  '';
-
-  # With Python it's a common idiom to run the tests
-  # after the software has been installed.
-  doCheck = attrs.doCheck or true;
-
-  shellHook = attrs.shellHook or ''
-    ${preShellHook}
-    # Long-term setup.py should be dropped.
-    if [ -e pyproject.toml ]; then
-      tmp_path=$(mktemp -d)
-      export PATH="$tmp_path/bin:$PATH"
-      export PYTHONPATH="$tmp_path/${python.pythonForBuild.sitePackages}:$PYTHONPATH"
-      mkdir -p $tmp_path/${python.pythonForBuild.sitePackages}
-      ${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install -e . --prefix $tmp_path >&2
-    fi
-    ${postShellHook}
-  '';
-
-}
diff --git a/pkgs/development/interpreters/python/build-python-package-setuptools.nix b/pkgs/development/interpreters/python/build-python-package-setuptools.nix
deleted file mode 100644
index 7738ea2f66a5..000000000000
--- a/pkgs/development/interpreters/python/build-python-package-setuptools.nix
+++ /dev/null
@@ -1,60 +0,0 @@
-# This function provides specific bits for building a setuptools-based Python package.
-
-{ lib
-, python
-}:
-
-{
-# Global options passed to "python setup.py"
-  setupPyGlobalFlags ? []
-# Build options passed to "python setup.py build_ext"
-# https://github.com/pypa/pip/issues/881
-, setupPyBuildFlags ? []
-# Execute before shell hook
-, preShellHook ? ""
-# Execute after shell hook
-, postShellHook ? ""
-, ... } @ attrs:
-
-let
-  # use setuptools shim (so that setuptools is imported before distutils)
-  # pip does the same thing: https://github.com/pypa/pip/pull/3265
-  setuppy = ./run_setup.py;
-
-  setupPyGlobalFlagsString = lib.concatStringsSep " " setupPyGlobalFlags;
-  setupPyBuildExtString = lib.optionalString (setupPyBuildFlags != []) ("build_ext " + (lib.concatStringsSep " " setupPyBuildFlags));
-
-in attrs // {
-  # we copy nix_run_setup over so it's executed relative to the root of the source
-  # many project make that assumption
-  buildPhase = attrs.buildPhase or ''
-    runHook preBuild
-    cp ${setuppy} nix_run_setup
-    ${python.pythonForBuild.interpreter} nix_run_setup ${setupPyGlobalFlagsString} ${setupPyBuildExtString} bdist_wheel
-    runHook postBuild
-  '';
-
-  installCheckPhase = attrs.checkPhase or ''
-    runHook preCheck
-    ${python.pythonForBuild.interpreter} nix_run_setup test
-    runHook postCheck
-  '';
-
-  # Python packages that are installed with setuptools
-  # are typically distributed with tests.
-  # With Python it's a common idiom to run the tests
-  # after the software has been installed.
-  doCheck = attrs.doCheck or true;
-
-  shellHook = attrs.shellHook or ''
-    ${preShellHook}
-    if test -e setup.py; then
-      tmp_path=$(mktemp -d)
-      export PATH="$tmp_path/bin:$PATH"
-      export PYTHONPATH="$tmp_path/${python.pythonForBuild.sitePackages}:$PYTHONPATH"
-      mkdir -p $tmp_path/${python.pythonForBuild.sitePackages}
-      ${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install -e . --prefix $tmp_path >&2
-    fi
-    ${postShellHook}
-  '';
-}
diff --git a/pkgs/development/interpreters/python/build-python-package-wheel.nix b/pkgs/development/interpreters/python/build-python-package-wheel.nix
deleted file mode 100644
index e3c4e13c0e2d..000000000000
--- a/pkgs/development/interpreters/python/build-python-package-wheel.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-# This function provides specific bits for building a wheel-based Python package.
-
-{
-}:
-
-{ ... } @ attrs:
-
-attrs // {
-  unpackPhase = ''
-    mkdir dist
-    cp "$src" "dist/$(stripHash "$src")"
-  '';
-
-  # Wheels are pre-compiled
-  buildPhase = attrs.buildPhase or ":";
-  installCheckPhase = attrs.checkPhase or ":";
-
-  # Wheels don't have any checks to run
-  doCheck = attrs.doCheck or false;
-}
\ No newline at end of file
diff --git a/pkgs/development/interpreters/python/build-python-package.nix b/pkgs/development/interpreters/python/build-python-package.nix
deleted file mode 100644
index 61c1186cef9e..000000000000
--- a/pkgs/development/interpreters/python/build-python-package.nix
+++ /dev/null
@@ -1,48 +0,0 @@
-# This function provides a generic Python package builder,
-# and can build packages that use distutils, setuptools or flit.
-
-{ lib
-, config
-, python
-, wrapPython
-, setuptools
-, unzip
-, ensureNewerSourcesForZipFilesHook
-, toPythonModule
-, namePrefix
-, flit
-, writeScript
-, update-python-libraries
-}:
-
-let
-  setuptools-specific = import ./build-python-package-setuptools.nix { inherit lib python; };
-  pyproject-specific = import ./build-python-package-pyproject.nix { inherit lib python; };
-  flit-specific = import ./build-python-package-flit.nix { inherit python flit; };
-  wheel-specific = import ./build-python-package-wheel.nix { };
-  common = import ./build-python-package-common.nix { inherit python; };
-  mkPythonDerivation = import ./mk-python-derivation.nix {
-    inherit lib config python wrapPython setuptools unzip ensureNewerSourcesForZipFilesHook;
-    inherit toPythonModule namePrefix update-python-libraries;
-  };
-in
-
-{
-# Several package formats are supported.
-# "setuptools" : Install a common setuptools/distutils based package. This builds a wheel.
-# "wheel" : Install from a pre-compiled wheel.
-# "flit" : Install a flit package. This builds a wheel.
-# "other" : Provide your own buildPhase and installPhase.
-format ? "setuptools"
-, ... } @ attrs:
-
-let
-  formatspecific =
-    if format == "pyproject" then common (pyproject-specific attrs)
-    else if format == "setuptools" then common (setuptools-specific attrs)
-    else if format == "flit" then common (flit-specific attrs)
-    else if format == "wheel" then common (wheel-specific attrs)
-    else if format == "other" then {}
-    else throw "Unsupported format ${format}";
-
-in mkPythonDerivation ( attrs // formatspecific )
diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix
new file mode 100644
index 000000000000..9a7ec98ba178
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/default.nix
@@ -0,0 +1,95 @@
+# Hooks for building Python packages.
+{ python
+, callPackage
+, makeSetupHook
+}:
+
+let
+  pythonInterpreter = python.pythonForBuild.interpreter;
+  pythonSitePackages = python.sitePackages;
+  pythonCheckInterpreter = python.interpreter;
+  setuppy = ../run_setup.py;
+in rec {
+
+  flitBuildHook = callPackage ({ flit }:
+    makeSetupHook {
+      name = "flit-build-hook";
+      deps = [ flit ];
+      substitutions = {
+        inherit pythonInterpreter;
+      };
+    } ./flit-build-hook.sh) {};
+
+  pipBuildHook = callPackage ({ pip }:
+    makeSetupHook {
+      name = "pip-build-hook.sh";
+      deps = [ pip ];
+      substitutions = {
+        inherit pythonInterpreter pythonSitePackages;
+      };
+    } ./pip-build-hook.sh) {};
+
+  pipInstallHook = callPackage ({ pip }:
+    makeSetupHook {
+      name = "pip-install-hook";
+      deps = [ pip ];
+      substitutions = {
+        inherit pythonInterpreter pythonSitePackages;
+      };
+    } ./pip-install-hook.sh) {};
+
+  pytestCheckHook = callPackage ({ pytest }:
+    makeSetupHook {
+      name = "pytest-check-hook";
+      deps = [ pytest ];
+      substitutions = {
+        inherit pythonCheckInterpreter;
+      };
+    } ./pytest-check-hook.sh) {};
+
+  pythonCatchConflictsHook = callPackage ({ setuptools }:
+    makeSetupHook {
+      name = "python-catch-conflicts-hook";
+      deps = [ setuptools ];
+      substitutions = {
+        inherit pythonInterpreter;
+        catchConflicts=../catch_conflicts/catch_conflicts.py;
+      };
+    } ./python-catch-conflicts-hook.sh) {};
+
+  pythonImportsCheckHook = callPackage ({}:
+    makeSetupHook {
+      name = "python-imports-check-hook.sh";
+      substitutions = {
+        inherit pythonCheckInterpreter;
+      };
+    } ./python-imports-check-hook.sh) {};
+
+  pythonRemoveBinBytecodeHook = callPackage ({ }:
+    makeSetupHook {
+      name = "python-remove-bin-bytecode-hook";
+    } ./python-remove-bin-bytecode-hook.sh) {};
+
+  setuptoolsBuildHook = callPackage ({ setuptools, wheel }:
+    makeSetupHook {
+      name = "setuptools-setup-hook";
+      deps = [ setuptools wheel ];
+      substitutions = {
+        inherit pythonInterpreter pythonSitePackages setuppy;
+      };
+    } ./setuptools-build-hook.sh) {};
+
+  setuptoolsCheckHook = callPackage ({ setuptools }:
+    makeSetupHook {
+      name = "setuptools-check-hook";
+      deps = [ setuptools ];
+      substitutions = {
+        inherit pythonCheckInterpreter setuppy;
+      };
+    } ./setuptools-check-hook.sh) {};
+
+  wheelUnpackHook = callPackage ({ }:
+    makeSetupHook {
+      name = "wheel-unpack-hook.sh";
+    } ./wheel-unpack-hook.sh) {};
+}
diff --git a/pkgs/development/interpreters/python/hooks/flit-build-hook.sh b/pkgs/development/interpreters/python/hooks/flit-build-hook.sh
new file mode 100644
index 000000000000..faa3f6e3075f
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/flit-build-hook.sh
@@ -0,0 +1,15 @@
+# Setup hook for flit
+echo "Sourcing flit-build-hook"
+
+flitBuildPhase () {
+    echo "Executing flitBuildPhase"
+    preBuild
+    @pythonInterpreter@ -m flit build --format wheel
+    postBuild
+    echo "Finished executing flitBuildPhase"
+}
+
+if [ -z "$dontUseFlitBuild" ] && [ -z "$buildPhase" ]; then
+    echo "Using flitBuildPhase"
+    buildPhase=flitBuildPhase
+fi
diff --git a/pkgs/development/interpreters/python/hooks/pip-build-hook.sh b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh
new file mode 100644
index 000000000000..6796d3efd0a1
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh
@@ -0,0 +1,42 @@
+# Setup hook to use for pip projects
+echo "Sourcing pip-build-hook"
+
+pipBuildPhase() {
+    echo "Executing pipBuildPhase"
+    runHook preBuild
+
+    mkdir -p dist
+    echo "Creating a wheel..."
+    @pythonInterpreter@ -m pip wheel --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist "$options" .
+    echo "Finished creating a wheel..."
+
+    runHook postBuild
+    echo "Finished executing pipBuildPhase"
+}
+
+pipShellHook() {
+    echo "Executing pipShellHook"
+    runHook preShellHook
+
+    # Long-term setup.py should be dropped.
+    if [ -e pyproject.toml ]; then
+      tmp_path=$(mktemp -d)
+      export PATH="$tmp_path/bin:$PATH"
+      export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH"
+      mkdir -p "$tmp_path/@pythonSitePackages@"
+      @pythonInterpreter@ -m pip install -e . --prefix "$tmp_path" >&2
+    fi
+
+    runHook postShellHook
+    echo "Finished executing pipShellHook"
+}
+
+if [ -z "$dontUsePipBuild" ] && [ -z "$buildPhase" ]; then
+    echo "Using pipBuildPhase"
+    buildPhase=pipBuildPhase
+fi
+
+if [ -z "$shellHook" ]; then
+    echo "Using pipShellHook"
+    shellHook=pipShellHook
+fi
diff --git a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh
new file mode 100644
index 000000000000..f528ec63cb8e
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh
@@ -0,0 +1,24 @@
+# Setup hook for pip.
+echo "Sourcing pip-install-hook"
+
+declare -a pipInstallFlags
+
+pipInstallPhase() {
+    echo "Executing pipInstallPhase"
+    runHook preInstall
+
+    mkdir -p "$out/@pythonSitePackages@"
+    export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH"
+
+    pushd dist || return 1
+    @pythonInterpreter@ -m pip install ./*.whl --no-index --prefix="$out" --no-cache $pipInstallFlags --build tmpbuild
+    popd || return 1
+
+    runHook postInstall
+    echo "Finished executing pipInstallPhase"
+}
+
+if [ -z "$dontUsePipInstall" ] && [ -z "$installPhase" ]; then
+    echo "Using pipInstallPhase"
+    installPhase=pipInstallPhase
+fi
diff --git a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh
new file mode 100644
index 000000000000..24510b9f9931
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh
@@ -0,0 +1,49 @@
+# Setup hook for pytest
+echo "Sourcing pytest-check-hook"
+
+declare -ar disabledTests
+
+function _concatSep {
+    local result
+    local sep="$1"
+    local -n arr=$2
+    for index in ${!arr[*]}; do
+        if [ $index -eq 0 ]; then
+            result="${arr[index]}"
+        else
+            result+=" $sep ${arr[index]}"
+        fi
+    done
+    echo "$result"
+}
+
+function _pytestComputeDisabledTestsString () {
+    declare -a tests
+    local tests=($1)
+    local prefix="not "
+    prefixed=( "${tests[@]/#/$prefix}" )
+    result=$(_concatSep "and" prefixed)
+    echo "$result"
+}
+
+function pytestCheckPhase() {
+    echo "Executing pytestCheckPhase"
+    runHook preCheck
+
+    # Compose arguments
+    args=" -m pytest"
+    if [ -n "$disabledTests" ]; then
+        disabledTestsString=$(_pytestComputeDisabledTestsString "${disabledTests[@]}")
+      args+=" -k \""$disabledTestsString"\""
+    fi
+    args+=" ${pytestFlagsArray[@]}"
+    eval "@pythonCheckInterpreter@ $args"
+
+    runHook postCheck
+    echo "Finished executing pytestCheckPhase"
+}
+
+if [ -z "$dontUsePytestCheck" ] && [ -z "$installCheckPhase" ]; then
+    echo "Using pytestCheckPhase"
+    preDistPhases+=" pytestCheckPhase"
+fi
diff --git a/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh
new file mode 100644
index 000000000000..e9065cf17934
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh
@@ -0,0 +1,10 @@
+# Setup hook for detecting conflicts in Python packages
+echo "Sourcing python-catch-conflicts-hook.sh"
+
+pythonCatchConflictsPhase() {
+    @pythonInterpreter@ @catchConflicts@
+}
+
+if [ -z "$dontUsePythonCatchConflicts" ]; then
+    preDistPhases+=" pythonCatchConflictsPhase"
+fi
diff --git a/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh b/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh
new file mode 100644
index 000000000000..7e2b3f69d6dd
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh
@@ -0,0 +1,16 @@
+# Setup hook for checking whether Python imports succeed
+echo "Sourcing python-imports-check-hook.sh"
+
+pythonImportsCheckPhase () {
+    echo "Executing pythonImportsCheckPhase"
+
+    if [ -n "$pythonImportsCheck" ]; then
+        echo "Check whether the following modules can be imported: $pythonImportsCheck"
+        cd $out && eval "@pythonCheckInterpreter@ -c 'import os; import importlib; list(map(lambda mod: importlib.import_module(mod), os.environ[\"pythonImportsCheck\"].split()))'"
+    fi
+}
+
+if [ -z "$dontUsePythonImportsCheck" ]; then
+    echo "Using pythonImportsCheckPhase"
+    preDistPhases+=" pythonImportsCheckPhase"
+fi
diff --git a/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh b/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh
new file mode 100644
index 000000000000..960de767be79
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh
@@ -0,0 +1,17 @@
+# Setup hook for detecting conflicts in Python packages
+echo "Sourcing python-remove-bin-bytecode-hook.sh"
+
+# Check if we have two packages with the same name in the closure and fail.
+# If this happens, something went wrong with the dependencies specs.
+# Intentionally kept in a subdirectory, see catch_conflicts/README.md.
+
+pythonRemoveBinBytecodePhase () {
+    if [ -d "$out/bin" ]; then
+      rm -rf "$out/bin/__pycache__"                 # Python 3
+      find "$out/bin" -type f -name "*.pyc" -delete # Python 2
+    fi
+}
+
+if [ -z "$dontUsePythonRemoveBinBytecode" ]; then
+    preDistPhases+=" pythonRemoveBinBytecodePhase"
+fi
diff --git a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh
new file mode 100644
index 000000000000..db3e4225d293
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh
@@ -0,0 +1,47 @@
+# Setup hook for setuptools.
+echo "Sourcing setuptools-build-hook"
+
+setuptoolsBuildPhase() {
+    echo "Executing setuptoolsBuildPhase"
+    local args
+    runHook preBuild
+
+    cp -f @setuppy@ nix_run_setup
+    args=""
+    if [ -n "$setupPyGlobalFlags" ]; then
+        args+="$setupPyGlobalFlags"
+    fi
+    if [ -n "$setupPyBuildFlags" ]; then
+        args+="build_ext $setupPyBuildFlags"
+    fi
+    eval "@pythonInterpreter@ nix_run_setup $args bdist_wheel"
+
+    runHook postBuild
+    echo "Finished executing setuptoolsInstallPhase"
+}
+
+setuptoolsShellHook() {
+    echo "Executing setuptoolsShellHook"
+    runHook preShellHook
+
+    if test -e setup.py; then
+        tmp_path=$(mktemp -d)
+        export PATH="$tmp_path/bin:$PATH"
+        export PYTHONPATH="@pythonSitePackages@:$PYTHONPATH"
+        mkdir -p "$tmp_path/@pythonSitePackages@"
+        eval "@pythonInterpreter@ -m pip -e . --prefix $tmp_path >&2"
+    fi
+
+    runHook postShellHook
+    echo "Finished executing setuptoolsShellHook"
+}
+
+if [ -z "$dontUseSetuptoolsBuild" ] && [ -z "$buildPhase" ]; then
+    echo "Using setuptoolsBuildPhase"
+    buildPhase=setuptoolsBuildPhase
+fi
+
+if [ -z "$dontUseSetuptoolsShellHook" ] && [ -z "$shellHook" ]; then
+    echo "Using setuptoolsShellHook"
+    shellHook=setuptoolsShellHook
+fi
diff --git a/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh
new file mode 100644
index 000000000000..71bb036a91ad
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh
@@ -0,0 +1,18 @@
+# Setup hook for setuptools.
+echo "Sourcing setuptools-check-hook"
+
+setuptoolsCheckPhase() {
+    echo "Executing setuptoolsCheckPhase"
+    runHook preCheck
+
+    cp -f @setuppy@ nix_run_setup
+    @pythonCheckInterpreter@ nix_run_setup test
+
+    runHook postCheck
+    echo "Finished executing setuptoolsCheckPhase"
+}
+
+if [ -z "$dontUseSetuptoolsCheck" ] && [ -z "$installCheckPhase" ]; then
+    echo "Using setuptoolsCheckPhase"
+    preDistPhases+=" setuptoolsCheckPhase"
+fi
diff --git a/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh b/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh
new file mode 100644
index 000000000000..6dd0c5be4cb2
--- /dev/null
+++ b/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh
@@ -0,0 +1,18 @@
+# Setup hook to use in case a wheel is fetched
+echo "Sourcing wheel setup hook"
+
+wheelUnpackPhase(){
+    echo "Executing wheelUnpackPhase"
+    runHook preUnpack
+
+    mkdir -p dist
+    cp "$src" "dist/$(stripHash "$src")"
+
+#     runHook postUnpack # Calls find...?
+    echo "Finished executing wheelUnpackPhase"
+}
+
+if [ -z "$dontUseWheelUnpack" ] && [ -z "$unpackPhase" ]; then
+    echo "Using wheelUnpackPhase"
+    unpackPhase=wheelUnpackPhase
+fi
diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix
index 6a9e3d48bdb5..700894eda6de 100644
--- a/pkgs/development/interpreters/python/mk-python-derivation.nix
+++ b/pkgs/development/interpreters/python/mk-python-derivation.nix
@@ -4,13 +4,22 @@
 , config
 , python
 , wrapPython
-, setuptools
 , unzip
 , ensureNewerSourcesForZipFilesHook
 # Whether the derivation provides a Python module or not.
 , toPythonModule
 , namePrefix
 , update-python-libraries
+, setuptools
+, flitBuildHook
+, pipBuildHook
+, pipInstallHook
+, pythonCatchConflictsHook
+, pythonImportsCheckHook
+, pythonRemoveBinBytecodeHook
+, setuptoolsBuildHook
+, setuptoolsCheckHook
+, wheelUnpackHook
 }:
 
 { name ? "${attrs.pname}-${attrs.version}"
@@ -48,6 +57,11 @@
 # Skip wrapping of python programs altogether
 , dontWrapPythonPrograms ? false
 
+# Don't use Pip to install a wheel
+# Note this is actually a variable for the pipInstallPhase in pip's setupHook.
+# It's included here to prevent an infinite recursion.
+, dontUsePipInstall ? false
+
 # Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs
 , permitUserSite ? false
 
@@ -57,6 +71,13 @@
 # However, some packages do provide executables with extensions, and thus bytecode is generated.
 , removeBinBytecode ? true
 
+# Several package formats are supported.
+# "setuptools" : Install a common setuptools/distutils based package. This builds a wheel.
+# "wheel" : Install from a pre-compiled wheel.
+# "flit" : Install a flit package. This builds a wheel.
+# "other" : Provide your own buildPhase and installPhase.
+, format ? "setuptools"
+
 , meta ? {}
 
 , passthru ? {}
@@ -71,26 +92,43 @@ if disabled
 then throw "${name} not supported for interpreter ${python.executable}"
 else
 
-let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
-    "disabled" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts"
-  ] // {
+let
+  inherit (python) stdenv;
+
+  self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [
+    "disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format"
+  ]) // {
 
   name = namePrefix + name;
 
   nativeBuildInputs = [
     python
     wrapPython
-    ensureNewerSourcesForZipFilesHook
-    setuptools
-#     ++ lib.optional catchConflicts setuptools # If we no longer propagate setuptools
+    ensureNewerSourcesForZipFilesHook  # move to wheel installer (pip) or builder (setuptools, flit, ...)?
+  ] ++ lib.optionals catchConflicts [
+    setuptools pythonCatchConflictsHook
+  ] ++ lib.optionals removeBinBytecode [
+    pythonRemoveBinBytecodeHook
   ] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [
     unzip
+  ] ++ lib.optionals (format == "setuptools") [
+    setuptoolsBuildHook
+  ] ++ lib.optionals (format == "flit") [
+    flitBuildHook
+  ] ++ lib.optionals (format == "pyproject") [
+    pipBuildHook
+  ] ++ lib.optionals (format == "wheel") [
+    wheelUnpackHook
+  ] ++ lib.optionals (!(format == "other") || dontUsePipInstall) [
+    pipInstallHook
+  ] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [
+    # This is a test, however, it should be ran independent of the checkPhase and checkInputs
+    pythonImportsCheckHook
   ] ++ nativeBuildInputs;
 
   buildInputs = buildInputs ++ pythonPath;
 
-  # Propagate python and setuptools. We should stop propagating setuptools.
-  propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ];
+  propagatedBuildInputs = propagatedBuildInputs ++ [ python ];
 
   inherit strictDeps;
 
@@ -98,21 +136,17 @@ let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attr
 
   # Python packages don't have a checkPhase, only an installCheckPhase
   doCheck = false;
-  doInstallCheck = doCheck;
-  installCheckInputs = checkInputs;
+  doInstallCheck = attrs.doCheck or true;
+  installCheckInputs = [
+  ] ++ lib.optionals (format == "setuptools") [
+    # Longer-term we should get rid of this and require
+    # users of this function to set the `installCheckPhase` or
+    # pass in a hook that sets it.
+    setuptoolsCheckHook
+  ] ++ checkInputs;
 
   postFixup = lib.optionalString (!dontWrapPythonPrograms) ''
     wrapPythonPrograms
-  '' + lib.optionalString removeBinBytecode ''
-    if [ -d "$out/bin" ]; then
-      rm -rf "$out/bin/__pycache__"                 # Python 3
-      find "$out/bin" -type f -name "*.pyc" -delete # Python 2
-    fi
-  '' + lib.optionalString catchConflicts ''
-    # Check if we have two packages with the same name in the closure and fail.
-    # If this happens, something went wrong with the dependencies specs.
-    # Intentionally kept in a subdirectory, see catch_conflicts/README.md.
-    ${python.pythonForBuild.interpreter} ${./catch_conflicts}/catch_conflicts.py
   '' + attrs.postFixup or '''';
 
   # Python packages built through cross-compilation are always for the host platform.
@@ -123,6 +157,10 @@ let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attr
     platforms = python.meta.platforms;
     isBuildPythonPackage = python.meta.platforms;
   } // meta;
+} // lib.optionalAttrs (attrs?checkPhase) {
+  # If given use the specified checkPhase, otherwise use the setup hook.
+  # Longer-term we should get rid of `checkPhase` and use `installCheckPhase`.
+  installCheckPhase = attrs.checkPhase;
 }));
 
 passthru.updateScript = let
diff --git a/pkgs/development/python-modules/atomicwrites/default.nix b/pkgs/development/python-modules/atomicwrites/default.nix
index e34f937b5090..eed9591d7bdf 100644
--- a/pkgs/development/python-modules/atomicwrites/default.nix
+++ b/pkgs/development/python-modules/atomicwrites/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonPackage, fetchPypi }:
+{ stdenv, buildPythonPackage, fetchPypi, pytest }:
 
 buildPythonPackage rec {
   pname = "atomicwrites";
@@ -9,6 +9,10 @@ buildPythonPackage rec {
     sha256 = "75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6";
   };
 
+  # Tests depend on pytest but atomicwrites is a dependency of pytest
+  doCheck = false;
+  checkInputs = [ pytest ];
+
   meta = with stdenv.lib; {
     description = "Atomic file writes on POSIX";
     homepage = https://pypi.python.org/pypi/atomicwrites;
diff --git a/pkgs/development/python-modules/bootstrapped-pip/default.nix b/pkgs/development/python-modules/bootstrapped-pip/default.nix
index 1455a783593f..3039c8fa1b9c 100644
--- a/pkgs/development/python-modules/bootstrapped-pip/default.nix
+++ b/pkgs/development/python-modules/bootstrapped-pip/default.nix
@@ -1,4 +1,8 @@
-{ stdenv, python, fetchPypi, makeWrapper, unzip }:
+{ stdenv, python, fetchPypi, makeWrapper, unzip, makeSetupHook
+, pipInstallHook
+, setuptoolsBuildHook
+
+}:
 
 let
   wheel_source = fetchPypi {
@@ -25,6 +29,15 @@ in stdenv.mkDerivation rec {
     sha256 = "993134f0475471b91452ca029d4390dc8f298ac63a712814f101cd1b6db46676";
   };
 
+  dontUseSetuptoolsBuild = true;
+
+  # Should be propagatedNativeBuildInputs
+  propagatedBuildInputs = [
+    # Override to remove dependencies to prevent infinite recursion.
+    (pipInstallHook.override{pip=null;})
+    (setuptoolsBuildHook.override{setuptools=null; wheel=null;})
+  ];
+
   unpackPhase = ''
     mkdir -p $out/${python.sitePackages}
     unzip -d $out/${python.sitePackages} $src
@@ -32,7 +45,7 @@ in stdenv.mkDerivation rec {
     unzip -d $out/${python.sitePackages} ${wheel_source}
   '';
 
-  patchPhase = ''
+  postPatch = ''
     mkdir -p $out/bin
   '';
 
@@ -52,4 +65,5 @@ in stdenv.mkDerivation rec {
       wrapProgram $f --prefix PYTHONPATH ":" $out/${python.sitePackages}/
     done
   '';
+
 }
diff --git a/pkgs/development/python-modules/pip/default.nix b/pkgs/development/python-modules/pip/default.nix
index 76f3b0b7176b..00159449d057 100644
--- a/pkgs/development/python-modules/pip/default.nix
+++ b/pkgs/development/python-modules/pip/default.nix
@@ -1,25 +1,32 @@
 { lib
+, python
 , buildPythonPackage
+, bootstrapped-pip
 , fetchPypi
 , mock
 , scripttest
 , virtualenv
 , pretend
 , pytest
+, setuptools
+, wheel
 }:
 
 buildPythonPackage rec {
   pname = "pip";
   version = "19.1.1";
+  format = "other";
 
   src = fetchPypi {
     inherit pname version;
     sha256 = "44d3d7d3d30a1eb65c7e5ff1173cdf8f7467850605ac7cc3707b6064bddd0958";
   };
 
+  nativeBuildInputs = [ bootstrapped-pip ];
+
   # pip detects that we already have bootstrapped_pip "installed", so we need
   # to force it a little.
-  installFlags = [ "--ignore-installed" ];
+  pipInstallFlags = [ "--ignore-installed" ];
 
   checkInputs = [ mock scripttest virtualenv pretend pytest ];
   # Pip wants pytest, but tests are not distributed
diff --git a/pkgs/development/python-modules/py/default.nix b/pkgs/development/python-modules/py/default.nix
index e54fd1521b3e..9c5ada22b146 100644
--- a/pkgs/development/python-modules/py/default.nix
+++ b/pkgs/development/python-modules/py/default.nix
@@ -12,7 +12,11 @@ buildPythonPackage rec {
   # Circular dependency on pytest
   doCheck = false;
 
-  buildInputs = [ setuptools_scm ];
+  nativeBuildInputs = [ setuptools_scm ];
+
+  pythonImportsCheck = [
+    "py"
+  ];
 
   meta = with stdenv.lib; {
     description = "Library with cross-python path, ini-parsing, io, code, log facilities";
diff --git a/pkgs/development/python-modules/pytest/default.nix b/pkgs/development/python-modules/pytest/default.nix
index 7866454a62fa..506b560e01ae 100644
--- a/pkgs/development/python-modules/pytest/default.nix
+++ b/pkgs/development/python-modules/pytest/default.nix
@@ -1,6 +1,6 @@
 { stdenv, buildPythonPackage, pythonOlder, fetchPypi, attrs, hypothesis, py
 , setuptools_scm, setuptools, six, pluggy, funcsigs, isPy3k, more-itertools
-, atomicwrites, mock, writeText, pathlib2, wcwidth, packaging, isPyPy
+, atomicwrites, mock, writeText, pathlib2, wcwidth, packaging, isPyPy, python
 }:
 buildPythonPackage rec {
   version = "5.1.0";
@@ -17,12 +17,13 @@ buildPythonPackage rec {
   };
 
   checkInputs = [ hypothesis mock ];
-  buildInputs = [ setuptools_scm ];
+  nativeBuildInputs = [ setuptools_scm ];
   propagatedBuildInputs = [ attrs py setuptools six pluggy more-itertools atomicwrites wcwidth packaging ]
     ++ stdenv.lib.optionals (!isPy3k) [ funcsigs ]
     ++ stdenv.lib.optionals (pythonOlder "3.6") [ pathlib2 ];
 
   doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460
+
   # Ignored file https://github.com/pytest-dev/pytest/pull/5605#issuecomment-522243929
   checkPhase = ''
     runHook preCheck
@@ -35,15 +36,17 @@ buildPythonPackage rec {
     pytestcachePhase() {
         find $out -name .pytest_cache -type d -exec rm -rf {} +
     }
-
     preDistPhases+=" pytestcachePhase"
   '';
 
+  pythonImportsCheck = [
+    "pytest"
+  ];
+
   meta = with stdenv.lib; {
     homepage = https://docs.pytest.org;
     description = "Framework for writing tests";
     maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
     license = licenses.mit;
-    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix
index a849dad54aa9..8506b0f28d51 100644
--- a/pkgs/development/python-modules/setuptools/default.nix
+++ b/pkgs/development/python-modules/setuptools/default.nix
@@ -1,15 +1,17 @@
 { stdenv
+, buildPythonPackage
 , fetchPypi
 , python
 , wrapPython
 , unzip
+, callPackage
+, bootstrapped-pip
 }:
 
-# Should use buildPythonPackage here somehow
-stdenv.mkDerivation rec {
+buildPythonPackage rec {
   pname = "setuptools";
   version = "41.0.1";
-  name = "${python.libPrefix}-${pname}-${version}";
+  format = "other";
 
   src = fetchPypi {
     inherit pname version;
@@ -17,8 +19,11 @@ stdenv.mkDerivation rec {
     sha256 = "a222d126f5471598053c9a77f4b5d4f26eaa1f150ad6e01dcf1a42e185d05613";
   };
 
-  nativeBuildInputs = [ unzip wrapPython python.pythonForBuild ];
-  doCheck = false;  # requires pytest
+  # There is nothing to build
+  dontBuild = true;
+
+  nativeBuildInputs = [ bootstrapped-pip ];
+
   installPhase = ''
       dst=$out/${python.sitePackages}
       mkdir -p $dst
@@ -27,13 +32,11 @@ stdenv.mkDerivation rec {
       wrapPythonPrograms
   '';
 
-  pythonPath = [];
-
-  dontPatchShebangs = true;
-
-  # Python packages built through cross-compilation are always for the host platform.
-  disallowedReferences = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ python.pythonForBuild ];
+  # Adds setuptools to nativeBuildInputs causing infinite recursion.
+  catchConflicts = false;
 
+  # Requires pytest, causing infinite recursion.
+  doCheck = false;
 
   meta = with stdenv.lib; {
     description = "Utilities to facilitate the installation of Python packages";
diff --git a/pkgs/development/python-modules/setuptools_scm/default.nix b/pkgs/development/python-modules/setuptools_scm/default.nix
index a222fc9e49f8..c9704196aec3 100644
--- a/pkgs/development/python-modules/setuptools_scm/default.nix
+++ b/pkgs/development/python-modules/setuptools_scm/default.nix
@@ -8,8 +8,6 @@ buildPythonPackage rec {
     sha256 = "52ab47715fa0fc7d8e6cd15168d1a69ba995feb1505131c3e814eb7087b57358";
   };
 
-  buildInputs = [ pip ];
-
   # Seems to fail due to chroot and would cause circular dependency
   # with pytest
   doCheck = false;
diff --git a/pkgs/development/python-modules/wheel/default.nix b/pkgs/development/python-modules/wheel/default.nix
index d7814984060e..5638e3e8be9f 100644
--- a/pkgs/development/python-modules/wheel/default.nix
+++ b/pkgs/development/python-modules/wheel/default.nix
@@ -1,15 +1,19 @@
 { lib
+, setuptools
+, pip
 , buildPythonPackage
 , fetchPypi
 , pytest
 , pytestcov
 , coverage
 , jsonschema
+, bootstrapped-pip
 }:
 
 buildPythonPackage rec {
   pname = "wheel";
   version = "0.33.4";
+  format = "other";
 
   src = fetchPypi {
     inherit pname version;
@@ -17,14 +21,14 @@ buildPythonPackage rec {
   };
 
   checkInputs = [ pytest pytestcov coverage ];
+  nativeBuildInputs = [ bootstrapped-pip setuptools ];
 
-  propagatedBuildInputs = [ jsonschema ];
-
+  catchConflicts = false;
   # No tests in archive
   doCheck = false;
 
   # We add this flag to ignore the copy installed by bootstrapped-pip
-  installFlags = [ "--ignore-installed" ];
+  pipInstallFlags = [ "--ignore-installed" ];
 
   meta = {
     description = "A built-package format for Python";
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 921948b3c821..750f96c62894 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -42,17 +42,14 @@ let
       }
       else ff;
 
-  buildPythonPackage = makeOverridablePythonPackage ( makeOverridable (callPackage ../development/interpreters/python/build-python-package.nix {
-    flit = self.flit;
-    # We want Python libraries to be named like e.g. "python3.6-${name}"
-    inherit namePrefix;
-    inherit toPythonModule;
+  buildPythonPackage = makeOverridablePythonPackage ( makeOverridable (callPackage ../development/interpreters/python/mk-python-derivation.nix {
+    inherit namePrefix;     # We want Python libraries to be named like e.g. "python3.6-${name}"
+    inherit toPythonModule; # Libraries provide modules
   }));
 
-  buildPythonApplication = makeOverridablePythonPackage ( makeOverridable (callPackage ../development/interpreters/python/build-python-package.nix {
-    flit = self.flit;
-    namePrefix = "";
-    toPythonModule = x: x; # Application does not provide modules.
+  buildPythonApplication = makeOverridablePythonPackage ( makeOverridable (callPackage ../development/interpreters/python/mk-python-derivation.nix {
+    namePrefix = "";        # Python applications should not have any prefix
+    toPythonModule = x: x;  # Application does not provide modules.
   }));
 
   # See build-setupcfg/default.nix for documentation.
@@ -110,6 +107,9 @@ in {
   inherit toPythonModule toPythonApplication;
   inherit buildSetupcfg;
 
+  inherit (callPackage ../development/interpreters/python/hooks { })
+    flitBuildHook pipBuildHook pipInstallHook pytestCheckHook pythonCatchConflictsHook pythonImportsCheckHook pythonRemoveBinBytecodeHook setuptoolsBuildHook setuptoolsCheckHook wheelUnpackHook;
+
   # helpers
 
   wrapPython = callPackage ../development/interpreters/python/wrap-python.nix {inherit python; inherit (pkgs) makeSetupHook makeWrapper; };
@@ -121,7 +121,7 @@ in {
 
   recursivePthLoader = callPackage ../development/python-modules/recursive-pth-loader { };
 
-  setuptools = toPythonModule (callPackage ../development/python-modules/setuptools { });
+  setuptools = callPackage ../development/python-modules/setuptools { };
 
   vowpalwabbit = callPackage ../development/python-modules/vowpalwabbit { };
 

From 9dd6537303d18f21d4d7bba23dd9a528e1374814 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sat, 31 Aug 2019 13:57:57 +0200
Subject: [PATCH 24/54] pythonPackages.tld: use pythonImportsCheck and
 pytestCheckHook

---
 pkgs/development/python-modules/tld/default.nix | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/pkgs/development/python-modules/tld/default.nix b/pkgs/development/python-modules/tld/default.nix
index 3a21ce57fe7a..b3d83deeac9e 100644
--- a/pkgs/development/python-modules/tld/default.nix
+++ b/pkgs/development/python-modules/tld/default.nix
@@ -10,20 +10,25 @@ python.pkgs.buildPythonPackage rec {
   };
 
   propagatedBuildInputs = with python.pkgs; [ six ];
-  checkInputs = with python.pkgs; [ factory_boy faker pytest pytestcov tox ];
+  checkInputs = with python.pkgs; [ factory_boy faker pytestcov tox pytestCheckHook];
 
   # https://github.com/barseghyanartur/tld/issues/54
-  disabledTests = stdenv.lib.concatMapStringsSep " and " (s: "not " + s) ([
+  disabledTests = [
     "test_1_update_tld_names"
     "test_1_update_tld_names_command"
     "test_2_update_tld_names_module"
-  ]);
+  ];
 
-  checkPhase = ''
-      export PATH="$PATH:$out/bin"
-      py.test -k '${disabledTests}'
+  preCheck = ''
+    export PATH="$PATH:$out/bin"
   '';
 
+  dontUseSetuptoolsCheck = true;
+
+  pythonImportsCheck = [
+    "tld"
+  ];
+
   meta = with stdenv.lib; {
     homepage = https://github.com/barseghyanartur/tld;
     description = "Extracts the top level domain (TLD) from the URL given";

From 755de1cbe208cd8c300510a28f352b0ada6798e4 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sat, 31 Aug 2019 14:37:34 +0200
Subject: [PATCH 25/54] python.pkgs.terminado: disable tests

---
 pkgs/development/python-modules/terminado/default.nix | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pkgs/development/python-modules/terminado/default.nix b/pkgs/development/python-modules/terminado/default.nix
index bebe8c3d1f8e..dbcc5935e5e2 100644
--- a/pkgs/development/python-modules/terminado/default.nix
+++ b/pkgs/development/python-modules/terminado/default.nix
@@ -16,6 +16,9 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [ ptyprocess tornado ];
 
+  # test_max_terminals fails
+  doCheck = false;
+
   meta = with lib; {
     description = "Terminals served by Tornado websockets";
     homepage = https://github.com/jupyter/terminado;

From dc95e17fc2be9aa3c5a620649de6e4176df697f3 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sat, 31 Aug 2019 15:22:52 +0200
Subject: [PATCH 26/54] python: bootstrapped-pip: update wheel, setuptools, pip

wheel 33.4 -> 33.6
setuptools 41.0.1 -> 42.2.0
pip 19.1.1 -> 19.2.3
---
 .../python-modules/bootstrapped-pip/default.nix      | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkgs/development/python-modules/bootstrapped-pip/default.nix b/pkgs/development/python-modules/bootstrapped-pip/default.nix
index 3039c8fa1b9c..d2f64a5e5a8b 100644
--- a/pkgs/development/python-modules/bootstrapped-pip/default.nix
+++ b/pkgs/development/python-modules/bootstrapped-pip/default.nix
@@ -7,26 +7,26 @@
 let
   wheel_source = fetchPypi {
     pname = "wheel";
-    version = "0.33.4";
+    version = "0.33.6";
     format = "wheel";
-    sha256 = "5e79117472686ac0c4aef5bad5172ea73a1c2d1646b808c35926bd26bdfb0c08";
+    sha256 = "f4da1763d3becf2e2cd92a14a7c920f0f00eca30fdde9ea992c836685b9faf28";
   };
   setuptools_source = fetchPypi {
     pname = "setuptools";
-    version = "41.0.1";
+    version = "41.2.0";
     format = "wheel";
-    sha256 = "c7769ce668c7a333d84e17fe8b524b1c45e7ee9f7908ad0a73e1eda7e6a5aebf";
+    sha256 = "4380abcf2a4ffd1a5ba22d687c6d690dce83b2b51c70e9c6d09f7e8c7e8040dc";
   };
 
 in stdenv.mkDerivation rec {
   pname = "pip";
-  version = "19.1.1";
+  version = "19.2.3";
   name = "${python.libPrefix}-bootstrapped-${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
     format = "wheel";
-    sha256 = "993134f0475471b91452ca029d4390dc8f298ac63a712814f101cd1b6db46676";
+    sha256 = "340a0ba40fdeb16413914c0fcd8e0b4ebb0bf39a900ec80e11c05d836c05103f";
   };
 
   dontUseSetuptoolsBuild = true;

From afe67e5493788d25ac853e49f3580864e943a6ba Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sat, 31 Aug 2019 15:23:58 +0200
Subject: [PATCH 27/54] python.pkgs.pip: 19.1.1 -> 19.2.3

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

diff --git a/pkgs/development/python-modules/pip/default.nix b/pkgs/development/python-modules/pip/default.nix
index 00159449d057..9892d02b3922 100644
--- a/pkgs/development/python-modules/pip/default.nix
+++ b/pkgs/development/python-modules/pip/default.nix
@@ -14,12 +14,12 @@
 
 buildPythonPackage rec {
   pname = "pip";
-  version = "19.1.1";
+  version = "19.2.3";
   format = "other";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "44d3d7d3d30a1eb65c7e5ff1173cdf8f7467850605ac7cc3707b6064bddd0958";
+    sha256 = "e7a31f147974362e6c82d84b91c7f2bdf57e4d3163d3d454e6c3e71944d67135";
   };
 
   nativeBuildInputs = [ bootstrapped-pip ];

From 0570a6b126855af5586eae938351968c35f8a16c Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sat, 31 Aug 2019 15:24:08 +0200
Subject: [PATCH 28/54] python.pkgs.setuptools: 0.33.4 -> 0.33.6

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

diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix
index 8506b0f28d51..569ff017ea9b 100644
--- a/pkgs/development/python-modules/setuptools/default.nix
+++ b/pkgs/development/python-modules/setuptools/default.nix
@@ -10,13 +10,13 @@
 
 buildPythonPackage rec {
   pname = "setuptools";
-  version = "41.0.1";
+  version = "41.2.0";
   format = "other";
 
   src = fetchPypi {
     inherit pname version;
     extension = "zip";
-    sha256 = "a222d126f5471598053c9a77f4b5d4f26eaa1f150ad6e01dcf1a42e185d05613";
+    sha256 = "66b86bbae7cc7ac2e867f52dc08a6bd064d938bac59dfec71b9b565dd36d6012";
   };
 
   # There is nothing to build

From 5718ed6d3225a282a1c3777a268311bb042b5041 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sat, 31 Aug 2019 15:24:17 +0200
Subject: [PATCH 29/54] python.pkgs.wheel: 0.33.4 -> 0.33.6

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

diff --git a/pkgs/development/python-modules/wheel/default.nix b/pkgs/development/python-modules/wheel/default.nix
index 5638e3e8be9f..0ba5b19597ee 100644
--- a/pkgs/development/python-modules/wheel/default.nix
+++ b/pkgs/development/python-modules/wheel/default.nix
@@ -12,12 +12,12 @@
 
 buildPythonPackage rec {
   pname = "wheel";
-  version = "0.33.4";
+  version = "0.33.6";
   format = "other";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "62fcfa03d45b5b722539ccbc07b190e4bfff4bb9e3a4d470dd9f6a0981002565";
+    sha256 = "10c9da68765315ed98850f8e048347c3eb06dd81822dc2ab1d4fde9dc9702646";
   };
 
   checkInputs = [ pytest pytestcov coverage ];

From bf4f885471eea0b1d2db73dbb102effacf22c9f1 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Fri, 6 Sep 2019 14:59:23 +0200
Subject: [PATCH 30/54] pythonPackages.editorconfig: remove duplicate
 EditorConfig

---
 pkgs/development/python-modules/jsbeautifier/default.nix | 4 ++--
 pkgs/top-level/python-packages.nix                       | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/python-modules/jsbeautifier/default.nix b/pkgs/development/python-modules/jsbeautifier/default.nix
index 15191858daa8..10d0004f74a5 100644
--- a/pkgs/development/python-modules/jsbeautifier/default.nix
+++ b/pkgs/development/python-modules/jsbeautifier/default.nix
@@ -1,10 +1,10 @@
-{ lib, fetchPypi, buildPythonApplication, EditorConfig, pytest, six }:
+{ lib, fetchPypi, buildPythonApplication, editorconfig, pytest, six }:
 
 buildPythonApplication rec {
   pname = "jsbeautifier";
   version = "1.10.0";
 
-  propagatedBuildInputs = [ six EditorConfig ];
+  propagatedBuildInputs = [ six editorconfig ];
   checkInputs = [ pytest ];
 
   src = fetchPypi {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 750f96c62894..d4de5e084a6a 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2250,8 +2250,6 @@ in {
     pythonPackages = self;
   });
 
-  EditorConfig = callPackage ../development/python-modules/editorconfig { };
-
   edward = callPackage ../development/python-modules/edward { };
 
   elasticsearch = callPackage ../development/python-modules/elasticsearch { };

From 1ede2de8a3c34b99bc761b2fd4c3db12b6f990b3 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Fri, 6 Sep 2019 15:17:31 +0200
Subject: [PATCH 31/54] pythonPackages.editorconfig: -> 0.12.1 -> 0.12.2

---
 .../python-modules/editorconfig/default.nix           | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/python-modules/editorconfig/default.nix b/pkgs/development/python-modules/editorconfig/default.nix
index 3f276374d9ea..28eff473199c 100644
--- a/pkgs/development/python-modules/editorconfig/default.nix
+++ b/pkgs/development/python-modules/editorconfig/default.nix
@@ -5,17 +5,20 @@
 }:
 
 buildPythonPackage rec {
-  pname = "EditorConfig";
-  version = "0.12.1";
+  pname = "editorconfig";
+  version = "0.12.2";
 
   # fetchgit used to ensure test submodule is available
   src = fetchgit {
     url = "https://github.com/editorconfig/editorconfig-core-py";
-    rev = "refs/tags/v${version}";
-    sha256 = "0svk7id7ncygj2rnxhm7602xizljyidk4xgrl6i0xgq3829cz4bl";
+    rev = "596da5e06ebee05bdbdc6224203c79c4d3c6486a"; # Not tagged
+    sha256 = "05cbp971b0zix7kfxkk7ndxb4ax1l21frwc00d4g78mk4sdz6dig";
   };
 
   nativeBuildInputs = [ cmake ];
+
+  dontUseCmakeConfigure = true;
+
   checkPhase = ''
     cmake .
     # utf_8_char fails with python3

From a70aea12ca35ac10468fb241f5f957de8c83431f Mon Sep 17 00:00:00 2001
From: Jonathan Ringer <jonringer117@gmail.com>
Date: Thu, 5 Sep 2019 13:10:58 -0700
Subject: [PATCH 32/54] pythonPackages.setuptools_scm: 3.2.0 -> 3.3.3

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

diff --git a/pkgs/development/python-modules/setuptools_scm/default.nix b/pkgs/development/python-modules/setuptools_scm/default.nix
index c9704196aec3..9e176bc68749 100644
--- a/pkgs/development/python-modules/setuptools_scm/default.nix
+++ b/pkgs/development/python-modules/setuptools_scm/default.nix
@@ -1,11 +1,12 @@
 { stdenv, buildPythonPackage, fetchPypi, pip }:
+
 buildPythonPackage rec {
   pname = "setuptools_scm";
-  version = "3.2.0";
+  version = "3.3.3";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "52ab47715fa0fc7d8e6cd15168d1a69ba995feb1505131c3e814eb7087b57358";
+    sha256 = "19cyndx23xmpbhz4qrwmfwsmnnaczd0dw7qg977ksq2dbvxy29dx";
   };
 
   # Seems to fail due to chroot and would cause circular dependency

From 053b9da7546d98a5194ca2b5fa093552db96bf30 Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:00:00 -0500
Subject: [PATCH 33/54] pythonPackages.area53: drop

PyPI package was taken offline.

See https://github.com/bluepines/slick53/issues/5
---
 .../python-modules/area53/default.nix         | 23 -------------------
 pkgs/top-level/python-packages.nix            |  2 --
 2 files changed, 25 deletions(-)
 delete mode 100644 pkgs/development/python-modules/area53/default.nix

diff --git a/pkgs/development/python-modules/area53/default.nix b/pkgs/development/python-modules/area53/default.nix
deleted file mode 100644
index cd8e83dbf630..000000000000
--- a/pkgs/development/python-modules/area53/default.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-{ lib, buildPythonPackage, fetchPypi
-, boto }:
-
-buildPythonPackage rec {
-  pname = "Area53";
-  version = "0.94";
-
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "0v9b7f8b6v21y410anx5sr52k2ac8jrzdf19q6m6p0zsdsf9vr42";
-  };
-
-  # error: invalid command 'test'
-  doCheck = false;
-
-  propagatedBuildInputs = [ boto ];
-
-  meta = with lib; {
-    description = "Python Interface to Route53";
-    homepage = https://github.com/mariusv/Area53;
-    license = licenses.unfree; # unspecified
-  };
-}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 34888c3e4b79..72faa26fcb01 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1400,8 +1400,6 @@ in {
 
   argcomplete = callPackage ../development/python-modules/argcomplete { };
 
-  area53 = callPackage ../development/python-modules/area53 { };
-
   arxiv2bib = callPackage ../development/python-modules/arxiv2bib { };
 
   chai = callPackage ../development/python-modules/chai { };

From 59ff3a08f847d35f274c65f63dd735bfd43c2097 Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:03:00 -0500
Subject: [PATCH 34/54] pythonPackages.pystache: fix pname

---
 pkgs/development/python-modules/pystache/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/python-modules/pystache/default.nix b/pkgs/development/python-modules/pystache/default.nix
index ee57c4995481..8ae01e493970 100644
--- a/pkgs/development/python-modules/pystache/default.nix
+++ b/pkgs/development/python-modules/pystache/default.nix
@@ -1,7 +1,7 @@
 { stdenv, buildPythonPackage, python, fetchPypi, isPy3k, glibcLocales }:
 
 buildPythonPackage rec {
-  pname = "pystache-${version}";
+  pname = "pystache";
   version = "0.5.4";
 
   src = fetchPypi {

From ad4ac8a797b8f95a460c55ce3184ab24b40184ad Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:04:00 -0500
Subject: [PATCH 35/54] pythonPackages.pymysqlsa: fix PyPI name

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

diff --git a/pkgs/development/python-modules/pymysqlsa/default.nix b/pkgs/development/python-modules/pymysqlsa/default.nix
index 0167fe00ea7c..11813d3d1bcd 100644
--- a/pkgs/development/python-modules/pymysqlsa/default.nix
+++ b/pkgs/development/python-modules/pymysqlsa/default.nix
@@ -6,11 +6,12 @@
 }:
 
 buildPythonPackage rec {
-  pname = "pymysqlsa";
+  pname = "pymysql-sa";
   version = "1.0";
 
   src = fetchPypi {
-    inherit pname version;
+    inherit version;
+    pname = "pymysql_sa";
     sha256 = "a2676bce514a29b2d6ab418812259b0c2f7564150ac53455420a20bd7935314a";
   };
 

From 47ae762b85e7c22934ae84fb095c49f6dfa50363 Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:05:00 -0500
Subject: [PATCH 36/54] pythonPackages.pyaudio: fix PyPI name

---
 pkgs/development/python-modules/pyaudio/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/python-modules/pyaudio/default.nix b/pkgs/development/python-modules/pyaudio/default.nix
index 2f788966718c..ef068e51c59d 100644
--- a/pkgs/development/python-modules/pyaudio/default.nix
+++ b/pkgs/development/python-modules/pyaudio/default.nix
@@ -6,7 +6,7 @@
 }:
 
 buildPythonPackage rec {
-  pname = "python-pyaudio";
+  pname = "PyAudio";
   version = "0.2.9";
   disabled = isPyPy;
 

From b1c2a05877a95876f552d8c735827d25edfcfbe8 Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:06:00 -0500
Subject: [PATCH 37/54] pythonPackages.mrbob: fix PyPI name

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

diff --git a/pkgs/development/python-modules/mrbob/default.nix b/pkgs/development/python-modules/mrbob/default.nix
index 388e0148d0a0..dd255d4d0049 100644
--- a/pkgs/development/python-modules/mrbob/default.nix
+++ b/pkgs/development/python-modules/mrbob/default.nix
@@ -3,11 +3,12 @@
 }:
 
 buildPythonPackage rec {
-  pname = "mrbob";
+  pname = "mr-bob";
   version = "0.1.2";
 
   src = fetchPypi {
-    inherit pname version;
+    inherit version;
+    pname = "mr.bob";
     sha256 = "6737eaf98aaeae85e07ebef844ee5156df2f06a8b28d7c3dcb056f811c588121";
   };
 

From 4778194f7d4a10fd3b09545cabcf9c8265be274c Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:07:00 -0500
Subject: [PATCH 38/54] pythonPackages.mp2: fix PyPI name

---
 pkgs/development/python-modules/mpd2/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/python-modules/mpd2/default.nix b/pkgs/development/python-modules/mpd2/default.nix
index 3669b8dddbf8..32e36c4fb8c2 100644
--- a/pkgs/development/python-modules/mpd2/default.nix
+++ b/pkgs/development/python-modules/mpd2/default.nix
@@ -5,7 +5,7 @@
 }:
 
 buildPythonPackage rec {
-  pname = "mpd2";
+  pname = "python-mpd2";
   version = "0.5.5";
 
   src = fetchPypi {

From c800464bc7ed4c742a9cdd0fb9ef6db581c07a9d Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:08:00 -0500
Subject: [PATCH 39/54] pythonPackages.eggdeps: fix PyPI name

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

diff --git a/pkgs/development/python-modules/eggdeps/default.nix b/pkgs/development/python-modules/eggdeps/default.nix
index 0622bd41d237..c837e46066fe 100644
--- a/pkgs/development/python-modules/eggdeps/default.nix
+++ b/pkgs/development/python-modules/eggdeps/default.nix
@@ -6,11 +6,12 @@
 }:
 
 buildPythonPackage rec {
-  pname = "eggdeps";
+  pname = "tl-eggdeps";
   version = "0.4";
 
   src = fetchPypi {
-    inherit pname version;
+    inherit version;
+    pname = "tl.eggdeps";
     sha256 = "a99de5e4652865224daab09b2e2574a4f7c1d0d9a267048f9836aa914a2caf3a";
   };
 

From 11900ffe3313110ddf6b15c0914da472e299a4d1 Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:10:00 -0500
Subject: [PATCH 40/54] pythonPackages.python3pika: drop

Pika already supports Python3, and python3pika wasn't updated since 2014
---
 .../python-modules/python3pika/default.nix    | 33 -------------------
 pkgs/top-level/python-packages.nix            |  2 --
 2 files changed, 35 deletions(-)
 delete mode 100644 pkgs/development/python-modules/python3pika/default.nix

diff --git a/pkgs/development/python-modules/python3pika/default.nix b/pkgs/development/python-modules/python3pika/default.nix
deleted file mode 100644
index 4f75acff02ec..000000000000
--- a/pkgs/development/python-modules/python3pika/default.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-{ stdenv
-, buildPythonPackage
-, fetchPypi
-, isPy3k
-, nose
-, mock
-, pyyaml
-, unittest2
-}:
-
-buildPythonPackage rec {
-  pname = "python3-pika";
-  version = "0.9.14";
-  disabled = !isPy3k;
-
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "1c3hifwvn04kvlja88iawf0awyz726jynwnpcb6gn7376b4nfch7";
-  };
-
-  # Unit tests adds dependencies on pyev, tornado and twisted (and twisted is disabled for Python 3)
-  doCheck = false;
-
-  buildInputs = [ nose mock pyyaml ];
-  propagatedBuildInputs = [ unittest2 ];
-
-  meta = with stdenv.lib; {
-    homepage = https://pika.readthedocs.org/;
-    description = "Pika Python AMQP Client Library";
-    license = licenses.gpl2;
-  };
-
-}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 72faa26fcb01..e5ad1d4af085 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -4235,8 +4235,6 @@ in {
 
   pysoundfile = self.soundfile;  # Alias added 23-06-2019
 
-  python3pika = callPackage ../development/python-modules/python3pika { };
-
   python-jenkins = callPackage ../development/python-modules/python-jenkins { };
 
   pystringtemplate = callPackage ../development/python-modules/stringtemplate { };

From bb5c039fc95bea25133a01e8f1b46a50159f2412 Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:11:00 -0500
Subject: [PATCH 41/54] pythonPackages.pyev: drop

pyev is not available in PyPI anymore
---
 .../python-modules/pyev/default.nix           | 30 -------------------
 pkgs/top-level/python-packages.nix            |  2 --
 2 files changed, 32 deletions(-)
 delete 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
deleted file mode 100644
index b5ca0c7ef6cf..000000000000
--- a/pkgs/development/python-modules/pyev/default.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ stdenv, fetchurl, buildPythonPackage, libev }:
-
-buildPythonPackage rec {
-  pname = "pyev";
-  version = "0.9.0";
-
-  src = fetchurl {
-    url = "mirror://pypi/p/pyev/${pname}-${version}.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 e5ad1d4af085..ebdb55c0e520 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -4370,8 +4370,6 @@ in {
 
   pyenchant = callPackage ../development/python-modules/pyenchant { };
 
-  pyev = callPackage ../development/python-modules/pyev { };
-
   pyexcelerator = callPackage ../development/python-modules/pyexcelerator { };
 
   pyext = callPackage ../development/python-modules/pyext { };

From 53579ceed4136700b54b83862a7f94cd298f465a Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:12:00 -0500
Subject: [PATCH 42/54] pythonPackages.pyaudio: 0.2.9 -> 0.2.11

---
 pkgs/development/python-modules/pyaudio/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/python-modules/pyaudio/default.nix b/pkgs/development/python-modules/pyaudio/default.nix
index ef068e51c59d..62fec908a4d3 100644
--- a/pkgs/development/python-modules/pyaudio/default.nix
+++ b/pkgs/development/python-modules/pyaudio/default.nix
@@ -7,19 +7,19 @@
 
 buildPythonPackage rec {
   pname = "PyAudio";
-  version = "0.2.9";
+  version = "0.2.11";
   disabled = isPyPy;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "bfd694272b3d1efc51726d0c27650b3c3ba1345f7f8fdada7e86c9751ce0f2a1";
+    sha256 = "93bfde30e0b64e63a46f2fd77e85c41fd51182a4a3413d9edfaf9ffaa26efb74";
   };
 
   buildInputs = [ pkgs.portaudio ];
 
   meta = with stdenv.lib; {
     description = "Python bindings for PortAudio";
-    homepage = "http://people.csail.mit.edu/hubert/pyaudio/";
+    homepage = https://people.csail.mit.edu/hubert/pyaudio/;
     license = licenses.mit;
   };
 

From 3cc3bfc4bd49628c53c0a78002859d4f4b9f0ed0 Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 24 Apr 2019 00:13:00 -0500
Subject: [PATCH 43/54] pythonPackages.mpd2: 0.5.5 -> 1.0.0

---
 pkgs/development/python-modules/mpd2/default.nix | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/python-modules/mpd2/default.nix b/pkgs/development/python-modules/mpd2/default.nix
index 32e36c4fb8c2..95ee5c5001ad 100644
--- a/pkgs/development/python-modules/mpd2/default.nix
+++ b/pkgs/development/python-modules/mpd2/default.nix
@@ -1,22 +1,24 @@
 { stdenv
 , buildPythonPackage
 , fetchPypi
+, python
 , mock
 }:
 
 buildPythonPackage rec {
   pname = "python-mpd2";
-  version = "0.5.5";
+  version = "1.0.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1gfrxf71xll1w6zb69znqg5c9j0g7036fsalkvqprh2id640cl3a";
+    extension = "tar.bz2";
+    sha256 = "772fa6861273bb9f363a97987c2c45ca3965eb770570f1f02566efec9c89fc5f";
   };
 
   buildInputs = [ mock ];
-  patchPhase = ''
-    sed -i -e '/tests_require/d' \
-        -e 's/cmdclass.*/test_suite="mpd_test",/' setup.py
+
+  checkPhase = ''
+    ${python.interpreter} -m unittest mpd.tests
   '';
 
   meta = with stdenv.lib; {

From 7d1b5fa2b03093816f83afb64b2adb1dcb946dcf Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Fri, 23 Aug 2019 22:30:39 -0500
Subject: [PATCH 44/54] mesa_glu: 9.0.0 -> 9.0.1

* source tarball is now xz, not bz2
* pkgconfig was fixed to include Cflags

https://gitlab.freedesktop.org/mesa/glu/compare/glu-9.0.0...glu-9.0.1
---
 pkgs/development/libraries/mesa-glu/default.nix | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/pkgs/development/libraries/mesa-glu/default.nix b/pkgs/development/libraries/mesa-glu/default.nix
index 902fd9205681..dd2091c8a796 100644
--- a/pkgs/development/libraries/mesa-glu/default.nix
+++ b/pkgs/development/libraries/mesa-glu/default.nix
@@ -2,15 +2,12 @@
 
 stdenv.mkDerivation rec {
   pname = "glu";
-  version = "9.0.0";
+  version = "9.0.1";
 
   src = fetchurl {
-    url = "ftp://ftp.freedesktop.org/pub/mesa/glu/${pname}-${version}.tar.bz2";
-    sha256 = "04nzlil3a6fifcmb95iix3yl8mbxdl66b99s62yzq8m7g79x0yhz";
+    url = "ftp://ftp.freedesktop.org/pub/mesa/${pname}/${pname}-${version}.tar.xz";
+    sha256 = "1g2m634p73mixkzv1qz1d0flwm390ydi41bwmchiqvdssqnlqnpv";
   };
-  postPatch = ''
-    echo 'Cflags: -I''${includedir}' >> glu.pc.in
-  '';
 
   nativeBuildInputs = [ pkgconfig ];
   propagatedBuildInputs = [ libGL ]

From 841c667e9d70baf33a01f58639b156f1eaa285aa Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Mon, 2 Sep 2019 18:01:31 -0500
Subject: [PATCH 45/54] librsvg: 2.44.14 -> 2.44.15

https://mail.gnome.org/archives/ftp-release-list/2019-September/msg00029.html
---
 pkgs/development/libraries/librsvg/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix
index a911524a9acd..4653b8b86a26 100644
--- a/pkgs/development/libraries/librsvg/default.nix
+++ b/pkgs/development/libraries/librsvg/default.nix
@@ -5,14 +5,14 @@
 
 let
   pname = "librsvg";
-  version = "2.44.14";
+  version = "2.44.15";
 in
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
-    sha256 = "00z3qimpk909pcqq0jlsis5sskc6kn7cqia20smd9k9rhs3ag1ba";
+    sha256 = "1p4cifnxppz2qwsk2wvn2a6c7dpvgfrsf5vlhdkmsd373czm9396";
   };
 
   outputs = [ "out" "dev" "installedTests" ];

From 289579b09e49d00e6c976ef943fb736979aaf7da Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Mon, 2 Sep 2019 18:15:05 -0500
Subject: [PATCH 46/54] numactl: 2.0.12 -> 2.0.13

https://github.com/numactl/numactl/releases/tag/v2.0.13
---
 pkgs/os-specific/linux/numactl/default.nix | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/os-specific/linux/numactl/default.nix b/pkgs/os-specific/linux/numactl/default.nix
index 4417ffb569bf..f2188ee37cb4 100644
--- a/pkgs/os-specific/linux/numactl/default.nix
+++ b/pkgs/os-specific/linux/numactl/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "numactl";
-  version = "2.0.12";
+  version = "2.0.13";
 
   src = fetchFromGitHub {
-    owner = "numactl";
-    repo = "numactl";
+    owner = pname;
+    repo = pname;
     rev = "v${version}";
-    sha256 = "0crhpxwakp0gvd7wwpbkfd3brnrdf89lkbf03axnbrs0b6kaygg2";
+    sha256 = "08xj0n27qh0ly8hjallnx774gicz15nfq0yyxz8zhgy6pq8l33vv";
   };
 
   nativeBuildInputs = [ autoreconfHook ];

From 94aa75c2c9d4896eadc0114b97168baf17a1b8df Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Mon, 2 Sep 2019 18:25:34 -0500
Subject: [PATCH 47/54] harfbuzz: 2.6.0 -> 2.6.1

https://github.com/harfbuzz/harfbuzz/releases/tag/2.6.1
---
 pkgs/development/libraries/harfbuzz/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix
index 87453a09e7f9..3f7d1a2c3526 100644
--- a/pkgs/development/libraries/harfbuzz/default.nix
+++ b/pkgs/development/libraries/harfbuzz/default.nix
@@ -8,7 +8,7 @@
 }:
 
 let
-  version = "2.6.0";
+  version = "2.6.1";
   inherit (stdenv.lib) optional optionals optionalString;
 in
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-${version}.tar.xz";
-    sha256 = "0rn9fvnrxds7f4812yx68myy3x7szb4z9ql4m1fgjrc2ahbx3xww";
+    sha256 = "0kw4c04jd8c8ili3j1glgv0wsr207313fs3jh2rawf53m8zznlf6";
   };
 
   postPatch = ''

From 772e2aa94bd4ef72aea9924cebed65059031bb78 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Mon, 2 Sep 2019 18:29:29 -0500
Subject: [PATCH 48/54] cups: 2.2.11 -> 2.2.12 (security!)

https://github.com/apple/cups/releases/tag/v2.2.12
---
 pkgs/misc/cups/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix
index b28374ab6357..6e27fdb0a524 100644
--- a/pkgs/misc/cups/default.nix
+++ b/pkgs/misc/cups/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   pname = "cups";
 
   # After 2.2.6, CUPS requires headers only available in macOS 10.12+
-  version = if stdenv.isDarwin then "2.2.6" else "2.2.11";
+  version = if stdenv.isDarwin then "2.2.6" else "2.2.12";
 
   passthru = { inherit version; };
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     url = "https://github.com/apple/cups/releases/download/v${version}/cups-${version}-source.tar.gz";
     sha256 = if version == "2.2.6"
              then "16qn41b84xz6khrr2pa2wdwlqxr29rrrkjfi618gbgdkq9w5ff20"
-             else "0v5p10lyv8wv48s8ghkhjmdrxg6iwj8hn36v1ilkz46n7y0i107m";
+             else "1a4sgx5y7z16flmpnchd2ix294bnzy0v8mdkd96a4j27kr2anq8g";
   };
 
   outputs = [ "out" "lib" "dev" "man" ];

From b38a26e202bba83794dc4e304caa200db9757932 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Wed, 28 Aug 2019 18:01:16 -0500
Subject: [PATCH 49/54] libusb1: pname-ification

---
 pkgs/development/libraries/libusb1/default.nix | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix
index 0620163bb320..bc5ac43d55db 100644
--- a/pkgs/development/libraries/libusb1/default.nix
+++ b/pkgs/development/libraries/libusb1/default.nix
@@ -1,10 +1,11 @@
 { stdenv, fetchurl, pkgconfig, systemd ? null, libobjc, IOKit, withStatic ? false }:
 
 stdenv.mkDerivation (rec {
-  name = "libusb-1.0.22";
+  pname = "libusb";
+  version = "1.0.22";
 
   src = fetchurl {
-    url = "mirror://sourceforge/libusb/${name}.tar.bz2";
+    url = "mirror://sourceforge/libusb/${pname}-${version}.tar.bz2";
     sha256 = "0mw1a5ss4alg37m6bd4k44v35xwrcwp5qm4s686q1nsgkbavkbkm";
   };
 

From 4941879049a5144c18cefcfb1b4abce09dcc8394 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Wed, 28 Aug 2019 18:10:02 -0500
Subject: [PATCH 50/54] libusb1: 1.0.22 -> 1.0.23

---
 pkgs/development/libraries/libusb1/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix
index bc5ac43d55db..19a8025359a0 100644
--- a/pkgs/development/libraries/libusb1/default.nix
+++ b/pkgs/development/libraries/libusb1/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation (rec {
   pname = "libusb";
-  version = "1.0.22";
+  version = "1.0.23";
 
   src = fetchurl {
-    url = "mirror://sourceforge/libusb/${pname}-${version}.tar.bz2";
-    sha256 = "0mw1a5ss4alg37m6bd4k44v35xwrcwp5qm4s686q1nsgkbavkbkm";
+    url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
+    sha256 = "13dd2a9x290d1q8nb1lqiaf36grcvns5ripk5k2xm0lajmpc04fv";
   };
 
   outputs = [ "out" "dev" ]; # get rid of propagating systemd closure

From 8d3d7ce3e5a8aabc7846755c4fc5d1d129e5e95b Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Tue, 25 Jun 2019 19:32:31 -0500
Subject: [PATCH 51/54] libX11: 1.6.7 -> 1.6.8

---
 pkgs/servers/x11/xorg/default.nix   | 6 +++---
 pkgs/servers/x11/xorg/tarballs.list | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index c328e6ed1665..8c654b0f9924 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -703,11 +703,11 @@ lib.makeScope newScope (self: with self; {
   }) {};
 
   libX11 = callPackage ({ stdenv, pkgconfig, fetchurl, xorgproto, libxcb, xtrans }: stdenv.mkDerivation {
-    name = "libX11-1.6.7";
+    name = "libX11-1.6.8";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libX11-1.6.7.tar.bz2;
-      sha256 = "0j0k5bjz4kd7rx6z09n5ggxbzbi84wf78xx25ikx6jmsxwq9w3li";
+      url = mirror://xorg/individual/lib/libX11-1.6.8.tar.bz2;
+      sha256 = "1mbkwhhprhf49s2iwx7kiliprsdvd690zk44x3h53ql9q52si2dj";
     };
     hardeningDisable = [ "bindnow" "relro" ];
     nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/servers/x11/xorg/tarballs.list b/pkgs/servers/x11/xorg/tarballs.list
index 23fa9d774e79..df877566b4a6 100644
--- a/pkgs/servers/x11/xorg/tarballs.list
+++ b/pkgs/servers/x11/xorg/tarballs.list
@@ -177,7 +177,7 @@ mirror://xorg/individual/lib/libICE-1.0.9.tar.bz2
 mirror://xorg/individual/lib/libpciaccess-0.16.tar.bz2
 mirror://xorg/individual/lib/libSM-1.2.3.tar.bz2
 mirror://xorg/individual/lib/libWindowsWM-1.0.1.tar.bz2
-mirror://xorg/individual/lib/libX11-1.6.7.tar.bz2
+mirror://xorg/individual/lib/libX11-1.6.8.tar.bz2
 mirror://xorg/individual/lib/libXau-1.0.9.tar.bz2
 mirror://xorg/individual/lib/libXaw-1.0.13.tar.bz2
 mirror://xorg/individual/lib/libXaw3d-1.6.3.tar.bz2

From ae5df9705c987a5398ca306dd89fd0d8c5f9eb14 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Tue, 25 Jun 2019 19:33:05 -0500
Subject: [PATCH 52/54] libXi: 1.7.9 -> 1.7.10

---
 pkgs/servers/x11/xorg/default.nix   | 6 +++---
 pkgs/servers/x11/xorg/tarballs.list | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index 8c654b0f9924..270b8b4b70eb 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -898,11 +898,11 @@ lib.makeScope newScope (self: with self; {
   }) {};
 
   libXi = callPackage ({ stdenv, pkgconfig, fetchurl, xorgproto, libX11, libXext, libXfixes }: stdenv.mkDerivation {
-    name = "libXi-1.7.9";
+    name = "libXi-1.7.10";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libXi-1.7.9.tar.bz2;
-      sha256 = "0idg1wc01hndvaa820fvfs7phvd1ymf0lldmq6386i7rhkzvirn2";
+      url = mirror://xorg/individual/lib/libXi-1.7.10.tar.bz2;
+      sha256 = "0q8hz3slga3w3ch8wp0k7ay9ilhz315qnab0w1y2x9w3cf7hv8rn";
     };
     hardeningDisable = [ "bindnow" "relro" ];
     nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/servers/x11/xorg/tarballs.list b/pkgs/servers/x11/xorg/tarballs.list
index df877566b4a6..e9b6caf26487 100644
--- a/pkgs/servers/x11/xorg/tarballs.list
+++ b/pkgs/servers/x11/xorg/tarballs.list
@@ -190,7 +190,7 @@ mirror://xorg/individual/lib/libXfixes-5.0.3.tar.bz2
 mirror://xorg/individual/lib/libXfont-1.5.4.tar.bz2
 mirror://xorg/individual/lib/libXfont2-2.0.3.tar.bz2
 mirror://xorg/individual/lib/libXft-2.3.3.tar.bz2
-mirror://xorg/individual/lib/libXi-1.7.9.tar.bz2
+mirror://xorg/individual/lib/libXi-1.7.10.tar.bz2
 mirror://xorg/individual/lib/libXinerama-1.1.4.tar.bz2
 mirror://xorg/individual/lib/libxkbfile-1.1.0.tar.bz2
 mirror://xorg/individual/lib/libXmu-1.1.3.tar.bz2

From 5abfb98d50f7ea6a5a15ed0373320e10d2d1c41b Mon Sep 17 00:00:00 2001
From: "R. RyanTM" <ryantm-bot@ryantm.com>
Date: Sun, 4 Aug 2019 08:28:22 -0700
Subject: [PATCH 53/54] kexectools: 2.0.19 -> 2.0.20

Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/kexec-tools/versions
---
 pkgs/os-specific/linux/kexectools/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/kexectools/default.nix b/pkgs/os-specific/linux/kexectools/default.nix
index 326afdfff464..3d3215e6b4bf 100644
--- a/pkgs/os-specific/linux/kexectools/default.nix
+++ b/pkgs/os-specific/linux/kexectools/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   pname = "kexec-tools";
-  version = "2.0.19";
+  version = "2.0.20";
 
   src = fetchurl {
     urls = [
       "mirror://kernel/linux/utils/kernel/kexec/${pname}-${version}.tar.xz"
       "http://horms.net/projects/kexec/kexec-tools/${pname}-${version}.tar.xz"
     ];
-    sha256 = "03jyi4c47ywclycf3a253xpqs7p6ys8inz9q66b8m3xc6nrh307d";
+    sha256 = "1j7qlhxk1rbv9jbj8wd6hb7zl8p2mp29ymrmccgmsi0m0dzhgn6s";
   };
 
   hardeningDisable = [ "format" "pic" "relro" "pie" ];

From 3263254cfb3163ec5b036d135b7d516f175014da Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Fri, 23 Aug 2019 21:40:01 -0500
Subject: [PATCH 54/54] xorg.xinput: 1.6.2 -> 1.6.3

https://lists.x.org/archives/xorg-announce/2019-July/003013.html
---
 pkgs/servers/x11/xorg/default.nix   | 6 +++---
 pkgs/servers/x11/xorg/tarballs.list | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index 270b8b4b70eb..e752f3ad834e 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -2458,11 +2458,11 @@ lib.makeScope newScope (self: with self; {
   }) {};
 
   xinput = callPackage ({ stdenv, pkgconfig, fetchurl, xorgproto, libX11, libXext, libXi, libXinerama, libXrandr }: stdenv.mkDerivation {
-    name = "xinput-1.6.2";
+    name = "xinput-1.6.3";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xinput-1.6.2.tar.bz2;
-      sha256 = "1i75mviz9dyqyf7qigzmxq8vn31i86aybm662fzjz5c086dx551n";
+      url = mirror://xorg/individual/app/xinput-1.6.3.tar.bz2;
+      sha256 = "1vb6xdd1xmk5f7pwc5zcbxfray5sf1vbnscqwf2yl8lv7gfq38im";
     };
     hardeningDisable = [ "bindnow" "relro" ];
     nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/servers/x11/xorg/tarballs.list b/pkgs/servers/x11/xorg/tarballs.list
index e9b6caf26487..05b035197c1c 100644
--- a/pkgs/servers/x11/xorg/tarballs.list
+++ b/pkgs/servers/x11/xorg/tarballs.list
@@ -47,7 +47,7 @@ mirror://xorg/individual/app/xgamma-1.0.6.tar.bz2
 mirror://xorg/individual/app/xgc-1.0.5.tar.bz2
 mirror://xorg/individual/app/xhost-1.0.8.tar.bz2
 mirror://xorg/individual/app/xinit-1.4.1.tar.bz2
-mirror://xorg/individual/app/xinput-1.6.2.tar.bz2
+mirror://xorg/individual/app/xinput-1.6.3.tar.bz2
 mirror://xorg/individual/app/xkbcomp-1.4.2.tar.bz2
 mirror://xorg/individual/app/xkbevd-1.1.4.tar.bz2
 mirror://xorg/individual/app/xkbprint-1.0.4.tar.bz2