From 4313c44de358022cc7adf69fc8e0104edb50e3cd Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 1 Mar 2017 18:01:42 -0600
Subject: [PATCH 001/157] pcapc: 2015-03.06 -> 1.0.0

---
 pkgs/tools/networking/pcapc/default.nix | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/pkgs/tools/networking/pcapc/default.nix b/pkgs/tools/networking/pcapc/default.nix
index 66028a973b3c..552cda93bcc9 100644
--- a/pkgs/tools/networking/pcapc/default.nix
+++ b/pkgs/tools/networking/pcapc/default.nix
@@ -1,16 +1,17 @@
-{ stdenv, fetchFromGitHub, libpcap }:
+{ stdenv, fetchFromGitHub, libpcap, cmake }:
 
 stdenv.mkDerivation rec {
   name = "pcapc-${version}";
-  version = "2015-03-06";
+  version = "1.0.0";
 
   src = fetchFromGitHub {
-    sha256 = "02j45wmxy8qcji0giwx3364pbqb6849s8y0xfvzx40g98mssl027";
-    rev = "9dddf52e65c8cff72c7c11758a951b31bf083436";
+    sha256 = "137crs0bb7kh9a8p9g168yj2jrp0h3j3073nwh31jy4nk0g5hlfp";
+    rev = "v${version}";
     repo = "pcapc";
     owner = "pfactum";
   };
 
+  nativeBuildInputs = [ cmake ];
   buildInputs = [ libpcap ];
 
   makeFlags = [ "PREFIX=$(out)" ];
@@ -19,12 +20,8 @@ stdenv.mkDerivation rec {
 
   doCheck = false;
 
-  postInstall = ''
-    install -Dm644 {.,$out/share/doc/pcapc}/README.md
-  '';
-
   meta = with stdenv.lib; {
-    inherit (src.meta) homepage;
+    homepage = "https://github.com/pfactum/pcapc";
     description = "Compile libpcap filter expressions into BPF opcodes";
     license = licenses.gpl3;
     platforms = platforms.linux;

From 78ede3ab1f3a64cc39d9ee2986322d3aa6b58407 Mon Sep 17 00:00:00 2001
From: Julien Dehos <dehos@univ-littoral.fr>
Date: Mon, 27 Feb 2017 23:09:24 +0100
Subject: [PATCH 002/157] hieroglyph: init at 0.7.1

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

diff --git a/pkgs/development/python-modules/hieroglyph/default.nix b/pkgs/development/python-modules/hieroglyph/default.nix
new file mode 100644
index 000000000000..e79cdede092e
--- /dev/null
+++ b/pkgs/development/python-modules/hieroglyph/default.nix
@@ -0,0 +1,26 @@
+{ stdenv , fetchurl , buildPythonPackage , sphinx }:
+
+buildPythonPackage rec {
+  version = "0.7.1";
+  name = "hieroglyph-${version}";
+
+  src = fetchurl {
+    url = "mirror://pypi/h/hieroglyph/${name}.tar.gz";
+    sha256 = "0rswfk7x6zlj1z8388f153k3zn2h52k5h9b6p57pn7kqagsjilcb";
+  };
+
+  propagatedBuildInputs = [ sphinx ];
+
+  # all tests fail; don't know why:
+  # test_absolute_paths_made_relative (hieroglyph.tests.test_path_fixing.PostProcessImageTests) ... ERROR
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Generate HTML presentations from plain text sources";
+    homepage = https://github.com/nyergler/hieroglyph/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ juliendehos ];
+    platforms = platforms.unix;
+  };
+}
+
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 6a51e40d1233..1d534bd452b1 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -24675,6 +24675,8 @@ in {
     doCheck = false;
   };
 
+  hieroglyph = callPackage ../development/python-modules/hieroglyph { };
+
   sphinx_rtd_theme = buildPythonPackage (rec {
     name = "sphinx_rtd_theme-0.1.9";
 

From b9c7d291bc38c41f0c389c8615f42eb9c33ddd23 Mon Sep 17 00:00:00 2001
From: Leon Isenberg <leon.isenberg@t-online.de>
Date: Sun, 5 Mar 2017 17:13:27 +0100
Subject: [PATCH 003/157] haskellPackages: apply GHC specific overrides before
 GHCJS

GHCJS is effectively a backend for GHC, so all the GHC version specific package set overrides should in
general apply to the GHCJS package sets, too.
---
 pkgs/development/haskell-modules/configuration-ghcjs.nix | 2 --
 pkgs/top-level/haskell-packages.nix                      | 6 ++++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/haskell-modules/configuration-ghcjs.nix b/pkgs/development/haskell-modules/configuration-ghcjs.nix
index e4a4f74907a8..6bbcb716051e 100644
--- a/pkgs/development/haskell-modules/configuration-ghcjs.nix
+++ b/pkgs/development/haskell-modules/configuration-ghcjs.nix
@@ -180,8 +180,6 @@ self: super:
       ] drv.libraryHaskellDepends;
   });
 
-  semigroups = addBuildDepends super.semigroups [ self.hashable self.unordered-containers self.text self.tagged ];
-
   transformers-compat = overrideCabal super.transformers-compat (drv: {
     configureFlags = [];
   });
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index b4226e656fde..0cb2ce640504 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -161,11 +161,13 @@ in rec {
     };
     ghcjs = callPackage ../development/haskell-modules {
       ghc = compiler.ghcjs;
-      compilerConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
+      compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
+      packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
     };
     ghcjsHEAD = callPackage ../development/haskell-modules {
       ghc = compiler.ghcjsHEAD;
-      compilerConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
+      compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
+      packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
     };
 
     # The integer-simple attribute set contains package sets for all the GHC compilers

From 65592837b6e62fb555d6e8c891f347428886c4f2 Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Sun, 5 Mar 2017 17:39:38 -0600
Subject: [PATCH 004/157] freetype: 2.6.5 -> 2.7.1

The Infinality bytecode interpreter is removed in favor of the new v40 TrueType
interpreter. In the past, the Infinality interpreter provided support for
ClearType-style hinting instructions while the default interpreter (then v35)
provided support only for original TrueType-style instructions. The v40
interpreter corrects this deficiency, so the Infinality interpreter is no longer
necessary.

To understand why the Infinality interpreter is no longer necessary, we should
understand how ClearType differs from TrueType and how the v40 interpreter
works. The following is a summary of information available on the FreeType
website [1] mixed with my own editorializing.

TrueType instructions use horizontal and vertical hints to improve glyph
rendering. Before TrueType, fonts were only vertically hinted; horizontal hints
improved rendering by snapping stems to pixel boundaries. Horizontal hinting is
a risk because it can significantly distort glyph shapes and kerning. Extensive
testing at different resolutions is needed to perfect the TrueType
hints. Microsoft invested significant effort to do this with its "Core fonts for
the Web" project, but few other typefaces have seen this level of attention.

With the advent of subpixel rendering, the effective horizontal resolution of
most displays increased significantly. ClearType eschews horizontal hinting in
favor of horizontal supersampling. Most fonts are designed for the Microsoft
bytecode interpreter, which implements a compatibility mode with
TrueType-style (horizontal and vertical) instructions. However, applying the
full horizontal hints to subpixel-rendered fonts leads to color fringes and
inconsistent stem widths. The Infinality interpreter implements several
techniques to mitigate these problems, going so far as to embed font- and
glyph-specific hacks in the interpreter. On the other hand, the v40 interpreter
ignores the horizontal hinting instructions so that glyphs render as they are
intended to on the Microsoft interpreter. Without the horizontal hints, the
problems of glyph and kerning distortion, color fringes, and inconsistent stem
widths--the problems the Infinality interpreter was created to solve--simply
don't occur in the first place.

There are also security concerns which motivate removing the Infinality patches.
Although there is an updated version of the Infinality interpreter for FreeType
2.7, the lack of a consistent upstream maintainer is a security concern. The
interpreter is a Turing-complete virtual machine which has had security
vulnerabilities in the past. While the default interpreter is used in billions
of devices and is maintained by an active developer, the Infinality interpreter
is neither scrutinized nor maintained. We will probably never know if there are
defects in the Infinality interpreter, and if they were discovered they would
likely never be fixed. I do not think that is an acceptable situtation for a
core library like FreeType.

Dropping the Infinality patches means that font rendering will be less
customizable. I think this is an acceptable trade-off. The Infinality
interpreter made many compromises to mitigate the problems with horizontal
hinting; the main purpose of customization is to tailor these compromises to the
user's preferences. The new interpreter does not have to make these compromises
because it renders fonts as their designers intended, so this level of
customization is not necessary.

The Infinality-associated patches are also removed from cairo. These patches
only set the default rendering options in case they aren't set though
Fontconfig. On NixOS, the rendering options are always set in Fontconfig, so
these patches never actually did anything for us!

The Fontconfig test suite is patched to account for a quirk in the way PCF fonts
are named.

The fontconfig option `hintstyle` is no longer configurable in NixOS. This
option selects the TrueType interpreter; the v40 interpreter is `hintslight` and
the older v35 interpreter is `hintmedium` or `hintfull` (which have actually
always been the same thing). The setting may still be changed through the
`localConf` option or by creating a user Fontconfig file.

Users with HiDPI displays should probably disable hinting and antialiasing: at
best they have no visible effect.

The fontconfig-ultimate settings are still available in NixOS, but they are no
longer the default. They still work, but their main purpose is to set rendering
quirks which are no longer necessary and may actually be
detrimental (e.g. setting `hintfull` for some fonts). Also, the vast array of
font substitutions provided is not an appropriate default; the default setting
should be to give the user the font they asked for.

[1]. https://www.freetype.org/freetype2/docs/subpixel-hinting.html
---
 .../config/fonts/fontconfig-ultimate.nix      | 12 +--
 nixos/modules/config/fonts/fontconfig.nix     | 41 ++++----
 nixos/modules/rename.nix                      |  4 +-
 .../services/x11/display-managers/default.nix |  2 +-
 pkgs/development/libraries/cairo/default.nix  | 11 ---
 .../development/libraries/fontconfig/2.10.nix | 16 +---
 .../libraries/fontconfig/default.nix          |  4 +
 .../test-pcf-family-names-freetype-2.7.patch  | 18 ++++
 .../libraries/freetype/default.nix            | 96 +++++++------------
 .../freetype/enable-subpixel-rendering.patch  | 13 +++
 .../freetype/enable-table-validation.patch    | 22 +++++
 11 files changed, 125 insertions(+), 114 deletions(-)
 create mode 100644 pkgs/development/libraries/fontconfig/test-pcf-family-names-freetype-2.7.patch
 create mode 100644 pkgs/development/libraries/freetype/enable-subpixel-rendering.patch
 create mode 100644 pkgs/development/libraries/freetype/enable-table-validation.patch

diff --git a/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixos/modules/config/fonts/fontconfig-ultimate.nix
index a3f52fbd9199..acfdcbd26574 100644
--- a/nixos/modules/config/fonts/fontconfig-ultimate.nix
+++ b/nixos/modules/config/fonts/fontconfig-ultimate.nix
@@ -104,7 +104,7 @@ in
         ultimate = {
           enable = mkOption {
             type = types.bool;
-            default = true;
+            default = false;
             description = ''
               Enable fontconfig-ultimate settings (formerly known as
               Infinality). Besides the customizable settings in this NixOS
@@ -163,15 +163,6 @@ in
               <literal>none</literal> disables the substitutions.
             '';
           };
-
-          preset = mkOption {
-            type = types.enum ["ultimate1" "ultimate2" "ultimate3" "ultimate4" "ultimate5" "osx" "windowsxp"];
-            default = "ultimate3";
-            description = ''
-              FreeType rendering settings preset. Any of the presets may be
-              customized by setting environment variables.
-            '';
-          };
         };
       };
     };
@@ -181,7 +172,6 @@ in
   config = mkIf (config.fonts.fontconfig.enable && cfg.enable) {
 
     fonts.fontconfig.confPackages = [ confPkg ];
-    environment.variables."INFINALITY_FT" = cfg.preset;
 
   };
 
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index 52ad1e714fb9..aa9c59ec551b 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -83,7 +83,7 @@ let cfg = config.fonts.fontconfig;
             ${fcBool cfg.hinting.autohint}
           </edit>
           <edit mode="assign" name="hintstyle">
-            <const>hint${cfg.hinting.style}</const>
+            <const>hintslight</const>
           </edit>
           <edit mode="assign" name="antialias">
             ${fcBool cfg.antialias}
@@ -233,7 +233,11 @@ in
         antialias = mkOption {
           type = types.bool;
           default = true;
-          description = "Enable font antialiasing.";
+          description = ''
+            Enable font antialiasing. At high resolution (> 200 DPI),
+            antialiasing has no visible effect; users of such displays may want
+            to disable this option.
+          '';
         };
 
         dpi = mkOption {
@@ -249,7 +253,7 @@ in
           type = types.lines;
           default = "";
           description = ''
-            System-wide customization file contents, has higher priority than 
+            System-wide customization file contents, has higher priority than
             <literal>defaultFonts</literal> settings.
           '';
         };
@@ -287,7 +291,12 @@ in
           enable = mkOption {
             type = types.bool;
             default = true;
-            description = "Enable TrueType hinting.";
+            description = ''
+              Enable font hinting. Hinting aligns glyphs to pixel boundaries to
+              improve rendering sharpness at low resolution. At high resolution
+              (> 200 dpi) hinting will do nothing (at best); users of such
+              displays may want to disable this option.
+            '';
           };
 
           autohint = mkOption {
@@ -299,16 +308,6 @@ in
               correctly-hinted fonts.
             '';
           };
-
-          style = mkOption {
-            type = types.enum ["none" "slight" "medium" "full"];
-            default = "full";
-            description = ''
-              TrueType hinting style, one of <literal>none</literal>,
-              <literal>slight</literal>, <literal>medium</literal>, or
-              <literal>full</literal>.
-            '';
-          };
         };
 
         includeUserConf = mkOption {
@@ -327,7 +326,15 @@ in
             default = "rgb";
             type = types.enum ["rgb" "bgr" "vrgb" "vbgr" "none"];
             description = ''
-              Subpixel order.
+              Subpixel order. The overwhelming majority of displays are
+              <literal>rgb</literal> in their normal orientation. Select
+              <literal>vrgb</literal> for mounting such a display 90 degrees
+              clockwise from its normal orientation or <literal>vbgr</literal>
+              for mounting 90 degrees counter-clockwise. Select
+              <literal>bgr</literal> in the unlikely event of mounting 180
+              degrees from the normal orientation. Reverse these directions in
+              the improbable event that the display's native subpixel order is
+              <literal>bgr</literal>.
             '';
           };
 
@@ -335,7 +342,9 @@ in
             default = "default";
             type = types.enum ["none" "default" "light" "legacy"];
             description = ''
-              FreeType LCD filter.
+              FreeType LCD filter. At high resolution (> 200 DPI), LCD filtering
+              has no visible effect; users of such displays may want to select
+              <literal>none</literal>.
             '';
           };
 
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index ff3654737afd..02d875b26748 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -141,9 +141,6 @@ with lib;
     # Unity3D
     (mkRenamedOptionModule [ "programs" "unity3d" "enable" ] [ "security" "chromiumSuidSandbox" "enable" ])
 
-    # fontconfig-ultimate
-    (mkRenamedOptionModule [ "fonts" "fontconfig" "ultimate" "rendering" ] [ "fonts" "fontconfig" "ultimate" "preset" ])
-
     # murmur
     (mkRenamedOptionModule [ "services" "murmur" "welcome" ] [ "services" "murmur" "welcometext" ])
 
@@ -195,5 +192,6 @@ with lib;
       "See the 16.09 release notes for more information.")
     (mkRemovedOptionModule [ "services" "phpfpm" "phpIni" ] "")
     (mkRemovedOptionModule [ "services" "dovecot2" "package" ] "")
+    (mkRemovedOptionModule [ "fonts" "fontconfig" "hinting" "style" ] "")
   ];
 }
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index e8b897fb6050..4e2c0e01ca03 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -24,7 +24,7 @@ let
     Xft.lcdfilter: lcd${fontconfig.subpixel.lcdfilter}
     Xft.hinting: ${if fontconfig.hinting.enable then "1" else "0"}
     Xft.autohint: ${if fontconfig.hinting.autohint then "1" else "0"}
-    Xft.hintstyle: hint${fontconfig.hinting.style}
+    Xft.hintstyle: hintslight
   '';
 
   # file provided by services.xserver.displayManager.session.script
diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index 7df72bc05605..e1b87fafd8e8 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -19,13 +19,6 @@ stdenv.mkDerivation rec {
     sha1 = "c6f7b99986f93c9df78653c3e6a3b5043f65145e";
   };
 
-  infinality = fetchFromGitHub {
-    owner = "bohoomil";
-    repo = "fontconfig-ultimate";
-    rev = "730f5e77580677e86522c1f2119aa78803741759";
-    sha256 = "1hbrdpm6xcczs2c2iid7by8h7dsd0jcf7an88s150njyqnjzxjg7";
-  };
-
   patches = [
     # from https://bugs.freedesktop.org/show_bug.cgi?id=98165
     (fetchpatch {
@@ -35,10 +28,6 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  prePatch = ''
-    patches="$patches $(echo $infinality/*_cairo-iu/*.patch)"
-  '';
-
   outputs = [ "out" "dev" "devdoc" ];
   outputBin = "dev"; # very small
 
diff --git a/pkgs/development/libraries/fontconfig/2.10.nix b/pkgs/development/libraries/fontconfig/2.10.nix
index 2705339adbfb..222dfc27256c 100644
--- a/pkgs/development/libraries/fontconfig/2.10.nix
+++ b/pkgs/development/libraries/fontconfig/2.10.nix
@@ -8,13 +8,11 @@ stdenv.mkDerivation rec {
     sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
   };
 
-  infinality_patch =
-    let subvers = "1";
-      in fetchurl {
-        url = http://www.infinality.net/fedora/linux/zips/fontconfig-infinality-1-20130104_1.tar.bz2;
-        sha256 = "1fm5xx0mx2243jrq5rxk4v0ajw2nawpj23399h710bx6hd1rviq7";
-      }
-    ;
+  patches = [
+    # FreeType 2.7 prefixes PCF font family names with the foundry name.
+    # The output of fc-list and fc-query change which breaks the tests.
+    ./test-pcf-family-names-freetype-2.7.patch
+  ];
 
   outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
 
@@ -44,10 +42,6 @@ stdenv.mkDerivation rec {
   # Don't try to write to /var/cache/fontconfig at install time.
   installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
 
-  postInstall = ''
-    cd "$out/etc/fonts" && tar xvf ${infinality_patch}
-  '';
-
   passthru = {
     # Empty for backward compatibility, there was no versioning before 2.11
     configVersion = "";
diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix
index 14983b744df9..c44373625e0f 100644
--- a/pkgs/development/libraries/fontconfig/default.nix
+++ b/pkgs/development/libraries/fontconfig/default.nix
@@ -33,6 +33,10 @@ stdenv.mkDerivation rec {
       url = "https://cgit.freedesktop.org/fontconfig/patch/?id=1ab5258f7c";
       sha256 = "0x2a4qx51j3gqcp1kp4lisdzmhrkw1zw0r851d82ksgjlc0vkbaz";
     })
+
+    # FreeType 2.7 prefixes PCF font family names with the foundry name.
+    # The output of fc-list and fc-query change which breaks the tests.
+    ./test-pcf-family-names-freetype-2.7.patch
   ];
   # additionally required for the glibc-2.25 patch; avoid requiring gperf
   postPatch = ''
diff --git a/pkgs/development/libraries/fontconfig/test-pcf-family-names-freetype-2.7.patch b/pkgs/development/libraries/fontconfig/test-pcf-family-names-freetype-2.7.patch
new file mode 100644
index 000000000000..24aa6e5aaa1e
--- /dev/null
+++ b/pkgs/development/libraries/fontconfig/test-pcf-family-names-freetype-2.7.patch
@@ -0,0 +1,18 @@
+diff -Nuar fontconfig-2.10.2-orig/test/out.expected fontconfig-2.10.2/test/out.expected
+--- fontconfig-2.10.2-orig/test/out.expected	2017-03-06 06:45:50.876053093 -0600
++++ fontconfig-2.10.2/test/out.expected	2017-03-06 06:48:18.012514337 -0600
+@@ -1,8 +1,8 @@
+-Fixed:pixelsize=16
+-Fixed:pixelsize=6
++Misc Fixed:pixelsize=6
++Sony Fixed:pixelsize=16
+ =
+-Fixed:pixelsize=16
+-Fixed:pixelsize=6
++Misc Fixed:pixelsize=6
++Sony Fixed:pixelsize=16
+ =
+-Fixed:pixelsize=16
+-Fixed:pixelsize=6
++Misc Fixed:pixelsize=6
++Sony Fixed:pixelsize=16
diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix
index adf48df2494e..f966965fa5fa 100644
--- a/pkgs/development/libraries/freetype/default.nix
+++ b/pkgs/development/libraries/freetype/default.nix
@@ -1,64 +1,53 @@
-{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, which, zlib, bzip2, libpng, gnumake
-, glib /* passthru only */
+{
+  stdenv, lib, fetchurl, copyPathsToStore,
+  pkgconfig, which,
+  zlib, bzip2, libpng, gnumake, glib,
 
-  # FreeType supports sub-pixel rendering.  This is patented by
-  # Microsoft, so it is disabled by default.  This option allows it to
-  # be enabled.  See http://www.freetype.org/patents.html.
-, useEncumberedCode ? true
-, useInfinality ? true
+  # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
+  # LCD filtering is also known as ClearType and covered by several Microsoft patents.
+  # This option allows it to be disabled. See http://www.freetype.org/patents.html.
+  useEncumberedCode ? true,
 }:
 
-assert useInfinality -> useEncumberedCode;
-
-let
-  version = "2.6.5";
-
-  infinality = fetchFromGitHub {
-    owner = "archfan";
-    repo = "infinality_bundle";
-    rev = "5c0949a477bf43d2ac4e57b4fc39bcc3331002ee";
-    sha256 = "17389aqm6rlxl4b5mv1fx4b22x2v2n60hfhixfxqxpd8ialsdi6l";
-  };
-
-in
 with { inherit (stdenv.lib) optional optionals optionalString; };
-stdenv.mkDerivation rec {
-  name = "freetype-${version}";
+
+let version = "2.7.1"; name = "freetype-" + version; in
+
+stdenv.mkDerivation {
+  inherit name;
+
+  meta = with stdenv.lib; {
+    description = "A font rendering engine";
+    longDescription = ''
+      FreeType is a portable and efficient library for rendering fonts. It
+      supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
+      fonts. It has a bytecode interpreter and has an automatic hinter called
+      autofit which can be used instead of hinting instructions included in
+      fonts.
+    '';
+    homepage = https://www.freetype.org/;
+    license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ttuegel ];
+  };
 
   src = fetchurl {
     url = "mirror://savannah/freetype/${name}.tar.bz2";
-    sha256 = "1w5c87s4rpx9af5b3mk5cjd1yny3c4dq5p9iv3ixb3vr00a6w2p2";
+    sha256 = "121gm15ayfg3rglby8ifh8384mcjb9dhmx9j40zl7yszw72b4frs";
   };
 
-  patches = [
-    # Patch for validation of OpenType and GX/AAT tables.
-    (fetchurl {
-      name = "freetype-2.2.1-enable-valid.patch";
-      url = "http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.2.1-enable-valid.patch?id=9a81147af83b1166a5f301e379f85927cc610990";
-      sha256 = "0zkgqhws2s0j8ywksclf391iijhidb1a406zszd7xbdjn28kmj2l";
-    })
-  ] ++ optionals (!useInfinality && useEncumberedCode) [
-    # Patch to enable subpixel rendering.
-    # See https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html.
-    (fetchurl {
-      name = "freetype-2.3.0-enable-spr.patch";
-      url = http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.3.0-enable-spr.patch?id=9a81147af83b1166a5f301e379f85927cc610990;
-      sha256 = "13ni9n5q3nla38wjmxd4f8cy29gp62kjx2l6y6nqhdyiqp8fz8nd";
-    })
-  ];
-
-  prePatch = optionalString useInfinality ''
-    patches="$patches $(ls ${infinality}/*_freetype2-iu/*-infinality-*.patch)"
-  '';
-
-  outputs = [ "out" "dev" ];
-
   propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
   # dependence on harfbuzz is looser than the reverse dependence
   nativeBuildInputs = [ pkgconfig which ]
     # FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
     ++ optional (!stdenv.isLinux) gnumake;
 
+  patches =
+    [ ./enable-table-validation.patch ]
+    ++ optional useEncumberedCode ./enable-subpixel-rendering.patch;
+
+  outputs = [ "out" "dev" ];
+
   configureFlags = [ "--disable-static" "--bindir=$(dev)/bin" ];
 
   # The asm for armel is written with the 'asm' keyword.
@@ -76,19 +65,4 @@ stdenv.mkDerivation rec {
     # know why it's on the PATH.
     configureFlags = "--disable-static CC_BUILD=gcc";
   };
-
-  meta = with stdenv.lib; {
-    description = "A font rendering engine";
-    longDescription = ''
-      FreeType is a portable and efficient library for rendering fonts. It
-      supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
-      fonts. It has a bytecode interpreter and has an automatic hinter called
-      autofit which can be used instead of hinting instructions included in
-      fonts.
-    '';
-    homepage = https://www.freetype.org/;
-    license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
-    #ToDo: encumbered = useEncumberedCode;
-    platforms = platforms.all;
-  };
 }
diff --git a/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch b/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch
new file mode 100644
index 000000000000..4f908343e8c1
--- /dev/null
+++ b/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch
@@ -0,0 +1,13 @@
+Index: freetype-2.7.1/include/freetype/config/ftoption.h
+===================================================================
+--- freetype-2.7.1.orig/include/freetype/config/ftoption.h
++++ freetype-2.7.1/include/freetype/config/ftoption.h
+@@ -122,7 +122,7 @@ FT_BEGIN_HEADER
+   /* This is done to allow FreeType clients to run unmodified, forcing     */
+   /* them to display normal gray-level anti-aliased glyphs.                */
+   /*                                                                       */
+-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+ 
+ 
+   /*************************************************************************/
diff --git a/pkgs/development/libraries/freetype/enable-table-validation.patch b/pkgs/development/libraries/freetype/enable-table-validation.patch
new file mode 100644
index 000000000000..37419f14f40f
--- /dev/null
+++ b/pkgs/development/libraries/freetype/enable-table-validation.patch
@@ -0,0 +1,22 @@
+Index: freetype-2.7.1/modules.cfg
+===================================================================
+--- freetype-2.7.1.orig/modules.cfg
++++ freetype-2.7.1/modules.cfg
+@@ -120,7 +120,7 @@ AUX_MODULES += cache
+ # TrueType GX/AAT table validation.  Needs ftgxval.c below.
+ #
+ # No FT_CONFIG_OPTION_PIC support.
+-# AUX_MODULES += gxvalid
++AUX_MODULES += gxvalid
+ 
+ # Support for streams compressed with gzip (files with suffix .gz).
+ #
+@@ -143,7 +143,7 @@ AUX_MODULES += bzip2
+ # OpenType table validation.  Needs ftotval.c below.
+ #
+ # No FT_CONFIG_OPTION_PIC support.
+-# AUX_MODULES += otvalid
++AUX_MODULES += otvalid
+ 
+ # Auxiliary PostScript driver component to share common code.
+ #

From 97f26ee39ae057022d060edd1c3c8b64e5e2b174 Mon Sep 17 00:00:00 2001
From: Maksim Bronsky <maks.bronsky@web.de>
Date: Mon, 13 Mar 2017 22:43:25 +0100
Subject: [PATCH 005/157] initial release: vulnix

---
 lib/maintainers.nix                         |   1 +
 pkgs/tools/security/vulnix/default.nix      |  56 +++
 pkgs/tools/security/vulnix/requirements.nix | 531 ++++++++++++++++++++
 pkgs/top-level/python-packages.nix          |   2 +
 4 files changed, 590 insertions(+)
 create mode 100644 pkgs/tools/security/vulnix/default.nix
 create mode 100644 pkgs/tools/security/vulnix/requirements.nix

diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index e7b8ff7bf101..f7c11b2029ef 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -392,6 +392,7 @@
   pjones = "Peter Jones <pjones@devalot.com>";
   pkmx = "Chih-Mao Chen <pkmx.tw@gmail.com>";
   plcplc = "Philip Lykke Carlsen <plcplc@gmail.com>";
+  plumps = "Maksim Bronsky <maks.bronsky@web.de";
   pmahoney = "Patrick Mahoney <pat@polycrystal.org>";
   pmiddend = "Philipp Middendorf <pmidden@secure.mailbox.org>";
   polyrod = "Maurizio Di Pietro <dc1mdp@gmail.com>";
diff --git a/pkgs/tools/security/vulnix/default.nix b/pkgs/tools/security/vulnix/default.nix
new file mode 100644
index 000000000000..afec616563cb
--- /dev/null
+++ b/pkgs/tools/security/vulnix/default.nix
@@ -0,0 +1,56 @@
+{ buildPythonPackage,
+  callPackage,
+  click,
+  colorama,
+  fetchurl,
+  flake8,
+  lxml,
+  nix,
+  python,
+  pytest,
+  pytestcov,
+  stdenv,
+  }:
+
+let
+  external = callPackage ./requirements.nix { inherit buildPythonPackage fetchurl stdenv; };
+in
+
+buildPythonPackage rec{
+  name = "${pname}-${version}";
+  pname = "vulnix";
+  version = "1.2.2";
+
+  src = fetchurl {
+    url = "https://pypi.python.org/packages/90/c9/ebef9243334a99edb8598061efae0f00d7a199b01bea574a84e31e06236d/vulnix-${version}.tar.gz";
+    sha256 = "1ia9plziwach0bxnlcd33q30kcsf8sv0nf2jc78gsmrqnxjabr12";
+  };
+
+  buildInputs = [
+    flake8
+    pytest
+    pytestcov
+  ];
+
+  propagatedBuildInputs = [
+    click
+    colorama
+    nix
+    external.lxml
+    external.PyYAML
+    external.requests
+    external.ZODB
+  ];
+
+  checkPhase = ''
+    export PYTHONPATH=src:$PYTHONPATH
+    py.test
+  '';
+
+  meta = with stdenv.lib; {
+    description = "NixOS vulnerability scanner";
+    homepage = https://github.com/flyingcircusio/vulnix;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ plumps ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/tools/security/vulnix/requirements.nix b/pkgs/tools/security/vulnix/requirements.nix
new file mode 100644
index 000000000000..df51a5e8cd62
--- /dev/null
+++ b/pkgs/tools/security/vulnix/requirements.nix
@@ -0,0 +1,531 @@
+{ buildPythonPackage, commonDoCheck ? false, commonBuildInputs ? [], fetchurl, libxml2, libxslt, stdenv }:
+
+rec {
+
+  BTrees = buildPythonPackage {
+    name = "BTrees-4.3.1";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/24/76/cd6f225f2180c22af5cdb6656f51aec5fca45e45bdc4fa75c0a32f161a61/BTrees-4.3.1.tar.gz";
+      sha256 = "2565b7d35260dfc6b1e2934470fd0a2f9326c58c535a2b4cb396289d1c195a95";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      coverage
+      persistent
+      transaction
+      zope.interface
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Scalable persistent object containers";
+    };
+  };
+
+
+
+  PyYAML = buildPythonPackage {
+    name = "PyYAML-3.11";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/75/5e/b84feba55e20f8da46ead76f14a3943c8cb722d40360702b2365b91dec00/PyYAML-3.11.tar.gz";
+      sha256 = "c36c938a872e5ff494938b33b14aaa156cb439ec67548fcab3535bb78b0846e8";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "YAML parser and emitter for Python";
+    };
+  };
+
+
+
+  ZConfig = buildPythonPackage {
+    name = "ZConfig-3.1.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/52/b3/a96d62711a26d8cfbe546519975dc9ed54d2eb50b3238d2e6de045764796/ZConfig-3.1.0.tar.gz";
+      sha256 = "c21fa3a073a56925a8098036d46717392994a92cffea1b3cda3176b70c0a842e";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Structured Configuration Library";
+    };
+  };
+
+
+
+  ZODB = buildPythonPackage {
+    name = "ZODB-5.1.1";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/08/67/62d42c704edd64bcecddc29442a70535ebc7af46e232a5efa9fc572953f0/ZODB-5.1.1.tar.gz";
+      sha256 = "b0bbe6dfe60e2bdcf842a87abcc53b5cd15ad88ae2824c0c526cbb01ca0b90e5";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      BTrees
+      ZConfig
+      persistent
+      six
+      transaction
+      zc.lockfile
+      zodbpickle
+      zope.interface
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Zope Object Database: object database and persistence";
+    };
+  };
+
+
+
+  click = buildPythonPackage {
+    name = "click-6.6";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/7a/00/c14926d8232b36b08218067bcd5853caefb4737cda3f0a47437151344792/click-6.6.tar.gz";
+      sha256 = "cc6a19da8ebff6e7074f731447ef7e112bd23adf3de5c597cf9989f2fd8defe9";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.bsdOriginal;
+      description = "A simple wrapper around optparse for powerful command line utilities.";
+    };
+  };
+
+
+
+  colorama = buildPythonPackage {
+    name = "colorama-0.3.7";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/f0/d0/21c6449df0ca9da74859edc40208b3a57df9aca7323118c913e58d442030/colorama-0.3.7.tar.gz";
+      sha256 = "e043c8d32527607223652021ff648fbb394d5e19cba9f1a698670b338c9d782b";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.bsdOriginal;
+      description = "Cross-platform colored terminal text.";
+    };
+  };
+
+
+
+  coverage = buildPythonPackage {
+    name = "coverage-4.0.3";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/76/b4/3777a6bae434240b1fcbbda6cb30085bd897b3519acfffea498ee9f41038/coverage-4.0.3.tar.gz";
+      sha256 = "85b1275b6d7a61ccc8024a4e9a4c9e896394776edce1a5d075ec116f91925462";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.asl20;
+      description = "Code coverage measurement for Python";
+    };
+  };
+
+
+
+  flake8 = buildPythonPackage {
+    name = "flake8-2.5.4";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/60/4a/7b0ac4920af5673380b7079ba2f7580a8645790c7718881082c0d918b8b4/flake8-2.5.4.tar.gz";
+      sha256 = "cc1e58179f6cf10524c7bfdd378f5536d0a61497688517791639a5ecc867492f";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      "mccabe"
+      "pep8"
+      "pyflakes"
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "the modular source code checker: pep8, pyflakes and co";
+    };
+  };
+
+
+
+  lxml = buildPythonPackage {
+    name = "lxml-3.7.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/14/51/61462e59ab58575fe0d679ab2d31ec73cd49b26182c6ece3d9379faccfd7/lxml-3.7.0.tar.gz";
+      sha256 = "9c62eb2a1862e1ae285d7e7e3b7dc8772d387b19258086afcec143c6b7b8a5c9";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ libxml2 libxslt ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.bsdOriginal;
+      description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.";
+    };
+  };
+
+
+
+  mccabe = buildPythonPackage {
+    name = "mccabe-0.4.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/f6/e7/54461a958bb8b16f8db5f849d5d08b7d74153e064ac385fb68ff09f0bd27/mccabe-0.4.0.tar.gz";
+      sha256 = "9a2b12ebd876e77c72e41ebf401cc2e7c5b566649d50105ca49822688642207b";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "McCabe checker, plugin for flake8";
+    };
+  };
+
+
+
+  pep8 = buildPythonPackage {
+    name = "pep8-1.7.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/3e/b5/1f717b85fbf5d43d81e3c603a7a2f64c9f1dabc69a1e7745bd394cc06404/pep8-1.7.0.tar.gz";
+      sha256 = "a113d5f5ad7a7abacef9df5ec3f2af23a20a28005921577b15dd584d099d5900";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "Python style guide checker";
+    };
+  };
+
+
+
+  persistent = buildPythonPackage {
+    name = "persistent-4.2.2";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/3d/71/3302512282b606ec4d054e09be24c065915518903b29380b6573bff79c24/persistent-4.2.2.tar.gz";
+      sha256 = "52ececc6dbba5ef572d3435189318b4dff07675bafa9620e32f785e147c6563c";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      coverage
+      zope.interface
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Translucent persistent objects";
+    };
+  };
+
+
+
+  py = buildPythonPackage {
+    name = "py-1.4.31";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/f4/9a/8dfda23f36600dd701c6722316ba8a3ab4b990261f83e7d3ffc6dfedf7ef/py-1.4.31.tar.gz";
+      sha256 = "a6501963c725fc2554dabfece8ae9a8fb5e149c0ac0a42fd2b02c5c1c57fc114";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "library with cross-python path, ini-parsing, io, code, log facilities";
+    };
+  };
+
+
+
+  pyflakes = buildPythonPackage {
+    name = "pyflakes-1.0.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/45/24/6bc038f3422bab08c24173c1990a56e9eb0c4582a9b202858a33f8aefeb8/pyflakes-1.0.0.tar.gz";
+      sha256 = "f39e33a4c03beead8774f005bd3ecf0c3f2f264fa0201de965fce0aff1d34263";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "passive checker of Python programs";
+    };
+  };
+
+
+
+  pytest = buildPythonPackage {
+    name = "pytest-2.9.1";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/5e/f0/75c5cee17575bef459c916b6276bd9ad56944836bb0d9e36dd05704e7f35/pytest-2.9.1.tar.gz";
+      sha256 = "0d48d27a127644fbe7c8158157e08b35f8255045d4476df694b91eb3a8147e65";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      "colorama"
+      "py"
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "pytest: simple powerful testing with Python";
+    };
+  };
+
+
+
+  pytest-capturelog = buildPythonPackage {
+    name = "pytest-capturelog-0.7";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/35/e9/6051b5bb65ad5049d5eb60127d34c63ba724e17acf8b1f2f2e0755131b6c/pytest-capturelog-0.7.tar.gz";
+      sha256 = "b6e8d5189b39462109c2188e6b512d6cc7e66d62bb5be65389ed50e96d22000d";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      "py"
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "py.test plugin to capture log messages";
+    };
+  };
+
+
+
+  pytest-codecheckers = buildPythonPackage {
+    name = "pytest-codecheckers-0.2";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/53/09/263669db13955496e77017f389693c1e1dd77d98fd4afd51b133162e858f/pytest-codecheckers-0.2.tar.gz";
+      sha256 = "853de10f204865140da2bc173f791c9e13794fc43656e02fffcce23c9999e748";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      "pep8"
+      "py"
+      "pyflakes"
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = "";
+      description = "pytest plugin to add source code sanity checks (pep8 and friends)";
+    };
+  };
+
+
+
+  pytest-cov = buildPythonPackage {
+    name = "pytest-cov-2.2.1";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/39/07/bdd2d985ae7ac726cc5e7a6a343b585570bf1f9f7cb297a9cd58a60c7c89/pytest-cov-2.2.1.tar.gz";
+      sha256 = "a8b22e53e7f3b971454c35df99dffe21f4749f539491e935c55d3ff7e1b284fa";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      "coverage"
+      "pytest"
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.bsdOriginal;
+      description = "Pytest plugin for measuring coverage.";
+    };
+  };
+
+
+
+  pytest-runner = buildPythonPackage {
+    name = "pytest-runner-2.9";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/11/d4/c335ddf94463e451109e3494e909765c3e5205787b772e3b25ee8601b86a/pytest-runner-2.9.tar.gz";
+      sha256 = "50378de59b02f51f64796d3904dfe71b9dc6f06d88fc6bfbd5c8e8366ae1d131";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "Invoke py.test as distutils command with dependency resolution";
+    };
+  };
+
+
+
+  pytest-timeout = buildPythonPackage {
+    name = "pytest-timeout-1.0.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/cf/92/ab29b9baa54d47dfd50e43be35577de9af4e7ebf27d29f546ddeb6c3b6f5/pytest-timeout-1.0.0.tar.gz";
+      sha256 = "1465096be73e16df1e15d1b1453692428a7e15b997d756bc565aee0d12798ce1";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      "pytest"
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "py.test plugin to abort hanging tests";
+    };
+  };
+
+
+
+  requests = buildPythonPackage {
+    name = "requests-2.10.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/49/6f/183063f01aae1e025cf0130772b55848750a2f3a89bfa11b385b35d7329d/requests-2.10.0.tar.gz";
+      sha256 = "63f1815788157130cee16a933b2ee184038e975f0017306d723ac326b5525b54";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.asl20;
+      description = "Python HTTP for Humans.";
+    };
+  };
+
+
+
+  setuptools-scm = buildPythonPackage {
+    name = "setuptools-scm-1.15.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/80/b7/31b6ae5fcb188e37f7e31abe75f9be90490a5456a72860fa6e643f8a3cbc/setuptools_scm-1.15.0.tar.gz";
+      sha256 = "daf12d05aa2155a46aa357453757ffdc47d87f839e62114f042bceac6a619e2f";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "the blessed package to manage your versions by scm tags";
+    };
+  };
+
+
+
+  six = buildPythonPackage {
+    name = "six-1.10.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz";
+      sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.mit;
+      description = "Python 2 and 3 compatibility utilities";
+    };
+  };
+
+
+
+  transaction = buildPythonPackage {
+    name = "transaction-2.0.3";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/8c/af/3ffafe85bcc93ecb09459f3f2bd8fbe142e9ab34048f9e2774543b470cbd/transaction-2.0.3.tar.gz";
+      sha256 = "67bfb81309ba9717edbb2ca2e5717c325b78beec0bf19f44e5b4b9410f82df7f";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      coverage
+      zope.interface
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Transaction management for Python";
+    };
+  };
+
+
+
+  zc.lockfile = buildPythonPackage {
+    name = "zc.lockfile-1.2.1";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/bd/84/0299bbabbc9d3f84f718ba1039cc068030d3ad723c08f82a64337edf901e/zc.lockfile-1.2.1.tar.gz";
+      sha256 = "11db91ada7f22fe8aae268d4bfdeae012c4fe655f66bbb315b00822ec00d043e";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [ ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Basic inter-process locks";
+    };
+  };
+
+
+
+  zodbpickle = buildPythonPackage {
+    name = "zodbpickle-0.6.0";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/7a/fc/f6f437a5222b330735eaf8f1e67a6845bd1b600e9a9455e552d3c13c4902/zodbpickle-0.6.0.tar.gz";
+      sha256 = "ea3248be966159e7791e3db0e35ea992b9235d52e7d39835438686741d196665";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      coverage
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Fork of Python 3 pickle module.";
+    };
+  };
+
+
+
+  zope.interface = buildPythonPackage {
+    name = "zope.interface-4.3.3";
+    src = fetchurl {
+      url = "https://pypi.python.org/packages/44/af/cea1e18bc0d3be0e0824762d3236f0e61088eeed75287e7b854d65ec9916/zope.interface-4.3.3.tar.gz";
+      sha256 = "8780ef68ca8c3fe1abb30c058a59015129d6e04a6b02c2e56b9c7de6078dfa88";
+    };
+    doCheck = commonDoCheck;
+    buildInputs = commonBuildInputs;
+    propagatedBuildInputs = [
+      coverage
+    ];
+    meta = with stdenv.lib; {
+      homepage = "";
+      license = licenses.zpt21;
+      description = "Interfaces for Python";
+    };
+  };
+
+}
\ No newline at end of file
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 99a797ea509a..9bcdeb3c1ca5 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -31999,6 +31999,8 @@ EOF
     };
   };
 
+  vulnix = callPackage ../tools/security/vulnix { };
+
   wp_export_parser = buildPythonPackage rec {
     name = "${pname}-${version}";
     pname = "wp_export_parser";

From 5f89c9e92df754c108a57c5b691e7a00bfd37482 Mon Sep 17 00:00:00 2001
From: Renaud <c0bw3b@users.noreply.github.com>
Date: Thu, 16 Mar 2017 00:55:13 +0100
Subject: [PATCH 006/157] nghttp2: 1.19.0 -> 1.20.0

Corrected c-ares attribute name

Full changelog : https://nghttp2.org/blog/2017/02/26/nghttp2-v1-20-0/
---
 pkgs/development/libraries/nghttp2/default.nix | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/libraries/nghttp2/default.nix b/pkgs/development/libraries/nghttp2/default.nix
index aee0b3d7116c..5fb9cc36e962 100644
--- a/pkgs/development/libraries/nghttp2/default.nix
+++ b/pkgs/development/libraries/nghttp2/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, pkgconfig
 
 # Optional Dependencies
-, openssl ? null, libev ? null, zlib ? null, libcares ? null
+, openssl ? null, libev ? null, zlib ? null, c-ares ? null
 , enableHpack ? false, jansson ? null
 , enableAsioLib ? false, boost ? null
 , enableGetAssets ? false, libxml2 ? null
@@ -17,18 +17,18 @@ with { inherit (stdenv.lib) optional; };
 
 stdenv.mkDerivation rec {
   name = "nghttp2-${version}";
-  version = "1.19.0";
+  version = "1.20.0";
 
   # Don't use fetchFromGitHub since this needs a bootstrap curl
   src = fetchurl {
     url = "https://github.com/nghttp2/nghttp2/releases/download/v${version}/nghttp2-${version}.tar.bz2";
-    sha256 = "477466eee27158d37b4478d9335dd091497cae4d7f2375fc6657beab67db9e7a";
+    sha256 = "fb29d0500b194f11680203aed21aafab241063ec1397cc51ab5cc0957341141b";
   };
 
   outputs = [ "out" "dev" "lib" ];
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ openssl libev zlib libcares ]
+  buildInputs = [ openssl libev zlib c-ares ]
     ++ optional enableHpack jansson
     ++ optional enableAsioLib boost
     ++ optional enableGetAssets libxml2
@@ -36,8 +36,14 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  configureFlags = [ "--with-spdylay=no" "--disable-examples" "--disable-python-bindings" ]
+    ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib";
+
+  #doCheck = true;  # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc
+
+
   meta = with stdenv.lib; {
-    homepage = http://nghttp2.org/;
+    homepage = https://nghttp2.org/;
     description = "A C implementation of HTTP/2";
     license = licenses.mit;
     platforms = platforms.all;

From a4c68ace9cae9948ddd1a7ab7ef20e12ac8bb48e Mon Sep 17 00:00:00 2001
From: Renaud <c0bw3b@users.noreply.github.com>
Date: Wed, 15 Mar 2017 23:23:57 +0100
Subject: [PATCH 007/157] jemalloc: 4.3.1 -> 4.5.0

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

diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix
index 84638bc01ea6..8c8c181409d4 100644
--- a/pkgs/development/libraries/jemalloc/default.nix
+++ b/pkgs/development/libraries/jemalloc/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "jemalloc-${version}";
-  version = "4.3.1";
+  version = "4.5.0";
 
   src = fetchurl {
     url = "https://github.com/jemalloc/jemalloc/releases/download/${version}/${name}.tar.bz2";
-    sha256 = "12r71i8nm3vwz21fc16rwbb0pwcg5s05n1qg3rwl2s85v0x1ifzp";
+    sha256 = "9409d85664b4f135b77518b0b118c549009dc10f6cba14557d170476611f6780";
   };
 
   # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which
@@ -14,6 +14,9 @@ stdenv.mkDerivation rec {
   # option should remove the prefix and give us a working jemalloc.
   configureFlags = stdenv.lib.optional stdenv.isDarwin "--with-jemalloc-prefix=";
 
+  doCheck = true;
+
+
   meta = with stdenv.lib; {
     homepage = http://jemalloc.net;
     description = "General purpose malloc(3) implementation";

From 354ea69ae42d2a1b691a4f3cb771e59141bd0dcd Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Sun, 12 Mar 2017 17:06:44 -0500
Subject: [PATCH 008/157] fontconfig-penultimate: init at 0.2

Also provides a NixOS module.
---
 .../config/fonts/fontconfig-penultimate.nix   | 57 +++++++++++++++++++
 nixos/modules/module-list.nix                 |  3 +-
 .../fonts/fontconfig-penultimate/default.nix  | 18 ++++++
 pkgs/top-level/all-packages.nix               |  2 +
 4 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100644 nixos/modules/config/fonts/fontconfig-penultimate.nix
 create mode 100644 pkgs/data/fonts/fontconfig-penultimate/default.nix

diff --git a/nixos/modules/config/fonts/fontconfig-penultimate.nix b/nixos/modules/config/fonts/fontconfig-penultimate.nix
new file mode 100644
index 000000000000..8e41d3421173
--- /dev/null
+++ b/nixos/modules/config/fonts/fontconfig-penultimate.nix
@@ -0,0 +1,57 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.fonts.fontconfig.penultimate;
+
+  latestVersion  = pkgs.fontconfig.configVersion;
+
+  # The configuration to be included in /etc/font/
+  confPkg = pkgs.runCommand "font-penultimate-conf" {} ''
+    support_folder=$out/etc/fonts/conf.d
+    latest_folder=$out/etc/fonts/${latestVersion}/conf.d
+
+    mkdir -p $support_folder
+    mkdir -p $latest_folder
+
+    # fontconfig ultimate various configuration files
+    ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \
+          $support_folder
+    ln -s ${pkgs.fontconfig-penultimate}/etc/fonts/conf.d/*.conf \
+          $latest_folder
+  '';
+
+in
+{
+
+  options = {
+
+    fonts = {
+
+      fontconfig = {
+
+        penultimate = {
+          enable = mkOption {
+            type = types.bool;
+            default = true;
+            description = ''
+              Enable fontconfig-penultimate settings to supplement the
+              NixOS defaults by providing per-font rendering defaults and
+              metric aliases.
+            '';
+          };
+        };
+
+      };
+    };
+
+  };
+
+  config = mkIf (config.fonts.fontconfig.enable && cfg.enable) {
+
+    fonts.fontconfig.confPackages = [ confPkg ];
+
+  };
+
+}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 7d2ae4a571c4..a938ba6d0069 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -1,8 +1,9 @@
 [
   ./config/debug-info.nix
   ./config/fonts/corefonts.nix
-  ./config/fonts/fontconfig-ultimate.nix
   ./config/fonts/fontconfig.nix
+  ./config/fonts/fontconfig-penultimate.nix
+  ./config/fonts/fontconfig-ultimate.nix
   ./config/fonts/fontdir.nix
   ./config/fonts/fonts.nix
   ./config/fonts/ghostscript.nix
diff --git a/pkgs/data/fonts/fontconfig-penultimate/default.nix b/pkgs/data/fonts/fontconfig-penultimate/default.nix
new file mode 100644
index 000000000000..aea3365aba4b
--- /dev/null
+++ b/pkgs/data/fonts/fontconfig-penultimate/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchFromGitHub }:
+
+let version = "0.2"; in
+stdenv.mkDerivation {
+  name = "fontconfig-penultimate-${version}";
+
+  src = fetchFromGitHub {
+    owner = "ttuegel";
+    repo = "fontconfig-penultimate";
+    rev = version;
+    sha256 = "106sjfmxdn2cachgsg0ky3wi676x6nd14y5fcl16n82kghi3d9yf";
+  };
+
+  installPhase = ''
+    mkdir -p $out/etc/fonts/conf.d
+    cp *.conf $out/etc/fonts/conf.d
+  '';
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f2eb80ec01d1..962506444fc6 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7330,6 +7330,8 @@ with pkgs;
 
   fontconfig = callPackage ../development/libraries/fontconfig { };
 
+  fontconfig-penultimate = callPackage ../data/fonts/fontconfig-penultimate {};
+
   fontconfig-ultimate = callPackage ../development/libraries/fontconfig-ultimate {};
 
   folly = callPackage ../development/libraries/folly { };

From a6fce585e4c7acbd3fbb045199ef39a2f71df4ec Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Sun, 12 Mar 2017 17:08:02 -0500
Subject: [PATCH 009/157] nixos/fontconfig: set rendering defaults, not
 overrides

---
 nixos/modules/config/fonts/fontconfig.nix | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index aa9c59ec551b..a137eab35344 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -75,23 +75,23 @@ let cfg = config.fonts.fontconfig;
       <fontconfig>
 
         <!-- Default rendering settings -->
-        <match target="font">
-          <edit mode="assign" name="hinting">
+        <match target="pattern">
+          <edit mode="append" name="hinting">
             ${fcBool cfg.hinting.enable}
           </edit>
-          <edit mode="assign" name="autohint">
+          <edit mode="append" name="autohint">
             ${fcBool cfg.hinting.autohint}
           </edit>
-          <edit mode="assign" name="hintstyle">
+          <edit mode="append" name="hintstyle">
             <const>hintslight</const>
           </edit>
-          <edit mode="assign" name="antialias">
+          <edit mode="append" name="antialias">
             ${fcBool cfg.antialias}
           </edit>
-          <edit mode="assign" name="rgba">
+          <edit mode="append" name="rgba">
             <const>${cfg.subpixel.rgba}</const>
           </edit>
-          <edit mode="assign" name="lcdfilter">
+          <edit mode="append" name="lcdfilter">
             <const>lcd${cfg.subpixel.lcdfilter}</const>
           </edit>
         </match>

From f3aeb3b0ab3e8da1dcdce567e1e608e4268f49a2 Mon Sep 17 00:00:00 2001
From: Dan Peebles <pumpkin@me.com>
Date: Sat, 18 Mar 2017 15:05:55 -0400
Subject: [PATCH 010/157] llvm-39: a couple of improvements

Splits outputs in clang like we do in 3.8 and 4.0 to avoid runtime
dependency on Python in the main derivation.

I also disable TSAN on Darwin to maintain consistency with 4.0, which
disables it because it forces an unfree dependency in the stdenv.
---
 .../compilers/llvm/3.9/clang/default.nix         | 11 +++++++++++
 pkgs/development/compilers/llvm/3.9/llvm.nix     | 16 +++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/pkgs/development/compilers/llvm/3.9/clang/default.nix b/pkgs/development/compilers/llvm/3.9/clang/default.nix
index 677c4a526ea4..55938ca016e6 100644
--- a/pkgs/development/compilers/llvm/3.9/clang/default.nix
+++ b/pkgs/development/compilers/llvm/3.9/clang/default.nix
@@ -29,12 +29,23 @@ let
       sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
     '';
 
+    outputs = [ "out" "python" ];
+
     # Clang expects to find LLVMgold in its own prefix
     # Clang expects to find sanitizer libraries in its own prefix
     postInstall = ''
       ln -sv ${llvm}/lib/LLVMgold.so $out/lib
       ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
       ln -sv $out/bin/clang $out/bin/cpp
+
+      mkdir -p $python/bin $python/share/clang/
+      mv $out/bin/{git-clang-format,scan-view} $python/bin
+      if [ -e $out/bin/set-xcode-analyzer ]; then
+        mv $out/bin/set-xcode-analyzer $python/bin
+      fi
+      mv $out/share/clang/*.py $python/share/clang
+
+      rm $out/bin/c-index-test
     '';
 
     enableParallelBuilding = true;
diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix
index 62f1514e2315..2c47ec5127f9 100644
--- a/pkgs/development/compilers/llvm/3.9/llvm.nix
+++ b/pkgs/development/compilers/llvm/3.9/llvm.nix
@@ -40,8 +40,7 @@ in stdenv.mkDerivation rec {
   outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
 
   buildInputs = [ perl groff cmake libxml2 python libffi ]
-    ++ stdenv.lib.optionals stdenv.isDarwin
-         [ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ];
+    ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
 
   propagatedBuildInputs = [ ncurses zlib ];
 
@@ -53,11 +52,15 @@ in stdenv.mkDerivation rec {
       sha256 = "11sq86spw41v72f676igksapdlsgh7fiqp5qkkmgfj0ndqcn9skf";
     }}
   ''
-  # hacky fix: New LLVM releases require a newer OS X SDK than
-  # 10.9. This is a temporary measure until nixpkgs darwin support is
-  # updated.
+  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
+  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
+  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
+  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
+  # a flag and turn the flag off during the stdenv build. I realize that this LLVM isn't used in the stdenv but I want to
+  # keep it consistent with 4.0. We really shouldn't be copying and pasting all this code around...
   + stdenv.lib.optionalString stdenv.isDarwin ''
-        sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
+    substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
+      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   ''
   # Patch llvm-config to return correct library path based on --link-{shared,static}.
   + stdenv.lib.optionalString (enableSharedLibraries) ''
@@ -85,7 +88,6 @@ in stdenv.mkDerivation rec {
     ++ stdenv.lib.optionals (isDarwin) [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-    "-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool"
   ];
 
   postBuild = ''

From b79c28495213ce8b8038d7b85ac5ba850b378dc6 Mon Sep 17 00:00:00 2001
From: Benjamin Staffin <benley@gmail.com>
Date: Sat, 18 Mar 2017 17:51:11 -0400
Subject: [PATCH 011/157] nixos: Use xkbDir consistently so it has an effect

---
 nixos/modules/services/x11/desktop-managers/enlightenment.nix | 2 +-
 nixos/modules/services/x11/desktop-managers/plasma5.nix       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/services/x11/desktop-managers/enlightenment.nix b/nixos/modules/services/x11/desktop-managers/enlightenment.nix
index 38e24e9b709a..b02eaf861a0d 100644
--- a/nixos/modules/services/x11/desktop-managers/enlightenment.nix
+++ b/nixos/modules/services/x11/desktop-managers/enlightenment.nix
@@ -64,7 +64,7 @@ in
     security.wrappers.e_freqset.source = "${e.enlightenment.out}/bin/e_freqset";
 
     environment.etc = singleton
-      { source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
+      { source = xcfg.xkbDir;
         target = "X11/xkb";
       };
 
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
index bc6e728169b4..993002a57795 100644
--- a/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -176,7 +176,7 @@ in
       environment.pathsToLink = [ "/share" ];
 
       environment.etc = singleton {
-        source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
+        source = xcfg.xkbDir;
         target = "X11/xkb";
       };
 

From ef0eb3866071b5fa61e70f92577cd7b84e3d1882 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Sun, 19 Mar 2017 20:41:19 +0100
Subject: [PATCH 012/157] autogen: 5.18.7 -> 5.18.12

---
 pkgs/development/tools/misc/autogen/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/tools/misc/autogen/default.nix b/pkgs/development/tools/misc/autogen/default.nix
index 251387e7bd51..28034f9d5492 100644
--- a/pkgs/development/tools/misc/autogen/default.nix
+++ b/pkgs/development/tools/misc/autogen/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "autogen-${version}";
-  version = "5.18.7";
+  version = "5.18.12";
 
   src = fetchurl {
-    url = "mirror://gnu/autogen/autogen-${version}.tar.xz";
-    sha256 = "01d4m8ckww12sy50vgyxlnz83z9dxqpyqp153cscncc9w6jq19d7";
+    url = "mirror://gnu/autogen/rel${version}/autogen-${version}.tar.xz";
+    sha256 = "1n5zq4872sakvz9c7ncsdcfp0z8rsybsxvbmhkpbd19ii0pacfxy";
   };
 
   outputs = [ "bin" "dev" "lib" "out" "man" "info" ];

From 972f51a2daadfaff74db08cb1ac2061da31b9b3f Mon Sep 17 00:00:00 2001
From: Dan Peebles <pumpkin@me.com>
Date: Sun, 19 Mar 2017 17:37:03 -0400
Subject: [PATCH 013/157] llvmPackages_37.libcxxabi: fix with more recent
 versions of libc++

The build breaks on libc++ 3.8 and above, which hinders our upgrade to
LLVM 4 for the Darwin stdenv.
---
 .../compilers/llvm/3.7/libc++abi.nix            | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/compilers/llvm/3.7/libc++abi.nix b/pkgs/development/compilers/llvm/3.7/libc++abi.nix
index 6a62a6256b4f..d2be57b1a5fa 100644
--- a/pkgs/development/compilers/llvm/3.7/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/3.7/libc++abi.nix
@@ -1,6 +1,12 @@
-{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
+{ stdenv, cmake, fetch, fetchpatch, libcxx, libunwind, llvm, version }:
 
-stdenv.mkDerivation {
+let
+  # Newer LLVMs (3.8 onwards) have changed how some basic C++ stuff works, which breaks builds of this older version
+  llvm38-and-above = fetchpatch {
+    url    = "https://trac.macports.org/raw-attachment/ticket/50304/0005-string-Fix-exception-declaration.patch";
+    sha256 = "1lm38n7s0l5dbl7kp4i49pvzxz1mcvlr2vgsnj47agnwhhm63jvr";
+  };
+in stdenv.mkDerivation {
   name = "libc++abi-${version}";
 
   src = fetch "libcxxabi" "0ambfcmr2nh88hx000xb7yjm9lsqjjz49w5mlf6dlxzmj3nslzx4";
@@ -16,6 +22,13 @@ stdenv.mkDerivation {
     export TRIPLE=x86_64-apple-darwin
   '';
 
+  # I can't use patches directly because this is actually a patch for libc++'s source, which we manually extract
+  # into the libc++abi build environment above.
+  prePatch = ''(
+    cd ../libcxx-*
+    patch -p1 < ${llvm38-and-above}
+  )'';
+
   installPhase = if stdenv.isDarwin
     then ''
       for file in lib/*.dylib; do

From c3c9412c7d6513091295f4e253d416ddbd17fe55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Domen=20Ko=C5=BEar?= <domen@dev.si>
Date: Mon, 20 Mar 2017 14:11:20 +0100
Subject: [PATCH 014/157] git, openssl, curl: Respect $NIX_SSL_CERT_FILE

Slightly modified version of 942dbf89c6120cb5b52fb2ab456855d1fbf2994e
---
 .../git-and-tools/git/ssl-cert-file.patch          |  7 +++++--
 pkgs/development/libraries/openssl/default.nix     |  1 +
 .../libraries/openssl/nix-ssl-cert-file.patch      | 14 ++++++++++++++
 pkgs/tools/networking/curl/default.nix             |  2 +-
 pkgs/tools/networking/curl/nix-ssl-cert-file.patch | 14 ++++++++++++++
 5 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100644 pkgs/development/libraries/openssl/nix-ssl-cert-file.patch
 create mode 100644 pkgs/tools/networking/curl/nix-ssl-cert-file.patch

diff --git a/pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch b/pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch
index bafd65e8c93e..0e0697dfb211 100644
--- a/pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch
+++ b/pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch
@@ -1,11 +1,14 @@
 diff -ru git-2.7.4-orig/http.c git-2.7.4/http.c
 --- git-2.7.4-orig/http.c	2016-03-17 21:47:59.000000000 +0100
 +++ git-2.7.4/http.c	2016-04-12 11:38:33.187070848 +0200
-@@ -544,6 +544,7 @@
+@@ -544,6 +544,10 @@
  #if LIBCURL_VERSION_NUM >= 0x070908
  	set_from_env(&ssl_capath, "GIT_SSL_CAPATH");
  #endif
-+	set_from_env(&ssl_cainfo, "SSL_CERT_FILE");
++	if (getenv("NIX_SSL_CERT_FILE"))
++	  set_from_env(&ssl_cainfo, "NIX_SSL_CERT_FILE");
++	else
++	  set_from_env(&ssl_cainfo, "SSL_CERT_FILE");
  	set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO");
  
  	set_from_env(&user_agent, "GIT_HTTP_USER_AGENT");
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 2591a43f1d47..947c0e30f993 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -19,6 +19,7 @@ let
 
     patches =
       (args.patches or [])
+      ++ [ ./nix-ssl-cert-file.patch ]
       ++ optional (versionOlder version "1.1.0") ./use-etc-ssl-certs.patch
       ++ optional stdenv.isCygwin ./1.0.1-cygwin64.patch
       ++ optional
diff --git a/pkgs/development/libraries/openssl/nix-ssl-cert-file.patch b/pkgs/development/libraries/openssl/nix-ssl-cert-file.patch
new file mode 100644
index 000000000000..b615f1482b7c
--- /dev/null
+++ b/pkgs/development/libraries/openssl/nix-ssl-cert-file.patch
@@ -0,0 +1,14 @@
+diff -ru -x '*~' openssl-1.0.2j-orig/crypto/x509/by_file.c openssl-1.0.2j/crypto/x509/by_file.c
+--- openssl-1.0.2j-orig/crypto/x509/by_file.c	2016-09-26 11:49:07.000000000 +0200
++++ openssl-1.0.2j/crypto/x509/by_file.c	2016-10-13 16:54:31.400288302 +0200
+@@ -97,7 +97,9 @@
+     switch (cmd) {
+     case X509_L_FILE_LOAD:
+         if (argl == X509_FILETYPE_DEFAULT) {
+-            file = (char *)getenv(X509_get_default_cert_file_env());
++            file = (char *)getenv("NIX_SSL_CERT_FILE");
++            if (!file)
++                file = (char *)getenv(X509_get_default_cert_file_env());
+             if (file)
+                 ok = (X509_load_cert_crl_file(ctx, file,
+                                               X509_FILETYPE_PEM) != 0);
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index bb9316512ecd..f8d1506cca34 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     sha256 = "1s1hyndva0yp62xy96pcp4anzrvw6cl0abjajim17sbmdp00fwhw";
   };
 
-  patches = [ ];
+  patches = [ ./nix-ssl-cert-file.patch ];
 
   outputs = [ "bin" "dev" "out" "man" "devdoc" ];
 
diff --git a/pkgs/tools/networking/curl/nix-ssl-cert-file.patch b/pkgs/tools/networking/curl/nix-ssl-cert-file.patch
new file mode 100644
index 000000000000..20c408bfae23
--- /dev/null
+++ b/pkgs/tools/networking/curl/nix-ssl-cert-file.patch
@@ -0,0 +1,14 @@
+diff -ru -x '*~' curl-7.50.3-orig/src/tool_operate.c curl-7.50.3/src/tool_operate.c
+--- curl-7.50.3-orig/src/tool_operate.c	2016-09-06 23:25:06.000000000 +0200
++++ curl-7.50.3/src/tool_operate.c	2016-10-14 11:51:48.999943142 +0200
+@@ -269,7 +269,9 @@
+         capath_from_env = true;
+       }
+       else {
+-        env = curlx_getenv("SSL_CERT_FILE");
++        env = curlx_getenv("NIX_SSL_CERT_FILE");
++        if(!env)
++          env = curlx_getenv("SSL_CERT_FILE");
+         if(env) {
+           config->cacert = strdup(env);
+           if(!config->cacert) {

From d458b5401a36dd87cfd2bd071f634330f095cf5d Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Mon, 20 Mar 2017 10:34:52 -0500
Subject: [PATCH 015/157] nixos/fontconfig: add Changelog message about
 FreeType update

---
 nixos/doc/manual/release-notes/rl-1709.xml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/nixos/doc/manual/release-notes/rl-1709.xml b/nixos/doc/manual/release-notes/rl-1709.xml
index 3705fd468f61..66b88eab09bc 100644
--- a/nixos/doc/manual/release-notes/rl-1709.xml
+++ b/nixos/doc/manual/release-notes/rl-1709.xml
@@ -49,6 +49,18 @@ following incompatible changes:</para>
       rest of the system on a stable release.
     </para>
   </listitem>
+  <listitem>
+    <para>
+      Updated to FreeType 2.7.1, including a new TrueType engine.
+      The new engine replaces the Infinality engine which was the default in
+      NixOS. The default font rendering settings are now provided by
+      fontconfig-penultimate, replacing fontconfig-ultimate; the new defaults
+      are less invasive and provide rendering that is more consistent with
+      other systems and hopefully with each font designer's intent. Some
+      system-wide configuration has been removed from the Fontconfig NixOS
+      module where user Fontconfig settings are available.
+    </para>
+  </listitem>
 
 </itemizedlist>
 

From 48bc3cf9f497f38d0bfcf0ac6a808a1cd411a855 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Mon, 20 Mar 2017 16:47:13 +0100
Subject: [PATCH 016/157] bash: 4.4p5 -> 4.4p12

---
 pkgs/shells/bash/4.4.nix              | 7 -------
 pkgs/shells/bash/bash-4.4-patches.nix | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/pkgs/shells/bash/4.4.nix b/pkgs/shells/bash/4.4.nix
index 682123d924e0..988b4f711cb3 100644
--- a/pkgs/shells/bash/4.4.nix
+++ b/pkgs/shells/bash/4.4.nix
@@ -52,13 +52,6 @@ stdenv.mkDerivation rec {
   patchFlags = "-p0";
 
   patches = upstreamPatches
-      ++ [ (fetchurl {
-              # https://security.gentoo.org/glsa/201701-02
-              url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-shells"
-                  + "/bash/files/bash-4.4-popd-offset-overflow.patch"
-                  + "?id=1bf1ceeb04a2f57e1e5e1636a8c288c4d0db6682";
-              sha256 = "02n08lw5spvsc2b1bll0gr6mg4qxcg7pzfjkw7ji5w7bjcikccbm";
-          }) ]
       ++ optional stdenv.isCygwin ./cygwin-bash-4.3.33-1.src.patch;
 
   crossAttrs = {
diff --git a/pkgs/shells/bash/bash-4.4-patches.nix b/pkgs/shells/bash/bash-4.4-patches.nix
index c3ef5470aebf..741fb675d614 100644
--- a/pkgs/shells/bash/bash-4.4-patches.nix
+++ b/pkgs/shells/bash/bash-4.4-patches.nix
@@ -6,4 +6,11 @@ patch: [
 (patch "003" "1chqww2rj6g42b8s60q5zlzy0jzp684jkpsbrbfy1vzxja8mmpsi")
 (patch "004" "1cy8abf96hkrjhw921ndr0shlcnc52bg45rn6xri4v5clhq0l25d")
 (patch "005" "0a8515kyk4zsgmvlqvlganjfr7pq0j6kzpr4d6xx02kpbdr4n7i2")
+(patch "006" "1f24wgqngmj2mrj9yibwvc2zvlmn5xi53mnw777g3l40c4m2x3ka")
+(patch "007" "1bzdsnqaf05gdbqpsixhan8vygjxpcxlz1dd8d9f5jdznw3wq76y")
+(patch "008" "1firw915mjm03hbbw9a70ch3cpgrgnvqjpllgdnn6csr8q04f546")
+(patch "009" "0g1l56kvw61rpw7dqa9fcl9llkl693h73g631hrhxlm030ddssqb")
+(patch "010" "01lfhrkdsdkdz8ypzapr614ras23x7ckjnr60aa5bzkaqprccrc4")
+(patch "011" "038p7mhnq9m65g505hi3827jkf9f35nd1cy00w8mwafpyxp44mnx")
+(patch "012" "0gh6lbb1rwpk44pvbamm6vzdfi50xnwkqd9v7s8cjwk3pz973hps")
 ]

From 3760c8c7fde6e8b15d19b063579d05018fc2d8b3 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Tue, 21 Mar 2017 13:01:17 +0100
Subject: [PATCH 017/157] Python: replace mkPythonDerivation with
 buildPythonPackage and format="other";

This way all Python packages use the same function,
`buildPythonPackage`.
---
 .../version-management/mercurial/default.nix      |  3 ++-
 pkgs/development/python-modules/dbus/default.nix  |  5 +++--
 pkgs/development/python-modules/koji/default.nix  |  5 +++--
 .../python-modules/libsexy/default.nix            |  5 +++--
 .../python-modules/pycairo/default.nix            |  5 +++--
 pkgs/development/python-modules/pygobject/3.nix   |  5 +++--
 .../python-modules/pygobject/default.nix          |  4 ++--
 .../python-modules/pygtksourceview/default.nix    |  5 +++--
 pkgs/development/python-modules/pyqt/4.x.nix      |  5 +++--
 pkgs/development/python-modules/pyqt/5.x.nix      |  5 +++--
 .../development/python-modules/pyside/default.nix |  5 +++--
 pkgs/development/python-modules/pyxml/default.nix |  5 +++--
 pkgs/development/python-modules/sip/default.nix   |  5 +++--
 .../documentation/gnome-doc-utils/default.nix     |  3 ++-
 pkgs/development/tools/misc/d-feet/default.nix    |  4 ++--
 pkgs/misc/drivers/hplip/default.nix               |  3 ++-
 pkgs/os-specific/linux/dstat/default.nix          |  3 ++-
 pkgs/top-level/python-packages.nix                | 15 ++++++++++-----
 18 files changed, 55 insertions(+), 35 deletions(-)

diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix
index 034eb5344234..1c97f7252f56 100644
--- a/pkgs/applications/version-management/mercurial/default.nix
+++ b/pkgs/applications/version-management/mercurial/default.nix
@@ -7,8 +7,9 @@ let
   version = "3.9.2";
   name = "mercurial-${version}";
   inherit (python2Packages) docutils hg-git dulwich python;
-in python2Packages.mkPythonDerivation {
+in python2Packages.buildPythonApplication {
   inherit name;
+  format = "other";
 
   src = fetchurl {
     url = "https://mercurial-scm.org/release/${name}.tar.gz";
diff --git a/pkgs/development/python-modules/dbus/default.nix b/pkgs/development/python-modules/dbus/default.nix
index f3f897ac9e79..d2e1d2dc86fd 100644
--- a/pkgs/development/python-modules/dbus/default.nix
+++ b/pkgs/development/python-modules/dbus/default.nix
@@ -1,8 +1,9 @@
-{ lib, fetchurl, mkPythonDerivation, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy
+{ lib, fetchurl, buildPythonPackage, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy
 , ncurses, pygobject3 }:
 
-if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
+if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else buildPythonPackage rec {
   name = "dbus-python-1.2.4";
+  format = "other";
 
   src = fetchurl {
     url = "http://dbus.freedesktop.org/releases/dbus-python/${name}.tar.gz";
diff --git a/pkgs/development/python-modules/koji/default.nix b/pkgs/development/python-modules/koji/default.nix
index 262ea74d4a34..28b5e11223ff 100644
--- a/pkgs/development/python-modules/koji/default.nix
+++ b/pkgs/development/python-modules/koji/default.nix
@@ -1,7 +1,8 @@
-{ stdenv, fetchurl, mkPythonDerivation, pycurl }:
+{ stdenv, fetchurl, buildPythonPackage, pycurl }:
 
-mkPythonDerivation rec {
+buildPythonPackage rec {
   name = "koji-1.8";
+  format = "other";
 
   src = fetchurl {
     url = "https://fedorahosted.org/released/koji/koji-1.8.0.tar.bz2";
diff --git a/pkgs/development/python-modules/libsexy/default.nix b/pkgs/development/python-modules/libsexy/default.nix
index fa79cfa3be5c..79eb8ab2f83c 100644
--- a/pkgs/development/python-modules/libsexy/default.nix
+++ b/pkgs/development/python-modules/libsexy/default.nix
@@ -1,8 +1,9 @@
-{ stdenv, fetchurl, mkPythonDerivation, libsexy, pkgconfig, libxml2, pygtk, pango, gtk2, glib }:
+{ stdenv, fetchurl, buildPythonPackage, libsexy, pkgconfig, libxml2, pygtk, pango, gtk2, glib }:
 
-mkPythonDerivation rec {
+buildPythonPackage rec {
   name = "libsexy-${version}";
   version = "0.1.9";
+  format = "other";
 
   src = fetchurl {
     url = "http://releases.chipx86.com/libsexy/sexy-python/sexy-python-${version}.tar.gz";
diff --git a/pkgs/development/python-modules/pycairo/default.nix b/pkgs/development/python-modules/pycairo/default.nix
index e7cf3b4c4489..5d002c096239 100644
--- a/pkgs/development/python-modules/pycairo/default.nix
+++ b/pkgs/development/python-modules/pycairo/default.nix
@@ -1,8 +1,9 @@
-{ lib, fetchurl, fetchpatch, python, mkPythonDerivation, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35, isPy3k }:
+{ lib, fetchurl, fetchpatch, python, buildPythonPackage, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35, isPy3k }:
 
-if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
+if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else buildPythonPackage rec {
   version = "1.10.0";
   name = "pycairo-${version}";
+  format = "other";
   src = if isPy3k
     then fetchurl {
       url = "http://cairographics.org/releases/pycairo-${version}.tar.bz2";
diff --git a/pkgs/development/python-modules/pygobject/3.nix b/pkgs/development/python-modules/pygobject/3.nix
index 33bb1d5a4cab..984b11844342 100644
--- a/pkgs/development/python-modules/pygobject/3.nix
+++ b/pkgs/development/python-modules/pygobject/3.nix
@@ -1,9 +1,10 @@
-{ stdenv, fetchurl, mkPythonDerivation, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo, which, ncurses}:
+{ stdenv, fetchurl, buildPythonPackage, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo, which, ncurses}:
 
-mkPythonDerivation rec {
+buildPythonPackage rec {
   major = "3.22";
   minor = "0";
   name = "pygobject-${major}.${minor}";
+  format = "other";
 
   src = fetchurl {
     url = "mirror://gnome/sources/pygobject/${major}/${name}.tar.xz";
diff --git a/pkgs/development/python-modules/pygobject/default.nix b/pkgs/development/python-modules/pygobject/default.nix
index 6723ba6b6a58..a3658a96bf3d 100644
--- a/pkgs/development/python-modules/pygobject/default.nix
+++ b/pkgs/development/python-modules/pygobject/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, python, mkPythonDerivation, pkgconfig, glib }:
+{ stdenv, fetchurl, python, buildPythonPackage, pkgconfig, glib }:
 
-mkPythonDerivation rec {
+buildPythonPackage rec {
   name = "pygobject-${version}";
   version = "2.28.6";
 
diff --git a/pkgs/development/python-modules/pygtksourceview/default.nix b/pkgs/development/python-modules/pygtksourceview/default.nix
index 133cbdb34fd2..499634236acd 100644
--- a/pkgs/development/python-modules/pygtksourceview/default.nix
+++ b/pkgs/development/python-modules/pygtksourceview/default.nix
@@ -1,9 +1,10 @@
-{ lib, fetchurl, python, mkPythonDerivation, pkgconfig, pygobject2, glib, pygtk, gnome2 }:
+{ lib, fetchurl, python, buildPythonPackage, pkgconfig, pygobject2, glib, pygtk, gnome2 }:
 
 let version = "2.10.1"; in
 
-mkPythonDerivation {
+buildPythonPackage {
   name = "pygtksourceview-${version}";
+  format = "other";
 
   src = fetchurl {
     url = "http://ftp.gnome.org/pub/gnome/sources/pygtksourceview/2.10/pygtksourceview-${version}.tar.bz2";
diff --git a/pkgs/development/python-modules/pyqt/4.x.nix b/pkgs/development/python-modules/pyqt/4.x.nix
index dc3dd69ac02e..a5ae0aaa137d 100644
--- a/pkgs/development/python-modules/pyqt/4.x.nix
+++ b/pkgs/development/python-modules/pyqt/4.x.nix
@@ -2,9 +2,10 @@
 
 let
   version = "4.12";
-  inherit (pythonPackages) mkPythonDerivation python dbus-python sip;
-in mkPythonDerivation {
+  inherit (pythonPackages) buildPythonPackage python dbus-python sip;
+in buildPythonPackage {
   name = "PyQt-x11-gpl-${version}";
+  format = "other";
 
   src = fetchurl {
     url = "mirror://sourceforge/pyqt/PyQt4_gpl_x11-${version}.tar.gz";
diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix
index ee3419eed0e9..880edfbab079 100644
--- a/pkgs/development/python-modules/pyqt/5.x.nix
+++ b/pkgs/development/python-modules/pyqt/5.x.nix
@@ -3,9 +3,10 @@
 
 let
   version = "5.8.1";
-  inherit (pythonPackages) mkPythonDerivation python dbus-python sip;
-in mkPythonDerivation {
+  inherit (pythonPackages) buildPythonPackage python dbus-python sip;
+in buildPythonPackage {
   name = "PyQt-${version}";
+  format = "other";
 
   meta = with lib; {
     description = "Python bindings for Qt5";
diff --git a/pkgs/development/python-modules/pyside/default.nix b/pkgs/development/python-modules/pyside/default.nix
index 6473ebf22b13..4aff09b8f8f5 100644
--- a/pkgs/development/python-modules/pyside/default.nix
+++ b/pkgs/development/python-modules/pyside/default.nix
@@ -1,8 +1,9 @@
-{ lib, fetchurl, cmake, python, mkPythonDerivation, pysideGeneratorrunner, pysideShiboken, qt4 }:
+{ lib, fetchurl, cmake, python, buildPythonPackage, pysideGeneratorrunner, pysideShiboken, qt4 }:
 
-mkPythonDerivation rec {
+buildPythonPackage rec {
   name = "pyside-${version}";
   version = "1.2.4";
+  format = "other";
 
   src = fetchurl {
     url = "https://github.com/PySide/PySide/archive/${version}.tar.gz";
diff --git a/pkgs/development/python-modules/pyxml/default.nix b/pkgs/development/python-modules/pyxml/default.nix
index abea143d11da..b85b20423697 100644
--- a/pkgs/development/python-modules/pyxml/default.nix
+++ b/pkgs/development/python-modules/pyxml/default.nix
@@ -1,7 +1,8 @@
-{lib, fetchurl, python, mkPythonDerivation, makeWrapper}:
+{lib, fetchurl, python, buildPythonPackage, makeWrapper}:
 
-mkPythonDerivation rec {
+buildPythonPackage rec {
   name = "PyXML-0.8.4";
+  format = "other";
   src = fetchurl {
     url = "mirror://sourceforge/pyxml/${name}.tar.gz";
     sha256 = "04wc8i7cdkibhrldy6j65qp5l75zjxf5lx6qxdxfdf2gb3wndawz";
diff --git a/pkgs/development/python-modules/sip/default.nix b/pkgs/development/python-modules/sip/default.nix
index 99d3c89e1f9d..29295de66b7e 100644
--- a/pkgs/development/python-modules/sip/default.nix
+++ b/pkgs/development/python-modules/sip/default.nix
@@ -1,7 +1,8 @@
-{ lib, fetchurl, mkPythonDerivation, python, isPyPy }:
+{ lib, fetchurl, buildPythonPackage, python, isPyPy }:
 
-if isPyPy then throw "sip not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
+if isPyPy then throw "sip not supported for interpreter ${python.executable}" else buildPythonPackage rec {
   name = "sip-4.19.1";
+  format = "other";
 
   src = fetchurl {
     url = "mirror://sourceforge/pyqt/sip/${name}/${name}.tar.gz";
diff --git a/pkgs/development/tools/documentation/gnome-doc-utils/default.nix b/pkgs/development/tools/documentation/gnome-doc-utils/default.nix
index 18933426db0a..ef339d47ea05 100644
--- a/pkgs/development/tools/documentation/gnome-doc-utils/default.nix
+++ b/pkgs/development/tools/documentation/gnome-doc-utils/default.nix
@@ -1,8 +1,9 @@
 {stdenv, fetchurl, pkgconfig, libxml2Python, libxslt, intltool
 , makeWrapper, python2Packages }:
 
-python2Packages.mkPythonDerivation {
+python2Packages.buildPythonApplication {
   name = "gnome-doc-utils-0.20.10";
+  format = "other";
 
   src = fetchurl {
     url = mirror://gnome/sources/gnome-doc-utils/0.20/gnome-doc-utils-0.20.10.tar.xz;
diff --git a/pkgs/development/tools/misc/d-feet/default.nix b/pkgs/development/tools/misc/d-feet/default.nix
index 2ada782563e5..4fec00a2fd7e 100644
--- a/pkgs/development/tools/misc/d-feet/default.nix
+++ b/pkgs/development/tools/misc/d-feet/default.nix
@@ -4,9 +4,9 @@
 let
   version = "${major}.11";
   major = "0.3";
-in pythonPackages.mkPythonDerivation rec {
+in pythonPackages.buildPythonApplication rec {
   name = "d-feet-${version}";
-  namePrefix = "";
+  format = "other";
 
   src = fetchurl {
     url = "mirror://gnome/sources/d-feet/${major}/d-feet-${version}.tar.xz";
diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix
index c0a6c0a9baa0..1c40493e4ae9 100644
--- a/pkgs/misc/drivers/hplip/default.nix
+++ b/pkgs/misc/drivers/hplip/default.nix
@@ -47,8 +47,9 @@ in
 assert withPlugin -> builtins.elem hplipArch pluginArches
   || throw "HPLIP plugin not supported on ${stdenv.system}";
 
-pythonPackages.mkPythonDerivation {
+pythonPackages.buildPythonApplication {
   inherit name src;
+  format = "other";
 
   buildInputs = [
     libjpeg
diff --git a/pkgs/os-specific/linux/dstat/default.nix b/pkgs/os-specific/linux/dstat/default.nix
index ccedc381504f..366cc9787f28 100644
--- a/pkgs/os-specific/linux/dstat/default.nix
+++ b/pkgs/os-specific/linux/dstat/default.nix
@@ -1,7 +1,8 @@
 { stdenv, fetchurl, python2Packages }:
 
-python2Packages.mkPythonDerivation rec {
+python2Packages.buildPythonApplication rec {
   name = "dstat-${version}";
+  format = "other";
   version = "0.7.3";
 
   src = fetchurl {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index cf06f64421e1..d80c36842352 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -7035,9 +7035,10 @@ in {
     buildInputs = with self; [ fudge_9 nose ];
   };
 
-  fedora_cert = mkPythonDerivation rec {
+  fedora_cert = buildPythonPackage rec {
     name = "fedora-cert-0.5.9.2";
     meta.maintainers = with maintainers; [ mornfall ];
+    format = "other";
 
     src = pkgs.fetchurl {
       url = "https://fedorahosted.org/releases/f/e/fedora-packager/fedora-packager-0.5.9.2.tar.bz2";
@@ -21809,8 +21810,9 @@ in {
   };
 
 
-  pysvn = mkPythonDerivation rec {
+  pysvn = buildPythonPackage rec {
     name = "pysvn-1.8.0";
+    format = "other";
 
     src = pkgs.fetchurl {
       url = "http://pysvn.barrys-emacs.org/source_kits/${name}.tar.gz";
@@ -21965,9 +21967,10 @@ in {
   });
 
 
-  pywebkitgtk = mkPythonDerivation rec {
+  pywebkitgtk = buildPythonPackage rec {
     name = "pywebkitgtk-${version}";
     version = "1.1.8";
+    format = "other";
 
     src = pkgs.fetchurl {
       url = "http://pywebkitgtk.googlecode.com/files/${name}.tar.bz2";
@@ -22300,10 +22303,11 @@ in {
 
   qscintilla = if isPy3k || isPyPy
     then throw "qscintilla-${pkgs.qscintilla.version} not supported for interpreter ${python.executable}"
-    else mkPythonDerivation rec {
+    else buildPythonPackage rec {
       # TODO: Qt5 support
       name = "qscintilla-${version}";
       version = pkgs.qscintilla.version;
+      format = "other";
 
       src = pkgs.qscintilla.src;
 
@@ -25833,9 +25837,10 @@ in {
   # Python package.
   tkinter = let
     py = python.override{x11Support=true;};
-  in mkPythonDerivation rec {
+  in buildPythonPackage rec {
     name = "tkinter-${python.version}";
     src = py;
+    format = "other";
 
     disabled = isPy26 || isPyPy;
 

From 261d7caed794c4e7e8346455e53a2f3a464e7935 Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Tue, 21 Mar 2017 15:51:35 +0300
Subject: [PATCH 018/157] mesa: enable texture floats by default

---
 pkgs/development/libraries/mesa/default.nix | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 1987bbd323ee..d79d9b2859e8 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -5,7 +5,8 @@
 , libelf, libvdpau, python2
 , grsecEnabled ? false
 , enableRadv ? false
-, enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt
+# Texture floats are patented, see docs/patents.txt, but Debian enables them.
+, enableTextureFloats ? true
 , galliumDrivers ? null
 , driDrivers ? null
 , vulkanDrivers ? null

From 7299db431a700768d0b5a6c80ae6e82b748ad0db Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Tue, 21 Mar 2017 11:22:07 -0500
Subject: [PATCH 019/157] fontconfig-penultimate: 0.2 -> 0.2.1

Added package metadata, including license.
---
 pkgs/data/fonts/fontconfig-penultimate/default.nix | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/pkgs/data/fonts/fontconfig-penultimate/default.nix b/pkgs/data/fonts/fontconfig-penultimate/default.nix
index aea3365aba4b..f9d60d6600dc 100644
--- a/pkgs/data/fonts/fontconfig-penultimate/default.nix
+++ b/pkgs/data/fonts/fontconfig-penultimate/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchFromGitHub }:
 
-let version = "0.2"; in
+let version = "0.2.1"; in
 stdenv.mkDerivation {
   name = "fontconfig-penultimate-${version}";
 
@@ -8,11 +8,19 @@ stdenv.mkDerivation {
     owner = "ttuegel";
     repo = "fontconfig-penultimate";
     rev = version;
-    sha256 = "106sjfmxdn2cachgsg0ky3wi676x6nd14y5fcl16n82kghi3d9yf";
+    sha256 = "14arpalmpn7ig2myxslk4jdg6lm0cnmwsxy7zl0j7yr417k1kprf";
   };
 
   installPhase = ''
     mkdir -p $out/etc/fonts/conf.d
     cp *.conf $out/etc/fonts/conf.d
   '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/ttuegel/fontconfig-penultimate;
+    description = "Sensible defaults for Fontconfig";
+    license = licenses.asl20;
+    maintainers = [ maintainers.ttuegel ];
+    platforms = platforms.all;
+  };
 }

From 328bcdae252319bacdac9e9e20d0125af9969e20 Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Tue, 21 Mar 2017 21:56:40 +0300
Subject: [PATCH 020/157] mesa: enable texture floats only for drivers

To be on more safe side. This shouldn't matter theoretically as nothing in core
Mesa depends on them.
---
 pkgs/development/libraries/mesa/default.nix | 5 +++--
 pkgs/top-level/all-packages.nix             | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index d79d9b2859e8..6a5c72f04c3a 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -5,8 +5,9 @@
 , libelf, libvdpau, python2
 , grsecEnabled ? false
 , enableRadv ? false
-# Texture floats are patented, see docs/patents.txt, but Debian enables them.
-, enableTextureFloats ? true
+# Texture floats are patented, see docs/patents.txt, so we don't enable them for full Mesa.
+# It's overridden for mesa_drivers.
+, enableTextureFloats ? false
 , galliumDrivers ? null
 , driDrivers ? null
 , vulkanDrivers ? null
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 458858cfeb01..fcfdd22630cf 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8991,6 +8991,7 @@ with pkgs;
   mesa_drivers = mesaDarwinOr (
     let mo = mesa_noglu.override {
       grsecEnabled = config.grsecurity or false;
+      enableTextureFloats = true;
     };
     in mo.drivers
   );

From 39eda57d2a2abd0d80828ff94541ff342764aad8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Tue, 21 Mar 2017 20:11:31 +0100
Subject: [PATCH 021/157] mesa: maintenance 17.0.1 -> 17.0.2

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

diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 6a5c72f04c3a..eac07ddbfb19 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -65,7 +65,7 @@ let
 in
 
 let
-  version = "17.0.1";
+  version = "17.0.2";
   branch  = head (splitString "." version);
   driverLink = "/run/opengl-driver" + optionalString stdenv.isi686 "-32";
 in
@@ -80,7 +80,7 @@ stdenv.mkDerivation {
       "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
       "https://launchpad.net/mesa/trunk/${version}/+download/mesa-${version}.tar.xz"
     ];
-    sha256 = "96fd70ef5f31d276a17e424e7e1bb79447ccbbe822b56844213ef932e7ad1b0c";
+    sha256 = "f8f191f909e01e65de38d5bdea5fb057f21649a3aed20948be02348e77a689d4";
   };
 
   prePatch = "patchShebangs .";

From 8143413e590cf249b50047906d61eab2ce983c12 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Tue, 21 Mar 2017 21:58:57 +0100
Subject: [PATCH 022/157] pythonPackages.pygobject2: fixup conversation to
 buildPythonPackage

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

diff --git a/pkgs/development/python-modules/pygobject/default.nix b/pkgs/development/python-modules/pygobject/default.nix
index a3658a96bf3d..b72bd8b9b529 100644
--- a/pkgs/development/python-modules/pygobject/default.nix
+++ b/pkgs/development/python-modules/pygobject/default.nix
@@ -3,6 +3,7 @@
 buildPythonPackage rec {
   name = "pygobject-${version}";
   version = "2.28.6";
+  format = "other";
 
   src = fetchurl {
     url = "mirror://gnome/sources/pygobject/2.28/${name}.tar.xz";

From 525a6631747597cd108bed21c26286637038b6a6 Mon Sep 17 00:00:00 2001
From: Guillaume Maudoux <guillaume.maudoux@uclouvain.be>
Date: Tue, 21 Mar 2017 10:28:44 +0100
Subject: [PATCH 023/157] curl, git: Fix curl default CA, let git use it

Improve patching of curl to use NIX_SSL_CERT_FILE as default CA
Remove patches from git, as git uses curl and passes its environment
variables to curl.
---
 .../git-and-tools/git/default.nix             |  1 -
 .../git-and-tools/git/ssl-cert-file.patch     | 14 ---------
 .../networking/curl/nix-ssl-cert-file.patch   | 31 ++++++++++++++++---
 3 files changed, 27 insertions(+), 19 deletions(-)
 delete mode 100644 pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch

diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index af5fc8a8be46..d6cc205bbae4 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -30,7 +30,6 @@ stdenv.mkDerivation {
     ./symlinks-in-bin.patch
     ./git-sh-i18n.patch
     ./ssh-path.patch
-    ./ssl-cert-file.patch
   ];
 
   postPatch = ''
diff --git a/pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch b/pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch
deleted file mode 100644
index 0e0697dfb211..000000000000
--- a/pkgs/applications/version-management/git-and-tools/git/ssl-cert-file.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -ru git-2.7.4-orig/http.c git-2.7.4/http.c
---- git-2.7.4-orig/http.c	2016-03-17 21:47:59.000000000 +0100
-+++ git-2.7.4/http.c	2016-04-12 11:38:33.187070848 +0200
-@@ -544,6 +544,10 @@
- #if LIBCURL_VERSION_NUM >= 0x070908
- 	set_from_env(&ssl_capath, "GIT_SSL_CAPATH");
- #endif
-+	if (getenv("NIX_SSL_CERT_FILE"))
-+	  set_from_env(&ssl_cainfo, "NIX_SSL_CERT_FILE");
-+	else
-+	  set_from_env(&ssl_cainfo, "SSL_CERT_FILE");
- 	set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO");
- 
- 	set_from_env(&user_agent, "GIT_HTTP_USER_AGENT");
diff --git a/pkgs/tools/networking/curl/nix-ssl-cert-file.patch b/pkgs/tools/networking/curl/nix-ssl-cert-file.patch
index 20c408bfae23..14eaea7071bf 100644
--- a/pkgs/tools/networking/curl/nix-ssl-cert-file.patch
+++ b/pkgs/tools/networking/curl/nix-ssl-cert-file.patch
@@ -1,7 +1,30 @@
-diff -ru -x '*~' curl-7.50.3-orig/src/tool_operate.c curl-7.50.3/src/tool_operate.c
---- curl-7.50.3-orig/src/tool_operate.c	2016-09-06 23:25:06.000000000 +0200
-+++ curl-7.50.3/src/tool_operate.c	2016-10-14 11:51:48.999943142 +0200
-@@ -269,7 +269,9 @@
+diff --git a/lib/url.c b/lib/url.c
+index 03feaa20f..43d3baa80 100644
+--- a/lib/url.c
++++ b/lib/url.c
+@@ -574,11 +574,15 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
+ 
+   /* This is our preferred CA cert bundle/path since install time */
+ #if defined(CURL_CA_BUNDLE)
+-  result = setstropt(&set->str[STRING_SSL_CAFILE_ORIG], CURL_CA_BUNDLE);
++  char* env = curl_getenv("NIX_SSL_CERT_FILE");
++  if (!env)
++      env = CURL_CA_BUNDLE;
++
++  result = setstropt(&set->str[STRING_SSL_CAFILE_ORIG], env);
+   if(result)
+     return result;
+ 
+-  result = setstropt(&set->str[STRING_SSL_CAFILE_PROXY], CURL_CA_BUNDLE);
++  result = setstropt(&set->str[STRING_SSL_CAFILE_PROXY], env);
+   if(result)
+     return result;
+ #endif
+diff --git a/src/tool_operate.c b/src/tool_operate.c
+index 572c8d0cc..ca4fb31cb 100644
+--- a/src/tool_operate.c
++++ b/src/tool_operate.c
+@@ -265,7 +265,9 @@ static CURLcode operate_do(struct GlobalConfig *global,
          capath_from_env = true;
        }
        else {

From 8ecb94bb97842f95ca3fb780fc2977ee43b7d554 Mon Sep 17 00:00:00 2001
From: Guillaume Maudoux <guillaume.maudoux@uclouvain.be>
Date: Wed, 22 Mar 2017 11:48:06 +0100
Subject: [PATCH 024/157] curl: Use default trust store of TLS backend

Having curl fall back to openssl's CA means that we need not patch curl
to respect NIX_SSL_CERT_FILE. It will work in all the cases.

This reverts commit fb4c43dd8adbd7a10d1c52539b36e2da269f3f7f "curl: Use CA bundle in nix default profile by default"
If we want to reintroduce that feature, this needs to go inside openssl
---
 pkgs/tools/networking/curl/default.nix        |  6 +--
 .../networking/curl/nix-ssl-cert-file.patch   | 37 -------------------
 2 files changed, 1 insertion(+), 42 deletions(-)
 delete mode 100644 pkgs/tools/networking/curl/nix-ssl-cert-file.patch

diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index f8d1506cca34..4f8daf38d467 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -28,8 +28,6 @@ stdenv.mkDerivation rec {
     sha256 = "1s1hyndva0yp62xy96pcp4anzrvw6cl0abjajim17sbmdp00fwhw";
   };
 
-  patches = [ ./nix-ssl-cert-file.patch ];
-
   outputs = [ "bin" "dev" "out" "man" "devdoc" ];
 
   enableParallelBuilding = true;
@@ -57,9 +55,7 @@ stdenv.mkDerivation rec {
   '';
 
   configureFlags = [
-      # OS X does not have a default system bundle, so we assume cacerts is installed in the default nix-env profile
-      # This sucks. We should probably just include the latest cacerts in the darwin bootstrap.
-      "--with-ca-bundle=${if stdenv.isDarwin then "/nix/var/nix/profiles/default" else ""}/etc/ssl/certs/ca-${if stdenv.isDarwin then "bundle" else "certificates"}.crt"
+      "--with-ca-fallback"
       "--disable-manual"
       ( if sslSupport then "--with-ssl=${openssl.dev}" else "--without-ssl" )
       ( if gnutlsSupport then "--with-gnutls=${gnutls.dev}" else "--without-gnutls" )
diff --git a/pkgs/tools/networking/curl/nix-ssl-cert-file.patch b/pkgs/tools/networking/curl/nix-ssl-cert-file.patch
deleted file mode 100644
index 14eaea7071bf..000000000000
--- a/pkgs/tools/networking/curl/nix-ssl-cert-file.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-diff --git a/lib/url.c b/lib/url.c
-index 03feaa20f..43d3baa80 100644
---- a/lib/url.c
-+++ b/lib/url.c
-@@ -574,11 +574,15 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
- 
-   /* This is our preferred CA cert bundle/path since install time */
- #if defined(CURL_CA_BUNDLE)
--  result = setstropt(&set->str[STRING_SSL_CAFILE_ORIG], CURL_CA_BUNDLE);
-+  char* env = curl_getenv("NIX_SSL_CERT_FILE");
-+  if (!env)
-+      env = CURL_CA_BUNDLE;
-+
-+  result = setstropt(&set->str[STRING_SSL_CAFILE_ORIG], env);
-   if(result)
-     return result;
- 
--  result = setstropt(&set->str[STRING_SSL_CAFILE_PROXY], CURL_CA_BUNDLE);
-+  result = setstropt(&set->str[STRING_SSL_CAFILE_PROXY], env);
-   if(result)
-     return result;
- #endif
-diff --git a/src/tool_operate.c b/src/tool_operate.c
-index 572c8d0cc..ca4fb31cb 100644
---- a/src/tool_operate.c
-+++ b/src/tool_operate.c
-@@ -265,7 +265,9 @@ static CURLcode operate_do(struct GlobalConfig *global,
-         capath_from_env = true;
-       }
-       else {
--        env = curlx_getenv("SSL_CERT_FILE");
-+        env = curlx_getenv("NIX_SSL_CERT_FILE");
-+        if(!env)
-+          env = curlx_getenv("SSL_CERT_FILE");
-         if(env) {
-           config->cacert = strdup(env);
-           if(!config->cacert) {

From c86f05e7ce13e64238960ebf3ee9706142db961b Mon Sep 17 00:00:00 2001
From: Guillaume Maudoux <guillaume.maudoux@uclouvain.be>
Date: Wed, 22 Mar 2017 12:09:09 +0100
Subject: [PATCH 025/157] openssl: default to default profile CA on darwin

---
 pkgs/development/libraries/openssl/default.nix      |  3 ++-
 .../openssl/use-etc-ssl-certs-darwin.patch          | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 pkgs/development/libraries/openssl/use-etc-ssl-certs-darwin.patch

diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 947c0e30f993..a9f8c32dde9b 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -20,7 +20,8 @@ let
     patches =
       (args.patches or [])
       ++ [ ./nix-ssl-cert-file.patch ]
-      ++ optional (versionOlder version "1.1.0") ./use-etc-ssl-certs.patch
+      ++ optional (versionOlder version "1.1.0")
+          (if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch)
       ++ optional stdenv.isCygwin ./1.0.1-cygwin64.patch
       ++ optional
            (versionOlder version "1.0.2" && (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem")))
diff --git a/pkgs/development/libraries/openssl/use-etc-ssl-certs-darwin.patch b/pkgs/development/libraries/openssl/use-etc-ssl-certs-darwin.patch
new file mode 100644
index 000000000000..3d9ee7e6a822
--- /dev/null
+++ b/pkgs/development/libraries/openssl/use-etc-ssl-certs-darwin.patch
@@ -0,0 +1,13 @@
+diff -ru -x '*~' openssl-1.0.1r-orig/crypto/cryptlib.h openssl-1.0.1r/crypto/cryptlib.h
+--- openssl-1.0.1r-orig/crypto/cryptlib.h	2016-01-28 14:38:30.000000000 +0100
++++ openssl-1.0.1r/crypto/cryptlib.h	2016-02-03 12:54:29.193165176 +0100
+@@ -81,8 +81,8 @@
+ 
+ # ifndef OPENSSL_SYS_VMS
+ #  define X509_CERT_AREA          OPENSSLDIR
+ #  define X509_CERT_DIR           OPENSSLDIR "/certs"
+-#  define X509_CERT_FILE          OPENSSLDIR "/cert.pem"
++#  define X509_CERT_FILE          "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt"
+ #  define X509_PRIVATE_DIR        OPENSSLDIR "/private"
+ # else
+ #  define X509_CERT_AREA          "SSLROOT:[000000]"

From d284e37a59ef759b1bdca7f92f8b0278d6a70ad0 Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Wed, 22 Mar 2017 15:48:13 +0100
Subject: [PATCH 026/157] pythonPackages.django: 1.10.5 -> 1.10.6

This is a bugfix release.
---
 .../python-modules/django/1_10.nix            | 35 +++++++++++++++++++
 pkgs/top-level/python-packages.nix            | 32 ++---------------
 2 files changed, 37 insertions(+), 30 deletions(-)
 create mode 100644 pkgs/development/python-modules/django/1_10.nix

diff --git a/pkgs/development/python-modules/django/1_10.nix b/pkgs/development/python-modules/django/1_10.nix
new file mode 100644
index 000000000000..271f8a5467ba
--- /dev/null
+++ b/pkgs/development/python-modules/django/1_10.nix
@@ -0,0 +1,35 @@
+{ stdenv, buildPythonPackage, fetchurl, substituteAll,
+  pythonOlder,
+  geos, gdal
+}:
+buildPythonPackage rec {
+  name = "Django-${version}";
+  version = "1.10.6";
+  disabled = pythonOlder "2.7";
+
+  src = fetchurl {
+    url = "http://www.djangoproject.com/m/releases/1.10/${name}.tar.gz";
+    sha256 = "0q9c7hx720vc0jzq4xlxwhnxmmm8kh0qsqj3l46m29mi98jvwvks";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./1.10-gis-libs.template.patch;
+      geos = geos;
+      gdal = gdal;
+    })
+  ];
+
+  # patch only $out/bin to avoid problems with starter templates (see #3134)
+  postFixup = ''
+    wrapPythonProgramsIn $out/bin "$out $pythonPath"
+  '';
+
+  # too complicated to setup
+  doCheck = false;
+
+  meta = {
+    description = "A high-level Python Web framework";
+    homepage = https://www.djangoproject.com/;
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index d1d2a3983007..0fb356ee1db3 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -10315,36 +10315,8 @@ in {
 
   django = self.django_1_10;
 
-  django_1_10 = buildPythonPackage rec {
-    name = "Django-${version}";
-    version = "1.10.5";
-    disabled = pythonOlder "2.7";
-
-    src = pkgs.fetchurl {
-      url = "http://www.djangoproject.com/m/releases/1.10/${name}.tar.gz";
-      sha256 = "12szjsmnfhh2yr54sfynyjr8vl0q9gb6qak3ayqcifcinrs97f0d";
-    };
-
-    patches = [
-      (pkgs.substituteAll {
-        src = ../development/python-modules/django/1.10-gis-libs.template.patch;
-        geos = pkgs.geos;
-        gdal = self.gdal;
-      })
-    ];
-
-    # patch only $out/bin to avoid problems with starter templates (see #3134)
-    postFixup = ''
-      wrapPythonProgramsIn $out/bin "$out $pythonPath"
-    '';
-
-    # too complicated to setup
-    doCheck = false;
-
-    meta = {
-      description = "A high-level Python Web framework";
-      homepage = https://www.djangoproject.com/;
-    };
+  django_1_10 = callPackage ../development/python-modules/django/1_10.nix {
+    gdal = self.gdal;
   };
 
   django_1_9 = buildPythonPackage rec {

From f13517433db5e42570d8b0cfe698a4c9b44d0bcb Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Mon, 20 Mar 2017 20:15:54 +0300
Subject: [PATCH 027/157] dconf: split outputs

---
 pkgs/desktops/gnome-3/3.22/core/dconf/default.nix | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pkgs/desktops/gnome-3/3.22/core/dconf/default.nix b/pkgs/desktops/gnome-3/3.22/core/dconf/default.nix
index 02c60256e15b..f67dc7e32ae0 100644
--- a/pkgs/desktops/gnome-3/3.22/core/dconf/default.nix
+++ b/pkgs/desktops/gnome-3/3.22/core/dconf/default.nix
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
     sha256 = "1jaqsr1r0grpd25rbsc2v3vb0sc51lia9w31wlqswgqsncp2k0w6";
   };
 
+  outputs = [ "out" "lib" "dev" ];
+
   buildInputs = [ vala_0_32 libxslt pkgconfig glib dbus_glib gnome3.gtk libxml2
                   intltool docbook_xsl docbook_xsl_ns makeWrapper ];
 

From 670744e1fa90a7497de8163d15fdfb95aac6d83d Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Mon, 20 Mar 2017 20:16:11 +0300
Subject: [PATCH 028/157] wrapGAppsHook: propagate dconf

It's effectively required for GTK3 applications because various parts of the library use GIO to store settings.

Also propagate GTK for clarity (it should be there anyway).
---
 pkgs/top-level/all-packages.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e086fd0b153e..4b209fb0f0a0 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -321,7 +321,7 @@ with pkgs;
   findXMLCatalogs = makeSetupHook { } ../build-support/setup-hooks/find-xml-catalogs.sh;
 
   wrapGAppsHook = makeSetupHook {
-    deps = [ makeWrapper ];
+    deps = [ gnome3.dconf.lib gnome3.gtk makeWrapper ];
   } ../build-support/setup-hooks/wrap-gapps-hook.sh;
 
   separateDebugInfo = makeSetupHook { } ../build-support/setup-hooks/separate-debug-info.sh;

From a40b7d07e9013fcc21d54cbb4a01bcfc9c6e68cb Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Mon, 20 Mar 2017 20:18:47 +0300
Subject: [PATCH 029/157] makeQtWrapper, kdeWrapper: add GTK3 dependencies

---
 pkgs/build-support/kde/wrapper.nix                 |  7 ++++---
 pkgs/development/libraries/qt-5/5.7/default.nix    |  4 ++--
 pkgs/development/libraries/qt-5/5.8/default.nix    |  4 ++--
 pkgs/development/libraries/qt-5/make-qt-wrapper.sh | 12 +++++++++++-
 pkgs/top-level/all-packages.nix                    |  6 ++++--
 5 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/pkgs/build-support/kde/wrapper.nix b/pkgs/build-support/kde/wrapper.nix
index f5add12e8eca..228eb696bd9a 100644
--- a/pkgs/build-support/kde/wrapper.nix
+++ b/pkgs/build-support/kde/wrapper.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, makeWrapper, buildEnv }:
+{ stdenv, lib, makeWrapper, buildEnv, gtk3, dconf }:
 
 packages:
 
@@ -47,10 +47,11 @@ stdenv.mkDerivation {
                     --argv0 '"$0"' \
                     --suffix PATH : "$env/bin" \
                     --prefix XDG_CONFIG_DIRS : "$env/etc/xdg" \
-                    --prefix XDG_DATA_DIRS : "$env/share" \
+                    --prefix XDG_DATA_DIRS : "$env/share:${gtk3}/share/gsettings-schemas/${gtk3.name}" \
                     --set QML_IMPORT_PATH "$env/lib/qt5/imports" \
                     --set QML2_IMPORT_PATH "$env/lib/qt5/qml" \
-                    --set QT_PLUGIN_PATH "$env/lib/qt5/plugins"
+                    --set QT_PLUGIN_PATH "$env/lib/qt5/plugins" \
+                    --prefix GIO_EXTRA_MODULES : "${dconf.lib}/lib/gio/modules"
                 good="1"
                 break
             fi
diff --git a/pkgs/development/libraries/qt-5/5.7/default.nix b/pkgs/development/libraries/qt-5/5.7/default.nix
index f387a242101b..91364dd65bb8 100644
--- a/pkgs/development/libraries/qt-5/5.7/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/default.nix
@@ -18,7 +18,7 @@ top-level attribute to `top-level/all-packages.nix`.
   newScope,
   stdenv, fetchurl, makeSetupHook, makeWrapper,
   bison, cups ? null, harfbuzz, mesa, perl,
-  gstreamer, gst-plugins-base,
+  gstreamer, gst-plugins-base, gtk3, dconf,
 
   # options
   developerBuild ? false,
@@ -107,7 +107,7 @@ let
 
       makeQtWrapper =
         makeSetupHook
-        { deps = [ makeWrapper ]; }
+        { deps = [ makeWrapper dconf.lib gtk ]; }
         (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
 
       qmakeHook =
diff --git a/pkgs/development/libraries/qt-5/5.8/default.nix b/pkgs/development/libraries/qt-5/5.8/default.nix
index 85b38c6fc6ce..f02b80706380 100644
--- a/pkgs/development/libraries/qt-5/5.8/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/default.nix
@@ -18,7 +18,7 @@ top-level attribute to `top-level/all-packages.nix`.
   newScope,
   stdenv, fetchurl, makeSetupHook, makeWrapper,
   bison, cups ? null, harfbuzz, mesa, perl,
-  gstreamer, gst-plugins-base,
+  gstreamer, gst-plugins-base, gtk3, dconf,
 
   # options
   developerBuild ? false,
@@ -106,7 +106,7 @@ let
 
       makeQtWrapper =
         makeSetupHook
-        { deps = [ makeWrapper ]; }
+        { deps = [ makeWrapper dconf.lib gtk3 ]; }
         ../make-qt-wrapper.sh;
 
       qmakeHook =
diff --git a/pkgs/development/libraries/qt-5/make-qt-wrapper.sh b/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
index d716a8765263..8f42682fa23e 100644
--- a/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
+++ b/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
@@ -7,6 +7,7 @@ wrapQtProgram() {
         --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
         --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
         --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
+        --prefix GIO_EXTRA_MODULES : "$GIO_EXTRA_MODULES" \
         "$@"
 }
 
@@ -21,6 +22,7 @@ makeQtWrapper() {
         --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
         --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
         --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
+        --prefix GIO_EXTRA_MODULES : "$GIO_EXTRA_MODULES" \
         "$@"
 }
 
@@ -29,8 +31,16 @@ _makeQtWrapperSetup() {
     export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
     export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
     export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
-    export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share"
+    export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share${GSETTINGS_SCHEMAS_PATH:+:$GSETTINGS_SCHEMAS_PATH}"
     export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
 }
 
 prePhases+=(_makeQtWrapperSetup)
+
+_findGioModules() {
+    if [ -d "$1"/lib/gio/modules ] && [ -n "$(ls -A $1/lib/gio/modules)" ] ; then
+        export GIO_EXTRA_MODULES="$GIO_EXTRA_MODULES${GIO_EXTRA_MODULES:+:}$1/lib/gio/modules"
+    fi
+}
+
+envHooks+=(_findGioModules)
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 4b209fb0f0a0..a929c2b85758 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -271,8 +271,8 @@ with pkgs;
 
   kdeDerivation = import ../build-support/kde/derivation.nix { inherit stdenv lib; };
 
-  kdeWrapper = import ../build-support/kde/wrapper.nix {
-    inherit stdenv lib makeWrapper buildEnv;
+  kdeWrapper = callPackage ../build-support/kde/wrapper.nix {
+    inherit (gnome3) dconf;
   };
 
   nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) lib writeText; inherit (emacsPackagesNg) inherit-local; };
@@ -9454,6 +9454,7 @@ with pkgs;
     mesa = mesa_noglu;
     inherit perl;
     inherit (gst_all_1) gstreamer gst-plugins-base;
+    inherit (gnome3) gtk3 dconf;
   });
 
   libsForQt57 = recurseIntoAttrs (lib.makeScope qt57.newScope mkLibsForQt5);
@@ -9467,6 +9468,7 @@ with pkgs;
     mesa = mesa_noglu;
     inherit perl;
     inherit (gst_all_1) gstreamer gst-plugins-base;
+    inherit (gnome3) gtk3 dconf;
   });
 
   libsForQt58 = recurseIntoAttrs (lib.makeScope qt58.newScope mkLibsForQt5);

From 82f7f8ad9a0344384a1f41e60c6665e721065242 Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Tue, 21 Mar 2017 23:33:40 +0300
Subject: [PATCH 030/157] antimicro: wrap Qt application

---
 pkgs/tools/misc/antimicro/default.nix | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pkgs/tools/misc/antimicro/default.nix b/pkgs/tools/misc/antimicro/default.nix
index 710641281e52..02d65597f749 100644
--- a/pkgs/tools/misc/antimicro/default.nix
+++ b/pkgs/tools/misc/antimicro/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, pkgconfig, SDL2, qtbase, qttools, xorg, fetchFromGitHub }:
+{ stdenv, cmake, pkgconfig, SDL2, qtbase, qttools, makeQtWrapper, xorg, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   name = "antimicro-${version}";
@@ -12,9 +12,13 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [
-    cmake pkgconfig SDL2 qtbase qttools xorg.libXtst
+    cmake pkgconfig SDL2 qtbase qttools xorg.libXtst makeQtWrapper
   ];
 
+  postInstall = ''
+    wrapQtProgram $out/bin/antimicro
+  '';
+
   meta = with stdenv.lib; {
     description = "GUI for mapping keyboard and mouse controls to a gamepad";
     inherit (src.meta) homepage;

From be1c8c4d634d7b8240e062f3b8d48d8cc0f70e68 Mon Sep 17 00:00:00 2001
From: Daiderd Jordan <daiderd@gmail.com>
Date: Wed, 22 Mar 2017 20:08:56 +0100
Subject: [PATCH 031/157] fox: fix build with clang >=4 and possibly other
 versions

---
 pkgs/development/libraries/fox/clang.patch | 13 +++++++++++
 pkgs/development/libraries/fox/default.nix | 27 +++++++++++-----------
 2 files changed, 26 insertions(+), 14 deletions(-)
 create mode 100644 pkgs/development/libraries/fox/clang.patch

diff --git a/pkgs/development/libraries/fox/clang.patch b/pkgs/development/libraries/fox/clang.patch
new file mode 100644
index 000000000000..0ca2ebf0d8da
--- /dev/null
+++ b/pkgs/development/libraries/fox/clang.patch
@@ -0,0 +1,13 @@
+diff --git a/src/FXReactor.cpp b/src/FXReactor.cpp
+index 1ecdb45..9058a30 100644
+--- a/src/FXReactor.cpp
++++ b/src/FXReactor.cpp
+@@ -452,7 +452,7 @@ FXint FXReactor::processActiveHandles(FXTime block,FXuint flags){
+     }
+ 
+   // Normal case
+-  if(0<=hand){
++  if(0==hand){
+ 
+     // Any handles active?
+     if(0<nhand){
diff --git a/pkgs/development/libraries/fox/default.nix b/pkgs/development/libraries/fox/default.nix
index 8969e4bd5ba8..1ad765486995 100644
--- a/pkgs/development/libraries/fox/default.nix
+++ b/pkgs/development/libraries/fox/default.nix
@@ -1,20 +1,19 @@
 { stdenv, fetchurl, xlibsWrapper, libpng, libjpeg, libtiff, zlib, bzip2, libXcursor, libXrandr, libXft
 , CoreServices ? null }:
 
-let
-  version = "1.7.9";
-in
-
 stdenv.mkDerivation rec {
   name = "fox-${version}";
+  version = "1.7.9";
 
   src = fetchurl {
     url = "ftp://ftp.fox-toolkit.org/pub/${name}.tar.gz";
     sha256 = "1jb9368xsin3ppdf6979n5s7in3s9klbxqbwcp0z8misjixl7nzg";
   };
 
+  patches = [ ./clang.patch ];
+
   buildInputs = [ libpng xlibsWrapper libjpeg libtiff zlib bzip2 libXcursor libXrandr libXft ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices ];
+    ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
 
   doCheck = true;
 
@@ -22,17 +21,17 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "C++ based class library for building Graphical User Interfaces";
     longDescription = ''
-        FOX stands for Free Objects for X.
-        It is a C++ based class library for building Graphical User Interfaces.
-        Initially, it was developed for LINUX, but the scope of this project has in the course of time become somewhat more ambitious.
-        Current aims are to make FOX completely platform independent, and thus programs written against the FOX library will be only a compile away from running on a variety of platforms.
-      '';
+      FOX stands for Free Objects for X.
+      It is a C++ based class library for building Graphical User Interfaces.
+      Initially, it was developed for LINUX, but the scope of this project has in the course of time become somewhat more ambitious.
+      Current aims are to make FOX completely platform independent, and thus programs written against the FOX library will be only a compile away from running on a variety of platforms.
+    '';
     homepage = "http://fox-toolkit.org";
-    license = stdenv.lib.licenses.lgpl3;
-    maintainers = [ stdenv.lib.maintainers.bbenoist ];
-    platforms = stdenv.lib.platforms.all;
+    license = licenses.lgpl3;
+    maintainers = [ maintainers.bbenoist ];
+    platforms = platforms.all;
   };
 }

From bab3594b54dc51d340a8780a53dcb851ea77ad6b Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 22 Mar 2017 16:52:52 -0500
Subject: [PATCH 032/157] gogs: 0.9.113 -> 0.10.18

---
 .../version-management/gogs/default.nix       | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/pkgs/applications/version-management/gogs/default.nix b/pkgs/applications/version-management/gogs/default.nix
index b9a1f2e7a843..4ab97cc06d2a 100644
--- a/pkgs/applications/version-management/gogs/default.nix
+++ b/pkgs/applications/version-management/gogs/default.nix
@@ -3,25 +3,26 @@
 , sqliteSupport ? true
 }:
 
+with stdenv.lib;
+
 buildGoPackage rec {
   name = "gogs-${version}";
-  version = "0.9.113";
+  version = "0.10.18";
 
   src = fetchFromGitHub {
     owner = "gogits";
     repo = "gogs";
     rev = "v${version}";
-    sha256 = "1zk83c9jiazfw3221yi2sidp7917q3dxb2xb7wrjg4an18gj46j7";
+    sha256 = "1f1dlickjpdilf4j295i9v2h4ig4pf5d2mnpbr59wh14bby4bh0y";
   };
 
   patchPhase = ''
-    substituteInPlace models/repo.go \
-      --replace '#!/usr/bin/env' '#!${coreutils}/bin/env'
-  '';
+    patchShebangs .
+    '';
 
-  buildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ makeWrapper ];
 
-  buildFlags = stdenv.lib.optionalString sqliteSupport "-tags sqlite";
+  buildFlags = optionalString sqliteSupport "-tags sqlite";
 
   outputs = [ "bin" "out" "data" ];
 
@@ -30,7 +31,7 @@ buildGoPackage rec {
     cp -R $src/{public,templates} $data
 
     wrapProgram $bin/bin/gogs \
-      --prefix PATH : ${stdenv.lib.makeBinPath [ bash git gzip openssh ]} \
+      --prefix PATH : ${makeBinPath [ bash git gzip openssh ]} \
       --run 'export GOGS_WORK_DIR=''${GOGS_WORK_DIR:-$PWD}' \
       --run 'mkdir -p "$GOGS_WORK_DIR" && cd "$GOGS_WORK_DIR"' \
       --run "ln -fs $data/{public,templates} ."
@@ -42,7 +43,7 @@ buildGoPackage rec {
   meta = {
     description = "A painless self-hosted Git service";
     homepage = "https://gogs.io";
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [ schneefux ];
+    license = licenses.mit;
+    maintainers = [ maintainers.schneefux ];
   };
 }

From d09ed00e2ded5fe545402d347669baee47da7e70 Mon Sep 17 00:00:00 2001
From: Richard Lupton <richard.lupton@gmail.com>
Date: Wed, 22 Mar 2017 22:44:19 +0000
Subject: [PATCH 033/157] cde: init at 0.1

---
 pkgs/tools/package-management/cde/default.nix | 34 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 ++
 2 files changed, 36 insertions(+)
 create mode 100644 pkgs/tools/package-management/cde/default.nix

diff --git a/pkgs/tools/package-management/cde/default.nix b/pkgs/tools/package-management/cde/default.nix
new file mode 100644
index 000000000000..8261cc9e4cfa
--- /dev/null
+++ b/pkgs/tools/package-management/cde/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchgit }:
+
+stdenv.mkDerivation {
+  name = "cde-0.1";
+  src = fetchgit {
+    url = "https://github.com/pgbovine/CDE.git";
+    sha256 = "";
+    rev = "551e54d95eb3f8eefc698891f1b873fc4f02f360";
+  };
+
+  # The build is small, so there should be no problem
+  # running this locally. There is also a use case for
+  # older systems, where modern binaries might not be
+  # useful.
+  preferLocalBuild = true;
+
+  patchBuild = ''
+    sed '/install/d' $src/Makefile > $src/Makefile
+  '';
+  
+  installPhase = ''
+    mkdir -p $out/bin
+    cp cde $out/bin
+    cp cde-exec $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/pgbovine/CDE";
+    description = "A packaging tool for building portable packages";
+    license = licenses.gpl3;
+    maintainers = [ maintainers.rlupton20 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e086fd0b153e..489eddb0a151 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -736,6 +736,8 @@ with pkgs;
 
   catclock = callPackage ../applications/misc/catclock { };
 
+  cde = callPackage ../tools/package-management/cde { };
+  
   cdemu-daemon = callPackage ../misc/emulators/cdemu/daemon.nix { };
 
   cdemu-client = callPackage ../misc/emulators/cdemu/client.nix { };

From 375639518d0fcf7e8b73d8d3c9e072549b6bbc73 Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 22 Mar 2017 17:46:41 -0500
Subject: [PATCH 034/157] freicoin: 0.8.3-1 -> 0.8.6-2; Moved to correct
 category

---
 pkgs/applications/altcoins/default.nix      |  1 +
 pkgs/applications/altcoins/freicoin.nix     | 32 +++++++++++++++++++++
 pkgs/applications/misc/freicoin/default.nix | 28 ------------------
 pkgs/top-level/all-packages.nix             |  4 ---
 4 files changed, 33 insertions(+), 32 deletions(-)
 create mode 100644 pkgs/applications/altcoins/freicoin.nix
 delete mode 100644 pkgs/applications/misc/freicoin/default.nix

diff --git a/pkgs/applications/altcoins/default.nix b/pkgs/applications/altcoins/default.nix
index 1d9b897188d7..9c19be3cc524 100644
--- a/pkgs/applications/altcoins/default.nix
+++ b/pkgs/applications/altcoins/default.nix
@@ -16,6 +16,7 @@ rec {
   dogecoin  = callPackage ./dogecoin.nix { withGui = true; };
   dogecoind = callPackage ./dogecoin.nix { withGui = false; };
 
+  freicoin = callPackage ../freicoin.nix { boost = boost155; };
   go-ethereum = callPackage ./go-ethereum.nix { };
 
   litecoin  = callPackage ./litecoin.nix { withGui = true; };
diff --git a/pkgs/applications/altcoins/freicoin.nix b/pkgs/applications/altcoins/freicoin.nix
new file mode 100644
index 000000000000..f7cd04f1be4e
--- /dev/null
+++ b/pkgs/applications/altcoins/freicoin.nix
@@ -0,0 +1,32 @@
+{ fetchFromGitHub, stdenv, db, boost, gmp, mpfr, miniupnpc, qt4, qmake4Hook, unzip }:
+
+stdenv.mkDerivation rec {
+  version = "0.8.6-2";
+  name = "freicoin-${version}";
+
+  src = fetchFromGitHub {
+    owner = "freicoin";
+    repo = "freicoin";
+    rev = "v${version}";
+    sha256 = "1m5pcnfhwhcj7q00p2sy3h73rkdm3w6grmljgiq53gshcj08cq1z";
+  };
+
+  # I think that openssl and zlib are required, but come through other
+  # packages
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp freicoin-qt $out/bin
+    '';
+
+  nativeBuildInputs = [ qmake4Hook ];
+  buildInputs = [ db boost gmp mpfr miniupnpc qt4 ];
+
+  meta = with stdenv.lib; {
+    description = "Peer-to-peer currency with demurrage fee";
+    homepage = http://freicoi.in/;
+    license = licenses.mit;
+    maintainers = [ maintainers.viric ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/misc/freicoin/default.nix b/pkgs/applications/misc/freicoin/default.nix
deleted file mode 100644
index b4e71d4bbc75..000000000000
--- a/pkgs/applications/misc/freicoin/default.nix
+++ /dev/null
@@ -1,28 +0,0 @@
-{ fetchurl, stdenv, db, boost, gmp, mpfr, miniupnpc, qt4, qmake4Hook, unzip }:
-
-stdenv.mkDerivation rec {
-  version = "0.8.3-1";
-  name = "freicoin-${version}";
-
-  src = fetchurl {
-    url = "https://github.com/freicoin/freicoin/archive/v${version}.zip";
-    sha256 = "0v3mh8a96nnb86mkyaylyjj7qfdrl7i9gvybh7f8w2hrl9paszfh";
-  };
-
-  # I think that openssl and zlib are required, but come through other
-  # packages
-  buildInputs = [ db boost gmp mpfr miniupnpc qt4 unzip qmake4Hook ];
-
-  installPhase = ''
-    mkdir -p $out/bin
-    cp freicoin-qt $out/bin
-  '';
-
-  meta = {
-    description = "Peer-to-peer currency with demurrage fee";
-    homepage = "http://freicoi.in/";
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e086fd0b153e..6e5a2afa1044 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -13771,10 +13771,6 @@ with pkgs;
     ffmpeg = ffmpeg_1;
   };
 
-  freicoin = callPackage ../applications/misc/freicoin {
-    boost = boost155;
-  };
-
   fte = callPackage ../applications/editors/fte { };
 
   game-music-emu = callPackage ../applications/audio/game-music-emu { };

From bd0f070b98b87ce65baafe2007b0ef52a0bc88cd Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 22 Mar 2017 20:27:43 -0500
Subject: [PATCH 035/157] get_iplayer: 2.97 -> 2.99

---
 .../applications/misc/get_iplayer/default.nix | 29 +++++++++++--------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/pkgs/applications/misc/get_iplayer/default.nix b/pkgs/applications/misc/get_iplayer/default.nix
index a858fefa8c2b..d024b0fce99e 100644
--- a/pkgs/applications/misc/get_iplayer/default.nix
+++ b/pkgs/applications/misc/get_iplayer/default.nix
@@ -1,9 +1,20 @@
-{stdenv, fetchurl, atomicparsley, flvstreamer, ffmpeg, makeWrapper, perl, buildPerlPackage, perlPackages, rtmpdump}:
+{stdenv, fetchFromGitHub, atomicparsley, flvstreamer, ffmpeg, makeWrapper, perl, buildPerlPackage, perlPackages, rtmpdump}:
+
+with stdenv.lib;
+
 buildPerlPackage rec {
   name = "get_iplayer-${version}";
-  version = "2.97";
+  version = "2.99";
+  
+  src = fetchFromGitHub {
+    owner = "get-iplayer";
+    repo = "get_iplayer";
+    rev = "v${version}";
+    sha256 = "085bgwkjnaqp96gvd2s8qmkw69rz91si1sgzqdqbplkzj9bk2qii";
+  };
 
-  buildInputs = [makeWrapper perl];
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perl ];
   propagatedBuildInputs = with perlPackages; [HTMLParser HTTPCookies LWP XMLLibXML XMLSimple];
 
   preConfigure = "touch Makefile.PL";
@@ -13,21 +24,15 @@ buildPerlPackage rec {
   installPhase = ''
     mkdir -p $out/bin $out/share/man/man1
     cp get_iplayer $out/bin
-    wrapProgram $out/bin/get_iplayer --suffix PATH : ${stdenv.lib.makeBinPath [ atomicparsley ffmpeg flvstreamer rtmpdump ]} --prefix PERL5LIB : $PERL5LIB
+    wrapProgram $out/bin/get_iplayer --suffix PATH : ${makeBinPath [ atomicparsley ffmpeg flvstreamer rtmpdump ]} --prefix PERL5LIB : $PERL5LIB
     cp get_iplayer.1 $out/share/man/man1
   '';
-  
-  src = fetchurl {
-    url = "https://github.com/get-iplayer/get_iplayer/archive/v${version}.tar.gz";
-    sha256 = "0bb6kmzjmazwfxq5ip7yxm39vssfgz3v5vfx1114wfssp6pw0r44";
-  };
 
   meta = {
     description = "Downloads TV and radio from BBC iPlayer";
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = licenses.gpl3Plus;
     homepage = https://squarepenguin.co.uk/;
-    downloadPage = https://github.com/get-iplayer/get_iplayer/releases;
-    platforms = stdenv.lib.platforms.all;
+    platforms = platforms.all;
   };
   
 }

From 5fbdb796cd8a1e5a87a71f3846ed0fe852f96cf2 Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 22 Mar 2017 20:35:44 -0500
Subject: [PATCH 036/157] gkrellm: 2.3.5 -> 2.3.10

---
 pkgs/applications/misc/gkrellm/default.nix | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/pkgs/applications/misc/gkrellm/default.nix b/pkgs/applications/misc/gkrellm/default.nix
index d6a59a89be65..86b6d532be45 100644
--- a/pkgs/applications/misc/gkrellm/default.nix
+++ b/pkgs/applications/misc/gkrellm/default.nix
@@ -1,15 +1,19 @@
 { fetchurl, stdenv, gettext, pkgconfig, glib, gtk2, libX11, libSM, libICE
 , IOKit ? null }:
 
+with stdenv.lib;
+
 stdenv.mkDerivation rec {
-  name = "gkrellm-2.3.5";
+  name = "gkrellm-2.3.10";
+
   src = fetchurl {
-    url = "http://members.dslextreme.com/users/billw/gkrellm/${name}.tar.bz2";
-    sha256 = "12rc6zaa7kb60b9744lbrlfkxxfniprm6x0mispv63h4kh75navh";
+    url = "http://gkrellm.srcbox.net/releases/${name}.tar.bz2";
+    sha256 = "0rnpzjr0ys0ypm078y63q4aplcgdr5nshjzhmz330n6dmnxci7lb";
   };
 
-  buildInputs = [gettext pkgconfig glib gtk2 libX11 libSM libICE]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ IOKit ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [gettext glib gtk2 libX11 libSM libICE]
+    ++ optionals stdenv.isDarwin [ IOKit ];
 
   hardeningDisable = [ "format" ];
 
@@ -22,12 +26,11 @@ stdenv.mkDerivation rec {
        sed -i "$i" -e "s|/usr/X11R6|${libX11.dev}|g ; s|-lICE|-lX11 -lICE|g"
      done '';
 
-  buildPhase = ''
-     make PREFIX="$out" '';
-  installPhase = ''
-     make install PREFIX="$out" '';
+   installPhase = ''
+     make DESTDIR=$out install
+     '';
 
-  meta = {
+   meta = {
     description = "Themeable process stack of system monitors";
     longDescription =
       '' GKrellM is a single process stack of system monitors which supports
@@ -36,9 +39,8 @@ stdenv.mkDerivation rec {
       '';
 
     homepage = http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html;
-    license = stdenv.lib.licenses.gpl3Plus;
-
+    license = licenses.gpl3Plus;
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = platforms.unix;
   };
 }

From 2477196fb1f4693d85844a63b714ddeb5b0453ee Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 22 Mar 2017 20:44:55 -0500
Subject: [PATCH 037/157] gpa: 0.9.9 -> 0.9.10

---
 pkgs/applications/misc/gpa/default.nix | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkgs/applications/misc/gpa/default.nix b/pkgs/applications/misc/gpa/default.nix
index 600a54931217..ef805a31567a 100644
--- a/pkgs/applications/misc/gpa/default.nix
+++ b/pkgs/applications/misc/gpa/default.nix
@@ -1,14 +1,15 @@
 { stdenv, fetchurl, intltool, pkgconfig, gtk2, gpgme, libgpgerror, libassuan }:
 
 stdenv.mkDerivation rec {
-  name = "gpa-0.9.9";
+  name = "gpa-0.9.10";
 
   src = fetchurl {
     url = "mirror://gnupg/gpa/${name}.tar.bz2";
-    sha256 = "0d235hcqai7m3qb7m9kvr2r4qg4714f87j9fdplwrlz1p4wdfa38";
+    sha256 = "09xphbi2456qynwqq5n0yh0zdmdi2ggrj3wk4hsyh5lrzlvcrff3";
   };
 
-  buildInputs = [ intltool pkgconfig gtk2 gpgme libgpgerror libassuan ];
+  nativeBuildInputs = [ intltool pkgconfig ];
+  buildInputs = [ gtk2 gpgme libgpgerror libassuan ];
 
   meta = with stdenv.lib; {
     description = "Graphical user interface for the GnuPG";

From edf32f90e6ab4af0e6a53466654dae4a4447aced Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Wed, 22 Mar 2017 14:46:55 -0500
Subject: [PATCH 038/157] plasma5: 5.9.3 -> 5.9.4

---
 pkgs/desktops/plasma-5/fetch.sh               |   2 +-
 pkgs/desktops/plasma-5/srcs.nix               | 320 +++++++++---------
 .../libraries/kde-frameworks/kio/default.nix  |   9 +-
 3 files changed, 162 insertions(+), 169 deletions(-)

diff --git a/pkgs/desktops/plasma-5/fetch.sh b/pkgs/desktops/plasma-5/fetch.sh
index acf7f54f0ed8..cf9327d7a60d 100644
--- a/pkgs/desktops/plasma-5/fetch.sh
+++ b/pkgs/desktops/plasma-5/fetch.sh
@@ -1 +1 @@
-WGET_ARGS=( http://download.kde.org/stable/plasma/5.9.3/ -A '*.tar.xz' )
+WGET_ARGS=( http://download.kde.org/stable/plasma/5.9.4/ -A '*.tar.xz' )
diff --git a/pkgs/desktops/plasma-5/srcs.nix b/pkgs/desktops/plasma-5/srcs.nix
index eff7a816a09a..c156de40caed 100644
--- a/pkgs/desktops/plasma-5/srcs.nix
+++ b/pkgs/desktops/plasma-5/srcs.nix
@@ -3,323 +3,323 @@
 
 {
   bluedevil = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/bluedevil-5.9.3.tar.xz";
-      sha256 = "0cfk0khcd62ficsmpxhiqwfdgwzv771ndlf0s7b8ghqqyckq6bld";
-      name = "bluedevil-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/bluedevil-5.9.4.tar.xz";
+      sha256 = "1a31vsaiy7kzbw79kjiia5a966xc9ba3phxhyqmdzvllf9jw5xdc";
+      name = "bluedevil-5.9.4.tar.xz";
     };
   };
   breeze = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/breeze-5.9.3.tar.xz";
-      sha256 = "0f1h7ky9chsnbm8r85lwipc1sh7kb32jdaj3wl9qd7k0q4j115x0";
-      name = "breeze-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/breeze-5.9.4.tar.xz";
+      sha256 = "07i13g9iyq9j2vx22z7krnkahil3qljxpzgmqai8m67gwhgvn1zj";
+      name = "breeze-5.9.4.tar.xz";
     };
   };
   breeze-grub = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/breeze-grub-5.9.3.tar.xz";
-      sha256 = "1hbvmyj1f5f8v0pc70w93ck27xw25m4x70vnbhgqi91y5dd1gh49";
-      name = "breeze-grub-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/breeze-grub-5.9.4.tar.xz";
+      sha256 = "0rn7dgmw495575lcsnlgvx8r8sjjaaw3b1s0l43d2r186zay0nkr";
+      name = "breeze-grub-5.9.4.tar.xz";
     };
   };
   breeze-gtk = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/breeze-gtk-5.9.3.tar.xz";
-      sha256 = "12qa4wllgr52ycdprlxq0h4pgykbbs0vbmmmiardpzlrplm0an26";
-      name = "breeze-gtk-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/breeze-gtk-5.9.4.tar.xz";
+      sha256 = "1xjrhi6cq5dd5qslphdjrg018ni1z9xdac7cg33wl8bsvzcl0xgl";
+      name = "breeze-gtk-5.9.4.tar.xz";
     };
   };
   breeze-plymouth = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/breeze-plymouth-5.9.3.tar.xz";
-      sha256 = "0vz0hgx3hl03h4rkfrcaydaddljam3jbg6gd7n600a068p74s2mm";
-      name = "breeze-plymouth-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/breeze-plymouth-5.9.4.tar.xz";
+      sha256 = "1vwlvnbsc67xzqvrpgkva1rlim075x9ffjlsxfk38gmq00b7s88g";
+      name = "breeze-plymouth-5.9.4.tar.xz";
     };
   };
   discover = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/discover-5.9.3.tar.xz";
-      sha256 = "0xkf08k4jz5ym406bpnjf3xsx0il9wka4jp2k38bkl3sxh2s900f";
-      name = "discover-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/discover-5.9.4.tar.xz";
+      sha256 = "1pf2qawa32x94ljqscfbpmkbxk5awlqbf9jw9w7rfqwd5z9cgzzf";
+      name = "discover-5.9.4.tar.xz";
     };
   };
   kactivitymanagerd = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kactivitymanagerd-5.9.3.tar.xz";
-      sha256 = "0ywby3ijq4hjljy5qwd7rybpk2x4scairjffiy5n1jg7lq6sm44r";
-      name = "kactivitymanagerd-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kactivitymanagerd-5.9.4.tar.xz";
+      sha256 = "04i4zmbblsx3xz3vq4m88qd3ky0r5v26ivjchzpcpgkczqv85x1j";
+      name = "kactivitymanagerd-5.9.4.tar.xz";
     };
   };
   kde-cli-tools = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kde-cli-tools-5.9.3.tar.xz";
-      sha256 = "1p9zjp9jmknyh82d6av3xhy461fsdppjxrxbmrlm9z6nsjyp0m0a";
-      name = "kde-cli-tools-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kde-cli-tools-5.9.4.tar.xz";
+      sha256 = "1a2ssv7mphqnzwphd8nkh0g0g4w9b2r0ah0a9wd5ssnr5xg3izm8";
+      name = "kde-cli-tools-5.9.4.tar.xz";
     };
   };
   kdecoration = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kdecoration-5.9.3.tar.xz";
-      sha256 = "1z37llaqf9mrb4aif75dfvbhr51rrgfpncv70v916jddcf90q4i9";
-      name = "kdecoration-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kdecoration-5.9.4.tar.xz";
+      sha256 = "12cfp4svhxfygbjhymnmwyryx6r117mkdy2iq9adbq5af3gak972";
+      name = "kdecoration-5.9.4.tar.xz";
     };
   };
   kde-gtk-config = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kde-gtk-config-5.9.3.tar.xz";
-      sha256 = "1wxk3brwq105258ndx5l98n78q2h2idigkpp5s2xzmzw05m3gg6r";
-      name = "kde-gtk-config-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kde-gtk-config-5.9.4.tar.xz";
+      sha256 = "0cg3myr3jr9i4vxpqbd8gs7yrscxn15a96zqvgsbjczlfmxanq86";
+      name = "kde-gtk-config-5.9.4.tar.xz";
     };
   };
   kdeplasma-addons = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kdeplasma-addons-5.9.3.tar.xz";
-      sha256 = "1k3fsrafrd72qymyi2ij36al7k92mnssz90kmmh830pszif16js3";
-      name = "kdeplasma-addons-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kdeplasma-addons-5.9.4.tar.xz";
+      sha256 = "019d3d3pkw1c6l7dggasr7g7yj9kl3xd2hsawch1s9ba420fd6fp";
+      name = "kdeplasma-addons-5.9.4.tar.xz";
     };
   };
   kgamma5 = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kgamma5-5.9.3.tar.xz";
-      sha256 = "02s3j1c5gjcv7b79448sizs6hdw91jysq9prkzznprw6jbb615v1";
-      name = "kgamma5-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kgamma5-5.9.4.tar.xz";
+      sha256 = "0qwgjdrjfc48d8j62iwz6d61nxd7ddcsxn7wmxgbgl3l36p5j0jv";
+      name = "kgamma5-5.9.4.tar.xz";
     };
   };
   khotkeys = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/khotkeys-5.9.3.tar.xz";
-      sha256 = "0jv77rpx01cl15qf9vzndpks2q2lgq8dhjq4pg34zh8khr03snlf";
-      name = "khotkeys-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/khotkeys-5.9.4.tar.xz";
+      sha256 = "0lhgkvnrzsxpw6vpn0xam1a4dgkfb0k9h3nchaf93fyl8745j4q0";
+      name = "khotkeys-5.9.4.tar.xz";
     };
   };
   kinfocenter = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kinfocenter-5.9.3.tar.xz";
-      sha256 = "14zaqrjf77008dc5c071hw75vd4dwvvmgkyz74vhs94i7bspzy6a";
-      name = "kinfocenter-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kinfocenter-5.9.4.tar.xz";
+      sha256 = "14vf27s501r6ac2gxashwi3ynlcncjp03rahz61wry1dsm9wsc4x";
+      name = "kinfocenter-5.9.4.tar.xz";
     };
   };
   kmenuedit = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kmenuedit-5.9.3.tar.xz";
-      sha256 = "1m7naiy6jq031psdx4jsxq7vsldn9j4girq820m24inh2ky105zk";
-      name = "kmenuedit-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kmenuedit-5.9.4.tar.xz";
+      sha256 = "1lx7g67qc7amx8jsna7b13hhq85pv4969d9824qfciwywj19sx4x";
+      name = "kmenuedit-5.9.4.tar.xz";
     };
   };
   kscreen = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kscreen-5.9.3.tar.xz";
-      sha256 = "1z3cihgjqrkg5h4y4gm1ah60r0vfpxrngry10fcc6343arbyk1bb";
-      name = "kscreen-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kscreen-5.9.4.tar.xz";
+      sha256 = "1g4i4rwnmni3q3crbywkp0s199bp0bl8cx97d37cp9qh6drsgrxx";
+      name = "kscreen-5.9.4.tar.xz";
     };
   };
   kscreenlocker = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kscreenlocker-5.9.3.tar.xz";
-      sha256 = "0ccpgfp1gz07yiw98sqjlc097cac4z9qdcrwxm65bvqjj777by1a";
-      name = "kscreenlocker-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kscreenlocker-5.9.4.tar.xz";
+      sha256 = "0cn194bmab7qgv1x7gg81l0mj3k9x1is9whn8h7g02pzn5c6gqlj";
+      name = "kscreenlocker-5.9.4.tar.xz";
     };
   };
   ksshaskpass = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/ksshaskpass-5.9.3.tar.xz";
-      sha256 = "0jk6k5bn2aqjjl3li5qpmihk57d5hc197cpqjaj61a0bapab42hw";
-      name = "ksshaskpass-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/ksshaskpass-5.9.4.tar.xz";
+      sha256 = "1w1m55i8i9f3npcczqiy1knarbh2j4cp8ispif1s4j6k3vixqnka";
+      name = "ksshaskpass-5.9.4.tar.xz";
     };
   };
   ksysguard = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/ksysguard-5.9.3.tar.xz";
-      sha256 = "0paypcwah41p2ygmfwzhw8mdfh47a6x0190yngxn8j0jhzfyllca";
-      name = "ksysguard-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/ksysguard-5.9.4.tar.xz";
+      sha256 = "04hzqkna22vsa12z04cy50s2jzglllfhd5vz33vk2wj6zgghwd0h";
+      name = "ksysguard-5.9.4.tar.xz";
     };
   };
   kwallet-pam = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kwallet-pam-5.9.3.tar.xz";
-      sha256 = "1pmsfp6pn1r3crg5z5v7sz413v9qvn0j4n9l88zbw538lz2scpna";
-      name = "kwallet-pam-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kwallet-pam-5.9.4.tar.xz";
+      sha256 = "0l6ganmp2ml0icfkrqcq4vngm8f4pl76p6w13a3m8x2k2wrsbynw";
+      name = "kwallet-pam-5.9.4.tar.xz";
     };
   };
   kwayland-integration = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kwayland-integration-5.9.3.tar.xz";
-      sha256 = "1r3cryv10lkvl1nrpq21w4kj9jd270m3p3dw07d888b891rgmzb7";
-      name = "kwayland-integration-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kwayland-integration-5.9.4.tar.xz";
+      sha256 = "11vqi293azv5cpz2rrngxsqqaj7swcmxivgm688yz6wzbm8gyd1x";
+      name = "kwayland-integration-5.9.4.tar.xz";
     };
   };
   kwin = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kwin-5.9.3.tar.xz";
-      sha256 = "119cy472x5ssrr54v14pbs85gfrsjhz99ms8flb1xp38jb14xxhk";
-      name = "kwin-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kwin-5.9.4.tar.xz";
+      sha256 = "0qckhk6vd31mwhawb0i636l4vx99v0v84nam2dhpd0rcdk2b0dm1";
+      name = "kwin-5.9.4.tar.xz";
     };
   };
   kwrited = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/kwrited-5.9.3.tar.xz";
-      sha256 = "0liqspd4m6xly48vv85abnaxfvsjcbgg58843j9fpnzkk9nlj98q";
-      name = "kwrited-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/kwrited-5.9.4.tar.xz";
+      sha256 = "1prbn0f6a1cywn2ivzv39bxfc5nxmgxp7gqlxqg87ajig43gvdb7";
+      name = "kwrited-5.9.4.tar.xz";
     };
   };
   libkscreen = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/libkscreen-5.9.3.tar.xz";
-      sha256 = "1nxhbxmr0kmyp745bf3vd21xcjpv7jac9bdagraiqfcmwj4f86gb";
-      name = "libkscreen-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/libkscreen-5.9.4.tar.xz";
+      sha256 = "1h39910ry59wd179fk02ck10ydaby3il4q3rnxlnn9qph0kiy3pv";
+      name = "libkscreen-5.9.4.tar.xz";
     };
   };
   libksysguard = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/libksysguard-5.9.3.tar.xz";
-      sha256 = "0fj7rycawarg7iydml0xw20nkyxlwa2nl5chxbbcs5mnmvpfv6ig";
-      name = "libksysguard-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/libksysguard-5.9.4.tar.xz";
+      sha256 = "1gpfqr8prk96vwy9dkxlgf4lc3ck04a31src9mix8a6wrr01ppqm";
+      name = "libksysguard-5.9.4.tar.xz";
     };
   };
   milou = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/milou-5.9.3.tar.xz";
-      sha256 = "1pmk9czmpz0mfqmkv7gl9wdlj8b7wwixv1zb43q24a471qby2xf3";
-      name = "milou-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/milou-5.9.4.tar.xz";
+      sha256 = "18xzx99ml6gcglly9p98rscs6dxhdgn9pkc5mn7apwnp7865kbfw";
+      name = "milou-5.9.4.tar.xz";
     };
   };
   oxygen = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/oxygen-5.9.3.tar.xz";
-      sha256 = "1v529wp9ll1hzb48xswigzf2r23k84f4cd7am2fnj73p3a0rg5ia";
-      name = "oxygen-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/oxygen-5.9.4.tar.xz";
+      sha256 = "0fmysq3j0v18hz6hfp7qgrj3ghmaf3c1gam9c9263sf9q1dghk0q";
+      name = "oxygen-5.9.4.tar.xz";
     };
   };
   plasma-desktop = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-desktop-5.9.3.tar.xz";
-      sha256 = "0582n21nd15834mxc54pq1nx9a5z8ds3yz0x0lc5m35ps7abh7im";
-      name = "plasma-desktop-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-desktop-5.9.4.tar.xz";
+      sha256 = "1p3iq5rmfznsi4174zjavs945wysf763ha46vd83mz0w7583j6cd";
+      name = "plasma-desktop-5.9.4.tar.xz";
     };
   };
   plasma-integration = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-integration-5.9.3.tar.xz";
-      sha256 = "1yq3i0sqsn0m2y62npyad1nv17hgc0fm35cfq5fdjd96sr356znl";
-      name = "plasma-integration-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-integration-5.9.4.tar.xz";
+      sha256 = "1mk59p214184m2q8wfik8gkfxxikrvric0v8c09lamybg15pas8m";
+      name = "plasma-integration-5.9.4.tar.xz";
     };
   };
   plasma-nm = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-nm-5.9.3.tar.xz";
-      sha256 = "1i5djnbimkwcbjh6bi0cdw98qskli4jd1c8a8dbwqqh5pyqbrf66";
-      name = "plasma-nm-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-nm-5.9.4.tar.xz";
+      sha256 = "0sbvyyhx7gxg1li5y1h7jv1s3krp2ch6zzhm9ad1l17w589kij9x";
+      name = "plasma-nm-5.9.4.tar.xz";
     };
   };
   plasma-pa = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-pa-5.9.3.tar.xz";
-      sha256 = "0br83bnm6g7lzw4hwkppk8l6scbzblr3m3mi64a852lnxxvdwn01";
-      name = "plasma-pa-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-pa-5.9.4.tar.xz";
+      sha256 = "0hincgm6x613sw3mywq64i27laahqzy7qjiv24g8h3ppw75a32i8";
+      name = "plasma-pa-5.9.4.tar.xz";
     };
   };
   plasma-sdk = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-sdk-5.9.3.tar.xz";
-      sha256 = "104rhybchdjqnglzp3bpjv8052n2gi44bn58nyb6wz6gkzg3xzrb";
-      name = "plasma-sdk-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-sdk-5.9.4.tar.xz";
+      sha256 = "0nw49kaw7323dmaq8hh4zrhvy6ga6svg2g0zhxj0cjjwgbk31pfw";
+      name = "plasma-sdk-5.9.4.tar.xz";
     };
   };
   plasma-tests = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-tests-5.9.3.tar.xz";
-      sha256 = "1wpbfna9yjvzc5fhgnw2hwnq04vzb3qfy42zrwbijy8sl6csgzzp";
-      name = "plasma-tests-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-tests-5.9.4.tar.xz";
+      sha256 = "0m6dlx29785kh1pxm0xyym85k475s8gdjds6ywgpblj9lh5rm4v5";
+      name = "plasma-tests-5.9.4.tar.xz";
     };
   };
   plasma-workspace = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-workspace-5.9.3.tar.xz";
-      sha256 = "0lnb36qnkw5z7w1y5ykiz6xfhc4h21dzlbhddipvd97bxycad6vg";
-      name = "plasma-workspace-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-workspace-5.9.4.tar.xz";
+      sha256 = "0pazgn45a445wknd3xp7jnsg6k5ddqv4pjrz2ggkbaz9mrllgbqm";
+      name = "plasma-workspace-5.9.4.tar.xz";
     };
   };
   plasma-workspace-wallpapers = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/plasma-workspace-wallpapers-5.9.3.tar.xz";
-      sha256 = "1ikjj41nn5hn9r3glfhqsizawhkpw3cvybqq0ym4zky9lvbxzxb0";
-      name = "plasma-workspace-wallpapers-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/plasma-workspace-wallpapers-5.9.4.tar.xz";
+      sha256 = "0jngl7a86xr09g87iydw8fi4ggh6hmz5vaznx4xqh403xf9pl281";
+      name = "plasma-workspace-wallpapers-5.9.4.tar.xz";
     };
   };
   polkit-kde-agent = {
-    version = "1-5.9.3";
+    version = "1-5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/polkit-kde-agent-1-5.9.3.tar.xz";
-      sha256 = "0kfafag3bqp03aaa5dn7f8mkc174s80mwn98linl1dn12np2wv2q";
-      name = "polkit-kde-agent-1-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/polkit-kde-agent-1-5.9.4.tar.xz";
+      sha256 = "10x3vgdjkvzmnv5zl65q0mj6gxlcl620kyva1cx3qhq93w68jfjc";
+      name = "polkit-kde-agent-1-5.9.4.tar.xz";
     };
   };
   powerdevil = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/powerdevil-5.9.3.tar.xz";
-      sha256 = "1sphmngckfns5sx0n95njf39m02fg3q7bdafwrw8i4lv2svb1axj";
-      name = "powerdevil-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/powerdevil-5.9.4.tar.xz";
+      sha256 = "1fpp06criw51lpg21f3xm4gd9yzjj08lr5j8908qz2dywqlp91rv";
+      name = "powerdevil-5.9.4.tar.xz";
     };
   };
   sddm-kcm = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/sddm-kcm-5.9.3.tar.xz";
-      sha256 = "142na2cnx5v459798fq6gx30k9v0i10myfyvgv562n1x79nbkyl0";
-      name = "sddm-kcm-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/sddm-kcm-5.9.4.tar.xz";
+      sha256 = "1zrda4vzvqh6vs93yl2g4b63siqb5cqhrp4kknzm571djiar26ll";
+      name = "sddm-kcm-5.9.4.tar.xz";
     };
   };
   systemsettings = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/systemsettings-5.9.3.tar.xz";
-      sha256 = "15ihvbkp91dz1z1z5dqgqyziiklzq2zkl3ns8dqzs3pbpki7jbqc";
-      name = "systemsettings-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/systemsettings-5.9.4.tar.xz";
+      sha256 = "03h5dagghjg6qhjbf0fnlhwh2v1nh7w22g00g1qzi8yrads1icy1";
+      name = "systemsettings-5.9.4.tar.xz";
     };
   };
   user-manager = {
-    version = "5.9.3";
+    version = "5.9.4";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.9.3/user-manager-5.9.3.tar.xz";
-      sha256 = "1s91zgh1rcqrpyh9fiklwqj2m78ify5fv83kh9zvyl4bapgyb0gn";
-      name = "user-manager-5.9.3.tar.xz";
+      url = "${mirror}/stable/plasma/5.9.4/user-manager-5.9.4.tar.xz";
+      sha256 = "1cjwkxb5qzj8sbkhcyyzw1axzddb2pwbd16wmaqpiz9qh2k4mr64";
+      name = "user-manager-5.9.4.tar.xz";
     };
   };
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kio/default.nix b/pkgs/development/libraries/kde-frameworks/kio/default.nix
index 1d37c794674b..3f4ae5a25c2b 100644
--- a/pkgs/development/libraries/kde-frameworks/kio/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kio/default.nix
@@ -17,12 +17,5 @@ kdeFramework {
     ktextwidgets kwallet kwidgetsaddons kwindowsystem kxmlgui solid qtscript
     qtx11extras
   ];
-  patches = (copyPathsToStore (lib.readPathsFromFile ./. ./series))
-    ++ [
-      (fetchpatch {
-        name = "SanitizeURLsBeforePassingThemToFindProxyForURL.patch";
-        url = "https://cgit.kde.org/kio.git/patch/?id=f9d0cb47cf94e209f6171ac0e8d774e68156a6e4";
-        sha256 = "1s6rcp8rrlhc6rgy3b303y0qq0s8371n12r5lk9zbkw14wjvbix0";
-      })
-    ];
+  patches = (copyPathsToStore (lib.readPathsFromFile ./. ./series));
 }

From 6a1e5cc2fa1c607197778b0574237f74f6180bec Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Wed, 22 Mar 2017 15:10:38 -0500
Subject: [PATCH 039/157] kdeFrameworks: 5.31 -> 5.32

---
 .../libraries/kde-frameworks/fetch.sh         |   2 +-
 .../libraries/kde-frameworks/srcs.nix         | 592 +++++++++---------
 2 files changed, 297 insertions(+), 297 deletions(-)

diff --git a/pkgs/development/libraries/kde-frameworks/fetch.sh b/pkgs/development/libraries/kde-frameworks/fetch.sh
index 263f811ebc62..7343b408dff9 100644
--- a/pkgs/development/libraries/kde-frameworks/fetch.sh
+++ b/pkgs/development/libraries/kde-frameworks/fetch.sh
@@ -1 +1 @@
-WGET_ARGS=( http://download.kde.org/stable/frameworks/5.31/ -A '*.tar.xz' )
+WGET_ARGS=( http://download.kde.org/stable/frameworks/5.32/ -A '*.tar.xz' )
diff --git a/pkgs/development/libraries/kde-frameworks/srcs.nix b/pkgs/development/libraries/kde-frameworks/srcs.nix
index f879005da1d0..4b902d4d57e5 100644
--- a/pkgs/development/libraries/kde-frameworks/srcs.nix
+++ b/pkgs/development/libraries/kde-frameworks/srcs.nix
@@ -3,595 +3,595 @@
 
 {
   attica = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/attica-5.31.0.tar.xz";
-      sha256 = "0gfqxaqvw05rdgjqs2cn5bgnmijcsl16myf919fdc75xkdpg1h56";
-      name = "attica-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/attica-5.32.0.tar.xz";
+      sha256 = "16vl3gpwqcvfms82grv1bvqlxj085bqssv5ixjx007826pd8qhp5";
+      name = "attica-5.32.0.tar.xz";
     };
   };
   baloo = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/baloo-5.31.0.tar.xz";
-      sha256 = "0n3cwq7g9zik3xjp895vl1j62b538rg6zcsm2x4h2nnq3njrnfbz";
-      name = "baloo-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/baloo-5.32.0.tar.xz";
+      sha256 = "0a4qwinkp4gmcbx4j0qxbj5qb40h7594s39za7sc7bymadicasy1";
+      name = "baloo-5.32.0.tar.xz";
     };
   };
   bluez-qt = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/bluez-qt-5.31.0.tar.xz";
-      sha256 = "12g9jc6b8f03dka5sbjf19g536y8d1xvzkrwp2m0w98zcd0q33jl";
-      name = "bluez-qt-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/bluez-qt-5.32.0.tar.xz";
+      sha256 = "0pl6cp0rgjkh7d06ik35rw7qd96j5sh2flgjx4vi21zl5vf3vgyh";
+      name = "bluez-qt-5.32.0.tar.xz";
     };
   };
   breeze-icons = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/breeze-icons-5.31.0.tar.xz";
-      sha256 = "1ylask25jrwyk53c81jy73k9i8cylnab3a42yyrf3f25qbvhr845";
-      name = "breeze-icons-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/breeze-icons-5.32.0.tar.xz";
+      sha256 = "1n51kahzk09v52yhi7k4kqgavqlz3ghqv5cx2ssz2djpyavs18r3";
+      name = "breeze-icons-5.32.0.tar.xz";
     };
   };
   extra-cmake-modules = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/extra-cmake-modules-5.31.0.tar.xz";
-      sha256 = "1srdvjgn72687r48f0x32vn7q5czvk9k1w1393bcws2l0icil9w4";
-      name = "extra-cmake-modules-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/extra-cmake-modules-5.32.0.tar.xz";
+      sha256 = "1iqakxzr6bcs9wgyi8if1smpq6px0bvlcyddyk0hxhindzl7pn5i";
+      name = "extra-cmake-modules-5.32.0.tar.xz";
     };
   };
   frameworkintegration = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/frameworkintegration-5.31.0.tar.xz";
-      sha256 = "1wfiny11fm0k6w1ly7ca7xj3f7a1mn3b1gpvlcpaqbrib6b3dgcj";
-      name = "frameworkintegration-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/frameworkintegration-5.32.0.tar.xz";
+      sha256 = "022scc4pgl68973wq29l1kc9j9lspvlmpr3bc6zlyg57m8agapwa";
+      name = "frameworkintegration-5.32.0.tar.xz";
     };
   };
   kactivities = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kactivities-5.31.0.tar.xz";
-      sha256 = "1v33pkjwjjp6lrqhch7l66xyyvln1pgbs0wbgi8q9c024s92jqqz";
-      name = "kactivities-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kactivities-5.32.0.tar.xz";
+      sha256 = "0xin4shaj0zsfsww84mwk5n4ldaqy730jhc369px2j2nq57sg9g7";
+      name = "kactivities-5.32.0.tar.xz";
     };
   };
   kactivities-stats = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kactivities-stats-5.31.0.tar.xz";
-      sha256 = "1ngydmby0dzf802bjszhn3qsc0vgrhc0ya511x7jc9h49mgbp2jy";
-      name = "kactivities-stats-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kactivities-stats-5.32.0.tar.xz";
+      sha256 = "1b3z7bcap3vjc0155y0a9xkbd477fklmpj8dr3rs0ccyc6qxxbvw";
+      name = "kactivities-stats-5.32.0.tar.xz";
     };
   };
   kapidox = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kapidox-5.31.0.tar.xz";
-      sha256 = "1lnqcgmxdy8l0qzn2jb9kww2lg1a33izw0hy78fkm7drg67g26za";
-      name = "kapidox-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kapidox-5.32.0.tar.xz";
+      sha256 = "1z6hdsppwrmqkcanrppxhqcrjvblg9i02rh3bz5m3pn66wwz0sdw";
+      name = "kapidox-5.32.0.tar.xz";
     };
   };
   karchive = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/karchive-5.31.0.tar.xz";
-      sha256 = "1yafkgd5q9j1y3shivh5jayc4pss1skzyf3f1rmzl4psn2r6rsay";
-      name = "karchive-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/karchive-5.32.0.tar.xz";
+      sha256 = "1dzvphqnc09mmaydqggpxg6zwwyr56p6l4jdf1rf6ns90fzxy0m4";
+      name = "karchive-5.32.0.tar.xz";
     };
   };
   kauth = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kauth-5.31.0.tar.xz";
-      sha256 = "0y4gc3n8d36wrpdmgq2jif82lkqr3xhb7v8lgg6kgaxb1d7fi2r8";
-      name = "kauth-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kauth-5.32.0.tar.xz";
+      sha256 = "00kdq16n9w6nf1bpwzl5lp5c2xq74g8nn6081kvnjcd4ld66ncmq";
+      name = "kauth-5.32.0.tar.xz";
     };
   };
   kbookmarks = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kbookmarks-5.31.0.tar.xz";
-      sha256 = "0xdrx3gr291gkrfj360pw3aax0mz0zhhvjw7c4fcp35m0sqg1kvp";
-      name = "kbookmarks-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kbookmarks-5.32.0.tar.xz";
+      sha256 = "03a024phcjv46afbp5lbmj2p8hb6srfzyaslc6ln6ms473bf5k4w";
+      name = "kbookmarks-5.32.0.tar.xz";
     };
   };
   kcmutils = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kcmutils-5.31.0.tar.xz";
-      sha256 = "00ngh556sxswrfhhy5vkfi8sk5jbb0srvx4np49xwpmh5xb6qzk9";
-      name = "kcmutils-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kcmutils-5.32.0.tar.xz";
+      sha256 = "1mr9h7wc22bfrbm92ajsjfcs16c5xpkrxbxzcma3a0s7jhy6qrm9";
+      name = "kcmutils-5.32.0.tar.xz";
     };
   };
   kcodecs = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kcodecs-5.31.0.tar.xz";
-      sha256 = "1nyn4b61ymbxv1xnbq3z79dbvapsy6jg51w52l0gnqkiy2zlbz13";
-      name = "kcodecs-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kcodecs-5.32.0.tar.xz";
+      sha256 = "0yybkp52i8nm4qjady6jqswn6v70cqbvjqwgrghjnc88b2cly253";
+      name = "kcodecs-5.32.0.tar.xz";
     };
   };
   kcompletion = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kcompletion-5.31.0.tar.xz";
-      sha256 = "0jx1lsz1fh8h20a5ixdv9q5yx6r5r7jr8hi68v7b66anmpnh2m3g";
-      name = "kcompletion-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kcompletion-5.32.0.tar.xz";
+      sha256 = "0fn8imr3m219r38a0rafbnylcpjq4rqhz1w66mx80sc7l10mhcni";
+      name = "kcompletion-5.32.0.tar.xz";
     };
   };
   kconfig = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kconfig-5.31.0.tar.xz";
-      sha256 = "1z9jf5rizdj7c7x918zmdv4v01glpl3z44mrx7yfp2cqnjniwhxi";
-      name = "kconfig-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kconfig-5.32.0.tar.xz";
+      sha256 = "1pajh1l08b995shp6l75ri9z4vr6wjapvrkmrmv8hksnxvfi97dp";
+      name = "kconfig-5.32.0.tar.xz";
     };
   };
   kconfigwidgets = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kconfigwidgets-5.31.0.tar.xz";
-      sha256 = "19y3s5qcb3mzw8xiyp57zb2sjclcmxzj3xp0iwzs41r4lqmlwajs";
-      name = "kconfigwidgets-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kconfigwidgets-5.32.0.tar.xz";
+      sha256 = "1cq0a3k6pvl9f098ssqqk2rddxh0xn1kk4p5kfyd7w0m3c604zw3";
+      name = "kconfigwidgets-5.32.0.tar.xz";
     };
   };
   kcoreaddons = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kcoreaddons-5.31.0.tar.xz";
-      sha256 = "0175vgii8l5yx1bbbjljblkkq03nqfhb3v7in2657glag6imcb7m";
-      name = "kcoreaddons-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kcoreaddons-5.32.0.tar.xz";
+      sha256 = "1n1xzvwwji9pwyxrvwp4rmpc7qzp9nlis26xmn81k607jn587ksx";
+      name = "kcoreaddons-5.32.0.tar.xz";
     };
   };
   kcrash = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kcrash-5.31.0.tar.xz";
-      sha256 = "0mj6dahalwks39d881nvmrd3rqm2aid06iq6s8p2grhnncf6cd4j";
-      name = "kcrash-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kcrash-5.32.0.tar.xz";
+      sha256 = "1zrkjrpj88ymdy5vbn9db73vxppswvmbn2gkn4gpx773dsmflhz3";
+      name = "kcrash-5.32.0.tar.xz";
     };
   };
   kdbusaddons = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kdbusaddons-5.31.0.tar.xz";
-      sha256 = "1dv9yzicd2d1k0qjgjbryks0f6s0v76hr0csdb7j22nwn9pb4cfk";
-      name = "kdbusaddons-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kdbusaddons-5.32.0.tar.xz";
+      sha256 = "1a15jjsrkza0ll2viyk834pgdxsdgdacm0982xxwl5z937f75609";
+      name = "kdbusaddons-5.32.0.tar.xz";
     };
   };
   kdeclarative = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kdeclarative-5.31.0.tar.xz";
-      sha256 = "0hw3rkmlw6j056b3wvhpaj778xfxajcqidpf5x3nyfjmqjvxsgw1";
-      name = "kdeclarative-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kdeclarative-5.32.0.tar.xz";
+      sha256 = "1y5g3yi1l0g1mkqhhakg265r25zm23qc2fqg55rq0g7l9ss7w7g9";
+      name = "kdeclarative-5.32.0.tar.xz";
     };
   };
   kded = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kded-5.31.0.tar.xz";
-      sha256 = "0zsikbzi8i8bmlpa4kgdpcpsifkwwclsfdgafd7yf5svc4hyyl51";
-      name = "kded-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kded-5.32.0.tar.xz";
+      sha256 = "0pmmsvqwkw86yvxxf9i6lg13vg80m0kmhjjs88lbm60cgvr5jhq6";
+      name = "kded-5.32.0.tar.xz";
     };
   };
   kdelibs4support = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/portingAids/kdelibs4support-5.31.0.tar.xz";
-      sha256 = "1yh4lr56mnwsbc0gysj1c58w1r62dlxxds16xnp5j0lyir7wx0pl";
-      name = "kdelibs4support-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/portingAids/kdelibs4support-5.32.0.tar.xz";
+      sha256 = "1wan5ad5rhhrwvwjjjd87n790r6d8r118gs2kw49s91pdj3iv9pb";
+      name = "kdelibs4support-5.32.0.tar.xz";
     };
   };
   kdesignerplugin = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kdesignerplugin-5.31.0.tar.xz";
-      sha256 = "1g510f8dfvaddcq5hrvsaiwayp2hzkdryzn62zff29ipd7qpcd2x";
-      name = "kdesignerplugin-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kdesignerplugin-5.32.0.tar.xz";
+      sha256 = "1hapj8x8nky3m6lx2ianmxwprf00jqyjsknjz3pi4vk3i714vhnf";
+      name = "kdesignerplugin-5.32.0.tar.xz";
     };
   };
   kdesu = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kdesu-5.31.0.tar.xz";
-      sha256 = "0mzvvr3zz28pgp42i3f54g5k3wplvjdg41d8jb9k6m5qcj8aryax";
-      name = "kdesu-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kdesu-5.32.0.tar.xz";
+      sha256 = "0zsy1hivy5bbczrpkpgj72mlx0km2nm53kpgrj2hfdy3ss0vn3hl";
+      name = "kdesu-5.32.0.tar.xz";
     };
   };
   kdewebkit = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kdewebkit-5.31.0.tar.xz";
-      sha256 = "0x9v8i37apbik2krxr9n2pgq5xmcgjlhzflbrwwqaq30c2l8aid0";
-      name = "kdewebkit-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kdewebkit-5.32.0.tar.xz";
+      sha256 = "0y7262pqzdx0hxkyqrbawgx99rn6q85m1slr4nbn914kn350xpy0";
+      name = "kdewebkit-5.32.0.tar.xz";
     };
   };
   kdnssd = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kdnssd-5.31.0.tar.xz";
-      sha256 = "1bbk9qsvx49zbjvdg0xi9s2x51f331n8wnyd320j3ay0mp4yq2kk";
-      name = "kdnssd-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kdnssd-5.32.0.tar.xz";
+      sha256 = "1xakbs2wm627zn01ni8fyrz64xl5jw4by0pdrb70aad7w37dijrw";
+      name = "kdnssd-5.32.0.tar.xz";
     };
   };
   kdoctools = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kdoctools-5.31.0.tar.xz";
-      sha256 = "1m7l4bk5h75mcrgislp4rc7fj1szv1ij30y5yizncg2c3aq2czxk";
-      name = "kdoctools-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kdoctools-5.32.0.tar.xz";
+      sha256 = "0i7zgg7iw6w0sdr6cv3yf4blcr61i8zczgmyqa964ka6p3ywwjs9";
+      name = "kdoctools-5.32.0.tar.xz";
     };
   };
   kemoticons = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kemoticons-5.31.0.tar.xz";
-      sha256 = "0zvps3jrx02dzy82mwf5l7dirpnj616081yhkp2m0xw3qa3i16xk";
-      name = "kemoticons-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kemoticons-5.32.0.tar.xz";
+      sha256 = "1ncjs9iy6z6rhk83ff7fj1b68rkylnry0h698rh4jvs98gpw8sgj";
+      name = "kemoticons-5.32.0.tar.xz";
     };
   };
   kfilemetadata = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kfilemetadata-5.31.0.tar.xz";
-      sha256 = "123cin3fhai85zzz5hfr6h87cjrqvsyl9i809j7q0fshjx8c9wpd";
-      name = "kfilemetadata-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kfilemetadata-5.32.0.tar.xz";
+      sha256 = "01d91gmrxlax0g13ib841vc4qwmv6r4qdr10wfs77rrxsvw7z08f";
+      name = "kfilemetadata-5.32.0.tar.xz";
     };
   };
   kglobalaccel = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kglobalaccel-5.31.0.tar.xz";
-      sha256 = "1l7phfk17z9rrdlcjz97zyyqlj9pps0gdpphrfqrz1fyx5ifybmc";
-      name = "kglobalaccel-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kglobalaccel-5.32.0.tar.xz";
+      sha256 = "0dxwjznnqlgnvn15pl34rxlzk3i21cvzn8xbgqmxakny8qiib9ry";
+      name = "kglobalaccel-5.32.0.tar.xz";
     };
   };
   kguiaddons = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kguiaddons-5.31.0.tar.xz";
-      sha256 = "0bvjnbsskps2pfh0y72klxfanm54c0iflll5awaps750flb3bbp3";
-      name = "kguiaddons-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kguiaddons-5.32.0.tar.xz";
+      sha256 = "0rbfd0rykmwl9hs1q22pqg2by8vi9y1pgs2ishgnan4sc4w87wjb";
+      name = "kguiaddons-5.32.0.tar.xz";
     };
   };
   khtml = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/portingAids/khtml-5.31.0.tar.xz";
-      sha256 = "19pf3ir3r8igrx3h90sn383kxmyjdxgmwaw66p6vjb83243dy57h";
-      name = "khtml-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/portingAids/khtml-5.32.0.tar.xz";
+      sha256 = "1bkxfldw55khycbpcqpwi86rpv6qyqsndvjncfd5a5knnsynwdyf";
+      name = "khtml-5.32.0.tar.xz";
     };
   };
   ki18n = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/ki18n-5.31.0.tar.xz";
-      sha256 = "1q496i4a3kq2bfxpfnz6bfxk2shfdshrxcf253ab58l76l3jcy9g";
-      name = "ki18n-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/ki18n-5.32.0.tar.xz";
+      sha256 = "068xvw2hy4hlpj85wgjjdj0nc37fygpd8wb1dnpqcvzzy8rc1rsf";
+      name = "ki18n-5.32.0.tar.xz";
     };
   };
   kiconthemes = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kiconthemes-5.31.0.tar.xz";
-      sha256 = "0kangszmlhzbwvvplnxk2i938xl8j8jpd8kpf2n9skxkqfd19qr5";
-      name = "kiconthemes-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kiconthemes-5.32.0.tar.xz";
+      sha256 = "00azbyk5y3jgdqv03a2nd0627kdkhq1bkghvw7w62kcnih9k8lq5";
+      name = "kiconthemes-5.32.0.tar.xz";
     };
   };
   kidletime = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kidletime-5.31.0.tar.xz";
-      sha256 = "03ajdhxv2jdggqhy02s6xgbaf4pa2chj0f6d5kgz9r0wx6kxmh25";
-      name = "kidletime-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kidletime-5.32.0.tar.xz";
+      sha256 = "0rkxx3bnspjwm4vcy4rdfahk6vcfpkh8fldww0zfdn7s7pigqwch";
+      name = "kidletime-5.32.0.tar.xz";
     };
   };
   kimageformats = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kimageformats-5.31.0.tar.xz";
-      sha256 = "17cz2xmmm5g55kndq983vy6cg7adpbiw7ahn0lpvviinnsf53s12";
-      name = "kimageformats-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kimageformats-5.32.0.tar.xz";
+      sha256 = "05hn8n4sc3rj5c30ki068f76k1gfgvq19zcw5jlqpnn1l5db5fvz";
+      name = "kimageformats-5.32.0.tar.xz";
     };
   };
   kinit = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kinit-5.31.0.tar.xz";
-      sha256 = "082kq25163x40bq12x84ccrk3zrzmn5xpb5m4zgi06zcvzb8rl9l";
-      name = "kinit-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kinit-5.32.0.tar.xz";
+      sha256 = "0103lflppdw55l9xiqs68lzaq9897m5qnkmy6fp7dm9wfh9aplqn";
+      name = "kinit-5.32.0.tar.xz";
     };
   };
   kio = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kio-5.31.0.tar.xz";
-      sha256 = "1rry7v9g2430hkz44b4xjcbs3lr64srs8822a52vx1w69jpkn5s9";
-      name = "kio-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kio-5.32.0.tar.xz";
+      sha256 = "19da02l0aj0l07x9bbklhvx9slci3v1d8q80jvam4vyzs4qdyjin";
+      name = "kio-5.32.0.tar.xz";
     };
   };
   kitemmodels = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kitemmodels-5.31.0.tar.xz";
-      sha256 = "0zb9cm5v3ylqhg8l5sp3jskghm5izzihha5ik09y7fabl52cd6v5";
-      name = "kitemmodels-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kitemmodels-5.32.0.tar.xz";
+      sha256 = "0lxld7jdixpq23sycv8n4ckzmdr34aycrsf2zffziw6r59f0mzki";
+      name = "kitemmodels-5.32.0.tar.xz";
     };
   };
   kitemviews = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kitemviews-5.31.0.tar.xz";
-      sha256 = "04r4pd5rkdgbszyg7l050r53f38skhh2p2mi3xkz4ckci132srlv";
-      name = "kitemviews-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kitemviews-5.32.0.tar.xz";
+      sha256 = "1h1zgawdi4vbgymdl5215lx7hpcx9jqxy7vjf5hwgs6b2cls1sws";
+      name = "kitemviews-5.32.0.tar.xz";
     };
   };
   kjobwidgets = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kjobwidgets-5.31.0.tar.xz";
-      sha256 = "16grnlccmqcs84gpz62s1iz5amdwsprr76gd0q845bd49crgacfa";
-      name = "kjobwidgets-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kjobwidgets-5.32.0.tar.xz";
+      sha256 = "0lhv3mg2liija0g8x14jpv1mdhb0zjh868p1cs24bs9xrw1l8984";
+      name = "kjobwidgets-5.32.0.tar.xz";
     };
   };
   kjs = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/portingAids/kjs-5.31.0.tar.xz";
-      sha256 = "027n2ivh5kfmrm06xgcryxm14hbxyf83cx6rbc34093kk905ghg1";
-      name = "kjs-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/portingAids/kjs-5.32.0.tar.xz";
+      sha256 = "022n2hl1s5kap3pqaz4y28wn5z5qh6jcypz5kini2ic94xf7ydrg";
+      name = "kjs-5.32.0.tar.xz";
     };
   };
   kjsembed = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/portingAids/kjsembed-5.31.0.tar.xz";
-      sha256 = "1mss7lahczvwhmybxnbcynqwa56gjrxiyq79fcicybp7h7rvqw14";
-      name = "kjsembed-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/portingAids/kjsembed-5.32.0.tar.xz";
+      sha256 = "0h0p4mcvmdgvjv2xd8s4x2i554nh08mc258gxhb41bs6vm3yhiz4";
+      name = "kjsembed-5.32.0.tar.xz";
     };
   };
   kmediaplayer = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/portingAids/kmediaplayer-5.31.0.tar.xz";
-      sha256 = "0vxzw5grw53bxp0nvwmiqyw9sbpglhrnfg4d1ldlg4a1gibfijx4";
-      name = "kmediaplayer-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/portingAids/kmediaplayer-5.32.0.tar.xz";
+      sha256 = "1s86dfzrqxrmbqmxq4yyyy1p507d9ns6d7sy6z67dhykgahacqf4";
+      name = "kmediaplayer-5.32.0.tar.xz";
     };
   };
   knewstuff = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/knewstuff-5.31.0.tar.xz";
-      sha256 = "06qrgzfxrpmckyjq21ajvw08n5f5bdyqqgrnrbr1cjsfcx7xwdfl";
-      name = "knewstuff-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/knewstuff-5.32.0.tar.xz";
+      sha256 = "1i3ldy9wwnjhpgdd2d0bg4304k88riin89zqzdl52lpqa6hjl3fp";
+      name = "knewstuff-5.32.0.tar.xz";
     };
   };
   knotifications = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/knotifications-5.31.0.tar.xz";
-      sha256 = "0nz5dkzgkv4mzcsg2mn9zzcqh484cyh5n1y8sx1831r808jd2wly";
-      name = "knotifications-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/knotifications-5.32.0.tar.xz";
+      sha256 = "06ap7m8c2py49pqrnhadbyl69y3nsyamzahbpwipqgh9k62sy34y";
+      name = "knotifications-5.32.0.tar.xz";
     };
   };
   knotifyconfig = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/knotifyconfig-5.31.0.tar.xz";
-      sha256 = "1zdzfqqd32ykd5ibrkssl3p47v704jxs16br1rhrr32ymv4qcbpi";
-      name = "knotifyconfig-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/knotifyconfig-5.32.0.tar.xz";
+      sha256 = "14qc6wj4j5i45vzqsvl2wlc07c6x30hb2680gwfqsvwgiaszkzv4";
+      name = "knotifyconfig-5.32.0.tar.xz";
     };
   };
   kpackage = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kpackage-5.31.0.tar.xz";
-      sha256 = "1hg8f2i10wcs31xhvw40dwgbgfrwx93w5bi5wlbrw55jcs040dfr";
-      name = "kpackage-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kpackage-5.32.0.tar.xz";
+      sha256 = "070zasl5c58n01fk18mjgccfizymc9griwicxizqjgzzbgvkns3r";
+      name = "kpackage-5.32.0.tar.xz";
     };
   };
   kparts = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kparts-5.31.0.tar.xz";
-      sha256 = "093g5zsdqqyx9z69afsmgyszd807pv3wpzwn37x1glg399dsv7fa";
-      name = "kparts-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kparts-5.32.0.tar.xz";
+      sha256 = "0hrx0mdvw301nbdyw5fkvgkw60ya6kmfw6hfzmj48bws8mi33rs5";
+      name = "kparts-5.32.0.tar.xz";
     };
   };
   kpeople = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kpeople-5.31.0.tar.xz";
-      sha256 = "1f71c2q8a9m463ghpq50gbhkvf5szkvvfwbamlrwwygpb89fzfjy";
-      name = "kpeople-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kpeople-5.32.0.tar.xz";
+      sha256 = "1xqi8zr76hajgyv016iaqlmnr5b84s71fbx412q153g92jglp4mk";
+      name = "kpeople-5.32.0.tar.xz";
     };
   };
   kplotting = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kplotting-5.31.0.tar.xz";
-      sha256 = "15yv1rh1vlxhv77j50inq9kkwalhs2r1mjba82fnxy8z569i66cm";
-      name = "kplotting-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kplotting-5.32.0.tar.xz";
+      sha256 = "0a0pfmdlx84526lb2jvx94i2pf85km57fm2ygis4z5mjgbzsmb6v";
+      name = "kplotting-5.32.0.tar.xz";
     };
   };
   kpty = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kpty-5.31.0.tar.xz";
-      sha256 = "0hfs1gdi1fqaaki5aa9b93j4pl33g4s82yxpbyc0h9k2891aq196";
-      name = "kpty-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kpty-5.32.0.tar.xz";
+      sha256 = "0h4318rc9902cvqj69capb8lh7s84y44jd59d11fyhq21jhy152s";
+      name = "kpty-5.32.0.tar.xz";
     };
   };
   kross = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/portingAids/kross-5.31.0.tar.xz";
-      sha256 = "0lc9ijn60bw0y9nrlva2fd0hf0b4x6488jjmymrnrc8zzjnigyqp";
-      name = "kross-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/portingAids/kross-5.32.0.tar.xz";
+      sha256 = "0mgicb2rfhzp0hr1zckp1qzqzbdx0zy82mcjibrlsp7spmvynw5a";
+      name = "kross-5.32.0.tar.xz";
     };
   };
   krunner = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/krunner-5.31.0.tar.xz";
-      sha256 = "0xqayhd179387m02arxdcl1lgk8f2h0fxlzyigy6ja6wylbwphrw";
-      name = "krunner-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/krunner-5.32.0.tar.xz";
+      sha256 = "1k4rg9vqr6h5aj7v51fx3i5z9kxlfpacahs81hkwksi6if8ik4kr";
+      name = "krunner-5.32.0.tar.xz";
     };
   };
   kservice = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kservice-5.31.0.tar.xz";
-      sha256 = "0hjlcnypg96np88hgfvqd8g5z4cxgi4a0j5mnlfx65jrzpv5hsjg";
-      name = "kservice-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kservice-5.32.0.tar.xz";
+      sha256 = "02xk3ajspprmx964zhwh2l3axm4gns9h0m0pvcb1v5j8pfh9v70q";
+      name = "kservice-5.32.0.tar.xz";
     };
   };
   ktexteditor = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/ktexteditor-5.31.0.tar.xz";
-      sha256 = "099axcwl8z4npvcrirycc82zg7sf9ac3yxrwpsp0f337gdl1qvln";
-      name = "ktexteditor-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/ktexteditor-5.32.0.tar.xz";
+      sha256 = "1sybw8k3f36mcs5qh3b51v7ynbqn4pbiiabkyxfmyi82i09m2jgw";
+      name = "ktexteditor-5.32.0.tar.xz";
     };
   };
   ktextwidgets = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/ktextwidgets-5.31.0.tar.xz";
-      sha256 = "0n0v42b4bq1f6f120bjhr69qwgnvwlhnnqsh75nl9jvv8g3lyspy";
-      name = "ktextwidgets-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/ktextwidgets-5.32.0.tar.xz";
+      sha256 = "1s2fd4n4hfkzscxv0cdfjynjzi1f57pfi9a3fp6rrm5c5645zk7r";
+      name = "ktextwidgets-5.32.0.tar.xz";
     };
   };
   kunitconversion = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kunitconversion-5.31.0.tar.xz";
-      sha256 = "190d2v3bv7ccg2wqjmd6p46d4zz59r1mf86l2wkqw212rr59pafx";
-      name = "kunitconversion-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kunitconversion-5.32.0.tar.xz";
+      sha256 = "0crc8riwafcx6fwhgrc8vfbwmdygd6vlz1fbbgni09gamm8mbcin";
+      name = "kunitconversion-5.32.0.tar.xz";
     };
   };
   kwallet = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kwallet-5.31.0.tar.xz";
-      sha256 = "0r7n49ii8y1ygc7ncysjif4mrmsd9jq4yfm251m7lrp82drza26n";
-      name = "kwallet-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kwallet-5.32.0.tar.xz";
+      sha256 = "0psc4n6lck9gbx2nn7mgv33x4z2r0xp1mx1xcsgy8smvalrfv5xa";
+      name = "kwallet-5.32.0.tar.xz";
     };
   };
   kwayland = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kwayland-5.31.0.tar.xz";
-      sha256 = "0f134spj1vz3f43bdrb93kr54s50x4a9xvkfhl3inlxmglbk3h8b";
-      name = "kwayland-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kwayland-5.32.0.tar.xz";
+      sha256 = "1kzvq7qx102rfdv975x5sd37lsl6wn0mzm2m1f9fnnn2rvii3h5d";
+      name = "kwayland-5.32.0.tar.xz";
     };
   };
   kwidgetsaddons = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kwidgetsaddons-5.31.0.tar.xz";
-      sha256 = "0yrhss1x8q4nanpq2gbzqjds9s7hjl3zzkwnd8hahh9fyg8w9815";
-      name = "kwidgetsaddons-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kwidgetsaddons-5.32.0.tar.xz";
+      sha256 = "1aksy326ppdfcx20zl9hxsd8j0br32j6dlx4i1xxbd976csys9b2";
+      name = "kwidgetsaddons-5.32.0.tar.xz";
     };
   };
   kwindowsystem = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kwindowsystem-5.31.0.tar.xz";
-      sha256 = "0jzhsdfzzhxfgjqd4pl98ckbbqfwkv6qy5szh82078gxc2rf1wna";
-      name = "kwindowsystem-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kwindowsystem-5.32.0.tar.xz";
+      sha256 = "1c3kd23c4wwzdhfcyhv41czw3y2kk1492xn6ah9n3r98akrhgar1";
+      name = "kwindowsystem-5.32.0.tar.xz";
     };
   };
   kxmlgui = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kxmlgui-5.31.0.tar.xz";
-      sha256 = "1rnznapp1vflg66k0jk8n8v9zci20bs0v88hci3rf0qfd5cmgnzr";
-      name = "kxmlgui-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kxmlgui-5.32.0.tar.xz";
+      sha256 = "1pxi4z7z3bzwcnfwq0pvjsmds401fkisyr353lyxf4rvcpwj3a65";
+      name = "kxmlgui-5.32.0.tar.xz";
     };
   };
   kxmlrpcclient = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/kxmlrpcclient-5.31.0.tar.xz";
-      sha256 = "1lrv1qxbfm1ss2hb171p9s3f3iwn8zfrsipin0gvfwnjrldi4fkb";
-      name = "kxmlrpcclient-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/kxmlrpcclient-5.32.0.tar.xz";
+      sha256 = "1kaczibdfdph5mpg1dldsmqb1six57w7ch3v0v7av5h6j6sx0xaq";
+      name = "kxmlrpcclient-5.32.0.tar.xz";
     };
   };
   modemmanager-qt = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/modemmanager-qt-5.31.0.tar.xz";
-      sha256 = "0s2dfz9zvn6f9xpzs412iniipaai5zs9m06lpxss0w1nq5ig856r";
-      name = "modemmanager-qt-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/modemmanager-qt-5.32.0.tar.xz";
+      sha256 = "0ywyiq1kj4ya5knn0r12j9m1ig9mlyfypnrzihlvipddjrqs7jyd";
+      name = "modemmanager-qt-5.32.0.tar.xz";
     };
   };
   networkmanager-qt = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/networkmanager-qt-5.31.0.tar.xz";
-      sha256 = "18wbmd4nsgwzqlp254k1ahy8iyydx59fshb3wci5sgxnsn435np4";
-      name = "networkmanager-qt-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/networkmanager-qt-5.32.0.tar.xz";
+      sha256 = "0bcy7nzfvx2xah3kxklmrjn08qbjddiny7wf7nkxsbc3kkhrxqyd";
+      name = "networkmanager-qt-5.32.0.tar.xz";
     };
   };
   oxygen-icons5 = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/oxygen-icons5-5.31.0.tar.xz";
-      sha256 = "0ka4zll8v8wahqg50vpm9mrxlyh9244y0yrprbwxzl9xpx113ppi";
-      name = "oxygen-icons5-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/oxygen-icons5-5.32.0.tar.xz";
+      sha256 = "05v3blgs4qbjl8s6470baahy9a98cfi3mplzp462axcgkqdj1nwf";
+      name = "oxygen-icons5-5.32.0.tar.xz";
     };
   };
   plasma-framework = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/plasma-framework-5.31.0.tar.xz";
-      sha256 = "0hq3d96d9xhx6wqrrhnyygwajg69vfxbjc8dlpf5nwc3kqv2wim2";
-      name = "plasma-framework-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/plasma-framework-5.32.0.tar.xz";
+      sha256 = "1hrnmilc30d1kh20cky329i5ji3qyy7m4f8jzax5cgl7nrjca31h";
+      name = "plasma-framework-5.32.0.tar.xz";
     };
   };
   prison = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/prison-5.31.0.tar.xz";
-      sha256 = "0qaqj5gazby4fdq9yii67cmr04i007blhl27h9c5p169khh9ck2s";
-      name = "prison-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/prison-5.32.0.tar.xz";
+      sha256 = "0q5cs60293bdm3mynhx39rjsh87mfxngxsqa2fqm2gsqjvlciyvr";
+      name = "prison-5.32.0.tar.xz";
     };
   };
   solid = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/solid-5.31.0.tar.xz";
-      sha256 = "05rgzdzwbnmnvzkf4gz3z5i1ggwyd21y0yli7shas4i8l29kjd7m";
-      name = "solid-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/solid-5.32.0.tar.xz";
+      sha256 = "1jhymivravgix0sa0szkax50j09l5fl55xi3fbyjxlb4cil114v5";
+      name = "solid-5.32.0.tar.xz";
     };
   };
   sonnet = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/sonnet-5.31.0.tar.xz";
-      sha256 = "16vzdhppb2w5vyfr332bcvw4dyw9cz4apxain28d43p0ir03xxz3";
-      name = "sonnet-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/sonnet-5.32.0.tar.xz";
+      sha256 = "17sjv48b3z5fgplsy16ilcw6p7mlqjs61ib6jqd1mqzv4xrr27yi";
+      name = "sonnet-5.32.0.tar.xz";
     };
   };
   syntax-highlighting = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/syntax-highlighting-5.31.0.tar.xz";
-      sha256 = "0igd6jpbck94gl8gs5a5dgj2cxbv370prnk22037clqry6y38v1a";
-      name = "syntax-highlighting-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/syntax-highlighting-5.32.0.tar.xz";
+      sha256 = "1d9m7x53mwggwmhhba1c7b8v4f8qjql889y674ldpzs2nrk5y7x3";
+      name = "syntax-highlighting-5.32.0.tar.xz";
     };
   };
   threadweaver = {
-    version = "5.31.0";
+    version = "5.32.0";
     src = fetchurl {
-      url = "${mirror}/stable/frameworks/5.31/threadweaver-5.31.0.tar.xz";
-      sha256 = "0wsdv135mxpka0rfg9zwhnzp0svfkvd4idyj38rgipxbada0hb7f";
-      name = "threadweaver-5.31.0.tar.xz";
+      url = "${mirror}/stable/frameworks/5.32/threadweaver-5.32.0.tar.xz";
+      sha256 = "1qpy2rzqyd4ap5fibkfk87z66ijh2h79cd7f0h506jh2dbx20g0h";
+      name = "threadweaver-5.32.0.tar.xz";
     };
   };
 }

From 89e2a4c390ff2a0daeadc09477958805f4d205fb Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 22 Mar 2017 20:52:41 -0500
Subject: [PATCH 040/157] gphoto2: 2.5.8 -> 2.5.11

---
 pkgs/applications/misc/gphoto2/default.nix | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/pkgs/applications/misc/gphoto2/default.nix b/pkgs/applications/misc/gphoto2/default.nix
index 742bdaad9966..46278f42e7bb 100644
--- a/pkgs/applications/misc/gphoto2/default.nix
+++ b/pkgs/applications/misc/gphoto2/default.nix
@@ -3,17 +3,17 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gphoto2-2.5.8";
+  name = "gphoto2-2.5.11";
 
   src = fetchurl {
     url = "mirror://sourceforge/gphoto/${name}.tar.bz2";
-    sha256 = "0kgfql6c64ha1gahjdwlqhmkslnfywmc2fkys4c5682zv4awvax9";
+    sha256 = "1sgr6rsvzzagcwhc8fxbnvz3k02wr2hab0vrbvcb04k5l3b48a1r";
   };
 
-  nativeBuildInputs = [ pkgconfig gettext ];
-  buildInputs = [ libgphoto2 libexif popt libjpeg readline libtool ];
+  nativeBuildInputs = [ pkgconfig gettext libtool ];
+  buildInputs = [ libgphoto2 libexif popt libjpeg readline ];
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "A ready to use set of digital camera software applications";
     longDescription = ''
 
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
 
     '';
     homepage = http://www.gphoto.org/;
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = with stdenv.lib.platforms; unix;
-    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.jcumming ];
   };
 }

From 7d72b9b74ef70f65bd46389f59e76569301d514d Mon Sep 17 00:00:00 2001
From: Baptist BENOIST <return_0@live.com>
Date: Thu, 23 Mar 2017 03:02:09 +0100
Subject: [PATCH 041/157] Remove bbenoist from maintainers

Sorry guys but I did not used Nix since months and cannot spend time
maintaining my previous work...
---
 .mention-bot                                           | 3 ++-
 lib/maintainers.nix                                    | 1 -
 pkgs/applications/editors/geany/default.nix            | 2 +-
 pkgs/applications/misc/gmrun/default.nix               | 2 +-
 pkgs/applications/misc/xfe/default.nix                 | 2 +-
 pkgs/development/libraries/fox/default.nix             | 2 +-
 pkgs/development/libraries/fox/fox-1.6.nix             | 2 +-
 pkgs/development/libraries/qt-5/5.5/qtbase/default.nix | 2 +-
 pkgs/development/libraries/qt-5/5.6/qtbase/default.nix | 2 +-
 pkgs/development/libraries/qt-5/5.7/qtbase/default.nix | 2 +-
 pkgs/development/libraries/qt-5/5.8/qtbase/default.nix | 2 +-
 pkgs/development/libraries/vtk/default.nix             | 2 +-
 pkgs/development/qtcreator/default.nix                 | 2 +-
 pkgs/tools/text/numdiff/default.nix                    | 2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/.mention-bot b/.mention-bot
index d8529bd9123e..33c7e41c1dc7 100644
--- a/.mention-bot
+++ b/.mention-bot
@@ -2,7 +2,8 @@
   "userBlacklist": [
     "civodul",
     "jhasse",
-    "shlevy"
+    "shlevy",
+    "bbenoist"
   ],
   "alwaysNotifyForPaths": [
     { "name": "FRidh", "files": ["pkgs/top-level/python-packages.nix", "pkgs/development/interpreters/python/*", "pkgs/development/python-modules/*" ] },
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 3baf99b1fd48..8253caa808cb 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -60,7 +60,6 @@
   badi = "Badi' Abdul-Wahid <abdulwahidc@gmail.com>";
   balajisivaraman = "Balaji Sivaraman<sivaraman.balaji@gmail.com>";
   Baughn = "Svein Ove Aas <sveina@gmail.com>";
-  bbenoist = "Baptist BENOIST <return_0@live.com>";
   bcarrell = "Brandon Carrell <brandoncarrell@gmail.com>";
   bcdarwin = "Ben Darwin <bcdarwin@gmail.com>";
   bdimcheff = "Brandon Dimcheff <brandon@dimcheff.com>";
diff --git a/pkgs/applications/editors/geany/default.nix b/pkgs/applications/editors/geany/default.nix
index 3649beb41c67..89235514bb82 100644
--- a/pkgs/applications/editors/geany/default.nix
+++ b/pkgs/applications/editors/geany/default.nix
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
     '';
     homepage = http://www.geany.org/;
     license = "GPL";
-    maintainers = [ maintainers.bbenoist ];
+    maintainers = [];
     platforms = platforms.all;
   };
 }
diff --git a/pkgs/applications/misc/gmrun/default.nix b/pkgs/applications/misc/gmrun/default.nix
index dbff65d36518..6c712db01a5a 100644
--- a/pkgs/applications/misc/gmrun/default.nix
+++ b/pkgs/applications/misc/gmrun/default.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     '';
     homepage = "http://sourceforge.net/projects/gmrun/";
     license = "GPL";
-    maintainers = [ stdenv.lib.maintainers.bbenoist ];
+    maintainers = [];
     platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/applications/misc/xfe/default.nix b/pkgs/applications/misc/xfe/default.nix
index 0ea1159208f4..b372cd5b2dd2 100644
--- a/pkgs/applications/misc/xfe/default.nix
+++ b/pkgs/applications/misc/xfe/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     '';
     homepage = "http://sourceforge.net/projects/xfe/";
     license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.bbenoist ];
+    maintainers = [];
     platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/fox/default.nix b/pkgs/development/libraries/fox/default.nix
index 8969e4bd5ba8..8ab5e7b62599 100644
--- a/pkgs/development/libraries/fox/default.nix
+++ b/pkgs/development/libraries/fox/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
       '';
     homepage = "http://fox-toolkit.org";
     license = stdenv.lib.licenses.lgpl3;
-    maintainers = [ stdenv.lib.maintainers.bbenoist ];
+    maintainers = [];
     platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/fox/fox-1.6.nix b/pkgs/development/libraries/fox/fox-1.6.nix
index ce778e4a3473..87c6739e2e02 100644
--- a/pkgs/development/libraries/fox/fox-1.6.nix
+++ b/pkgs/development/libraries/fox/fox-1.6.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
       '';
     homepage = "http://fox-toolkit.org";
     license = stdenv.lib.licenses.lgpl3;
-    maintainers = [ stdenv.lib.maintainers.bbenoist ];
+    maintainers = [];
     platforms = stdenv.lib.platforms.mesaPlatforms;
   };
 }
diff --git a/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
index ea04ca627284..141acfc3e574 100644
--- a/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
@@ -286,7 +286,7 @@ stdenv.mkDerivation {
     homepage = http://www.qt.io;
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
-    maintainers = with maintainers; [ bbenoist qknight ttuegel ];
+    maintainers = with maintainers; [ qknight ttuegel ];
     platforms = platforms.linux;
   };
 
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
index 6f9ec5607122..dae1139d9615 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
@@ -307,7 +307,7 @@ stdenv.mkDerivation {
     homepage = http://www.qt.io;
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
-    maintainers = with maintainers; [ bbenoist qknight ttuegel ];
+    maintainers = with maintainers; [ qknight ttuegel ];
     platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
index 4bf16004ce51..f41e8da11931 100644
--- a/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
@@ -306,7 +306,7 @@ stdenv.mkDerivation {
     homepage = http://www.qt.io;
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
-    maintainers = with maintainers; [ bbenoist qknight ttuegel ];
+    maintainers = with maintainers; [ qknight ttuegel ];
     platforms = platforms.unix;
   };
 
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
index 280d1f9c50b4..7da02525f2de 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
@@ -265,7 +265,7 @@ stdenv.mkDerivation {
     homepage = http://www.qt.io;
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
-    maintainers = with maintainers; [ bbenoist qknight ttuegel ];
+    maintainers = with maintainers; [ qknight ttuegel ];
     platforms = platforms.linux;
   };
 
diff --git a/pkgs/development/libraries/vtk/default.nix b/pkgs/development/libraries/vtk/default.nix
index 083f4a9140a1..5b0bdb4ee741 100644
--- a/pkgs/development/libraries/vtk/default.nix
+++ b/pkgs/development/libraries/vtk/default.nix
@@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
     description = "Open source libraries for 3D computer graphics, image processing and visualization";
     homepage = http://www.vtk.org/;
     license = stdenv.lib.licenses.bsd3;
-    maintainers = with stdenv.lib.maintainers; [ viric bbenoist ];
+    maintainers = with stdenv.lib.maintainers; [ viric ];
     platforms = with stdenv.lib.platforms; unix;
   };
 }
diff --git a/pkgs/development/qtcreator/default.nix b/pkgs/development/qtcreator/default.nix
index ea7e7d0fb8e3..f66070be6944 100644
--- a/pkgs/development/qtcreator/default.nix
+++ b/pkgs/development/qtcreator/default.nix
@@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
     '';
     homepage = "https://wiki.qt.io/Category:Tools::QtCreator";
     license = "LGPL";
-    maintainers = [ maintainers.akaWolf maintainers.bbenoist ];
+    maintainers = [ maintainers.akaWolf ];
     platforms = platforms.all;
   };
 }
diff --git a/pkgs/tools/text/numdiff/default.nix b/pkgs/tools/text/numdiff/default.nix
index 8f22a9e7600e..96c91def9ac7 100644
--- a/pkgs/tools/text/numdiff/default.nix
+++ b/pkgs/tools/text/numdiff/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     '';
     homepage = http://www.nongnu.org/numdiff/;
     license = licenses.gpl3Plus;
-    maintainers = with maintainers; [ bbenoist ndowens ];
+    maintainers = with maintainers; [ ndowens ];
     platforms = platforms.gnu;
   };
 }

From 39c39f2cbf85f37101c1557ed6af83b8af8bac5d Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Wed, 22 Mar 2017 21:25:03 -0500
Subject: [PATCH 042/157] gpscorrelate: 1.6.0 -> 1.6.1

---
 .../misc/gpscorrelate/default.nix             | 28 +++++++++++--------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/pkgs/applications/misc/gpscorrelate/default.nix b/pkgs/applications/misc/gpscorrelate/default.nix
index 5026fea0e358..e691c79d85c0 100644
--- a/pkgs/applications/misc/gpscorrelate/default.nix
+++ b/pkgs/applications/misc/gpscorrelate/default.nix
@@ -1,17 +1,22 @@
-{ fetchurl, stdenv, pkgconfig, exiv2, libxml2, gtk2
+{ fetchFromGitHub, stdenv, pkgconfig, exiv2, libxml2, gtk2
 , libxslt, docbook_xsl, docbook_xml_dtd_42 }:
 
 stdenv.mkDerivation rec {
-  name = "gpscorrelate-1.6.0";
+  name = "gpscorrelate-${version}";
+  version = "1.6.1";
 
-  src = fetchurl {
-    url = "http://freefoote.dview.net/linux/${name}.tar.gz";
-    sha256 = "1j0b244xkvvf0i4iivp4dw9k4xgyasx4sapd91mnwki35fy49sp0";
+  src = fetchFromGitHub {
+    owner = "freefoote";
+    repo = "gpscorrelate";
+    rev = version;
+    sha256 = "1z0fc75rx7dl6nnydksa578qv116j2c2xs1czfiijzxjghx8njdj";
   };
 
+  nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
-    pkgconfig exiv2 libxml2 gtk2
-    libxslt docbook_xsl docbook_xml_dtd_42
+    exiv2 libxml2 gtk2
+    libxslt docbook_xsl 
+    docbook_xml_dtd_42
   ];
 
   patchPhase = ''
@@ -19,7 +24,7 @@ stdenv.mkDerivation rec {
         -es",^[[:blank:]]*prefix[[:blank:]]*=.*$,prefix = $out,g"
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "A GPS photo correlation tool, to add EXIF geotags";
 
     longDescription = ''
@@ -38,9 +43,8 @@ stdenv.mkDerivation rec {
       one takes the GPS data in a different format.
     '';
 
-    license = stdenv.lib.licenses.gpl2Plus;
-
-    homepage = http://freefoote.dview.net/linux_gpscorr.html;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.gpl2Plus;
+    homepage = https://github.com/freefoote/gpscorrelate;
+    platforms = platforms.linux;
   };
 }

From e68eeb29ae7f81bc3f4d057a68fecc282ec171da Mon Sep 17 00:00:00 2001
From: "Rommel M. Martinez" <ebzzry@gmail.com>
Date: Thu, 23 Mar 2017 11:04:08 +0800
Subject: [PATCH 043/157] emem: 0.2.46 -> 0.2.47

---
 pkgs/applications/misc/emem/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/misc/emem/default.nix b/pkgs/applications/misc/emem/default.nix
index ed96ad759438..5c163fe8c441 100644
--- a/pkgs/applications/misc/emem/default.nix
+++ b/pkgs/applications/misc/emem/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   pname = "emem";
-  version = "0.2.46";
+  version = "0.2.47";
   name = "${pname}-${version}";
 
   inherit jdk;
 
   src = fetchurl {
     url = "https://github.com/ebzzry/${pname}/releases/download/v${version}/${pname}.jar";
-    sha256 = "1wyckyh8jknkrcd8bvlf9m16xpi85hvhz42zv80by0hvsxgsibvy";
+    sha256 = "0hz862g7k42kik9vgzskqr99321llmmakl54ay9vsykvcxs632mx";
   };
 
   phases = [ "buildPhase" "installPhase" ];

From 55ac21e81d5787428be4fa9ec0e50329eacb1f79 Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Wed, 22 Mar 2017 22:53:28 +0000
Subject: [PATCH 044/157] ocamlPackages.nocrypto: 0.5.3 -> 0.5.4

---
 .../ocaml-modules/nocrypto/default.nix        | 31 ++++++++++---------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/pkgs/development/ocaml-modules/nocrypto/default.nix b/pkgs/development/ocaml-modules/nocrypto/default.nix
index d7f7ae0e3655..f9240f7507cf 100644
--- a/pkgs/development/ocaml-modules/nocrypto/default.nix
+++ b/pkgs/development/ocaml-modules/nocrypto/default.nix
@@ -1,32 +1,33 @@
-{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib
-, cstruct, zarith, ounit, ocaml_oasis, ppx_sexp_conv, sexplib
-, lwt ? null}:
+{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, opam, topkg
+, cpuid, ocb-stubblr
+, cstruct, zarith, ocaml_oasis, ppx_sexp_conv, sexplib
+, lwt ? null
+}:
 
 with stdenv.lib;
 let withLwt = lwt != null; in
 
-buildOcaml rec {
-  name = "nocrypto";
-  version = "0.5.3";
-
-  minimumSupportedOcamlVersion = "4.02";
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-nocrypto-${version}";
+  version = "0.5.4";
 
   src = fetchFromGitHub {
     owner  = "mirleft";
     repo   = "ocaml-nocrypto";
     rev    = "v${version}";
-    sha256 = "0m3yvqpgfffqp15mcl08b78cv8zw25rnp6z1pkj5aimz6xg3gqbl";
+    sha256 = "0nhnlpbqh3mf9y2cxivlvfb70yfbdpvg6jslzq64xblpgjyg443p";
   };
 
-  buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv ];
+  buildInputs = [ ocaml ocaml_oasis findlib ocamlbuild topkg opam cpuid ocb-stubblr
+    ppx_sexp_conv ];
   propagatedBuildInputs = [ cstruct zarith sexplib ] ++ optional withLwt lwt;
 
-  configureFlags = [ "--enable-tests" ] ++ optional withLwt ["--enable-lwt"];
+  buildPhase = ''
+    LD_LIBRARY_PATH=${cpuid}/lib/ocaml/${ocaml.version}/site-lib/stubslibs/ \
+    ${topkg.buildPhase} --with-lwt ${if withLwt then "true" else "false"}
+  '';
+  inherit (topkg) installPhase;
 
-  configurePhase = "./configure --prefix $out $configureFlags";
-
-  doCheck = true;
-  checkTarget = "test";
   createFindlibDestdir = true;
 
   meta = {

From a81e25336978af759f5e4f24c8ce1755f54481bc Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Thu, 23 Mar 2017 06:39:50 +0000
Subject: [PATCH 045/157] ocamlPackages.base: init at 0.9.0

Base is a complete and portable alternative to the OCaml standard library.

Homepage: https://github.com/janestreet/base
---
 .../ocaml-modules/base/default.nix            | 21 +++++++++++++++++++
 pkgs/top-level/ocaml-packages.nix             |  2 ++
 2 files changed, 23 insertions(+)
 create mode 100644 pkgs/development/ocaml-modules/base/default.nix

diff --git a/pkgs/development/ocaml-modules/base/default.nix b/pkgs/development/ocaml-modules/base/default.nix
new file mode 100644
index 000000000000..4c92c7f1ca1b
--- /dev/null
+++ b/pkgs/development/ocaml-modules/base/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, ocaml, jbuilder, findlib }:
+
+stdenv.mkDerivation {
+  name = "ocaml${ocaml.version}-base-0.9.0";
+
+  src = fetchurl {
+    url = http://ocaml.janestreet.com/ocaml-core/v0.9/files/base-v0.9.0.tar.gz;
+    sha256 = "0pdpa3hflbqn978ppvv5y08cjya0k8xpf1h0kcak6bdrmnmiwlyx";
+  };
+
+  buildInputs = [ ocaml jbuilder findlib ];
+
+  inherit (jbuilder) installPhase;
+
+  meta = {
+    license = stdenv.lib.licenses.asl20;
+    inherit (ocaml.meta) platforms;
+    homepage = https://github.com/janestreet/base;
+    description = "Full standard library replacement for OCaml";
+  };
+}
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index 281375b7fdf0..8471d1a1ced7 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -49,6 +49,8 @@ let
 
     atdgen = callPackage ../development/ocaml-modules/atdgen { };
 
+    base = callPackage ../development/ocaml-modules/base { };
+
     base64 = callPackage ../development/ocaml-modules/base64 { };
 
     bolt = callPackage ../development/ocaml-modules/bolt { };

From c6c92a1d0411de000c325a5187b5b5079556ffed Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 23 Mar 2017 15:01:44 +0800
Subject: [PATCH 046/157] terraform: only run tests from 0.9.0 onwards

---
 pkgs/applications/networking/cluster/terraform/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/applications/networking/cluster/terraform/default.nix b/pkgs/applications/networking/cluster/terraform/default.nix
index a91a28deba12..ab0771656b59 100644
--- a/pkgs/applications/networking/cluster/terraform/default.nix
+++ b/pkgs/applications/networking/cluster/terraform/default.nix
@@ -27,7 +27,7 @@ let
       export HOME=$TMP
     '';
 
-    doCheck = builtins.compareVersions version "0.8.8" >= 0;
+    doCheck = builtins.compareVersions version "0.9.0" >= 0;
 
     meta = with stdenv.lib; {
       description = "Tool for building, changing, and versioning infrastructure";

From 785e45ac06209295531955c0da302f72cb01e4ff Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Thu, 23 Mar 2017 10:10:04 +0100
Subject: [PATCH 047/157] Revert "Revert "kmod-blacklist-ubuntu: 9.3 -> 22.1""

This reverts commit 8c410f4b1877d3de7be5255972ef8177cdb81b9a with a fix
to make the tests run correctly. bochs-drm must not be blacklisted for
that.
---
 .../linux/kmod-blacklist-ubuntu/default.nix    | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix b/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix
index 35bf40bf835b..7137390ecabc 100644
--- a/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix
+++ b/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix
@@ -1,13 +1,14 @@
 { stdenv, fetchurl, gnugrep, findutils }:
+
 let
-  version = "3ubuntu1"; # Saucy
-in
-stdenv.mkDerivation {
+  version = "22-1.1ubuntu1"; # Zesty
+
+in stdenv.mkDerivation {
   name = "kmod-blacklist-${version}";
 
   src = fetchurl {
-    url = "https://launchpad.net/ubuntu/+archive/primary/+files/kmod_9-${version}.debian.tar.gz";
-    sha256 = "0h6h0zw2490iqj9xa2sz4309jyfmcc50jdvkhxa1nw90npxglp67";
+    url = "https://launchpad.net/ubuntu/+archive/primary/+files/kmod_${version}.debian.tar.xz";
+    sha256 = "1k749g707ccb82l4xmrkp53khl71f57cpj9fzd1qyzrz147fjyhi";
   };
 
   installPhase = ''
@@ -20,6 +21,7 @@ stdenv.mkDerivation {
     done
 
     substituteInPlace "$out"/modprobe.conf \
+      --replace "blacklist bochs-drm" "" \
       --replace /sbin/lsmod /run/booted-system/sw/bin/lsmod \
       --replace /sbin/rmmod /run/booted-system/sw/bin/rmmod \
       --replace /sbin/modprobe /run/booted-system/sw/bin/modprobe \
@@ -27,9 +29,9 @@ stdenv.mkDerivation {
       --replace " xargs " " ${findutils}/bin/xargs "
   '';
 
-  meta = {
-    homepage = http://packages.ubuntu.com/source/saucy/kmod;
+  meta = with stdenv.lib; {
+    homepage = http://packages.ubuntu.com/source/zesty/kmod;
     description = "Linux kernel module blacklists from Ubuntu";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = platforms.linux;
   };
 }

From 817d8a671cdf4eb1ba23c6f092446506c8372486 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Thu, 23 Mar 2017 11:52:37 +0100
Subject: [PATCH 048/157] gkrellm: fix homepage

---
 pkgs/applications/misc/gkrellm/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/applications/misc/gkrellm/default.nix b/pkgs/applications/misc/gkrellm/default.nix
index 86b6d532be45..8654e7f3a261 100644
--- a/pkgs/applications/misc/gkrellm/default.nix
+++ b/pkgs/applications/misc/gkrellm/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
          or any other theme.
       '';
 
-    homepage = http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html;
+    homepage = http://gkrellm.srcbox.net;
     license = licenses.gpl3Plus;
     maintainers = [ ];
     platforms = platforms.unix;

From a6665adde8242162d94ef69b8d387fae9c6b1b14 Mon Sep 17 00:00:00 2001
From: Symphorien Gibol <symphorien+git@xlumurb.eu>
Date: Wed, 22 Mar 2017 15:40:22 +0100
Subject: [PATCH 049/157] grub module: fix useOSProber when installing grub as
 EFI

---
 .../system/boot/loader/grub/install-grub.pl   | 62 ++++++++++---------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index c7559cd634a2..5fcac5c8c6a4 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -443,9 +443,40 @@ my $confFile = $grubVersion == 1 ? "$bootPath/grub/menu.lst" : "$bootPath/grub/g
 my $tmpFile = $confFile . ".tmp";
 writeFile($tmpFile, $conf);
 
+
+# check whether to install GRUB EFI or not
+sub getEfiTarget {
+    if ($grubVersion == 1) {
+        return "no"
+    } elsif (($grub ne "") && ($grubEfi ne "")) {
+        # EFI can only be installed when target is set;
+        # A target is also required then for non-EFI grub
+        if (($grubTarget eq "") || ($grubTargetEfi eq "")) { die }
+        else { return "both" }
+    } elsif (($grub ne "") && ($grubEfi eq "")) {
+        # TODO: It would be safer to disallow non-EFI grub installation if no taget is given.
+        #       If no target is given, then grub auto-detects the target which can lead to errors.
+        #       E.g. it seems as if grub would auto-detect a EFI target based on the availability
+        #       of a EFI partition.
+        #       However, it seems as auto-detection is currently relied on for non-x86_64 and non-i386
+        #       architectures in NixOS. That would have to be fixed in the nixos modules first.
+        return "no"
+    } elsif (($grub eq "") && ($grubEfi ne "")) {
+        # EFI can only be installed when target is set;
+        if ($grubTargetEfi eq "") { die }
+        else {return "only" }
+    } else {
+        # prevent an installation if neither grub nor grubEfi is given
+        return "neither"
+    }
+}
+
+my $efiTarget = getEfiTarget();
+
 # Append entries detected by os-prober
 if (get("useOSProber") eq "true") {
-    system(get("shell"), "-c", "pkgdatadir=$grub/share/grub $grub/etc/grub.d/30_os-prober >> $tmpFile");
+    my $targetpackage = ($efiTarget eq "no") ? $grub : $grubEfi;
+    system(get("shell"), "-c", "pkgdatadir=$targetpackage/share/grub $targetpackage/etc/grub.d/30_os-prober >> $tmpFile");
 }
 
 # Atomically switch to the new config
@@ -498,36 +529,7 @@ sub getDeviceTargets {
     }
     return @devices;
 }
-
-# check whether to install GRUB EFI or not
-sub getEfiTarget {
-    if ($grubVersion == 1) {
-        return "no"
-    } elsif (($grub ne "") && ($grubEfi ne "")) {
-        # EFI can only be installed when target is set;
-        # A target is also required then for non-EFI grub
-        if (($grubTarget eq "") || ($grubTargetEfi eq "")) { die }
-        else { return "both" }
-    } elsif (($grub ne "") && ($grubEfi eq "")) {
-        # TODO: It would be safer to disallow non-EFI grub installation if no taget is given.
-        #       If no target is given, then grub auto-detects the target which can lead to errors.
-        #       E.g. it seems as if grub would auto-detect a EFI target based on the availability
-        #       of a EFI partition.
-        #       However, it seems as auto-detection is currently relied on for non-x86_64 and non-i386
-        #       architectures in NixOS. That would have to be fixed in the nixos modules first.
-        return "no"
-    } elsif (($grub eq "") && ($grubEfi ne "")) {
-        # EFI can only be installed when target is set;
-        if ($grubTargetEfi eq "") { die }
-        else {return "only" }
-    } else {
-        # prevent an installation if neither grub nor grubEfi is given
-        return "neither"
-    }
-}
-
 my @deviceTargets = getDeviceTargets();
-my $efiTarget = getEfiTarget();
 my $prevGrubState = readGrubState();
 my @prevDeviceTargets = split/,/, $prevGrubState->devices;
 

From a49df2a8942b1ccb3a8280a8887e8c76436525f0 Mon Sep 17 00:00:00 2001
From: Joachim Fasting <joachifm@fastmail.fm>
Date: Thu, 23 Mar 2017 12:53:10 +0100
Subject: [PATCH 050/157] tribler: fixup revision

Using `rev = "v${revision}"` results in a "bad reference" error;
use the plain revision instead.
---
 pkgs/applications/networking/p2p/tribler/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/applications/networking/p2p/tribler/default.nix b/pkgs/applications/networking/p2p/tribler/default.nix
index a8d360c41564..8e99d5159f87 100644
--- a/pkgs/applications/networking/p2p/tribler/default.nix
+++ b/pkgs/applications/networking/p2p/tribler/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
 
   src = fetchgit {
     url = "https://github.com/Tribler/tribler";
-    rev = "v${revision}";
+    rev = revision;
     sha256 = "16mk76qgg7fgca11yvpygicxqbkc0kn6r82x73fly2310pagd845";
     fetchSubmodules = true;
   };

From 632e81083caf8821c1c37e8476dac94910237d69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 23 Mar 2017 10:22:42 +0100
Subject: [PATCH 051/157] spice: 0.12.8 -> 0.13.3

(we can use upstream security patches again)
---
 ...lowing-patch-from-http-pkgs.fedorapr.patch | 56 -------------------
 pkgs/development/libraries/spice/default.nix  | 13 +++--
 2 files changed, 8 insertions(+), 61 deletions(-)
 delete mode 100644 pkgs/development/libraries/spice/0001-Adapting-the-following-patch-from-http-pkgs.fedorapr.patch

diff --git a/pkgs/development/libraries/spice/0001-Adapting-the-following-patch-from-http-pkgs.fedorapr.patch b/pkgs/development/libraries/spice/0001-Adapting-the-following-patch-from-http-pkgs.fedorapr.patch
deleted file mode 100644
index 8098f568e21a..000000000000
--- a/pkgs/development/libraries/spice/0001-Adapting-the-following-patch-from-http-pkgs.fedorapr.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 75e8685740199537bfefcbd9996ec3ff9f6342e6 Mon Sep 17 00:00:00 2001
-From: Graham Christensen <graham@grahamc.com>
-Date: Wed, 8 Feb 2017 21:58:43 -0500
-Subject: [PATCH] Adapting the following patch, from
- http://pkgs.fedoraproject.org/cgit/rpms/spice.git/plain/0003-main-channel-Prevent-overflow-reading-messages-from-.patch?id=d919d639ae5f83a9735a04d843eed675f9357c0d
-
-> From: Frediano Ziglio <fziglio@redhat.com>
-> Date: Tue, 29 Nov 2016 16:46:56 +0000
-> Subject: [spice-server 3/3] main-channel: Prevent overflow reading messages
->  from client
->
-> Caller is supposed the function return a buffer able to store
-> size bytes.
->
-> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
-> ---
->  server/main-channel.c | 3 +++
->  1 file changed, 3 insertions(+)
->
-> diff --git a/server/main-channel.c b/server/main-channel.c
-> index 24dd448..1124506 100644
-> --- a/server/main-channel.c
-> +++ b/server/main-channel.c
-> @@ -258,6 +258,9 @@ static uint8_t *main_channel_alloc_msg_rcv_buf(RedChannelClient *rcc,
->
->      if (type == SPICE_MSGC_MAIN_AGENT_DATA) {
->          return reds_get_agent_data_buffer(red_channel_get_server(channel), mcc, size);
-> +    } else if (size > sizeof(main_chan->recv_buf)) {
-> +        /* message too large, caller will log a message and close the connection */
-> +        return NULL;
->      } else {
->          return main_chan->recv_buf;
->      }
-> --
-> 2.9.3
-> ---
- server/main_channel.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/server/main_channel.c b/server/main_channel.c
-index 0ecc9df..1fc3915 100644
---- a/server/main_channel.c
-+++ b/server/main_channel.c
-@@ -1026,6 +1026,9 @@ static uint8_t *main_channel_alloc_msg_rcv_buf(RedChannelClient *rcc,
-
-     if (type == SPICE_MSGC_MAIN_AGENT_DATA) {
-         return reds_get_agent_data_buffer(mcc, size);
-+    } else if (size > sizeof(main_chan->recv_buf)) {
-+        /* message too large, caller will log a message and close the connection */
-+        return NULL;
-     } else {
-         return main_chan->recv_buf;
-     }
---
-2.10.0
diff --git a/pkgs/development/libraries/spice/default.nix b/pkgs/development/libraries/spice/default.nix
index 61952c3b3238..808bfd4f811d 100644
--- a/pkgs/development/libraries/spice/default.nix
+++ b/pkgs/development/libraries/spice/default.nix
@@ -6,14 +6,15 @@
 with stdenv.lib;
 
 stdenv.mkDerivation rec {
-  name = "spice-0.12.8";
+  name = "spice-0.13.3";
 
   src = fetchurl {
     url = "http://www.spice-space.org/download/releases/${name}.tar.bz2";
-    sha256 = "0za03i77j8i3g5l2np2j7vy8cqsdbkm9wbv4hjnaqq9xhz2sa0gr";
+    sha256 = "17mqgwamdhj8sx8vhahrjl5937x693kjnw6cp6v0akjrwz011xrh";
   };
 
   patches = [
+    # the following three patches fix CVE-2016-9577 and CVE-2016-9578
     (fetchpatch {
       name = "0001-Prevent-possible-DoS-attempts-during-protocol-handsh.patch";
       url = "http://pkgs.fedoraproject.org/cgit/rpms/spice.git/plain/0001-Prevent-possible-DoS-attempts-during-protocol-handsh.patch?id=d919d639ae5f83a9735a04d843eed675f9357c0d";
@@ -24,9 +25,11 @@ stdenv.mkDerivation rec {
       url = "http://pkgs.fedoraproject.org/cgit/rpms/spice.git/plain/0002-Prevent-integer-overflows-in-capability-checks.patch?id=d919d639ae5f83a9735a04d843eed675f9357c0d";
       sha256 = "1r1bhq98w93cvvrlrz6jwdfsy261xl3xqs0ppchaa2igyxvxv5z5";
     })
-    # Originally from http://pkgs.fedoraproject.org/cgit/rpms/spice.git/plain/0003-main-channel-Prevent-overflow-reading-messages-from-.patch?id=d919d639ae5f83a9735a04d843eed675f9357c0d
-    # but main-channel.c was renamed to main_channel.c
-    ./0001-Adapting-the-following-patch-from-http-pkgs.fedorapr.patch
+    (fetchpatch {
+      name = "0003-main-channel-Prevent-overflow-reading-messages-from.patch";
+      url = "https://cgit.freedesktop.org/spice/spice/patch/?id=1d3e26c0ee75712fa4bbbcfa09d8d5866b66c8af";
+      sha256 = "030mm551aipck99rqiz39vsvk071pn8715zynr5j6chwzgpflwm3";
+    })
   ];
 
   buildInputs = [ pixman celt alsaLib openssl libjpeg zlib

From f9add54f281391aca361230db96d15ec684b7a99 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Thu, 23 Mar 2017 15:10:34 +0100
Subject: [PATCH 052/157] fontforge-fonttools: init at 20160404

---
 pkgs/tools/misc/fontforge/default.nix         |  1 +
 .../misc/fontforge/fontforge-fonttools.nix    | 24 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 ++
 3 files changed, 27 insertions(+)
 create mode 100644 pkgs/tools/misc/fontforge/fontforge-fonttools.nix

diff --git a/pkgs/tools/misc/fontforge/default.nix b/pkgs/tools/misc/fontforge/default.nix
index 2cccee0a4e3b..cecd2ef3cf36 100644
--- a/pkgs/tools/misc/fontforge/default.nix
+++ b/pkgs/tools/misc/fontforge/default.nix
@@ -57,6 +57,7 @@ stdenv.mkDerivation rec {
     description = "A font editor";
     homepage = http://fontforge.github.io;
     platforms = stdenv.lib.platforms.all;
+    license = stdenv.lib.licenses.bsd3;
   };
 }
 
diff --git a/pkgs/tools/misc/fontforge/fontforge-fonttools.nix b/pkgs/tools/misc/fontforge/fontforge-fonttools.nix
new file mode 100644
index 000000000000..046c1d449201
--- /dev/null
+++ b/pkgs/tools/misc/fontforge/fontforge-fonttools.nix
@@ -0,0 +1,24 @@
+{stdenv, fontforge, zlib}:
+stdenv.mkDerivation rec {
+  name = "fontforge-fonttools-${fontforge.version}";
+  src = fontforge.src;
+
+  buildInputs = [zlib];
+
+  setSourceRoot = ''export sourceRoot="$(echo */contrib/fonttools)"'';
+
+  installPhase = ''
+    mkdir -p "$out"/{bin,share/doc/fontforge-fonttools}
+    for i in *.c; do
+      gcc "$i" -lz -lm --std=c99 -o "$out"/bin/$(basename "$i" .c)
+    done
+    cp README* "$out/share/doc/fontforge-fonttools"
+  '';
+
+  meta = with stdenv.lib; {
+    description = ''Small font tools shipped in FontForge contrib'';
+    license = fontforge.meta.license;
+    maintainers = with maintainers; [ raskin ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e086fd0b153e..f28f672eaba2 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1818,6 +1818,8 @@ with pkgs;
     inherit (darwin.apple_sdk.frameworks) Carbon Cocoa;
   };
 
+  fontforge-fonttools = callPackage ../tools/misc/fontforge/fontforge-fonttools.nix {};
+
   fontmatrix = callPackage ../applications/graphics/fontmatrix {};
 
   foremost = callPackage ../tools/system/foremost { };

From 45f486f096bb3f3fe030571d2bcfd561f921b0cc Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Thu, 23 Mar 2017 13:29:08 +0100
Subject: [PATCH 053/157] Revert "security-wrapper: Don't remove the old paths
 yet as that can create migration pain"

This reverts commit 4c751ced376e0042ddd4f2aa8bd40754b9ea8926.

This does not fix the issue as /run is now mounted with nosuid.
---
 nixos/modules/security/wrappers/default.nix | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/nixos/modules/security/wrappers/default.nix b/nixos/modules/security/wrappers/default.nix
index 0aca39fd6bed..65d875c3a375 100644
--- a/nixos/modules/security/wrappers/default.nix
+++ b/nixos/modules/security/wrappers/default.nix
@@ -177,6 +177,25 @@ in
           # programs to be wrapped.
           WRAPPER_PATH=${config.system.path}/bin:${config.system.path}/sbin
 
+          # Remove the old /var/setuid-wrappers path from the system...
+          #
+          # TODO: this is only necessary for ugprades 16.09 => 17.x;
+          # this conditional removal block needs to be removed after
+          # the release.
+          if [ -d /var/setuid-wrappers ]; then
+            rm -rf /var/setuid-wrappers
+          fi
+
+          # Remove the old /run/setuid-wrappers-dir path from the
+          # system as well...
+          #
+          # TODO: this is only necessary for ugprades 16.09 => 17.x;
+          # this conditional removal block needs to be removed after
+          # the release.
+          if [ -d /run/setuid-wrapper-dirs ]; then
+            rm -rf /run/setuid-wrapper-dirs
+          fi
+
           # We want to place the tmpdirs for the wrappers to the parent dir.
           wrapperDir=$(mktemp --directory --tmpdir="${parentWrapperDir}" wrappers.XXXXXXXXXX)
           chmod a+rx $wrapperDir

From e82baf043e25abbb354c7ab4415a40a4155df398 Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Thu, 23 Mar 2017 13:32:10 +0100
Subject: [PATCH 054/157] security-wrapper: link old wrapper dir to new one

This makes setuid wrappers not fail after upgrading.

references #23641, #22914, #19862, #16654
---
 nixos/modules/security/wrappers/default.nix | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/security/wrappers/default.nix b/nixos/modules/security/wrappers/default.nix
index 65d875c3a375..c051b7d49e3f 100644
--- a/nixos/modules/security/wrappers/default.nix
+++ b/nixos/modules/security/wrappers/default.nix
@@ -179,21 +179,31 @@ in
 
           # Remove the old /var/setuid-wrappers path from the system...
           #
-          # TODO: this is only necessary for ugprades 16.09 => 17.x;
+          # TODO: this is only necessary for upgrades 16.09 => 17.x;
           # this conditional removal block needs to be removed after
           # the release.
           if [ -d /var/setuid-wrappers ]; then
             rm -rf /var/setuid-wrappers
+            ln -s /run/wrappers/bin /var/setuid-wrappers
           fi
 
           # Remove the old /run/setuid-wrappers-dir path from the
           # system as well...
           #
-          # TODO: this is only necessary for ugprades 16.09 => 17.x;
+          # TODO: this is only necessary for upgrades 16.09 => 17.x;
           # this conditional removal block needs to be removed after
           # the release.
           if [ -d /run/setuid-wrapper-dirs ]; then
             rm -rf /run/setuid-wrapper-dirs
+            ln -s /run/wrappers/bin /run/setuid-wrapper-dirs
+          fi
+
+          # TODO: this is only necessary for upgrades 16.09 => 17.x;
+          # this conditional removal block needs to be removed after
+          # the release.
+          if readlink -f /run/booted-system | grep nixos-17 > /dev/null; then
+            rm -rf /run/setuid-wrapper-dirs
+            rm -rf /var/setuid-wrappers
           fi
 
           # We want to place the tmpdirs for the wrappers to the parent dir.

From bf7847ec7c3a11a4ccc03d72f995d78fb8133add Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Thu, 23 Mar 2017 10:00:32 -0500
Subject: [PATCH 055/157] galculator: 2.1.3 -> 2.1.4 (#24230)

---
 pkgs/applications/misc/galculator/default.nix | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/pkgs/applications/misc/galculator/default.nix b/pkgs/applications/misc/galculator/default.nix
index 5d5f83a2370f..44071b328758 100644
--- a/pkgs/applications/misc/galculator/default.nix
+++ b/pkgs/applications/misc/galculator/default.nix
@@ -1,17 +1,20 @@
-{ stdenv, fetchurl
-, intltool, pkgconfig, gtk }:
+{ stdenv, fetchFromGitHub
+, autoreconfHook, intltool
+, gtk, pkgconfig, flex }:
 
 stdenv.mkDerivation rec {
-  
   name = "galculator-${version}";
-  version = "2.1.3";
+  version = "2.1.4";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/galculator/${name}.tar.gz";
-    sha256 = "12m7dldjk10lpkdxk7zpk98n32ci65zmxidghihb7n1m3rhp3q17";
+  src = fetchFromGitHub {
+    owner = "galculator";
+    repo = "galculator";
+    rev = "v${version}";
+    sha256 = "0q0hb62f266709ncyq96bpx4a40a1i6dc5869byvd7x285sx1c2w";
   };
 
-  buildInputs = [ intltool pkgconfig gtk ];
+  nativeBuildInputs = [ autoreconfHook intltool pkgconfig ];
+  buildInputs = [ gtk flex ];
 
   meta = with stdenv.lib; {
     description = "A GTK 2/3 algebraic and RPN calculator";

From c71f8f6ead73c082143e9db2b921a6fb7bbfecc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Thu, 23 Mar 2017 16:10:04 +0100
Subject: [PATCH 056/157] release-combined: disable plasma tests temporarily

... to get a channel bump after a long time; see #24240.
---
 nixos/release-combined.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index 63ca39a9b602..00abbcacf8c9 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -72,7 +72,7 @@ in rec {
         (all nixos.tests.ecryptfs)
         (all nixos.tests.ipv6)
         (all nixos.tests.i3wm)
-        (all nixos.tests.plasma5)
+        #(all nixos.tests.plasma5) # temporarily, see #24240
         #(all nixos.tests.lightdm)
         (all nixos.tests.login)
         (all nixos.tests.misc)

From 070ae18422a2aeb3da20b0cc715bf7bfe8daa825 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Thu, 23 Mar 2017 16:34:11 +0100
Subject: [PATCH 057/157] knot-dns: maintenance 2.4.1 -> 2.4.2

---
 pkgs/servers/dns/knot-dns/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/servers/dns/knot-dns/default.nix b/pkgs/servers/dns/knot-dns/default.nix
index 94d5ee9f5c71..1174f5badba0 100644
--- a/pkgs/servers/dns/knot-dns/default.nix
+++ b/pkgs/servers/dns/knot-dns/default.nix
@@ -7,11 +7,11 @@ with { inherit (stdenv.lib) optional optionals; };
 # Note: ATM only the libraries have been tested in nixpkgs.
 stdenv.mkDerivation rec {
   name = "knot-dns-${version}";
-  version = "2.4.1";
+  version = "2.4.2";
 
   src = fetchurl {
     url = "http://secure.nic.cz/files/knot-dns/knot-${version}.tar.xz";
-    sha256 = "c064ddf99bf5fc24dd3c6a3a523394760357e204c8b69f0e691e49bc0d9b704c";
+    sha256 = "37da7fcf1f194bd6376c63d8c4fa28a21899b56a3f3b63dba7095740a5752c52";
   };
 
   outputs = [ "bin" "out" "dev" ];

From 73a6832ad86755ae4dfb7717b4d1e37b2691fb4f Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Thu, 23 Mar 2017 16:45:39 +0100
Subject: [PATCH 058/157] golly: use wxGTK 3.0

---
 pkgs/top-level/all-packages.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f28f672eaba2..165761611132 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17653,8 +17653,8 @@ with pkgs;
 
   gravit = callPackage ../applications/science/astronomy/gravit { };
 
-  golly = callPackage ../applications/science/misc/golly { };
-  golly-beta = callPackage ../applications/science/misc/golly/beta.nix { };
+  golly = callPackage ../applications/science/misc/golly { wxGTK = wxGTK30; };
+  golly-beta = callPackage ../applications/science/misc/golly/beta.nix { wxGTK = wxGTK30; };
 
   megam = callPackage ../applications/science/misc/megam { };
 

From b1a9bcfb161043297a63d9c6b5887b92debfcf3b Mon Sep 17 00:00:00 2001
From: romildo <malaquias@gmail.com>
Date: Wed, 22 Mar 2017 06:55:34 -0300
Subject: [PATCH 059/157] awesome: menubar should take XDG_HOME_DIR and
 XDG_DATA_DIRS into account

---
 pkgs/applications/window-managers/awesome/default.nix | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pkgs/applications/window-managers/awesome/default.nix b/pkgs/applications/window-managers/awesome/default.nix
index 8a088daec1ac..eccb1a19538a 100644
--- a/pkgs/applications/window-managers/awesome/default.nix
+++ b/pkgs/applications/window-managers/awesome/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, luaPackages, cairo, cmake, imagemagick, pkgconfig, gdk_pixbuf
+{ stdenv, fetchurl, fetchFromGitHub, luaPackages, cairo, cmake, imagemagick, pkgconfig, gdk_pixbuf
 , xorg, libstartup_notification, libxdg_basedir, libpthreadstubs
 , xcb-util-cursor, makeWrapper, pango, gobjectIntrospection, unclutter
 , compton, procps, iproute, coreutils, curl, alsaUtils, findutils, xterm
@@ -38,6 +38,13 @@ with luaPackages; stdenv.mkDerivation rec {
                   xorg.xcbutilrenderutil xorg.xcbutilwm libxkbcommon
                   xcbutilxrm ];
 
+  patches = [
+    (fetchurl {
+      url = "https://patch-diff.githubusercontent.com/raw/awesomeWM/awesome/pull/1639.patch";
+      sha256 = "00piynmbxajd2xbg960gmf0zlqn7m489f4ww482y49ravfy1jhsj";
+    })
+  ];
+
   #cmakeFlags = "-DGENERATE_MANPAGES=ON";
 
   LD_LIBRARY_PATH = "${stdenv.lib.makeLibraryPath [ cairo pango gobjectIntrospection ]}";

From a20602d8e22ae1aed9ff57815ab1d0bad71080ac Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Thu, 23 Mar 2017 16:38:46 -0400
Subject: [PATCH 060/157] linux: 4.4.55 -> 4.4.56

---
 pkgs/os-specific/linux/kernel/linux-4.4.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/linux-4.4.nix b/pkgs/os-specific/linux/kernel/linux-4.4.nix
index dd6bba4567a8..5a0366eb4ea6 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.4.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, perl, buildLinux, ... } @ args:
 
 import ./generic.nix (args // rec {
-  version = "4.4.55";
+  version = "4.4.56";
   extraMeta.branch = "4.4";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "14inh7ps6zkvkwifqgxnwj02a7907ighdj96dv66ydckwqcmyj4j";
+    sha256 = "1dm2qas6v73pkq787x2pqhl44xznnhdcvvjnyw75ajwyhqj1w62m";
   };
 
   kernelPatches = args.kernelPatches;

From 37a965c1debe2a9a951448b8ce7c25b9ebde2c50 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Thu, 23 Mar 2017 16:43:31 -0400
Subject: [PATCH 061/157] linux: 4.10.4 -> 4.10.5

---
 pkgs/os-specific/linux/kernel/linux-4.10.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/linux-4.10.nix b/pkgs/os-specific/linux/kernel/linux-4.10.nix
index 0311ea518c56..d0f891cb00c1 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.10.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.10.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, perl, buildLinux, ... } @ args:
 
 import ./generic.nix (args // rec {
-  version = "4.10.4";
+  version = "4.10.5";
   extraMeta.branch = "4.10";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "18cglngl42hcm0578hrsn962g2r1z9x6p5h9c6d3g0ac8siascqp";
+    sha256 = "04gwdqsngzddxvw34lcy9r03179l6s25qbxmsv5jz5kbczivzg6x";
   };
 
   kernelPatches = args.kernelPatches;

From a4d285616dac3147529dac22fadc515435cd7e49 Mon Sep 17 00:00:00 2001
From: Linus Heckemann <git@sphalerite.org>
Date: Thu, 23 Mar 2017 19:52:59 +0000
Subject: [PATCH 062/157] atanks: 6.2 -> 6.5

---
 pkgs/games/atanks/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/games/atanks/default.nix b/pkgs/games/atanks/default.nix
index 4b9b097bbb7e..88a9026e3bd1 100644
--- a/pkgs/games/atanks/default.nix
+++ b/pkgs/games/atanks/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "atanks-${version}";
-  version = "6.2";
+  version = "6.5";
 
   src = fetchurl {
     url = "mirror://sourceforge/project/atanks/atanks/${name}/${name}.tar.gz";
-    sha256 = "1s1lb87ind0y9d6hmfaf1b9wks8q3hd6w5n9dibq75rxqmcfvlpy";
+    sha256 = "0bijsbd51j4wsnmdxj54r92m7h8zqnvh9z3qqdig6zx7a8kjn61j";
   };
 
   buildInputs = [ allegro ];
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     substituteInPlace Makefile --replace /usr $out
   '';
 
-  makeFlags = [ "PREFIX=$(out)/" "INSTALL=install" ];
+  makeFlags = [ "PREFIX=$(out)/" "INSTALL=install" "CXX=g++" ];
 
   meta = with stdenv.lib; {
     description = "Atomic Tanks ballistics game";

From f92d08020dc5bb33622f83fade68b407f3a52378 Mon Sep 17 00:00:00 2001
From: Robert Helgesson <robert@rycee.net>
Date: Thu, 23 Mar 2017 21:52:09 +0100
Subject: [PATCH 063/157] atanks: remove unnecessary patch phase

---
 pkgs/games/atanks/default.nix | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/pkgs/games/atanks/default.nix b/pkgs/games/atanks/default.nix
index 88a9026e3bd1..05b645ee326b 100644
--- a/pkgs/games/atanks/default.nix
+++ b/pkgs/games/atanks/default.nix
@@ -11,10 +11,6 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ allegro ];
 
-  patchPhase = ''
-    substituteInPlace Makefile --replace /usr $out
-  '';
-
   makeFlags = [ "PREFIX=$(out)/" "INSTALL=install" "CXX=g++" ];
 
   meta = with stdenv.lib; {

From 37f7470269f14cf7d368bcbd80017b0511413966 Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Thu, 23 Mar 2017 22:04:19 +0100
Subject: [PATCH 064/157] linux: drop 3.12 and 4.1

Support ends before 17.09 is released:
https://www.kernel.org/category/releases.html
---
 pkgs/os-specific/linux/kernel/linux-3.12.nix | 18 --------------
 pkgs/os-specific/linux/kernel/linux-4.1.nix  | 18 --------------
 pkgs/top-level/all-packages.nix              | 25 --------------------
 3 files changed, 61 deletions(-)
 delete mode 100644 pkgs/os-specific/linux/kernel/linux-3.12.nix
 delete mode 100644 pkgs/os-specific/linux/kernel/linux-4.1.nix

diff --git a/pkgs/os-specific/linux/kernel/linux-3.12.nix b/pkgs/os-specific/linux/kernel/linux-3.12.nix
deleted file mode 100644
index f82eb073de9a..000000000000
--- a/pkgs/os-specific/linux/kernel/linux-3.12.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
-
-import ./generic.nix (args // rec {
-  version = "3.12.71";
-  extraMeta.branch = "3.12";
-
-  src = fetchurl {
-    url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz";
-    sha256 = "11wmrj2zqb3x2az22q7ggdp6ibhqmlngy7v01fm8vrhz7f6lwf87";
-  };
-
-  kernelPatches = args.kernelPatches;
-
-  features.iwlwifi = true;
-  features.efiBootStub = true;
-  features.needsCifsUtils = true;
-  features.netfilterRPFilter = true;
-})
diff --git a/pkgs/os-specific/linux/kernel/linux-4.1.nix b/pkgs/os-specific/linux/kernel/linux-4.1.nix
deleted file mode 100644
index 30c5ce7e569b..000000000000
--- a/pkgs/os-specific/linux/kernel/linux-4.1.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-{ stdenv, fetchurl, perl, buildLinux, ... } @ args:
-
-import ./generic.nix (args // rec {
-  version = "4.1.39";
-  extraMeta.branch = "4.1";
-
-  src = fetchurl {
-    url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0m48slb13ipnjnw4inhyb74xxpla94344wbc2y5lzb402n5jrs58";
-  };
-
-  kernelPatches = args.kernelPatches;
-
-  features.iwlwifi = true;
-  features.efiBootStub = true;
-  features.needsCifsUtils = true;
-  features.netfilterRPFilter = true;
-} // (args.argsOverride or {}))
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 165761611132..93d79b1e0ed3 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -11537,29 +11537,6 @@ with pkgs;
       ];
   };
 
-  linux_3_12 = callPackage ../os-specific/linux/kernel/linux-3.12.nix {
-    kernelPatches = with kernelPatches;
-      [ bridge_stp_helper
-      ]
-      ++ lib.optionals ((platform.kernelArch or null) == "mips")
-      [ kernelPatches.mips_fpureg_emu
-        kernelPatches.mips_fpu_sigill
-        kernelPatches.mips_ext3_n32
-      ];
-  };
-
-  linux_4_1 = callPackage ../os-specific/linux/kernel/linux-4.1.nix {
-    kernelPatches =
-      [ kernelPatches.bridge_stp_helper
-        kernelPatches.DCCP_double_free_vulnerability_CVE-2017-6074
-      ]
-      ++ lib.optionals ((platform.kernelArch or null) == "mips")
-      [ kernelPatches.mips_fpureg_emu
-        kernelPatches.mips_fpu_sigill
-        kernelPatches.mips_ext3_n32
-      ];
-  };
-
   linux_4_4 = callPackage ../os-specific/linux/kernel/linux-4.4.nix {
     kernelPatches =
       [ kernelPatches.bridge_stp_helper
@@ -11787,8 +11764,6 @@ with pkgs;
   linuxPackages_mptcp = linuxPackagesFor pkgs.linux_mptcp;
   linuxPackages_rpi = linuxPackagesFor pkgs.linux_rpi;
   linuxPackages_3_10 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_10);
-  linuxPackages_3_12 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_12);
-  linuxPackages_4_1 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_1);
   linuxPackages_4_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_4);
   linuxPackages_4_9 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_9);
   linuxPackages_4_10 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_10);

From 5b5357ae1eec83f6e52d4f61298cf5cb86055cae Mon Sep 17 00:00:00 2001
From: Daiderd Jordan <daiderd@gmail.com>
Date: Thu, 23 Mar 2017 22:53:46 +0100
Subject: [PATCH 065/157] khd: remove g++ patch

---
 pkgs/os-specific/darwin/khd/default.nix | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/pkgs/os-specific/darwin/khd/default.nix b/pkgs/os-specific/darwin/khd/default.nix
index 0768f5a12e09..8a2f4f46e03f 100644
--- a/pkgs/os-specific/darwin/khd/default.nix
+++ b/pkgs/os-specific/darwin/khd/default.nix
@@ -13,11 +13,6 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ Carbon Cocoa ];
 
-  prePatch = ''
-    substituteInPlace makefile \
-      --replace g++ clang++
-  '';
-
   buildPhase = ''
     make install
   '';

From 7444cad2f6e3ccfa27c70b52389621c13b6cbf1e Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@devalot.com>
Date: Thu, 23 Mar 2017 15:03:56 -0700
Subject: [PATCH 066/157] geda: fix build by using guile_2_0 instead of latest
 ver

gEDA is failing to build on unstable because of the recent upgrade of
guile.
---
 pkgs/top-level/all-packages.nix | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 93d79b1e0ed3..a6ec9a784651 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17515,7 +17515,9 @@ with pkgs;
 
   caneda = callPackage ../applications/science/electronics/caneda { };
 
-  geda = callPackage ../applications/science/electronics/geda { };
+  geda = callPackage ../applications/science/electronics/geda {
+    guile = guile_2_0;
+  };
 
   gerbv = callPackage ../applications/science/electronics/gerbv { };
 

From d6e2366b1cd97d4cdcc5c84a361bc8533dd6c063 Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Thu, 23 Mar 2017 22:57:51 +0100
Subject: [PATCH 067/157] mpd: fix i686-linux build

See upstream https://github.com/MaxKellermann/MPD/pull/24, not clear if
this will be merged upstream as the author has been quite uncooperative.

Github patch URL (https://github.com/MaxKellermann/MPD/pull/24.patch)
sadly does not work for this.
---
 pkgs/servers/mpd/default.nix |  4 +++-
 pkgs/servers/mpd/x86.patch   | 12 ++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 pkgs/servers/mpd/x86.patch

diff --git a/pkgs/servers/mpd/default.nix b/pkgs/servers/mpd/default.nix
index e3938ec71a84..1883764e24ff 100644
--- a/pkgs/servers/mpd/default.nix
+++ b/pkgs/servers/mpd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, glib, systemd, boost, darwin
+{ stdenv, fetchurl, fetchpatch, pkgconfig, glib, systemd, boost, darwin
 , alsaSupport ? true, alsaLib
 , avahiSupport ? true, avahi, dbus
 , flacSupport ? true, flac
@@ -42,6 +42,8 @@ in stdenv.mkDerivation rec {
     sha256 = "0isbpa79m7zf09w3s1ry638cw96rxasy1ch66zl01k75i48mw1gl";
   };
 
+  patches = [ ./x86.patch ];
+
   buildInputs = [ pkgconfig glib boost ]
     ++ opt stdenv.isDarwin darwin.apple_sdk.frameworks.CoreAudioKit
     ++ opt stdenv.isLinux systemd
diff --git a/pkgs/servers/mpd/x86.patch b/pkgs/servers/mpd/x86.patch
new file mode 100644
index 000000000000..3e4c036418d2
--- /dev/null
+++ b/pkgs/servers/mpd/x86.patch
@@ -0,0 +1,12 @@
+--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx
++++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
+@@ -20,8 +20,8 @@
+ /* necessary because libavutil/common.h uses UINT64_C */
+ #define __STDC_CONSTANT_MACROS
+ 
+-#include "lib/ffmpeg/Time.hxx"
+ #include "config.h"
++#include "lib/ffmpeg/Time.hxx"
+ #include "FfmpegDecoderPlugin.hxx"
+ #include "lib/ffmpeg/Domain.hxx"
+ #include "lib/ffmpeg/Error.hxx"

From 16d2799af22320334332dd8049071d2a62a8711c Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Thu, 23 Mar 2017 18:04:36 -0500
Subject: [PATCH 068/157] Changed fetchgit to fetchFromGitHub

---
 pkgs/tools/package-management/cde/default.nix | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/pkgs/tools/package-management/cde/default.nix b/pkgs/tools/package-management/cde/default.nix
index 8261cc9e4cfa..17150c75466e 100644
--- a/pkgs/tools/package-management/cde/default.nix
+++ b/pkgs/tools/package-management/cde/default.nix
@@ -1,11 +1,14 @@
-{ stdenv, fetchgit }:
+{ stdenv, fetchFromGitHub }:
 
-stdenv.mkDerivation {
-  name = "cde-0.1";
-  src = fetchgit {
-    url = "https://github.com/pgbovine/CDE.git";
-    sha256 = "";
-    rev = "551e54d95eb3f8eefc698891f1b873fc4f02f360";
+stdenv.mkDerivation rec {
+  name = "cde-${version}";
+  version = "0.1";
+
+  src = fetchFromGitHub {
+    owner = "pgbovine";
+    repo = "CDE";
+    sha256 = "0raiz7pczkbnzxpg7g59v7gdp1ipkwgms2vh3431snw1va1gjzmk";
+    rev = "v${version}";
   };
 
   # The build is small, so there should be no problem
@@ -25,7 +28,7 @@ stdenv.mkDerivation {
   '';
 
   meta = with stdenv.lib; {
-    homepage = "https://github.com/pgbovine/CDE";
+    homepage = https://github.com/pgbovine/CDE;
     description = "A packaging tool for building portable packages";
     license = licenses.gpl3;
     maintainers = [ maintainers.rlupton20 ];

From 7833436098a341c1296faba17a7839690aa0702a Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Wed, 22 Mar 2017 14:16:39 +0800
Subject: [PATCH 069/157] kodi: 17.0 -> 17.1

---
 pkgs/applications/video/kodi/default.nix | 25 +++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix
index d7625b8ebacc..9c421e0c8280 100644
--- a/pkgs/applications/video/kodi/default.nix
+++ b/pkgs/applications/video/kodi/default.nix
@@ -44,12 +44,12 @@ let
     sha256 = "14jicb26s20nr3qmfpazszpc892yjwjn81zbsb8szy3a5xs19y81";
   };
 in stdenv.mkDerivation rec {
-    name = "kodi-" + version;
-    version = "17.0";
+    name = "kodi-${version}";
+    version = "17.1";
 
     src = fetchurl {
       url = "https://github.com/xbmc/xbmc/archive/${version}-${rel}.tar.gz";
-      sha256 = "0ib59x733yf8ivsw82qlsq43jn5214n668nrn5df2flpjcjgmzsb";
+      sha256 = "1vmvrq0qdjnphw34yils2b5jnm05cmsg777hc4lwqz5mrc1kjgrh";
     };
 
     buildInputs = [
@@ -97,9 +97,18 @@ in stdenv.mkDerivation rec {
     '';
 
     preConfigure = ''
+      patchShebangs .
       ./bootstrap
+      # tests here fail
+      sed -i '/TestSystemInfo.cpp/d' xbmc/utils/test/{Makefile,CMakeLists.txt}
+      # tests here trigger a segfault in kodi.bin
+      sed -i '/TestWebServer.cpp/d'  xbmc/network/test/{Makefile,CMakeLists.txt}
     '';
 
+    enableParallelBuild = true;
+
+    doCheck = true;
+
     configureFlags = [ "--enable-libcec" ]
     ++ lib.optional (!sambaSupport) "--disable-samba"
     ++ lib.optional vdpauSupport "--enable-vdpau"
@@ -110,19 +119,17 @@ in stdenv.mkDerivation rec {
     postInstall = ''
       for p in $(ls $out/bin/) ; do
         wrapProgram $out/bin/$p \
-          --prefix PATH ":" "${python2}/bin" \
-          --prefix PATH ":" "${glxinfo}/bin" \
-          --prefix PATH ":" "${xdpyinfo}/bin" \
+          --prefix PATH ":" "${lib.makeBinPath
+              [ python2 glxinfo xdpyinfo ]}" \
           --prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
-              [ curl systemd libmad libvdpau libcec libcec_platform rtmpdump libass SDL2 ]
-            }"
+              [ curl systemd libmad libvdpau libcec libcec_platform rtmpdump libass SDL2 ]}"
       done
     '';
 
     meta = with stdenv.lib; {
       homepage = http://kodi.tv/;
       description = "Media center";
-      license = stdenv.lib.licenses.gpl2;
+      license = licenses.gpl2;
       platforms = platforms.linux;
       maintainers = with maintainers; [ domenkozar titanous edwtjo ];
     };

From 8e3d3b5328c0dbeeb1612f81efe051251c3c28c9 Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Thu, 23 Mar 2017 18:57:01 -0500
Subject: [PATCH 070/157] Revert "sddm: propagate qtbase input"

This reverts commit 3de6ccd5b21e391c4fa324c94dd150e331a8474e.
---
 .../display-managers/sddm/default.nix         | 24 +++----------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix
index 019d3e97a6f7..9fd56a49b5f5 100644
--- a/pkgs/applications/display-managers/sddm/default.nix
+++ b/pkgs/applications/display-managers/sddm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, makeQtWrapper, fetchFromGitHub, fetchpatch
+{ stdenv, makeQtWrapper, fetchFromGitHub, fetchpatch
 , cmake, extra-cmake-modules, pkgconfig, libxcb, libpthreadstubs, lndir
 , libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd
 , themes
@@ -28,13 +28,10 @@ let
     nativeBuildInputs = [ cmake extra-cmake-modules pkgconfig qttools ];
 
     buildInputs = [
-      libxcb libpthreadstubs libXdmcp libXau pam systemd
-      qtbase qtdeclarative
+      libxcb libpthreadstubs libXdmcp libXau qtbase pam systemd
     ];
 
-    propagatedUserEnvPkgs = builtins.map lib.getBin [
-      qtbase qtdeclarative
-    ];
+    propagatedBuildInputs = [ qtdeclarative ];
 
     cmakeFlags = [
       "-DCONFIG_FILE=/etc/sddm.conf"
@@ -83,21 +80,6 @@ stdenv.mkDerivation {
   installPhase = ''
     runHook preInstall
 
-    propagated=
-    for i in $unwrapped $themes; do
-      findInputs $i propagated propagated-user-env-packages
-      if [ -z "$crossConfig" ]; then
-          findInputs $i propagated propagated-native-build-inputs
-      else
-          findInputs $i propagated propagated-build-inputs
-      fi
-    done
-
-    for pkg in $propagated; do
-      addToSearchPath RUNTIME_XDG_DATA_DIRS "$pkg/share"
-      addToSearchPath RUNTIME_XDG_CONFIG_DIRS "$pkg/etc/xdg"
-    done
-
     makeQtWrapper "$unwrapped/bin/sddm" "$out/bin/sddm"
 
     mkdir -p "$out/share/sddm"

From ae1034ea965f9f86b6cbf1064071923650907618 Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Thu, 23 Mar 2017 18:57:23 -0500
Subject: [PATCH 071/157] nixos/sddm: improve test

Disable SDDM auto-login to improve testing for SDDM themes. See #24246.
---
 nixos/tests/sddm.nix | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/nixos/tests/sddm.nix b/nixos/tests/sddm.nix
index 041d88fbeae6..a1bd8f14d23b 100644
--- a/nixos/tests/sddm.nix
+++ b/nixos/tests/sddm.nix
@@ -1,26 +1,24 @@
 import ./make-test.nix ({ pkgs, ...} : {
   name = "sddm";
-  meta = with pkgs.stdenv.lib.maintainers; {
-    maintainers = [ ttuegel ];
-  };
 
   machine = { lib, ... }: {
     imports = [ ./common/user-account.nix ];
     services.xserver.enable = true;
-    services.xserver.displayManager.sddm = {
-      enable = true;
-      autoLogin = {
-        enable = true;
-        user = "alice";
-      };
-    };
+    services.xserver.displayManager.sddm.enable = true;
     services.xserver.windowManager.default = "icewm";
     services.xserver.windowManager.icewm.enable = true;
     services.xserver.desktopManager.default = "none";
   };
 
-  testScript = { nodes, ... }: ''
+  enableOCR = true;
+
+  testScript = { nodes, ... }: let
+    user = nodes.machine.config.users.extraUsers.alice;
+  in ''
     startAll;
+    $machine->waitForText(qr/ALICE/);
+    $machine->screenshot("sddm");
+    $machine->sendChars("${user.password}\n");
     $machine->waitForFile("/home/alice/.Xauthority");
     $machine->succeed("xauth merge ~alice/.Xauthority");
     $machine->waitForWindow("^IceWM ");

From 2822bacd60121b9305ed6244ec76f7be42fbbf5a Mon Sep 17 00:00:00 2001
From: Jan Malakhovski <oxij@oxij.org>
Date: Thu, 23 Mar 2017 23:22:29 +0000
Subject: [PATCH 072/157] nixos: xen: condition default packages on `enable`

Closes #23690.
---
 nixos/modules/virtualisation/xen-dom0.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix
index 57487f704519..1f5b6bd1d808 100644
--- a/nixos/modules/virtualisation/xen-dom0.nix
+++ b/nixos/modules/virtualisation/xen-dom0.nix
@@ -29,7 +29,6 @@ in
 
     virtualisation.xen.package = mkOption {
       type = types.package;
-      default = pkgs.xen;
       defaultText = "pkgs.xen";
       example = literalExample "pkgs.xen-light";
       description = ''
@@ -39,7 +38,6 @@ in
 
     virtualisation.xen.qemu = mkOption {
       type = types.path;
-      default = "${pkgs.xen}/lib/xen/bin/qemu-system-i386";
       defaultText = "\${pkgs.xen}/lib/xen/bin/qemu-system-i386";
       example = literalExample "''${pkgs.qemu_xen-light}/bin/qemu-system-i386";
       description = ''
@@ -49,7 +47,6 @@ in
 
     virtualisation.xen.qemu-package = mkOption {
       type = types.package;
-      default = pkgs.xen;
       defaultText = "pkgs.xen";
       example = literalExample "pkgs.qemu_xen-light";
       description = ''
@@ -136,6 +133,9 @@ in
       message = "Xen currently does not support EFI boot";
     } ];
 
+    virtualisation.xen.package = mkDefault pkgs.xen;
+    virtualisation.xen.qemu = mkDefault "${pkgs.xen}/lib/xen/bin/qemu-system-i386";
+    virtualisation.xen.qemu-package = mkDefault pkgs.xen;
     virtualisation.xen.stored = mkDefault "${cfg.package}/bin/oxenstored";
 
     environment.systemPackages = [ cfg.package ];

From e0e520a5191542ba6b204f1226bf97299b85b286 Mon Sep 17 00:00:00 2001
From: c74d <8573dd@gmail.com>
Date: Fri, 24 Mar 2017 00:52:56 +0000
Subject: [PATCH 073/157] google-compute-image: copy store paths with rsync

In `nixos/modules/virtualisation/google-compute-image.nix`, copy store
paths with `rsync -a` rather than `cp -prd`, because `rsync` seems
better able to handle the hard-links that may be present in the store,
whereas `cp` may fail to copy them.

I have tested that the Google Compute Engine image builds successfully
for me with this patch, whereas it did not without this patch.

This is the same fix applied for Azure images in commit
097ef6e435d5b3fcde92e67abbaaaaaf05c0723d.

Fixes #23973.
---
 nixos/modules/virtualisation/google-compute-image.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
index 556454c6b5f8..a03c45bfeff0 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -62,7 +62,7 @@ in
 
           mkdir -p /mnt/nix/store
           echo "copying everything (will take a while)..."
-          cp -prd $storePaths /mnt/nix/store/
+          ${pkgs.rsync}/bin/rsync -a $storePaths /mnt/nix/store/
 
           # Register the paths in the Nix database.
           printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \

From 7b470cd57ad1cf3959e9499cc806e850b9aff28a Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Thu, 23 Mar 2017 20:59:22 -0500
Subject: [PATCH 074/157] 915resolution: 0.5.2 -> 0.5.3

---
 .../linux/915resolution/default.nix            | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/pkgs/os-specific/linux/915resolution/default.nix b/pkgs/os-specific/linux/915resolution/default.nix
index 9bcfcf392f40..d1cb7221615f 100644
--- a/pkgs/os-specific/linux/915resolution/default.nix
+++ b/pkgs/os-specific/linux/915resolution/default.nix
@@ -1,15 +1,19 @@
 {stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "915resolution-0.5.2";
+stdenv.mkDerivation rec {
+  name = "915resolution-0.5.3";
+  
   src = fetchurl {
-    url = http://www.geocities.com/stomljen/915resolution-0.5.2.tar.gz;
-    sha256 = "1m5nfzgwaglqabpm2l2mjqvigz1z0dj87cmj2pjbbzxmmpapv0lq";
+    url = "http://915resolution.mango-lang.org/${name}.tar.gz";
+    sha256 = "0hmmy4kkz3x6yigz6hk99416ybznd67dpjaxap50nhay9f1snk5n";
   };
-  buildPhase = "rm *.o 915resolution; make";
+
+  patchPhase = "rm *.o";
   installPhase = "mkdir -p $out/sbin; cp 915resolution $out/sbin/";
 
-  meta = {
-    platforms = stdenv.lib.platforms.linux;
+  meta = with stdenv.lib; {
+    homepage = http://915resolution.mango-lang.org/;
+    description = "A tool to modify Intel 800/900 video BIOS";
+    platforms = platforms.linux;
   };
 }

From 306f2c65fe06fe6a8538b8056b7455ade882c044 Mon Sep 17 00:00:00 2001
From: Dan Peebles <pumpkin@me.com>
Date: Thu, 23 Mar 2017 22:41:45 -0400
Subject: [PATCH 075/157] zsnes: only build on Linux

It uses callPackage_i686 which forces Linux anyway, and the current setup
just means that we end up with a weird i686-linux job under Darwin.
---
 pkgs/misc/emulators/zsnes/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/misc/emulators/zsnes/default.nix b/pkgs/misc/emulators/zsnes/default.nix
index 02f93eb931d5..ae94c3de41b2 100644
--- a/pkgs/misc/emulators/zsnes/default.nix
+++ b/pkgs/misc/emulators/zsnes/default.nix
@@ -57,6 +57,6 @@ in stdenv.mkDerivation {
     license = stdenv.lib.licenses.gpl2Plus;
     maintainers = [ stdenv.lib.maintainers.sander ];
     homepage = http://www.zsnes.com;
-    platforms = stdenv.lib.platforms.unix;
+    platforms = stdenv.lib.platforms.linux;
   };
 }

From 59261f20f0ca18e761df342e1243e0a6ff3d3387 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Sun, 19 Mar 2017 22:21:36 +0800
Subject: [PATCH 076/157] msr-tools: init at 1.3

---
 pkgs/os-specific/linux/msr-tools/default.nix | 26 ++++++++++++++++++++
 pkgs/top-level/all-packages.nix              |  2 ++
 2 files changed, 28 insertions(+)
 create mode 100644 pkgs/os-specific/linux/msr-tools/default.nix

diff --git a/pkgs/os-specific/linux/msr-tools/default.nix b/pkgs/os-specific/linux/msr-tools/default.nix
new file mode 100644
index 000000000000..128f3eac2635
--- /dev/null
+++ b/pkgs/os-specific/linux/msr-tools/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "msr-tools-${version}";
+  version = "1.3";
+
+  src = fetchurl {
+    url = "https://01.org/sites/default/files/downloads/msr-tools/${name}.zip";
+    sha256 = "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr";
+  };
+
+  buildInputs = [ unzip ];
+
+  preInstall = ''
+    mkdir -p $out/bin
+    substituteInPlace Makefile \
+      --replace /usr/sbin $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Tool to read/write from/to MSR CPU registers on Linux";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ peterhoeg ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b3cf517303d4..dd127ea6a476 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1032,6 +1032,8 @@ with pkgs;
 
   mongodb-tools = callPackage ../tools/misc/mongodb-tools { };
 
+  msr-tools = callPackage ../os-specific/linux/msr-tools { };
+
   mstflint = callPackage ../tools/misc/mstflint { };
 
   mcelog = callPackage ../os-specific/linux/mcelog {

From 6948f79c16d8fe494dda1a25fdbe9d67f5de839e Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Fri, 24 Mar 2017 05:13:33 +0100
Subject: [PATCH 077/157] wireguard: 0.0.20170320.1 -> 0.0.20170324

---
 pkgs/os-specific/linux/wireguard/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/wireguard/default.nix b/pkgs/os-specific/linux/wireguard/default.nix
index 435653c19fdc..68966dd03998 100644
--- a/pkgs/os-specific/linux/wireguard/default.nix
+++ b/pkgs/os-specific/linux/wireguard/default.nix
@@ -6,11 +6,11 @@ assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "3.18";
 let
   name = "wireguard-${version}";
 
-  version = "0.0.20170320.1";
+  version = "0.0.20170324";
 
   src = fetchurl {
     url    = "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${version}.tar.xz";
-    sha256 = "19rcsmwcb9jp4lrfrkf1x78y4i6dcqx5p7kmcbjnbwl0nkc48vr8";
+    sha256 = "2ec08a5d74cb3a63576f06d3cae695b6b8995acd9665e2fa4da91927b467ca51";
   };
 
   meta = with stdenv.lib; {

From d69e9327806496090cb658e377f76b6fdadaaa9c Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Fri, 24 Mar 2017 06:36:41 +0000
Subject: [PATCH 078/157] ocamlPackages.ocaml-compiler-libs: init at 0.9.0

This packages exposes the OCaml compiler libraries repackages
under the toplevel names Ocaml_common, Ocaml_bytecomp, ...

Homepage: https://github.com/janestreet/ocaml-compiler-libs
---
 .../janestreet/ocaml-compiler-libs.nix        | 21 +++++++++++++++++++
 pkgs/top-level/ocaml-packages.nix             |  2 ++
 2 files changed, 23 insertions(+)
 create mode 100644 pkgs/development/ocaml-modules/janestreet/ocaml-compiler-libs.nix

diff --git a/pkgs/development/ocaml-modules/janestreet/ocaml-compiler-libs.nix b/pkgs/development/ocaml-modules/janestreet/ocaml-compiler-libs.nix
new file mode 100644
index 000000000000..7d7e44ab9cc1
--- /dev/null
+++ b/pkgs/development/ocaml-modules/janestreet/ocaml-compiler-libs.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, ocaml, jbuilder, findlib }:
+
+stdenv.mkDerivation {
+	name = "ocaml${ocaml.version}-ocaml-compiler-libs-0.9.0"; 
+	src = fetchurl {
+		url = http://ocaml.janestreet.com/ocaml-core/v0.9/files/ocaml-compiler-libs-v0.9.0.tar.gz;
+		sha256 = "0ipi56vg227924ahi9vv926jn16br9zfipm6a3xd4xrl5pxkvzaz";
+	};
+
+	buildInputs = [ ocaml jbuilder findlib ];
+
+	inherit (jbuilder) installPhase;
+
+	meta = {
+		description = "OCaml compiler libraries repackaged";
+		homepage = https://github.com/janestreet/ocaml-compiler-libs;
+		license = stdenv.lib.licenses.asl20;
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+		inherit (ocaml.meta) platforms;
+	};
+}
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index 8471d1a1ced7..12ddbfafa10e 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -571,6 +571,8 @@ let
 
     buildOcamlJane = callPackage ../development/ocaml-modules/janestreet/buildOcamlJane.nix {};
 
+    ocaml-compiler-libs = callPackage ../development/ocaml-modules/janestreet/ocaml-compiler-libs.nix {};
+
     ppx_core =
       if lib.versionOlder "4.03" ocaml.version
       then callPackage ../development/ocaml-modules/janestreet/ppx_core-113_33_01.nix {}

From 6414533391f7c042de2380e11fb53f41e8999e2c Mon Sep 17 00:00:00 2001
From: Periklis Tsirakidis <periklis.tsirakidis@mayflower.de>
Date: Thu, 23 Mar 2017 22:15:32 +0100
Subject: [PATCH 079/157] darwin: cleanup obsolete sdks

---
 pkgs/development/compilers/smlnj/default.nix  |  2 +-
 .../darwin/command-line-tools/default.nix     | 45 -------------------
 pkgs/os-specific/darwin/osx-sdk/default.nix   | 25 -----------
 pkgs/top-level/all-packages.nix               |  5 ---
 4 files changed, 1 insertion(+), 76 deletions(-)
 delete mode 100644 pkgs/os-specific/darwin/command-line-tools/default.nix
 delete mode 100644 pkgs/os-specific/darwin/osx-sdk/default.nix

diff --git a/pkgs/development/compilers/smlnj/default.nix b/pkgs/development/compilers/smlnj/default.nix
index 7f8580f058b6..75daad36f762 100644
--- a/pkgs/development/compilers/smlnj/default.nix
+++ b/pkgs/development/compilers/smlnj/default.nix
@@ -38,7 +38,7 @@ in stdenv.mkDerivation {
   '' + stdenv.lib.optionalString stdenv.isDarwin (with darwin; ''
     sed -i '/^[[:space:]]*\*x86-darwin\*)$/,/^[[:space:]]*\*) ;;/ c\
 \  \*x86-darwin\*)\
-\    INCLFILE=${osx_sdk}/Developer/SDKs/${osx_sdk.name}/usr/include/unistd.h\
+\    INCLFILE=${apple_sdk.sdk}/include/unistd.h\
 \    ;;\
 \  \*) ;;
 ' base/runtime/config/gen-posix-names.sh
diff --git a/pkgs/os-specific/darwin/command-line-tools/default.nix b/pkgs/os-specific/darwin/command-line-tools/default.nix
deleted file mode 100644
index 2d1eb7b6b3ca..000000000000
--- a/pkgs/os-specific/darwin/command-line-tools/default.nix
+++ /dev/null
@@ -1,45 +0,0 @@
-{ stdenv, fetchurl, xar, gzip, cpio }:
-
-let
-  pkg = { name, sha256 }: stdenv.mkDerivation {
-    inherit name;
-
-    src = fetchurl {
-      # Magic url found in:
-      # https://swscan.apple.com/content/catalogs/others/index-10.9-1.sucatalog
-      url = "http://swcdn.apple.com/content/downloads/27/02/031-06182/xxog8vxu8i6af781ivf4uhy6yt1lslex34/${name}.pkg";
-      inherit sha256;
-    };
-
-    buildInputs = [ xar gzip cpio ];
-
-    phases = [ "unpackPhase" "installPhase" ];
-
-    unpackPhase = ''
-      xar -x -f $src
-    '';
-
-    installPhase = ''
-      start="$(pwd)"
-      mkdir -p $out
-      cd $out
-      cat $start/Payload | gzip -d | cpio -idm
-    '';
-
-    meta = with stdenv.lib; {
-      description = "Apple developer tools ${name}";
-      maintainers = with maintainers; [ copumpkin ];
-      platforms   = platforms.darwin;
-    };
-  };
-in rec {
-  tools = pkg {
-    name   = "CLTools_Executables_OSX109";
-    sha256 = "1cjdnnjny6h0dc1cc994pgrkmsa5cvk7pi5dpkxyslyicwf260fx";
-  };
-
-  sdk = pkg {
-    name   = "DevSDK_OSX109";
-    sha256 = "16b7aplha5573yl1d44nl2yxzp0w2hafihbyh7930wrcvba69iy4";
-  };
-}
diff --git a/pkgs/os-specific/darwin/osx-sdk/default.nix b/pkgs/os-specific/darwin/osx-sdk/default.nix
deleted file mode 100644
index 235eadfd2556..000000000000
--- a/pkgs/os-specific/darwin/osx-sdk/default.nix
+++ /dev/null
@@ -1,25 +0,0 @@
-{ stdenv }:
-
-let
-  version = "10.9";
-in stdenv.mkDerivation rec {
-  name = "MacOSX10.9.sdk";
-
-  src = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk";
-
-  unpackPhase = "true";
-  dontBuild = true;
-
-  installPhase = ''
-    mkdir -p $out/Developer/SDKs/
-    echo "Source is: $src"
-    cp -r $src $out/Developer/SDKs/
-  '';
-
-  meta = with stdenv.lib; {
-    description = "The Mac OS ${version} SDK";
-    maintainers = with maintainers; [ copumpkin ];
-    platforms   = platforms.darwin;
-    license     = licenses.unfree;
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index dd127ea6a476..e07efc74838f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -11236,7 +11236,6 @@ with pkgs;
   crda = callPackage ../os-specific/linux/crda { };
 
   darwin = let
-    cmdline = callPackage ../os-specific/darwin/command-line-tools {};
     apple-source-releases = callPackage ../os-specific/darwin/apple-source-releases { };
   in apple-source-releases // rec {
     cctools_cross = callPackage (forcedNativePackages.callPackage ../os-specific/darwin/cctools/port.nix {}).cross {
@@ -11269,7 +11268,6 @@ with pkgs;
 
     xcode = callPackage ../os-specific/darwin/xcode {};
 
-    osx_sdk = callPackage ../os-specific/darwin/osx-sdk {};
     osx_private_sdk = callPackage ../os-specific/darwin/osx-private-sdk {};
 
     security_tool = (newScope (darwin.apple_sdk.frameworks // darwin)) ../os-specific/darwin/security-tool {
@@ -11278,9 +11276,6 @@ with pkgs;
 
     binutils = callPackage ../os-specific/darwin/binutils { inherit cctools; };
 
-    cmdline_sdk   = cmdline.sdk;
-    cmdline_tools = cmdline.tools;
-
     apple_sdk = callPackage ../os-specific/darwin/apple-sdk {};
 
     libobjc = apple-source-releases.objc4;

From f6669da3cfcf328e573b5be9dde56a638c3a0c95 Mon Sep 17 00:00:00 2001
From: Daiderd Jordan <daiderd@gmail.com>
Date: Fri, 24 Mar 2017 08:40:16 +0100
Subject: [PATCH 080/157] fetchrepoproject: fix evaluation

---
 pkgs/build-support/fetchrepoproject/default.nix | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix
index f0bc02cf66df..01d7fe1d0f55 100644
--- a/pkgs/build-support/fetchrepoproject/default.nix
+++ b/pkgs/build-support/fetchrepoproject/default.nix
@@ -15,11 +15,10 @@ stdenv.mkDerivation {
     done
 
     export HOME=.repo
-    repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle''
-  + ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"}
-  + ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"}
-  + ${optionalString (referenceDir != "") " --reference=${referenceDir}"}
-  + ''
+    repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle
+    ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"}
+    ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"}
+    ${optionalString (referenceDir != "") " --reference=${referenceDir}"}
     repo sync --jobs=$NIX_BUILD_CORES --current-branch
     rm -rf $out/.repo
   '';

From fb292118f88e1681aa3cb3fac6780286b3e210be Mon Sep 17 00:00:00 2001
From: Jaakko Luttinen <jaakko.luttinen@iki.fi>
Date: Fri, 24 Mar 2017 11:07:26 +0200
Subject: [PATCH 081/157] yadm: 1.05 -> 1.07

---
 pkgs/applications/version-management/yadm/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/version-management/yadm/default.nix b/pkgs/applications/version-management/yadm/default.nix
index f87d81bd8fb8..6587b25ef94a 100644
--- a/pkgs/applications/version-management/yadm/default.nix
+++ b/pkgs/applications/version-management/yadm/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, fetchFromGitHub }:
 
-let version = "1.05"; in
+let version = "1.07"; in
 stdenv.mkDerivation {
   name = "yadm-${version}";
 
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
     owner  = "TheLocehiliosan";
     repo   = "yadm";
     rev    = "${version}";
-    sha256 = "11bqgz28qzgb3iz8xvda9z0mh5r1a9m032pqm772ypiixsfz8hdd";
+    sha256 = "0kkxrvw17pmrx1dq0dq53jb9pm545firakrxc48znfw54n2036fw";
   };
 
   buildCommand = ''

From 4e57e7f7c6db9a9c00f527eff80cb37890ba516d Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Fri, 24 Mar 2017 10:34:40 +0100
Subject: [PATCH 082/157] Revert "gdm module: only make xserver args
 overrideable"

This reverts commit a5aa9269027d638b80fe1f23bcf8887ca80d034b.

This allows gdm to run again, the test is still failing.
---
 nixos/modules/services/x11/display-managers/gdm.nix | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix
index 6c63fede857f..1bf4fd3c089e 100644
--- a/nixos/modules/services/x11/display-managers/gdm.nix
+++ b/nixos/modules/services/x11/display-managers/gdm.nix
@@ -99,8 +99,7 @@ in
     services.xserver.displayManager.job =
       {
         environment = {
-          GDM_X_SERVER_EXTRA_ARGS = toString
-            (filter (arg: arg != "-terminate") cfg.xserverArgs);
+          GDM_X_SERVER = "${cfg.xserverBin} ${toString cfg.xserverArgs}";
           GDM_SESSIONS_DIR = "${cfg.session.desktops}";
           # Find the mouse
           XCURSOR_PATH = "~/.icons:${config.system.path}/share/icons";

From 70322d8b870697059a14e22a733f3a8af84f6f42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@higgsboson.tk>
Date: Wed, 15 Mar 2017 09:29:27 +0000
Subject: [PATCH 083/157] pythonPackages.BTrees: 4.1.4 -> 4.3.1

---
 .../python-modules/btrees-py35.patch          |  79 ---
 .../python-modules/btrees/default.nix         |  20 +
 pkgs/tools/security/vulnix/default.nix        |  56 +--
 pkgs/tools/security/vulnix/requirements.nix   | 452 +-----------------
 pkgs/top-level/all-packages.nix               |   4 +
 pkgs/top-level/python-packages.nix            |  22 +-
 6 files changed, 72 insertions(+), 561 deletions(-)
 delete mode 100644 pkgs/development/python-modules/btrees-py35.patch
 create mode 100644 pkgs/development/python-modules/btrees/default.nix

diff --git a/pkgs/development/python-modules/btrees-py35.patch b/pkgs/development/python-modules/btrees-py35.patch
deleted file mode 100644
index 77e47d670b9b..000000000000
--- a/pkgs/development/python-modules/btrees-py35.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From eee0beef88d135640871050b40844272a3aee790 Mon Sep 17 00:00:00 2001
-From: Tres Seaver <tseaver@palladion.com>
-Date: Tue, 15 Sep 2015 17:20:18 -0400
-Subject: [PATCH 1/2] Ensure that we don't overlook errors in first
- PyObject_RichCompareBool call.
-
-Python 3.5 turns such cases into SystemErrors.
-
-See: https://bugs.python.org/issue23571
-
-Fixes #15.
----
- BTrees/_compat.h | 22 +++++++++++++++++++---
- 1 file changed, 19 insertions(+), 3 deletions(-)
-
-diff --git a/BTrees/_compat.h b/BTrees/_compat.h
-index e004d54..19dd377 100644
---- a/BTrees/_compat.h
-+++ b/BTrees/_compat.h
-@@ -27,9 +27,25 @@
- #define TEXT_FROM_STRING PyUnicode_FromString
- #define TEXT_FORMAT PyUnicode_Format
- 
--#define COMPARE(lhs, rhs) \
--    PyObject_RichCompareBool((lhs), (rhs), Py_LT) > 0 ? -1 : \
--    (PyObject_RichCompareBool((lhs), (rhs), Py_EQ) > 0 ? 0 : 1)
-+/* Emulate Python2's __cmp__,  wrapping PyObject_RichCompareBool(),
-+ * Return -2/-3 for errors, -1 for lhs<rhs, 0 for lhs==rhs, 1 for lhs>rhs.
-+ */
-+static inline
-+int __compare(PyObject *lhs, PyObject *rhs) {
-+    int less, equal;
-+
-+    less = PyObject_RichCompareBool(lhs, rhs, Py_LT);
-+    if ( less == -1 ) {
-+        return -2;
-+    }
-+    equal = PyObject_RichCompareBool(lhs, rhs, Py_EQ);
-+    if ( equal == -1 ) {
-+        return -3;
-+    }
-+    return less ? -1 : (equal ? 0 : 1);
-+}
-+
-+#define COMPARE(lhs, rhs) __compare((lhs), (rhs))
- 
- 
- #else
-
-From ff4c3309fe471f2b9bdd642b8f7d1c2fe0f5e458 Mon Sep 17 00:00:00 2001
-From: Tres Seaver <tseaver@palladion.com>
-Date: Sun, 20 Sep 2015 11:07:10 -0400
-Subject: [PATCH 2/2] Avoid unnecessary comparison for 'Py_EQ' if 'Py_LT'
- returned True.
-
----
- BTrees/_compat.h | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/BTrees/_compat.h b/BTrees/_compat.h
-index 19dd377..ece2bf9 100644
---- a/BTrees/_compat.h
-+++ b/BTrees/_compat.h
-@@ -38,11 +38,14 @@ int __compare(PyObject *lhs, PyObject *rhs) {
-     if ( less == -1 ) {
-         return -2;
-     }
-+    if (less) {
-+        return -1;
-+    }
-     equal = PyObject_RichCompareBool(lhs, rhs, Py_EQ);
-     if ( equal == -1 ) {
-         return -3;
-     }
--    return less ? -1 : (equal ? 0 : 1);
-+    return equal ? 0 : 1;
- }
- 
- #define COMPARE(lhs, rhs) __compare((lhs), (rhs))
diff --git a/pkgs/development/python-modules/btrees/default.nix b/pkgs/development/python-modules/btrees/default.nix
new file mode 100644
index 000000000000..44e96b5ff307
--- /dev/null
+++ b/pkgs/development/python-modules/btrees/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, buildPythonPackage, persistent, zope_interface, transaction }:
+
+buildPythonPackage rec {
+  pname = "BTrees";
+  version = "4.3.1";
+  name = "${pname}-${version}";
+
+  propagatedBuildInputs = [ persistent zope_interface transaction ];
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "15as34f9sa4nnd62nnjkik2jd4rg1byp0i4kwaqwdpv0ab9vfr95";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Scalable persistent components";
+    homepage = http://packages.python.org/BTrees;
+    license = licenses.zpt21;
+  };
+}
diff --git a/pkgs/tools/security/vulnix/default.nix b/pkgs/tools/security/vulnix/default.nix
index afec616563cb..55defd680909 100644
--- a/pkgs/tools/security/vulnix/default.nix
+++ b/pkgs/tools/security/vulnix/default.nix
@@ -1,51 +1,37 @@
-{ buildPythonPackage,
-  callPackage,
-  click,
-  colorama,
-  fetchurl,
-  flake8,
-  lxml,
-  nix,
-  python,
-  pytest,
-  pytestcov,
-  stdenv,
-  }:
+{ stdenv, pythonPackages, fetchurl, callPackage, nix, }:
 
 let
-  external = callPackage ./requirements.nix { inherit buildPythonPackage fetchurl stdenv; };
-in
-
-buildPythonPackage rec{
+  external = callPackage ./requirements.nix {
+    inherit pythonPackages;
+  };
+in pythonPackages.buildPythonApplication rec{
   name = "${pname}-${version}";
   pname = "vulnix";
   version = "1.2.2";
 
-  src = fetchurl {
-    url = "https://pypi.python.org/packages/90/c9/ebef9243334a99edb8598061efae0f00d7a199b01bea574a84e31e06236d/vulnix-${version}.tar.gz";
+  src = pythonPackages.fetchPypi {
+    inherit pname version;
     sha256 = "1ia9plziwach0bxnlcd33q30kcsf8sv0nf2jc78gsmrqnxjabr12";
   };
 
-  buildInputs = [
-    flake8
-    pytest
-    pytestcov
-  ];
+  buildInputs = with pythonPackages; [ flake8 pytest pytestcov ];
+
+  postPatch = ''
+    sed -i -e 's/==\([^=]\+\)/>=\1/g' setup.py
+  '';
 
   propagatedBuildInputs = [
+    nix
+  ] ++ (with pythonPackages; [
     click
     colorama
-    nix
-    external.lxml
-    external.PyYAML
-    external.requests
-    external.ZODB
-  ];
+    lxml
+    pyyaml
+    requests2
+    external.zodb
+  ]);
 
-  checkPhase = ''
-    export PYTHONPATH=src:$PYTHONPATH
-    py.test
-  '';
+  checkPhase = "py.test";
 
   meta = with stdenv.lib; {
     description = "NixOS vulnerability scanner";
@@ -53,4 +39,4 @@ buildPythonPackage rec{
     license = licenses.bsd2;
     maintainers = with maintainers; [ plumps ];
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/tools/security/vulnix/requirements.nix b/pkgs/tools/security/vulnix/requirements.nix
index df51a5e8cd62..952dc1ce652f 100644
--- a/pkgs/tools/security/vulnix/requirements.nix
+++ b/pkgs/tools/security/vulnix/requirements.nix
@@ -1,21 +1,18 @@
-{ buildPythonPackage, commonDoCheck ? false, commonBuildInputs ? [], fetchurl, libxml2, libxslt, stdenv }:
+{ pythonPackages, fetchurl, stdenv }:
 
 rec {
-
-  BTrees = buildPythonPackage {
+  BTrees = pythonPackages.buildPythonPackage {
     name = "BTrees-4.3.1";
     src = fetchurl {
       url = "https://pypi.python.org/packages/24/76/cd6f225f2180c22af5cdb6656f51aec5fca45e45bdc4fa75c0a32f161a61/BTrees-4.3.1.tar.gz";
       sha256 = "2565b7d35260dfc6b1e2934470fd0a2f9326c58c535a2b4cb396289d1c195a95";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
     propagatedBuildInputs = [
-      coverage
       persistent
       transaction
-      zope.interface
-    ];
+      zope_interface
+    ] ++ (with pythonPackages; [ coverage ]);
+
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
@@ -23,35 +20,12 @@ rec {
     };
   };
 
-
-
-  PyYAML = buildPythonPackage {
-    name = "PyYAML-3.11";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/75/5e/b84feba55e20f8da46ead76f14a3943c8cb722d40360702b2365b91dec00/PyYAML-3.11.tar.gz";
-      sha256 = "c36c938a872e5ff494938b33b14aaa156cb439ec67548fcab3535bb78b0846e8";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "YAML parser and emitter for Python";
-    };
-  };
-
-
-
-  ZConfig = buildPythonPackage {
+  ZConfig = pythonPackages.buildPythonPackage {
     name = "ZConfig-3.1.0";
     src = fetchurl {
       url = "https://pypi.python.org/packages/52/b3/a96d62711a26d8cfbe546519975dc9ed54d2eb50b3238d2e6de045764796/ZConfig-3.1.0.tar.gz";
       sha256 = "c21fa3a073a56925a8098036d46717392994a92cffea1b3cda3176b70c0a842e";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
@@ -59,26 +33,21 @@ rec {
     };
   };
 
-
-
-  ZODB = buildPythonPackage {
-    name = "ZODB-5.1.1";
+  zodb = pythonPackages.buildPythonPackage {
+    name = "ZODB-5.2.0";
     src = fetchurl {
-      url = "https://pypi.python.org/packages/08/67/62d42c704edd64bcecddc29442a70535ebc7af46e232a5efa9fc572953f0/ZODB-5.1.1.tar.gz";
-      sha256 = "b0bbe6dfe60e2bdcf842a87abcc53b5cd15ad88ae2824c0c526cbb01ca0b90e5";
+      url = "https://pypi.python.org/packages/1e/47/2f17075ca94a4a537ebd8e195c458456ef49aa67355ec805e478b8ad1959/ZODB-5.2.0.tar.gz";
+      sha256 = "11l495lyym2fpvalj18yvcqwnsp8gyp18sgv5v575k4s2035lz0x";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
+    doCheck = false;
     propagatedBuildInputs = [
       BTrees
-      ZConfig
       persistent
-      six
       transaction
+      ZConfig
       zc.lockfile
       zodbpickle
-      zope.interface
-    ];
+    ] ++ (with pythonPackages; [ six wheel zope_interface ]);
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
@@ -86,150 +55,15 @@ rec {
     };
   };
 
-
-
-  click = buildPythonPackage {
-    name = "click-6.6";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/7a/00/c14926d8232b36b08218067bcd5853caefb4737cda3f0a47437151344792/click-6.6.tar.gz";
-      sha256 = "cc6a19da8ebff6e7074f731447ef7e112bd23adf3de5c597cf9989f2fd8defe9";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.bsdOriginal;
-      description = "A simple wrapper around optparse for powerful command line utilities.";
-    };
-  };
-
-
-
-  colorama = buildPythonPackage {
-    name = "colorama-0.3.7";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/f0/d0/21c6449df0ca9da74859edc40208b3a57df9aca7323118c913e58d442030/colorama-0.3.7.tar.gz";
-      sha256 = "e043c8d32527607223652021ff648fbb394d5e19cba9f1a698670b338c9d782b";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.bsdOriginal;
-      description = "Cross-platform colored terminal text.";
-    };
-  };
-
-
-
-  coverage = buildPythonPackage {
-    name = "coverage-4.0.3";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/76/b4/3777a6bae434240b1fcbbda6cb30085bd897b3519acfffea498ee9f41038/coverage-4.0.3.tar.gz";
-      sha256 = "85b1275b6d7a61ccc8024a4e9a4c9e896394776edce1a5d075ec116f91925462";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.asl20;
-      description = "Code coverage measurement for Python";
-    };
-  };
-
-
-
-  flake8 = buildPythonPackage {
-    name = "flake8-2.5.4";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/60/4a/7b0ac4920af5673380b7079ba2f7580a8645790c7718881082c0d918b8b4/flake8-2.5.4.tar.gz";
-      sha256 = "cc1e58179f6cf10524c7bfdd378f5536d0a61497688517791639a5ecc867492f";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      "mccabe"
-      "pep8"
-      "pyflakes"
-    ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "the modular source code checker: pep8, pyflakes and co";
-    };
-  };
-
-
-
-  lxml = buildPythonPackage {
-    name = "lxml-3.7.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/14/51/61462e59ab58575fe0d679ab2d31ec73cd49b26182c6ece3d9379faccfd7/lxml-3.7.0.tar.gz";
-      sha256 = "9c62eb2a1862e1ae285d7e7e3b7dc8772d387b19258086afcec143c6b7b8a5c9";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ libxml2 libxslt ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.bsdOriginal;
-      description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.";
-    };
-  };
-
-
-
-  mccabe = buildPythonPackage {
-    name = "mccabe-0.4.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/f6/e7/54461a958bb8b16f8db5f849d5d08b7d74153e064ac385fb68ff09f0bd27/mccabe-0.4.0.tar.gz";
-      sha256 = "9a2b12ebd876e77c72e41ebf401cc2e7c5b566649d50105ca49822688642207b";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "McCabe checker, plugin for flake8";
-    };
-  };
-
-
-
-  pep8 = buildPythonPackage {
-    name = "pep8-1.7.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/3e/b5/1f717b85fbf5d43d81e3c603a7a2f64c9f1dabc69a1e7745bd394cc06404/pep8-1.7.0.tar.gz";
-      sha256 = "a113d5f5ad7a7abacef9df5ec3f2af23a20a28005921577b15dd584d099d5900";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "Python style guide checker";
-    };
-  };
-
-
-
-  persistent = buildPythonPackage {
+  persistent = pythonPackages.buildPythonPackage {
     name = "persistent-4.2.2";
     src = fetchurl {
       url = "https://pypi.python.org/packages/3d/71/3302512282b606ec4d054e09be24c065915518903b29380b6573bff79c24/persistent-4.2.2.tar.gz";
       sha256 = "52ececc6dbba5ef572d3435189318b4dff07675bafa9620e32f785e147c6563c";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
     propagatedBuildInputs = [
-      coverage
-      zope.interface
-    ];
+      zope_interface
+    ] ++ (with pythonPackages; [ six wheel ]);
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
@@ -237,232 +71,15 @@ rec {
     };
   };
 
-
-
-  py = buildPythonPackage {
-    name = "py-1.4.31";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/f4/9a/8dfda23f36600dd701c6722316ba8a3ab4b990261f83e7d3ffc6dfedf7ef/py-1.4.31.tar.gz";
-      sha256 = "a6501963c725fc2554dabfece8ae9a8fb5e149c0ac0a42fd2b02c5c1c57fc114";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "library with cross-python path, ini-parsing, io, code, log facilities";
-    };
-  };
-
-
-
-  pyflakes = buildPythonPackage {
-    name = "pyflakes-1.0.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/45/24/6bc038f3422bab08c24173c1990a56e9eb0c4582a9b202858a33f8aefeb8/pyflakes-1.0.0.tar.gz";
-      sha256 = "f39e33a4c03beead8774f005bd3ecf0c3f2f264fa0201de965fce0aff1d34263";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "passive checker of Python programs";
-    };
-  };
-
-
-
-  pytest = buildPythonPackage {
-    name = "pytest-2.9.1";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/5e/f0/75c5cee17575bef459c916b6276bd9ad56944836bb0d9e36dd05704e7f35/pytest-2.9.1.tar.gz";
-      sha256 = "0d48d27a127644fbe7c8158157e08b35f8255045d4476df694b91eb3a8147e65";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      "colorama"
-      "py"
-    ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "pytest: simple powerful testing with Python";
-    };
-  };
-
-
-
-  pytest-capturelog = buildPythonPackage {
-    name = "pytest-capturelog-0.7";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/35/e9/6051b5bb65ad5049d5eb60127d34c63ba724e17acf8b1f2f2e0755131b6c/pytest-capturelog-0.7.tar.gz";
-      sha256 = "b6e8d5189b39462109c2188e6b512d6cc7e66d62bb5be65389ed50e96d22000d";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      "py"
-    ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "py.test plugin to capture log messages";
-    };
-  };
-
-
-
-  pytest-codecheckers = buildPythonPackage {
-    name = "pytest-codecheckers-0.2";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/53/09/263669db13955496e77017f389693c1e1dd77d98fd4afd51b133162e858f/pytest-codecheckers-0.2.tar.gz";
-      sha256 = "853de10f204865140da2bc173f791c9e13794fc43656e02fffcce23c9999e748";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      "pep8"
-      "py"
-      "pyflakes"
-    ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = "";
-      description = "pytest plugin to add source code sanity checks (pep8 and friends)";
-    };
-  };
-
-
-
-  pytest-cov = buildPythonPackage {
-    name = "pytest-cov-2.2.1";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/39/07/bdd2d985ae7ac726cc5e7a6a343b585570bf1f9f7cb297a9cd58a60c7c89/pytest-cov-2.2.1.tar.gz";
-      sha256 = "a8b22e53e7f3b971454c35df99dffe21f4749f539491e935c55d3ff7e1b284fa";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      "coverage"
-      "pytest"
-    ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.bsdOriginal;
-      description = "Pytest plugin for measuring coverage.";
-    };
-  };
-
-
-
-  pytest-runner = buildPythonPackage {
-    name = "pytest-runner-2.9";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/11/d4/c335ddf94463e451109e3494e909765c3e5205787b772e3b25ee8601b86a/pytest-runner-2.9.tar.gz";
-      sha256 = "50378de59b02f51f64796d3904dfe71b9dc6f06d88fc6bfbd5c8e8366ae1d131";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "Invoke py.test as distutils command with dependency resolution";
-    };
-  };
-
-
-
-  pytest-timeout = buildPythonPackage {
-    name = "pytest-timeout-1.0.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/cf/92/ab29b9baa54d47dfd50e43be35577de9af4e7ebf27d29f546ddeb6c3b6f5/pytest-timeout-1.0.0.tar.gz";
-      sha256 = "1465096be73e16df1e15d1b1453692428a7e15b997d756bc565aee0d12798ce1";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      "pytest"
-    ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "py.test plugin to abort hanging tests";
-    };
-  };
-
-
-
-  requests = buildPythonPackage {
-    name = "requests-2.10.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/49/6f/183063f01aae1e025cf0130772b55848750a2f3a89bfa11b385b35d7329d/requests-2.10.0.tar.gz";
-      sha256 = "63f1815788157130cee16a933b2ee184038e975f0017306d723ac326b5525b54";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.asl20;
-      description = "Python HTTP for Humans.";
-    };
-  };
-
-
-
-  setuptools-scm = buildPythonPackage {
-    name = "setuptools-scm-1.15.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/80/b7/31b6ae5fcb188e37f7e31abe75f9be90490a5456a72860fa6e643f8a3cbc/setuptools_scm-1.15.0.tar.gz";
-      sha256 = "daf12d05aa2155a46aa357453757ffdc47d87f839e62114f042bceac6a619e2f";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "the blessed package to manage your versions by scm tags";
-    };
-  };
-
-
-
-  six = buildPythonPackage {
-    name = "six-1.10.0";
-    src = fetchurl {
-      url = "https://pypi.python.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz";
-      sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a";
-    };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
-    meta = with stdenv.lib; {
-      homepage = "";
-      license = licenses.mit;
-      description = "Python 2 and 3 compatibility utilities";
-    };
-  };
-
-
-
-  transaction = buildPythonPackage {
+  transaction = pythonPackages.buildPythonPackage {
     name = "transaction-2.0.3";
     src = fetchurl {
       url = "https://pypi.python.org/packages/8c/af/3ffafe85bcc93ecb09459f3f2bd8fbe142e9ab34048f9e2774543b470cbd/transaction-2.0.3.tar.gz";
       sha256 = "67bfb81309ba9717edbb2ca2e5717c325b78beec0bf19f44e5b4b9410f82df7f";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
     propagatedBuildInputs = [
-      coverage
-      zope.interface
-    ];
+      zope_interface
+    ] ++ (with pythonPackages; [ six wheel ]);
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
@@ -470,17 +87,12 @@ rec {
     };
   };
 
-
-
-  zc.lockfile = buildPythonPackage {
+  zc.lockfile = pythonPackages.buildPythonPackage {
     name = "zc.lockfile-1.2.1";
     src = fetchurl {
       url = "https://pypi.python.org/packages/bd/84/0299bbabbc9d3f84f718ba1039cc068030d3ad723c08f82a64337edf901e/zc.lockfile-1.2.1.tar.gz";
       sha256 = "11db91ada7f22fe8aae268d4bfdeae012c4fe655f66bbb315b00822ec00d043e";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [ ];
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
@@ -488,19 +100,14 @@ rec {
     };
   };
 
-
-
-  zodbpickle = buildPythonPackage {
+  zodbpickle = pythonPackages.buildPythonPackage {
     name = "zodbpickle-0.6.0";
     src = fetchurl {
       url = "https://pypi.python.org/packages/7a/fc/f6f437a5222b330735eaf8f1e67a6845bd1b600e9a9455e552d3c13c4902/zodbpickle-0.6.0.tar.gz";
       sha256 = "ea3248be966159e7791e3db0e35ea992b9235d52e7d39835438686741d196665";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      coverage
-    ];
+    doCheck = false;
+
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
@@ -508,24 +115,17 @@ rec {
     };
   };
 
-
-
-  zope.interface = buildPythonPackage {
+  zope_interface = pythonPackages.buildPythonPackage {
     name = "zope.interface-4.3.3";
     src = fetchurl {
       url = "https://pypi.python.org/packages/44/af/cea1e18bc0d3be0e0824762d3236f0e61088eeed75287e7b854d65ec9916/zope.interface-4.3.3.tar.gz";
       sha256 = "8780ef68ca8c3fe1abb30c058a59015129d6e04a6b02c2e56b9c7de6078dfa88";
     };
-    doCheck = commonDoCheck;
-    buildInputs = commonBuildInputs;
-    propagatedBuildInputs = [
-      coverage
-    ];
+    propagatedBuildInputs = [ ];
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
       description = "Interfaces for Python";
     };
   };
-
-}
\ No newline at end of file
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 533d1c1e7da8..576746834af3 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6887,6 +6887,10 @@ with pkgs;
 
   vultr = callPackage ../development/tools/vultr { };
 
+  vulnix = callPackage ../tools/security/vulnix {
+    pythonPackages = python3Packages;
+  };
+
   xc3sprog = callPackage ../development/tools/misc/xc3sprog { };
 
   xcbuild  = callPackage ../development/tools/xcbuild/wrapper.nix {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 9bcdeb3c1ca5..1bf271838fd6 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -27406,25 +27406,7 @@ EOF
     };
   };
 
-
-  BTrees = self.buildPythonPackage rec {
-    name = "BTrees-4.1.4";
-
-    propagatedBuildInputs = with self; [ persistent zope_interface transaction ];
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/B/BTrees/${name}.tar.gz";
-      sha256 = "1avvhkd7rvp3rzhw20v6ank8a8m9a1lmh99c4gjjsa1ry0zsri3y";
-    };
-
-    patches = [ ../development/python-modules/btrees-py35.patch ];
-
-    meta = {
-      description = "Scalable persistent components";
-      homepage = http://packages.python.org/BTrees;
-    };
-  };
-
+  BTrees = callPackage ../development/python-modules/btrees {};
 
   persistent = self.buildPythonPackage rec {
     name = "persistent-4.0.8";
@@ -31999,8 +31981,6 @@ EOF
     };
   };
 
-  vulnix = callPackage ../tools/security/vulnix { };
-
   wp_export_parser = buildPythonPackage rec {
     name = "${pname}-${version}";
     pname = "wp_export_parser";

From f38c4ee775c7a485db3b3bcd86a59af84269f32b Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Fri, 24 Mar 2017 17:48:00 +0800
Subject: [PATCH 084/157] duplicity: 0.7.07.1 -> 0.7.12

---
 pkgs/tools/backup/duplicity/default.nix | 48 ++++++++++++++-----------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/pkgs/tools/backup/duplicity/default.nix b/pkgs/tools/backup/duplicity/default.nix
index b08bb0768f2c..313167b1ae27 100644
--- a/pkgs/tools/backup/duplicity/default.nix
+++ b/pkgs/tools/backup/duplicity/default.nix
@@ -1,37 +1,43 @@
-{ stdenv, fetchurl, python2Packages, librsync, ncftp, gnupg, rsync, makeWrapper
-}:
+{ stdenv, fetchurl, python2Packages, librsync, ncftp, gnupg, rsync, makeWrapper }:
 
-let
-  version = "0.7.07.1";
-in python2Packages.buildPythonApplication {
+python2Packages.buildPythonApplication rec {
   name = "duplicity-${version}";
+  version = "0.7.12";
 
   src = fetchurl {
-    url = "http://code.launchpad.net/duplicity/0.7-series/${version}/+download/duplicity-${version}.tar.gz";
-    sha256 = "594c6d0e723e56f8a7114d57811c613622d535cafdef4a3643a4d4c89c1904f8";
+    url = "http://code.launchpad.net/duplicity/0.7-series/${version}/+download/${name}.tar.gz";
+    sha256 = "1rhgrz2lm9vbfdp2raykrih1c6n2lw5jd572z4dsz488m52avjqi";
   };
 
+  buildInputs = [ librsync makeWrapper python2Packages.wrapPython ];
+  propagatedBuildInputs = with python2Packages; [
+    boto cffi cryptography ecdsa enum idna
+    ipaddress lockfile paramiko pyasn1 pycrypto six
+  ];
+  checkInputs = with python2Packages; [ lockfile mock pexpect ];
+
+  # lots of tests are failing, although we get a little further now with the bits in preCheck
+  doCheck = false;
+
   postInstall = ''
     wrapProgram $out/bin/duplicity \
       --prefix PATH : "${stdenv.lib.makeBinPath [ gnupg ncftp rsync ]}"
+
+    wrapPythonPrograms
   '';
 
-  buildInputs = [ librsync makeWrapper ];
+  preCheck = ''
+    patchShebangs testing
 
-  # Inputs for tests. These are added to buildInputs when doCheck = true
-  checkInputs = with python2Packages; [ lockfile mock pexpect ];
+    substituteInPlace testing/__init__.py \
+      --replace 'mkdir testfiles' 'mkdir -p testfiles'
+  '';
 
-  # Many problematic tests
-  doCheck = false;
-
-  propagatedBuildInputs = with python2Packages; [ boto cffi cryptography ecdsa enum idna
-    ipaddress lockfile paramiko pyasn1 pycrypto six ];
-
-  meta = {
+  meta = with stdenv.lib; {
     description = "Encrypted bandwidth-efficient backup using the rsync algorithm";
-    homepage = "http://www.nongnu.org/duplicity";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [viric peti];
-    platforms = stdenv.lib.platforms.unix;
+    homepage = http://www.nongnu.org/duplicity;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ viric peti ];
+    platforms = platforms.unix;
   };
 }

From 8c98df01360c783567b012d57d3e9f547c5b69c3 Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Fri, 24 Mar 2017 15:35:34 +0300
Subject: [PATCH 085/157] octoprint-plugins.m33-fio: fix incompatibility with
 new OctoPrint

---
 pkgs/applications/misc/octoprint/plugins.nix | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix
index 2f894514c519..8bc4a22bc923 100644
--- a/pkgs/applications/misc/octoprint/plugins.nix
+++ b/pkgs/applications/misc/octoprint/plugins.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, octoprint, pythonPackages }:
+{ stdenv, fetchFromGitHub, fetchpatch, octoprint, pythonPackages }:
 
 let
   buildPlugin = args: pythonPackages.buildPythonApplication (args // {
@@ -23,6 +23,11 @@ let
 
       patches = [
         ./m33-fio-one-library.patch
+        # Fix incompatibility with new OctoPrint
+        (fetchpatch {
+          url = "https://github.com/foosel/M33-Fio/commit/bdf2422dee3fb8e53b33f087f734956c3b209d72.patch";
+          sha256 = "0jm415sx6d3m0z4gfhbnxlasg08zf3f3mslaj4amn9wbvsik9s5d";
+        })
       ];
 
       postPatch = ''

From 67c44decc8605262605a9f2ac2c936706781e7d4 Mon Sep 17 00:00:00 2001
From: Kosyrev Serge <_deepfire@feelingofgreen.ru>
Date: Fri, 24 Mar 2017 01:39:45 +0300
Subject: [PATCH 086/157] travis: sudo: true, to gain 4G of RAM, as per
 @domenkozar suggestion to fix #24200

---
 .travis.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index bed82810d469..7474cce72727 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,10 @@
 language: nix
+sudo: true
+# 'sudo: false' == containers that start fast, but only get 4G ram;
+# 'sudo: true'  == VMs that start slow, but with 8G
+# ..as per:  https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments
+# Nixpkgs PR tests OOM with 4G: https://github.com/NixOS/nixpkgs/issues/24200
+
 matrix:
     include:
         - os: linux

From f815a7697e09b0b72fe2d06fd29ae1aeee6cdb5a Mon Sep 17 00:00:00 2001
From: Joachim Fasting <joachifm@fastmail.fm>
Date: Fri, 24 Mar 2017 14:36:54 +0100
Subject: [PATCH 087/157] dnscrypt-proxy service: systemd notification under
 apparmor

---
 nixos/modules/services/networking/dnscrypt-proxy.nix | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nixos/modules/services/networking/dnscrypt-proxy.nix b/nixos/modules/services/networking/dnscrypt-proxy.nix
index d382fa8c9cb2..077aeca457ea 100644
--- a/nixos/modules/services/networking/dnscrypt-proxy.nix
+++ b/nixos/modules/services/networking/dnscrypt-proxy.nix
@@ -220,6 +220,8 @@ in
         ${getLib pkgs.attr}/lib/libattr.so.* mr, # */
 
         ${resolverList} r,
+
+        /run/systemd/notify rw,
       }
     '');
     })

From 1c656d2f351275b1d620ad43355430078c0ab37a Mon Sep 17 00:00:00 2001
From: Bas van Dijk <v.dijk.bas@gmail.com>
Date: Thu, 23 Mar 2017 15:18:21 +0100
Subject: [PATCH 088/157] ghcjsHEAD: upgrade ghcjs-boot packages

Move them closer to the latest LTS Haskell.
---
 pkgs/development/compilers/ghcjs/head.nix     |  18 +-
 .../compilers/ghcjs/head_stage2.nix           | 330 ++++++++++--------
 2 files changed, 203 insertions(+), 145 deletions(-)

diff --git a/pkgs/development/compilers/ghcjs/head.nix b/pkgs/development/compilers/ghcjs/head.nix
index 1c347655ebed..e045dc67a507 100644
--- a/pkgs/development/compilers/ghcjs/head.nix
+++ b/pkgs/development/compilers/ghcjs/head.nix
@@ -1,22 +1,26 @@
 { fetchgit, fetchFromGitHub, bootPkgs }:
 
 bootPkgs.callPackage ./base.nix {
-  version = "0.2.020161101";
+  version = "0.2.020170323";
 
   # deprecated on HEAD, directly included in the distribution
   ghcjs-prim = null;
   inherit bootPkgs;
 
   ghcjsSrc = fetchFromGitHub {
-    owner = "ghcjs";
+    # TODO: switch back to the regular ghcjs repo
+    # when https://github.com/ghcjs/ghcjs/pull/573 is merged.
+    owner = "basvandijk";
     repo = "ghcjs";
-    rev = "2dc14802e78d7d9dfa35395d5dbfc9c708fb83e6";
-    sha256 = "0cvmapbrwg0h1pbz648isc2l84z694ylnfm8ncd1g4as28lmj0pz";
+    rev = "e6cdc71964a1c2e4184416a493e9d384c408914c";
+    sha256 = "00fk9qwyx4vpvr0h9jbqxwlrvl6w63l5sq8r357prsp6xyv5zniz";
   };
   ghcjsBootSrc = fetchgit {
-    url = git://github.com/ghcjs/ghcjs-boot.git;
-    rev = "b000a4f4619b850bf3f9a45c9058f7a51e7709c8";
-    sha256 = "164v0xf33r6mnympp6s70v8j6g7ccyg7z95gjp43bq150ppvisbq";
+    # TODO: switch back to git://github.com/ghcjs/ghcjs-boot.git
+    # when https://github.com/ghcjs/ghcjs-boot/pull/41 is merged.
+    url = git://github.com/basvandijk/ghcjs-boot.git;
+    rev = "19a3b157ecb807c2224daffda5baecc92b76af35";
+    sha256 = "16sgr8vfr1nx5ljnk8gckgjk70zpa67ix4dbr9aizkwyz41ilfrb";
     fetchSubmodules = true;
   };
 
diff --git a/pkgs/development/compilers/ghcjs/head_stage2.nix b/pkgs/development/compilers/ghcjs/head_stage2.nix
index 765a384bf634..d4247f51b3e3 100644
--- a/pkgs/development/compilers/ghcjs/head_stage2.nix
+++ b/pkgs/development/compilers/ghcjs/head_stage2.nix
@@ -2,107 +2,117 @@
 
 {
   async = callPackage
-    ({ mkDerivation, base, HUnit, stdenv, stm, test-framework
-      , test-framework-hunit
-      }:
-      mkDerivation {
-        pname = "async";
-        version = "2.1.0";
-        src = "${ghcjsBoot}/boot/async";
-        doCheck = false;
-        libraryHaskellDepends = [ base stm ];
-        testHaskellDepends = [
-          base HUnit test-framework test-framework-hunit
-        ];
-        jailbreak = true;
-        homepage = "https://github.com/simonmar/async";
-        description = "Run IO operations asynchronously and wait for their results";
-        license = stdenv.lib.licenses.bsd3;
-      }) {};
+    ({ mkDerivation, base, HUnit, stm, test-framework
+     , test-framework-hunit, stdenv
+     }:
+     mkDerivation {
+       pname = "async";
+       version = "2.1.1";
+       src = "${ghcjsBoot}/boot/async";
+       doCheck = false;
+       libraryHaskellDepends = [ base stm ];
+       testHaskellDepends = [
+         base HUnit test-framework test-framework-hunit
+       ];
+       jailbreak = true;
+       homepage = "https://github.com/simonmar/async";
+       description = "Run IO operations asynchronously and wait for their results";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   aeson = callPackage
-    ({ mkDerivation, attoparsec, base, bytestring, containers, deepseq
-      , dlist, fail, ghc-prim, hashable, HUnit, mtl, QuickCheck, scientific
-      , stdenv, syb, tagged, template-haskell, test-framework
-      , test-framework-hunit, test-framework-quickcheck2, text, time
-      , transformers, unordered-containers, vector
-      }:
-      mkDerivation {
-        pname = "aeson";
-        version = "0.11.2.0";
-        src = "${ghcjsBoot}/boot/aeson";
-        doCheck = false;
-        libraryHaskellDepends = [
-          attoparsec base bytestring containers deepseq dlist fail ghc-prim
-          hashable mtl scientific syb tagged template-haskell text time transformers
-          unordered-containers vector
-        ];
-        testHaskellDepends = [
-          attoparsec base bytestring containers ghc-prim HUnit QuickCheck
-          template-haskell test-framework test-framework-hunit
-          test-framework-quickcheck2 text time unordered-containers vector
-        ];
-        jailbreak = true;
-        homepage = "https://github.com/bos/aeson";
-        description = "Fast JSON parsing and encoding";
-        license = stdenv.lib.licenses.bsd3;
-      }) {};
+    ({ mkDerivation, attoparsec, base, base-compat, base-orphans
+     , base16-bytestring, bytestring, containers, deepseq, directory
+     , dlist, fetchgit, filepath, generic-deriving, ghc-prim, hashable
+     , hashable-time, HUnit, integer-logarithms, QuickCheck
+     , quickcheck-instances, scientific, stdenv, tagged
+     , template-haskell, test-framework, test-framework-hunit
+     , test-framework-quickcheck2, text, time, time-locale-compat
+     , unordered-containers, uuid-types, vector
+     }:
+     mkDerivation {
+       pname = "aeson";
+       version = "1.1.1.0";
+       src = "${ghcjsBoot}/boot/aeson";
+       libraryHaskellDepends = [
+         attoparsec base base-compat bytestring containers deepseq dlist
+         ghc-prim hashable scientific tagged template-haskell text time
+         time-locale-compat unordered-containers uuid-types vector
+       ];
+       testHaskellDepends = [
+         attoparsec base base-compat base-orphans base16-bytestring
+         bytestring containers directory dlist filepath generic-deriving
+         ghc-prim hashable hashable-time HUnit integer-logarithms QuickCheck
+         quickcheck-instances scientific tagged template-haskell
+         test-framework test-framework-hunit test-framework-quickcheck2 text
+         time time-locale-compat unordered-containers uuid-types vector
+       ];
+       jailbreak = true;
+       homepage = "https://github.com/bos/aeson";
+       description = "Fast JSON parsing and encoding";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   attoparsec = callPackage
-    ({ mkDerivation, array, base, bytestring, containers, deepseq
-      , QuickCheck, quickcheck-unicode, scientific, stdenv
-      , test-framework, test-framework-quickcheck2, text, transformers
-      , vector
-      }:
-      mkDerivation {
-        pname = "attoparsec";
-        version = "0.13.0.2";
-        src = "${ghcjsBoot}/boot/attoparsec";
-        doCheck = false;
-        libraryHaskellDepends = [
-          array base bytestring containers deepseq scientific text
-          transformers
-        ];
-        testHaskellDepends = [
-          array base bytestring containers deepseq QuickCheck
-          quickcheck-unicode scientific test-framework
-          test-framework-quickcheck2 text transformers vector
-        ];
-        jailbreak = true;
-        homepage = "https://github.com/bos/attoparsec";
-        description = "Fast combinator parsing for bytestrings and text";
-        license = stdenv.lib.licenses.bsd3;
-      }) {};
+    ({ mkDerivation, array, base, bytestring, case-insensitive
+     , containers, criterion, deepseq, directory, filepath, ghc-prim
+     , http-types, parsec, QuickCheck, quickcheck-unicode, scientific
+     , tasty, tasty-quickcheck, text, transformers, unordered-containers
+     , vector, stdenv
+     }:
+     mkDerivation {
+       pname = "attoparsec";
+       version = "0.13.1.0";
+       src = "${ghcjsBoot}/boot/attoparsec";
+       libraryHaskellDepends = [
+         array base bytestring containers deepseq scientific text
+         transformers
+       ];
+       testHaskellDepends = [
+         array base bytestring deepseq QuickCheck quickcheck-unicode
+         scientific tasty tasty-quickcheck text transformers vector
+       ];
+       benchmarkHaskellDepends = [
+         array base bytestring case-insensitive containers criterion deepseq
+         directory filepath ghc-prim http-types parsec scientific text
+         transformers unordered-containers vector
+       ];
+       jailbreak = true;
+       homepage = "https://github.com/bos/attoparsec";
+       description = "Fast combinator parsing for bytestrings and text";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   case-insensitive = callPackage
-    ({ mkDerivation, base, bytestring, deepseq, hashable, HUnit, stdenv
-      , test-framework, test-framework-hunit, text
-      }:
-      mkDerivation {
-        pname = "case-insensitive";
-        version = "1.2.0.6";
-        src = "${ghcjsBoot}/boot/case-insensitive";
-        doCheck = false;
-        libraryHaskellDepends = [ base bytestring deepseq hashable text ];
-        testHaskellDepends = [
-          base bytestring HUnit test-framework test-framework-hunit text
-        ];
-        jailbreak = true;
-        homepage = "https://github.com/basvandijk/case-insensitive";
-        description = "Case insensitive string comparison";
-        license = stdenv.lib.licenses.bsd3;
-      }) {};
+    ({ mkDerivation, base, bytestring, criterion, deepseq, hashable
+     , HUnit, test-framework, test-framework-hunit, text, stdenv
+     }:
+     mkDerivation {
+       pname = "case-insensitive";
+       version = "1.2.0.8";
+       src = "${ghcjsBoot}/boot/case-insensitive";
+       doCheck = false;
+       libraryHaskellDepends = [ base bytestring deepseq hashable text ];
+       testHaskellDepends = [
+         base bytestring HUnit test-framework test-framework-hunit text
+       ];
+       benchmarkHaskellDepends = [ base bytestring criterion deepseq ];
+       jailbreak = true;
+       homepage = "https://github.com/basvandijk/case-insensitive";
+       description = "Case insensitive string comparison";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   dlist = callPackage
     ({ mkDerivation, base, Cabal, deepseq, QuickCheck, stdenv }:
-      mkDerivation {
-        pname = "dlist";
-        version = "0.7.1.2";
-        src = "${ghcjsBoot}/boot/dlist";
-        doCheck = false;
-        libraryHaskellDepends = [ base deepseq ];
-        testHaskellDepends = [ base Cabal QuickCheck ];
-        jailbreak = true;
-        homepage = "https://github.com/spl/dlist";
-        description = "Difference lists";
-        license = stdenv.lib.licenses.bsd3;
-      }) {};
+     mkDerivation {
+       pname = "dlist";
+       version = "0.8.0.2";
+       src = "${ghcjsBoot}/boot/dlist";
+       doCheck = false;
+       libraryHaskellDepends = [ base deepseq ];
+       testHaskellDepends = [ base Cabal QuickCheck ];
+       jailbreak = true;
+       homepage = "https://github.com/spl/dlist";
+       description = "Difference lists";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   extensible-exceptions = callPackage
     ({ mkDerivation, base, stdenv }:
       mkDerivation {
@@ -175,29 +185,29 @@
         license = stdenv.lib.licenses.bsd3;
       }) {};
   scientific = callPackage
-    ({ mkDerivation, base, binary, bytestring, containers, deepseq, ghc-prim
-      , hashable, integer-gmp, QuickCheck, smallcheck, stdenv, tasty
-      , tasty-ant-xml, tasty-hunit, tasty-quickcheck, tasty-smallcheck
-      , text, vector
-      }:
-      mkDerivation {
-        pname = "scientific";
-        version = "0.3.4.7";
-        src = "${ghcjsBoot}/boot/scientific";
-        doCheck = false;
-        libraryHaskellDepends = [
-          base binary bytestring containers deepseq ghc-prim hashable
-          integer-gmp text vector
-        ];
-        testHaskellDepends = [
-          base bytestring QuickCheck smallcheck tasty tasty-ant-xml
-          tasty-hunit tasty-quickcheck tasty-smallcheck text
-        ];
-        jailbreak = true;
-        homepage = "https://github.com/basvandijk/scientific";
-        description = "Numbers represented using scientific notation";
-        license = stdenv.lib.licenses.bsd3;
-      }) {};
+    ({ mkDerivation, base, binary, bytestring, containers, criterion
+     , deepseq, ghc-prim, hashable, integer-gmp, integer-logarithms
+     , QuickCheck, smallcheck, tasty, tasty-ant-xml, tasty-hunit
+     , tasty-quickcheck, tasty-smallcheck, text, vector, stdenv
+     }:
+     mkDerivation {
+       pname = "scientific";
+       version = "0.3.4.10";
+       src = "${ghcjsBoot}/boot/scientific";
+       libraryHaskellDepends = [
+         base binary bytestring containers deepseq ghc-prim hashable
+         integer-gmp integer-logarithms text vector
+       ];
+       testHaskellDepends = [
+         base binary bytestring QuickCheck smallcheck tasty tasty-ant-xml
+         tasty-hunit tasty-quickcheck tasty-smallcheck text
+       ];
+       benchmarkHaskellDepends = [ base criterion ];
+       jailbreak = true;
+       homepage = "https://github.com/basvandijk/scientific";
+       description = "Numbers represented using scientific notation";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   stm = callPackage
     ({ mkDerivation, array, base, stdenv }:
       mkDerivation {
@@ -224,6 +234,23 @@
         description = "Scrap Your Boilerplate";
         license = stdenv.lib.licenses.bsd3;
       }) {};
+  tagged = callPackage
+    ({ mkDerivation, base, deepseq, template-haskell, transformers
+     , transformers-compat, stdenv
+     }:
+     mkDerivation {
+       pname = "tagged";
+       version = "0.8.5";
+       src = "${ghcjsBoot}/boot/tagged";
+       doCheck = false;
+       libraryHaskellDepends = [
+         base deepseq template-haskell transformers transformers-compat
+       ];
+       jailbreak = true;
+       homepage = "http://github.com/ekmett/tagged";
+       description = "Haskell 98 phantom types to avoid unsafely passing dummy arguments";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   text = callPackage
     ({ mkDerivation, array, base, binary, bytestring, deepseq, directory
       , ghc-prim, HUnit, integer-gmp, QuickCheck, quickcheck-unicode
@@ -249,25 +276,52 @@
         license = stdenv.lib.licenses.bsd3;
       }) {};
   unordered-containers = callPackage
-    ({ mkDerivation, base, ChasingBottoms, containers, deepseq, hashable
-      , HUnit, QuickCheck, stdenv, test-framework, test-framework-hunit
-      , test-framework-quickcheck2
-      }:
-      mkDerivation {
-        pname = "unordered-containers";
-        version = "0.2.7.0";
-        src = "${ghcjsBoot}/boot/unordered-containers";
-        doCheck = false;
-        libraryHaskellDepends = [ base deepseq hashable ];
-        testHaskellDepends = [
-          base ChasingBottoms containers hashable HUnit QuickCheck
-          test-framework test-framework-hunit test-framework-quickcheck2
-        ];
-        jailbreak = true;
-        homepage = "https://github.com/tibbe/unordered-containers";
-        description = "Efficient hashing-based container types";
-        license = stdenv.lib.licenses.bsd3;
-      }) {};
+    ({ mkDerivation, base, bytestring, ChasingBottoms, containers
+     , criterion, deepseq, deepseq-generics, hashable, hashmap, HUnit
+     , mtl, QuickCheck, random, test-framework, test-framework-hunit
+     , test-framework-quickcheck2, stdenv
+     }:
+     mkDerivation {
+       pname = "unordered-containers";
+       version = "0.2.7.2";
+       src = "${ghcjsBoot}/boot/unordered-containers";
+       libraryHaskellDepends = [ base deepseq hashable ];
+       testHaskellDepends = [
+         base ChasingBottoms containers hashable HUnit QuickCheck
+         test-framework test-framework-hunit test-framework-quickcheck2
+       ];
+       benchmarkHaskellDepends = [
+         base bytestring containers criterion deepseq deepseq-generics
+         hashable hashmap mtl random
+       ];
+       jailbreak = true;
+       homepage = "https://github.com/tibbe/unordered-containers";
+       description = "Efficient hashing-based container types";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+  uuid-types = callPackage
+    ({ mkDerivation, base, binary, bytestring, containers, criterion
+     , deepseq, hashable, HUnit, QuickCheck, random, stdenv, tasty
+     , tasty-hunit, tasty-quickcheck, text
+     }:
+     mkDerivation {
+       pname = "uuid-types";
+       version = "1.0.3";
+       src = "${ghcjsBoot}/boot/uuid/uuid-types";
+       libraryHaskellDepends = [
+         base binary bytestring deepseq hashable random text
+       ];
+       testHaskellDepends = [
+         base bytestring HUnit QuickCheck tasty tasty-hunit tasty-quickcheck
+       ];
+       benchmarkHaskellDepends = [
+         base bytestring containers criterion deepseq random
+       ];
+       jailbreak = true;
+       homepage = "https://github.com/aslatter/uuid";
+       description = "Type definitions for Universally Unique Identifiers";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
   vector = callPackage
     ({ mkDerivation, base, deepseq, ghc-prim, primitive, QuickCheck
       , random, stdenv, template-haskell, test-framework

From 27ba56f1e01e5015897be087fe25d5bbcfe13d70 Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Fri, 24 Mar 2017 08:02:24 -0500
Subject: [PATCH 089/157] nixos/plasma5: also test SDDM theme

---
 nixos/tests/plasma5.nix | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/nixos/tests/plasma5.nix b/nixos/tests/plasma5.nix
index ca787e9c7b9b..f561fc8c3c4c 100644
--- a/nixos/tests/plasma5.nix
+++ b/nixos/tests/plasma5.nix
@@ -8,25 +8,27 @@ import ./make-test.nix ({ pkgs, ...} :
 
   machine = { lib, ... }: {
     imports = [ ./common/user-account.nix ];
-    virtualisation.memorySize = 1024;
     services.xserver.enable = true;
-    services.xserver.displayManager.sddm = {
-      enable = true;
-      autoLogin = {
-        enable = true;
-        user = "alice";
-      };
-    };
+    services.xserver.displayManager.sddm.enable = true;
     services.xserver.desktopManager.plasma5.enable = true;
     services.xserver.desktopManager.default = "plasma5";
-    virtualisation.writableStore = false; # FIXME
+    virtualisation.memorySize = 1024;
   };
 
-  testScript = { nodes, ... }:
-  let xdo = "${pkgs.xdotool}/bin/xdotool"; in
-   ''
+  enableOCR = true;
+
+  testScript = { nodes, ... }: let
+    user = nodes.machine.config.users.extraUsers.alice;
+    xdo = "${pkgs.xdotool}/bin/xdotool";
+  in ''
     startAll;
 
+    # Wait for display manager to start
+    $machine->waitForText(qr/${user.description}/);
+    $machine->screenshot("sddm");
+
+    # Log in
+    $machine->sendChars("${user.password}\n");
     $machine->waitForFile("/home/alice/.Xauthority");
     $machine->succeed("xauth merge ~alice/.Xauthority");
 

From e44cd00c2aae5d5e419e3207a571d402f95ec87a Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Fri, 24 Mar 2017 08:02:53 -0500
Subject: [PATCH 090/157] sddm: fix wrapper

When I reduced the closure size, I broke the built-in theme. When I reverted
that fix, the built-in theme worked but the Plasma theme was broken. Now the
wrapper is fixed so that both themes work.
---
 .../display-managers/sddm/default.nix         | 24 ++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix
index 9fd56a49b5f5..f675febafb56 100644
--- a/pkgs/applications/display-managers/sddm/default.nix
+++ b/pkgs/applications/display-managers/sddm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, makeQtWrapper, fetchFromGitHub, fetchpatch
+{ stdenv, lib, makeQtWrapper, fetchFromGitHub, fetchpatch
 , cmake, extra-cmake-modules, pkgconfig, libxcb, libpthreadstubs, lndir
 , libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd
 , themes
@@ -28,10 +28,12 @@ let
     nativeBuildInputs = [ cmake extra-cmake-modules pkgconfig qttools ];
 
     buildInputs = [
-      libxcb libpthreadstubs libXdmcp libXau qtbase pam systemd
+      libxcb libpthreadstubs libXdmcp libXau pam systemd
     ];
 
-    propagatedBuildInputs = [ qtdeclarative ];
+    propagatedBuildInputs = [
+      qtbase qtdeclarative
+    ];
 
     cmakeFlags = [
       "-DCONFIG_FILE=/etc/sddm.conf"
@@ -80,6 +82,22 @@ stdenv.mkDerivation {
   installPhase = ''
     runHook preInstall
 
+    propagated=
+    for i in $unwrapped $themes; do
+      findInputs $i propagated propagated-user-env-packages
+      if [ -z "$crossConfig" ]; then
+          findInputs $i propagated propagated-native-build-inputs
+      else
+          findInputs $i propagated propagated-build-inputs
+      fi
+    done
+
+    for pkg in $propagated; do
+      addToSearchPath RUNTIME_XDG_DATA_DIRS "$pkg/share"
+      addToSearchPath RUNTIME_XDG_CONFIG_DIRS "$pkg/etc/xdg"
+    done
+
+    mkdir -p "$out/bin"
     makeQtWrapper "$unwrapped/bin/sddm" "$out/bin/sddm"
 
     mkdir -p "$out/share/sddm"

From 92a8c86647135502c6b48916b8403e7b83505020 Mon Sep 17 00:00:00 2001
From: Eric Litak <elitak@gmail.com>
Date: Fri, 24 Mar 2017 07:46:16 -0700
Subject: [PATCH 091/157] sox: added enableLibpulseaudio option

---
 pkgs/applications/misc/audio/sox/default.nix | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pkgs/applications/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix
index b4f01bc642bf..2585b5545482 100644
--- a/pkgs/applications/misc/audio/sox/default.nix
+++ b/pkgs/applications/misc/audio/sox/default.nix
@@ -9,6 +9,7 @@
 , enableLibsndfile ? true, libsndfile ? null
 # amrnb and amrwb are unfree, disabled by default
 , enableAMR ? false, amrnb ? null, amrwb ? null
+, enableLibpulseaudio ? true, libpulseaudio ? null
 }:
 
 with stdenv.lib;
@@ -30,7 +31,8 @@ stdenv.mkDerivation rec {
     optional enableFLAC flac ++
     optional enablePNG libpng ++
     optional enableLibsndfile libsndfile ++
-    optionals enableAMR [ amrnb amrwb ];
+    optionals enableAMR [ amrnb amrwb ] ++
+    optional enableLibpulseaudio libpulseaudio;
 
   meta = {
     description = "Sample Rate Converter for audio";

From 5dbbb60d4f11406467d2c3655c4fb35c951ee656 Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Fri, 24 Mar 2017 10:18:00 -0500
Subject: [PATCH 092/157] nixos/plasma5: re-enable test

Fixes #24240.

I do not know the cause of the test failures, but the tests pass now.
---
 nixos/release-combined.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index 00abbcacf8c9..63ca39a9b602 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -72,7 +72,7 @@ in rec {
         (all nixos.tests.ecryptfs)
         (all nixos.tests.ipv6)
         (all nixos.tests.i3wm)
-        #(all nixos.tests.plasma5) # temporarily, see #24240
+        (all nixos.tests.plasma5)
         #(all nixos.tests.lightdm)
         (all nixos.tests.login)
         (all nixos.tests.misc)

From 352e335f3d643b84f34d5c102a4828712924a267 Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Fri, 24 Mar 2017 10:38:16 -0500
Subject: [PATCH 093/157] nixos/sddm: test automatic and manual login

---
 nixos/release-combined.nix |  2 +-
 nixos/release.nix          |  2 +-
 nixos/tests/sddm.nix       | 88 +++++++++++++++++++++++++++-----------
 3 files changed, 66 insertions(+), 26 deletions(-)

diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index 63ca39a9b602..5c1112a1c6d6 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -92,7 +92,7 @@ in rec {
         (all nixos.tests.openssh)
         (all nixos.tests.printing)
         (all nixos.tests.proxy)
-        (all nixos.tests.sddm)
+        (all nixos.tests.sddm.default)
         (all nixos.tests.simple)
         (all nixos.tests.udisks2)
         (all nixos.tests.xfce)
diff --git a/nixos/release.nix b/nixos/release.nix
index cf7f0a63f4b2..3535690a8e69 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -296,7 +296,7 @@ in rec {
   tests.quake3 = callTest tests/quake3.nix {};
   tests.runInMachine = callTest tests/run-in-machine.nix {};
   tests.samba = callTest tests/samba.nix {};
-  tests.sddm = callTest tests/sddm.nix {};
+  tests.sddm = callSubTests tests/sddm.nix {};
   tests.simple = callTest tests/simple.nix {};
   tests.smokeping = callTest tests/smokeping.nix {};
   tests.taskserver = callTest tests/taskserver.nix {};
diff --git a/nixos/tests/sddm.nix b/nixos/tests/sddm.nix
index a1bd8f14d23b..82be9bc1d727 100644
--- a/nixos/tests/sddm.nix
+++ b/nixos/tests/sddm.nix
@@ -1,26 +1,66 @@
-import ./make-test.nix ({ pkgs, ...} : {
-  name = "sddm";
+{ system ? builtins.currentSystem }:
 
-  machine = { lib, ... }: {
-    imports = [ ./common/user-account.nix ];
-    services.xserver.enable = true;
-    services.xserver.displayManager.sddm.enable = true;
-    services.xserver.windowManager.default = "icewm";
-    services.xserver.windowManager.icewm.enable = true;
-    services.xserver.desktopManager.default = "none";
+with import ../lib/testing.nix { inherit system; };
+
+let
+  inherit (pkgs) lib;
+
+  tests = {
+    default = {
+      name = "sddm";
+
+      machine = { lib, ... }: {
+        imports = [ ./common/user-account.nix ];
+        services.xserver.enable = true;
+        services.xserver.displayManager.sddm.enable = true;
+        services.xserver.windowManager.default = "icewm";
+        services.xserver.windowManager.icewm.enable = true;
+        services.xserver.desktopManager.default = "none";
+      };
+
+      enableOCR = true;
+
+      testScript = { nodes, ... }: let
+        user = nodes.machine.config.users.extraUsers.alice;
+      in ''
+        startAll;
+        $machine->waitForText(qr/ALICE/);
+        $machine->screenshot("sddm");
+        $machine->sendChars("${user.password}\n");
+        $machine->waitForFile("/home/alice/.Xauthority");
+        $machine->succeed("xauth merge ~alice/.Xauthority");
+        $machine->waitForWindow("^IceWM ");
+      '';
+    };
+
+    autoLogin = {
+      name = "sddm-autologin";
+      meta = with pkgs.stdenv.lib.maintainers; {
+        maintainers = [ ttuegel ];
+      };
+
+      machine = { lib, ... }: {
+        imports = [ ./common/user-account.nix ];
+        services.xserver.enable = true;
+        services.xserver.displayManager.sddm = {
+          enable = true;
+          autoLogin = {
+            enable = true;
+            user = "alice";
+          };
+        };
+        services.xserver.windowManager.default = "icewm";
+        services.xserver.windowManager.icewm.enable = true;
+        services.xserver.desktopManager.default = "none";
+      };
+
+      testScript = { nodes, ... }: ''
+        startAll;
+        $machine->waitForFile("/home/alice/.Xauthority");
+        $machine->succeed("xauth merge ~alice/.Xauthority");
+        $machine->waitForWindow("^IceWM ");
+      '';
+    };
   };
-
-  enableOCR = true;
-
-  testScript = { nodes, ... }: let
-    user = nodes.machine.config.users.extraUsers.alice;
-  in ''
-    startAll;
-    $machine->waitForText(qr/ALICE/);
-    $machine->screenshot("sddm");
-    $machine->sendChars("${user.password}\n");
-    $machine->waitForFile("/home/alice/.Xauthority");
-    $machine->succeed("xauth merge ~alice/.Xauthority");
-    $machine->waitForWindow("^IceWM ");
-  '';
-})
+in
+  lib.mapAttrs (lib.const makeTest) tests

From a23b18cfb863cb8cf14893324bef977dc4bdda08 Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Mon, 6 Mar 2017 18:58:09 -0600
Subject: [PATCH 094/157] bitcoin-classic: 0.11.2.cl1.b1 -> 1.2.1

---
 .../applications/altcoins/bitcoin-classic.nix | 22 +++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/pkgs/applications/altcoins/bitcoin-classic.nix b/pkgs/applications/altcoins/bitcoin-classic.nix
index 0c8753085029..60ef20177a37 100644
--- a/pkgs/applications/altcoins/bitcoin-classic.nix
+++ b/pkgs/applications/altcoins/bitcoin-classic.nix
@@ -1,20 +1,24 @@
-{ stdenv, fetchurl, pkgconfig, autoreconfHook, openssl, db48, boost
-, zlib, miniupnpc, qt4, utillinux, protobuf, qrencode
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook, openssl, db48, boost
+, zlib, miniupnpc, qt4, utillinux, protobuf, qrencode, libevent
 , withGui }:
 
 with stdenv.lib;
+
 stdenv.mkDerivation rec {
 
   name = "bitcoin" + (toString (optional (!withGui) "d")) + "-classic-" + version;
-  version = "0.11.2.cl1.b1";
+  version = "1.2.1";
 
-  src = fetchurl {
-    url = "https://github.com/bitcoinclassic/bitcoinclassic/archive/v${version}.tar.gz";
-    sha256 = "1szsnx5aijk3hx7qkqzbqsr0basg8ydwp20mh3bhnf4ljryy2049";
+  src = fetchFromGitHub {
+    owner = "bitcoinclassic";
+    repo = "bitcoinclassic";
+    rev = "v${version}";
+    sha256 = "0ykblw6mb8bh2pa50iqgc5f07mmsz4m3yajsphqgiv5n2fwmkzng";
   };
 
-  buildInputs = [ pkgconfig autoreconfHook openssl db48 boost zlib
-                  miniupnpc utillinux protobuf ]
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ openssl db48 boost zlib
+                  miniupnpc utillinux protobuf libevent ]
                   ++ optionals withGui [ qt4 qrencode ];
 
   configureFlags = [ "--with-boost-libdir=${boost.out}/lib" ]
@@ -35,7 +39,7 @@ stdenv.mkDerivation rec {
       continue to release updates that are in line with Satoshi’s whitepaper &
       vision, and are agreed upon by the community.
     '';
-    homepage = "https://bitcoinclassic.com/";
+    homepage = https://bitcoinclassic.com/;
     maintainers = with maintainers; [ jefdaj ];
     license = licenses.mit;
     platforms = platforms.unix;

From a7cb6997aa411715c3b4bbfac79b154d2ec032c6 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 24 Mar 2017 16:58:15 +0100
Subject: [PATCH 095/157] bitcoin-classic: 1.2.1 -> 1.2.3

Update after #23577
---
 pkgs/applications/altcoins/bitcoin-classic.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/altcoins/bitcoin-classic.nix b/pkgs/applications/altcoins/bitcoin-classic.nix
index 60ef20177a37..50a011e00576 100644
--- a/pkgs/applications/altcoins/bitcoin-classic.nix
+++ b/pkgs/applications/altcoins/bitcoin-classic.nix
@@ -7,13 +7,13 @@ with stdenv.lib;
 stdenv.mkDerivation rec {
 
   name = "bitcoin" + (toString (optional (!withGui) "d")) + "-classic-" + version;
-  version = "1.2.1";
+  version = "1.2.3";
 
   src = fetchFromGitHub {
     owner = "bitcoinclassic";
     repo = "bitcoinclassic";
     rev = "v${version}";
-    sha256 = "0ykblw6mb8bh2pa50iqgc5f07mmsz4m3yajsphqgiv5n2fwmkzng";
+    sha256 = "0y99c8zv42ps3pxp46p3fqj9sir580v7s5qyi3cxva12mq2z0cql";
   };
 
   nativeBuildInputs = [ pkgconfig autoreconfHook ];

From c86f005137cde36de457572eec99dca58ffff1be Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Sun, 19 Mar 2017 21:02:01 -0500
Subject: [PATCH 096/157] direwolf: 1.2 -> 1.3

alaLib as optional

Remove extra stdenv.lib

(@7c6f434c) fixed a typo - pushing instead of #24105
---
 pkgs/applications/misc/direwolf/default.nix | 43 ++++++++++++---------
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/pkgs/applications/misc/direwolf/default.nix b/pkgs/applications/misc/direwolf/default.nix
index 0341ffc64af8..d4c8b1ada6c3 100644
--- a/pkgs/applications/misc/direwolf/default.nix
+++ b/pkgs/applications/misc/direwolf/default.nix
@@ -1,38 +1,43 @@
-{ stdenv, fetchFromGitHub, unzip, alsaLib }:
-let
-  version = "1.2";
-in
+{ stdenv, fetchFromGitHub
+, espeak, alsaLib, perl
+, python }:
+
+with stdenv.lib;
+
 stdenv.mkDerivation rec {
   name = "direwolf-${version}";
-  inherit version;
+  version = "1.3";
 
   src = fetchFromGitHub {
     owner = "wb2osz";
     repo = "direwolf";
-    rev = "8b81a32";
-    sha256 = "0r4fgdxghh292bzhqshr7zl5cg2lfsvlgmy4d5vqcli7x6qa1gcs";
+    rev = version;
+    sha256 = "1x6vvl3fy70ic5pqvqsyr0bkqwim8m9jaqnm5ls8z8i66rwq23fg";
   };
 
   buildInputs = [
-    unzip alsaLib
-  ];
+    espeak perl python
+  ] ++ (optional stdenv.isLinux alsaLib);
 
   patchPhase = ''
-    substituteInPlace Makefile.linux \
-      --replace "/usr/local" "$out" \
-      --replace "/usr/share" "$out/share"
-  '';
+        substituteInPlace Makefile.* \
+          --replace /usr/share $out/share
 
-  preInstall = ''
-    mkdir -p $out/bin
-  '';
+        substituteInPlace dwespeak.sh \
+          --replace espeak ${espeak}/bin/espeak
+        '';
 
-  meta = with stdenv.lib; {
+  installPhase = ''
+    mkdir -p $out/bin 
+    make INSTALLDIR=$out install
+    '';
+
+  meta = {
     description = "A Soundcard Packet TNC, APRS Digipeater, IGate, APRStt gateway";
     # On the page: This page will be disappearing on October 8, 2015.
-    homepage = https://home.comcast.net/~wb2osz/site/;
+    homepage = https://github.com/wb2osz/direwolf/;
     license = licenses.gpl2;
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     maintainers = [ maintainers.the-kenny ];
   };
 }

From 8d97ee2a97f7a588c731733bf84f398c8f74f96f Mon Sep 17 00:00:00 2001
From: Kosyrev Serge <deepfire@users.noreply.github.com>
Date: Fri, 24 Mar 2017 16:38:42 +0000
Subject: [PATCH 097/157] Fix a missed `sudo: true` line

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 7474cce72727..2bd784ed30a0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ sudo: true
 matrix:
     include:
         - os: linux
-          sudo: false
+          sudo: required
           script:
               - ./maintainers/scripts/travis-nox-review-pr.sh nixpkgs-verify nixpkgs-manual nixpkgs-tarball nixpkgs-unstable
               - ./maintainers/scripts/travis-nox-review-pr.sh nixos-options nixos-manual

From 317734f99cc095c0158e071ccb3052fa91407723 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Fri, 24 Mar 2017 18:44:45 +0800
Subject: [PATCH 098/157] speedcrunch: stick to qt 5.7 as 5.8 is broken

---
 pkgs/applications/science/math/speedcrunch/default.nix | 2 +-
 pkgs/top-level/all-packages.nix                        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/science/math/speedcrunch/default.nix b/pkgs/applications/science/math/speedcrunch/default.nix
index 334423660a03..33de9cd0d975 100644
--- a/pkgs/applications/science/math/speedcrunch/default.nix
+++ b/pkgs/applications/science/math/speedcrunch/default.nix
@@ -31,6 +31,6 @@ stdenv.mkDerivation rec {
     '';
     maintainers = with maintainers; [ gebner ];
     platforms = platforms.all;
+    broken = builtins.compareVersions qtbase.version "5.8.0" >= 0;
   };
-
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 96e4840b35bf..923676aa1545 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17613,7 +17613,7 @@ with pkgs;
 
   yacas = callPackage ../applications/science/math/yacas { };
 
-  speedcrunch = libsForQt5.callPackage ../applications/science/math/speedcrunch { };
+  speedcrunch = libsForQt57.callPackage ../applications/science/math/speedcrunch { };
 
   ### SCIENCE / MISC
 

From bc4dc9cb7557e2ae4326fcfec434a486ae34fa0d Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Sun, 19 Mar 2017 15:40:11 -0500
Subject: [PATCH 099/157] codeblocks: 13.12 -> 16.01

(@7c6f434c) move the buildInputs missed in the initial version to
nativeBuildInputs, too.

Pushed instead of #24074
---
 .../applications/editors/codeblocks/default.nix | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/pkgs/applications/editors/codeblocks/default.nix b/pkgs/applications/editors/codeblocks/default.nix
index 9cab87e9ed24..8ee08f576556 100644
--- a/pkgs/applications/editors/codeblocks/default.nix
+++ b/pkgs/applications/editors/codeblocks/default.nix
@@ -1,20 +1,23 @@
-{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig, file, zip, wxGTK, gtk2
+{ stdenv, fetchurl, autoreconfHook, libtool, pkgconfig, file, zip, wxGTK, gtk2
 , contribPlugins ? false, hunspell, gamin, boost
 }:
 
+with stdenv.lib;
+
 with { inherit (stdenv.lib) optionalString optional optionals; };
 
 stdenv.mkDerivation rec {
   name = "${pname}-${stdenv.lib.optionalString contribPlugins "full-"}${version}";
-  version = "13.12";
+  version = "16.01";
   pname = "codeblocks";
 
   src = fetchurl {
-    url = "mirror://sourceforge/codeblocks/Sources/${version}/codeblocks_${version}-1.tar.gz";
-    sha256 = "044njhps4cm1ijfdyr5f9wjyd0vblhrz9b4603ma52wcdq25093p";
+    url = "mirror://sourceforge/codeblocks/Sources/${version}/codeblocks_${version}.tar.gz";
+    sha256 = "00sskm91r20ywydwqwx6v7z3nwn9lyh5297c5wp3razldlh9vyrh";
   };
 
-  buildInputs = [ automake autoconf libtool pkgconfig file zip wxGTK gtk2 ]
+  nativeBuildInputs = [ autoreconfHook pkgconfig libtool file zip ];
+  buildInputs = [ wxGTK gtk2 ]
     ++ optionals contribPlugins [ hunspell gamin boost ];
   enableParallelBuilding = true;
   patches = [ ./writable-projects.patch ];
@@ -25,9 +28,9 @@ stdenv.mkDerivation rec {
 
   # Fix boost 1.59 compat
   # Try removing in the next version
-  CPPFLAGS = "-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED";
+  #CPPFLAGS = "-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED";
 
-  meta = with stdenv.lib; {
+  meta = {
     maintainers = [ maintainers.linquize ];
     platforms = platforms.all;
     description = "The open source, cross platform, free C, C++ and Fortran IDE";

From dd385d94684e7c09afd6ab3bd9ca19dd95bb5404 Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Fri, 24 Mar 2017 18:20:01 +0100
Subject: [PATCH 100/157] qt57.makeQtWrapper: fix eval

---
 pkgs/development/libraries/qt-5/5.7/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/libraries/qt-5/5.7/default.nix b/pkgs/development/libraries/qt-5/5.7/default.nix
index 91364dd65bb8..3af342aad935 100644
--- a/pkgs/development/libraries/qt-5/5.7/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/default.nix
@@ -107,7 +107,7 @@ let
 
       makeQtWrapper =
         makeSetupHook
-        { deps = [ makeWrapper dconf.lib gtk ]; }
+        { deps = [ makeWrapper dconf.lib gtk3 ]; }
         (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
 
       qmakeHook =

From 6b6454f190960eff595e06305d0633c283ea55a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Thu, 13 Oct 2016 19:43:04 +0200
Subject: [PATCH 101/157] perlPackages.OpenGL: 0.6703 -> 0.70

Fixes https://github.com/NixOS/nixpkgs/issues/19271 ("slic3r gui
fails").
---
 pkgs/development/perl-modules/perl-opengl.patch | 4 +++-
 pkgs/top-level/perl-packages.nix                | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/perl-modules/perl-opengl.patch b/pkgs/development/perl-modules/perl-opengl.patch
index 77bba1efa41c..a44dc4f2e42d 100644
--- a/pkgs/development/perl-modules/perl-opengl.patch
+++ b/pkgs/development/perl-modules/perl-opengl.patch
@@ -2,12 +2,14 @@ diff --git a/Makefile.PL b/Makefile.PL
 index 55c485c..8501c02 100644
 --- a/Makefile.PL
 +++ b/Makefile.PL
-@@ -116,12 +116,7 @@ if ($^O eq 'MSWin32' || $IS_W32API)
+@@ -124,14 +124,7 @@ if ($^O eq 'MSWin32' || $IS_W32API)
  # Look for available libs
  our @libdirs = qw
  {
 -  -L/usr/lib
+-  -L/usr/lib/i386-linux-gnu
 -  -L/usr/X11R6/lib
+-  -L/opt/X11/lib
 -  -L/usr/local/lib
 -  -L/usr/openwin/lib
 -  -L/opt/csw/lib
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index 72b80afebbb6..f0414b1b1ae3 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -9966,10 +9966,10 @@ let self = _self // overrides; _self = with self; {
   };
 
   OpenGL = buildPerlPackage rec {
-    name = "OpenGL-0.6703";
+    name = "OpenGL-0.70";
     src = fetchurl {
       url = "mirror://cpan/authors/id/C/CH/CHM/${name}.tar.gz";
-      sha256 = "0k2k8zg84qj1ry77i9dvmfdfpg13s6117wy5bc4nvnzv37qcvy32";
+      sha256 = "1q3lz168q081iwl9jg21fbzhp9la79gav9mv6nmh2jab83s2l3mj";
     };
 
     buildInputs = with pkgs; [ mesa mesa_glu freeglut xorg.libX11 xorg.libXi xorg.libXmu xorg.libXext xdummy ];

From e3c1e37823976a712ec86ddc7bb78f9c6420131a Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Fri, 24 Mar 2017 19:09:00 +0000
Subject: [PATCH 102/157] ocamlPackages.ppx_ast: init at 0.9.0

Ppx_ast selects a specific version of the OCaml Abstract Syntax
Tree from the migrate-parsetree project that is not necessarily
the same one as the one being used by the compiler.

Homepage: https://github.com/janestreet/ppx_ast
---
 .../ocaml-modules/janestreet/ppx_ast.nix      | 24 +++++++++++++++++++
 pkgs/top-level/ocaml-packages.nix             |  2 ++
 2 files changed, 26 insertions(+)
 create mode 100644 pkgs/development/ocaml-modules/janestreet/ppx_ast.nix

diff --git a/pkgs/development/ocaml-modules/janestreet/ppx_ast.nix b/pkgs/development/ocaml-modules/janestreet/ppx_ast.nix
new file mode 100644
index 000000000000..33f1766cb4a6
--- /dev/null
+++ b/pkgs/development/ocaml-modules/janestreet/ppx_ast.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, ocaml, jbuilder, findlib
+, ocaml-compiler-libs, ocaml-migrate-parsetree
+}:
+
+stdenv.mkDerivation {
+	name = "ocaml${ocaml.version}-ppx_ast-0.9.0";
+	src = fetchurl {
+		url = http://ocaml.janestreet.com/ocaml-core/v0.9/files/ppx_ast-v0.9.0.tar.gz;
+		sha256 = "1hirfmxr8hkf3p39k1pqidabxxhd541d6ddfaqpgxbl51bw9ddmz";
+	};
+
+	buildInputs = [ ocaml jbuilder findlib ];
+	propagatedBuildInputs = [ ocaml-compiler-libs ocaml-migrate-parsetree ];
+
+	inherit (jbuilder) installPhase;
+
+	meta = {
+		description = "OCaml AST used by Jane Street ppx rewriters";
+		homepage = https://github.com/janestreet/ppx_ast;
+		license = stdenv.lib.licenses.asl20;
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+		inherit (ocaml.meta) platforms;
+	};
+}
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index 12ddbfafa10e..54460f855db6 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -573,6 +573,8 @@ let
 
     ocaml-compiler-libs = callPackage ../development/ocaml-modules/janestreet/ocaml-compiler-libs.nix {};
 
+    ppx_ast = callPackage ../development/ocaml-modules/janestreet/ppx_ast.nix {};
+
     ppx_core =
       if lib.versionOlder "4.03" ocaml.version
       then callPackage ../development/ocaml-modules/janestreet/ppx_core-113_33_01.nix {}

From 9a777013d1d34acc4ea217a7f09bfab96c6be50f Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Thu, 23 Mar 2017 08:56:12 -0400
Subject: [PATCH 103/157] Add setupSystemdUnits function.

Allows setting up and managing a set of systemd units on any systemd distribution.
---
 pkgs/build-support/setup-systemd-units.nix | 83 ++++++++++++++++++++++
 pkgs/top-level/all-packages.nix            |  2 +
 2 files changed, 85 insertions(+)
 create mode 100644 pkgs/build-support/setup-systemd-units.nix

diff --git a/pkgs/build-support/setup-systemd-units.nix b/pkgs/build-support/setup-systemd-units.nix
new file mode 100644
index 000000000000..4fa2f42c39dc
--- /dev/null
+++ b/pkgs/build-support/setup-systemd-units.nix
@@ -0,0 +1,83 @@
+# | Build a script to install and start a set of systemd units on any
+# systemd-based system.
+#
+# Creates a symlink at /etc/systemd-static/${namespace} for slightly
+# improved atomicity.
+{ writeScriptBin
+, bash
+, coreutils
+, systemd
+, runCommand
+, lib
+}:
+  { units     # : AttrSet String (Either Path { path : Path, wanted-by : [ String ] })
+              # ^ A set whose names are unit names and values are
+              # either paths to the corresponding unit files or a set
+              # containing the path and the list of units this unit
+              # should be wanted-by (none by default).
+              #
+              # The names should include the unit suffix
+              # (e.g. ".service")
+  , namespace # : String
+              # The namespace for the unit files, to allow for
+              # multiple independent unit sets managed by
+              # `setupSystemdUnits`.
+  }:
+    let static = runCommand "systemd-static" {}
+          ''
+            mkdir -p $out
+            ${lib.concatStringsSep "\n" (lib.mapAttrsToList (nm: file:
+                "ln -sv ${file.path or file} $out/${nm}"
+             ) units)}
+          '';
+        add-unit-snippet = name: file:
+          ''
+            oldUnit=$(readlink -f "$unitDir/${name}" || echo "$unitDir/${name}")
+            if [ -f "$oldUnit" -a "$oldUnit" != "${file.path or file}" ]; then
+              unitsToStop+=("${name}")
+            fi
+            ln -sf "/etc/systemd-static/${namespace}/${name}" \
+              "$unitDir/.${name}.tmp"
+            mv -T "$unitDir/.${name}.tmp" "$unitDir/${name}"
+            ${lib.concatStringsSep "\n" (map (unit:
+                ''
+                  mkdir -p "$unitDir/${unit}.wants"
+                  ln -sf "../${name}" \
+                    "$unitDir/${unit}.wants/.${name}.tmp"
+                  mv -T "$unitDir/${unit}.wants/.${name}.tmp" \
+                    "$unitDir/${unit}.wants/${name}"
+                ''
+              ) file.wanted-by or [])}
+            unitsToStart+=("${name}")
+          '';
+    in
+      writeScriptBin "setup-systemd-units"
+        ''
+          #!${bash}/bin/bash -e
+          export PATH=${coreutils}/bin:${systemd}/bin
+
+          unitDir=/etc/systemd/system
+          if [ ! -w "$unitDir" ]; then
+            unitDir=/etc/systemd-mutable/system
+            mkdir -p "$unitDir"
+          fi
+          declare -a unitsToStop unitsToStart
+
+          oldStatic=$(readlink -f /etc/systemd-static/${namespace} || true)
+          if [ "$oldStatic" != "${static}" ]; then
+            ${lib.concatStringsSep "\n"
+                (lib.mapAttrsToList add-unit-snippet units)}
+            if [ ''${#unitsToStop[@]} -ne 0 ]; then
+              echo "Stopping unit(s) ''${unitsToStop[@]}" >&2
+              systemctl stop "''${unitsToStop[@]}"
+            fi
+            mkdir -p /etc/systemd-static
+            ln -sfT ${static} /etc/systemd-static/.${namespace}.tmp
+            mv -T /etc/systemd-static/.${namespace}.tmp /etc/systemd-static/${namespace}
+            systemctl daemon-reload
+            echo "Starting unit(s) ''${unitsToStart[@]}" >&2
+            systemctl start "''${unitsToStart[@]}"
+          else
+            echo "Units unchanged, doing nothing" >&2
+          fi
+        ''
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 923676aa1545..552f9d4158e3 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -281,6 +281,8 @@ with pkgs;
 
   pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;
 
+  setupSystemdUnits = callPackage ../build-support/setup-systemd-units.nix { };
+
   singularity-tools = callPackage ../build-support/singularity-tools { };
 
   srcOnly = args: callPackage ../build-support/src-only args;

From 1b4151b12f877d7ce532eb1621af05d311eb2815 Mon Sep 17 00:00:00 2001
From: Winnie Quinn <me@winniequinn.com>
Date: Fri, 24 Mar 2017 16:05:59 -0400
Subject: [PATCH 104/157] vscode: 1.10.0 -> 1.10.2

In addition to the version bump, this also fixes a broken install phase
on macOS. The install now completes properly on macOS 10.12 and
"bin/code" is now correctly linked to the binary within the bundle.
---
 pkgs/applications/editors/vscode/default.nix | 37 +++++++++++---------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/pkgs/applications/editors/vscode/default.nix b/pkgs/applications/editors/vscode/default.nix
index a92f8633c3a8..3031fa1cb0c1 100644
--- a/pkgs/applications/editors/vscode/default.nix
+++ b/pkgs/applications/editors/vscode/default.nix
@@ -2,24 +2,24 @@
   makeWrapper, libXScrnSaver }:
 
 let
-  version = "1.10.0";
-  rev = "49129d126e2c3c5592cfc8a509d872067b69d262";
+  version = "1.10.2";
+  rev = "8076a19fdcab7e1fc1707952d652f0bb6c6db331";
   channel = "stable";
 
   # The revision can be obtained with the following command (see https://github.com/NixOS/nixpkgs/issues/22465):
   # curl -w "%{url_effective}\n" -I -L -s -S https://vscode-update.azurewebsites.net/latest/linux-x64/stable -o /dev/null
 
-  sha256 = if stdenv.system == "i686-linux"    then "14ip00ysnn6daw7ws3vgnhib18pi7r1z1szfr7s996awbq12ir3i"
-      else if stdenv.system == "x86_64-linux"  then "1krrshsx2pjkr4pc1d6zad664f5khdbhwaq8lpx1aagxxd921mx6"
-      else if stdenv.system == "x86_64-darwin" then "1y574b4wpkk06a36clajx57ydj7a0scn2gms4070cqaf0afzy19f"
+  sha256 = if stdenv.system == "i686-linux"    then "1rhwrpv17c8j06qja7i58cggzka8jm9v9h27jy22z30yxjz0p241"
+      else if stdenv.system == "x86_64-linux"  then "1c1w7wc39a5vdap8j143ym976p9l9iwns1y28mcgjwrihdlb5wb8"
+      else if stdenv.system == "x86_64-darwin" then "1zznsn84k79lqirzv950q7caq7c88yh2gglwjc11y8k69awmlpva"
       else throw "Unsupported system: ${stdenv.system}";
 
   urlBase = "https://az764295.vo.msecnd.net/${channel}/${rev}/";
 
   urlStr = if stdenv.system == "i686-linux" then
-        urlBase + "code-${channel}-code_${version}-1488384152_i386.tar.gz"
+        urlBase + "code-${channel}-code_${version}-1488982317_i386.tar.gz"
       else if stdenv.system == "x86_64-linux" then
-        urlBase + "code-${channel}-code_${version}-1488387854_amd64.tar.gz"
+        urlBase + "code-${channel}-code_${version}-1488981323_amd64.tar.gz"
       else if stdenv.system == "x86_64-darwin" then
         urlBase + "VSCode-darwin-${channel}.zip"
       else throw "Unsupported system: ${stdenv.system}";
@@ -47,17 +47,22 @@ in
       then [ unzip makeWrapper libXScrnSaver ]
       else [ makeWrapper libXScrnSaver ];
 
-    installPhase = ''
-      mkdir -p $out/lib/vscode $out/bin
-      cp -r ./* $out/lib/vscode
-      ln -s $out/lib/vscode/code $out/bin
+    installPhase =
+      if stdenv.system == "x86_64-darwin" then ''
+        mkdir -p $out/lib/vscode $out/bin
+        cp -r ./* $out/lib/vscode
+        ln -s $out/lib/vscode/Contents/Resources/app/bin/code $out/bin
+      '' else ''
+        mkdir -p $out/lib/vscode $out/bin
+        cp -r ./* $out/lib/vscode
+        ln -s $out/lib/vscode/code $out/bin
 
-      mkdir -p $out/share/applications
-      cp $desktopItem/share/applications/* $out/share/applications
+        mkdir -p $out/share/applications
+        cp $desktopItem/share/applications/* $out/share/applications
 
-      mkdir -p $out/share/pixmaps
-      cp $out/lib/vscode/resources/app/resources/linux/code.png $out/share/pixmaps/code.png
-    '';
+        mkdir -p $out/share/pixmaps
+        cp $out/lib/vscode/resources/app/resources/linux/code.png $out/share/pixmaps/code.png
+      '';
 
     postFixup = lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") ''
       patchelf \

From 82adcd6cfb1c779b86c26e326a33728b316fa9c6 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 24 Mar 2017 22:01:31 +0100
Subject: [PATCH 105/157] pythonPackages.BTrees: fix evaluation; builds fine

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

diff --git a/pkgs/development/python-modules/btrees/default.nix b/pkgs/development/python-modules/btrees/default.nix
index 44e96b5ff307..8e69a207628e 100644
--- a/pkgs/development/python-modules/btrees/default.nix
+++ b/pkgs/development/python-modules/btrees/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonPackage, persistent, zope_interface, transaction }:
+{ stdenv, fetchPypi, buildPythonPackage, persistent, zope_interface, transaction }:
 
 buildPythonPackage rec {
   pname = "BTrees";

From 1e6fd6f901c3be2be68c55f81bb7080b65d6be25 Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Fri, 24 Mar 2017 16:06:41 -0500
Subject: [PATCH 106/157] dar: 2.5.3 -> 2.5.9

---
 pkgs/tools/archivers/dar/default.nix | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pkgs/tools/archivers/dar/default.nix b/pkgs/tools/archivers/dar/default.nix
index 83a73eb388f8..d75b50bca1af 100644
--- a/pkgs/tools/archivers/dar/default.nix
+++ b/pkgs/tools/archivers/dar/default.nix
@@ -1,15 +1,17 @@
 { stdenv, fetchurl, zlib, bzip2, openssl, attr, lzo, libgcrypt, e2fsprogs, gpgme, xz }:
 
+with stdenv.lib;
+
 stdenv.mkDerivation rec {
-  name = "dar-2.5.3";
+  name = "dar-2.5.9";
 
   src = fetchurl {
     url = "mirror://sourceforge/dar/${name}.tar.gz";
-    sha256 = "0myakyfgv2mhazwvbbwwncn9j7c9b4g3szs0aqlclmp01naaqmj5";
+    sha256 = "0bm91d82amh5h2sla2ngbpxd0l64alcdjhxz35bhj3cpz9562wv9";
   };
 
   buildInputs = [ zlib bzip2 openssl lzo libgcrypt gpgme xz ]
-    ++ stdenv.lib.optionals stdenv.isLinux [ attr e2fsprogs ];
+    ++ optionals stdenv.isLinux [ attr e2fsprogs ];
 
   configureFlags = [ "--disable-dar-static" ];
 
@@ -20,7 +22,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = http://dar.linux.free.fr/;
     description = "Disk ARchiver, allows backing up files into indexed archives";
-    maintainers = [ stdenv.lib.maintainers.viric ];
-    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ maintainers.viric ];
+    platforms = platforms.unix;
   };
 }

From 73edc1d5f8756f478052d67ec1f761ac3ac2cd0f Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Fri, 24 Mar 2017 12:44:02 +0100
Subject: [PATCH 107/157] phpPackages.composer: 1.3.2 -> 1.4.1

---
 pkgs/top-level/php-packages.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix
index e07930a94db0..221427e08514 100644
--- a/pkgs/top-level/php-packages.nix
+++ b/pkgs/top-level/php-packages.nix
@@ -235,11 +235,11 @@ let
 
   composer = pkgs.stdenv.mkDerivation rec {
     name = "composer-${version}";
-    version = "1.3.2";
+    version = "1.4.1";
 
     src = pkgs.fetchurl {
       url = "https://getcomposer.org/download/${version}/composer.phar";
-      sha256 = "0s85zglzwx5i0hw9zlpwy1385jink1g1lhdwhv59zdjblcd7ckva";
+      sha256 = "1g2wsnjcx1ysbw1ps2xwyhgcl8kl3yfzxgwcnh5rigjk6k67glmb";
     };
 
     phases = [ "installPhase" ];

From 9787b2b808bb7255f78bc628b5314d1fb3609082 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Fri, 24 Mar 2017 12:37:50 +0100
Subject: [PATCH 108/157] geogebra: 5-0-338-0 -> 5-0-346-0

---
 pkgs/applications/science/math/geogebra/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/science/math/geogebra/default.nix b/pkgs/applications/science/math/geogebra/default.nix
index aee4831034d8..916f0dc360f3 100644
--- a/pkgs/applications/science/math/geogebra/default.nix
+++ b/pkgs/applications/science/math/geogebra/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "geogebra-${version}";
-  version = "5-0-338-0";
+  version = "5-0-346-0";
 
   preferLocalBuild = true;
 
   src = fetchurl {
     url = "http://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2";
-    sha256 = "1namwib3912zjizgl9swan0fwgmq9kvfq5k5y8lz818vh4lv88kx";
+    sha256 = "13yiksdk5qwa7c5zp5l0h3czqq31qlf04ncgrh8mn7z70ng1f3l4";
   };
 
   srcIcon = fetchurl {

From 8c2f986ed1a2cbeb214533a125c75eae436c2fe2 Mon Sep 17 00:00:00 2001
From: Winnie Quinn <me@winniequinn.com>
Date: Fri, 24 Mar 2017 17:01:41 -0400
Subject: [PATCH 109/157] gitkraken: 2.2.0 -> 2.2.1

---
 .../version-management/gitkraken/default.nix       | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/pkgs/applications/version-management/gitkraken/default.nix b/pkgs/applications/version-management/gitkraken/default.nix
index 28d89fb32d04..6cc84c9e0987 100644
--- a/pkgs/applications/version-management/gitkraken/default.nix
+++ b/pkgs/applications/version-management/gitkraken/default.nix
@@ -4,16 +4,18 @@
   ,nss, nspr, cups, fetchurl, expat, gdk_pixbuf, libXdamage, libXrandr, dbus
 }:
 
+with stdenv.lib;
+
 stdenv.mkDerivation rec {
   name = "gitkraken-${version}";
-  version = "2.2.0";
+  version = "2.2.1";
 
   src = fetchurl {
     url = "https://release.gitkraken.com/linux/v${version}.tar.gz";
-    sha256 = "0a3ed917e6e937af4dd180144fbb4ad8b99b35b5d8c1f0684a55de38189a812d";
+    sha256 = "12nyw2dh9ylrms264dbw0xzyif0znmba32zyfq7kdp0iay0wvgqd";
   };
 
-  libPath = stdenv.lib.makeLibraryPath [
+  libPath = makeLibraryPath [
     stdenv.cc.cc.lib
     curl
     udev
@@ -58,13 +60,13 @@ stdenv.mkDerivation rec {
     patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
              --set-rpath "$libPath:$out/opt/gitkraken" "$out/opt/gitkraken/gitkraken"
     wrapProgram $out/opt/gitkraken/gitkraken \
-      --prefix LD_PRELOAD : "${stdenv.lib.makeLibraryPath [ curl ]}/libcurl.so.4" \
-      --prefix LD_PRELOAD : "${stdenv.lib.makeLibraryPath [ libgnome_keyring ]}/libgnome-keyring.so.0"
+      --prefix LD_PRELOAD : "${makeLibraryPath [ curl ]}/libcurl.so.4" \
+      --prefix LD_PRELOAD : "${makeLibraryPath [ libgnome_keyring ]}/libgnome-keyring.so.0"
     mkdir "$out/bin"
     ln -s "$out/opt/gitkraken/gitkraken" "$out/bin/gitkraken"
   '';
 
-  meta = with stdenv.lib; {
+  meta = {
     homepage = https://www.gitkraken.com/;
     description = "The downright luxurious and most popular Git client for Windows, Mac & Linux";
     license = licenses.unfree;

From edac1d3e7a2c319ee748882fc57d0dcb304d7591 Mon Sep 17 00:00:00 2001
From: Aleksey Kladov <aleksey.kladov@gmail.com>
Date: Sat, 25 Mar 2017 00:48:27 +0300
Subject: [PATCH 110/157] docs: clarify UEFI bootloader setup

---
 nixos/doc/manual/installation/installing-uefi.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nixos/doc/manual/installation/installing-uefi.xml b/nixos/doc/manual/installation/installing-uefi.xml
index 927648febc50..0d3eaa8bb1fb 100644
--- a/nixos/doc/manual/installation/installing-uefi.xml
+++ b/nixos/doc/manual/installation/installing-uefi.xml
@@ -26,7 +26,8 @@ changes:
     <literal>vfat</literal> filesystem.</para>
   </listitem>
   <listitem>
-    <para>You must set <option>boot.loader.systemd-boot.enable</option> to
+    <para>Instead of <option>boot.loader.grub.device</option>,
+    you must set <option>boot.loader.systemd-boot.enable</option> to
     <literal>true</literal>. <command>nixos-generate-config</command>
     should do this automatically for new configurations when booted in
     UEFI mode.</para>

From 2078c34dad8ecdb8955572e2662ecb4eef750d70 Mon Sep 17 00:00:00 2001
From: Sophie Taylor <sophie@spacekitteh.moe>
Date: Fri, 24 Mar 2017 18:27:18 +1000
Subject: [PATCH 111/157] fetchRepoProject: Fix buildCommand

---
 pkgs/build-support/fetchrepoproject/default.nix | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix
index 01d7fe1d0f55..33adb5ab1dd4 100644
--- a/pkgs/build-support/fetchrepoproject/default.nix
+++ b/pkgs/build-support/fetchrepoproject/default.nix
@@ -15,10 +15,11 @@ stdenv.mkDerivation {
     done
 
     export HOME=.repo
-    repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle
-    ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"}
-    ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"}
-    ${optionalString (referenceDir != "") " --reference=${referenceDir}"}
+    repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle''
+  + optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"
+  + optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"
+  + optionalString (referenceDir != "") " --reference=${referenceDir}"
+  + ''
     repo sync --jobs=$NIX_BUILD_CORES --current-branch
     rm -rf $out/.repo
   '';

From 00f472a563c030d0232bfd39af8b3f5411169a5d Mon Sep 17 00:00:00 2001
From: Daiderd Jordan <daiderd@gmail.com>
Date: Sat, 25 Mar 2017 00:35:20 +0100
Subject: [PATCH 112/157] fetchrepoproject: cleanup extra flags

---
 .../fetchrepoproject/default.nix              | 31 ++++++++++++-------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix
index 33adb5ab1dd4..78a46d4ac9bd 100644
--- a/pkgs/build-support/fetchrepoproject/default.nix
+++ b/pkgs/build-support/fetchrepoproject/default.nix
@@ -1,25 +1,34 @@
-{stdenv, git, gitRepo, gnupg ? null, cacert}:
+{ stdenv, git, gitRepo, gnupg ? null, cacert }:
 
-{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "",
-localManifests ? [] }:
+{ name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? ""
+, localManifests ? []
+}:
 
 assert repoRepoRev != "" -> repoRepoURL != "";
 
+with stdenv.lib;
+
+let
+  extraRepoInitFlags = [
+    (optionalString (repoRepoURL != "") "--repo-url=${repoRepoURL}")
+    (optionalString (repoRepoRev != "") "--repo-branch=${repoRepoRev}")
+    (optionalString (referenceDir != "") "--reference=${referenceDir}")
+  ];
+in
+
 stdenv.mkDerivation {
-  buildCommand = with stdenv.lib; ''
+  buildCommand = ''
     mkdir ./.repo
     mkdir ./.repo/local_manifests
-    for local_manifest in ${concatMapStringsSep " " (x: "${x}") localManifests}
+    for local_manifest in ${concatMapStringsSep " " toString localManifests}
     do
       cp $local_manifest ./.repo/local_manifests/$(stripHash $local_manifest; echo $strippedName)
     done
 
     export HOME=.repo
-    repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle''
-  + optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"
-  + optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"
-  + optionalString (referenceDir != "") " --reference=${referenceDir}"
-  + ''
+    repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle \
+        ${concatStringsSep " " extraRepoInitFlags}
+
     repo sync --jobs=$NIX_BUILD_CORES --current-branch
     rm -rf $out/.repo
   '';
@@ -30,7 +39,7 @@ stdenv.mkDerivation {
     "GIT_PROXY_COMMAND" "SOCKS_SERVER"
   ];
 
-  buildInputs = [git gitRepo cacert] ++ stdenv.lib.optional (gnupg != null) [gnupg] ;
+  buildInputs = [git gitRepo cacert] ++ optional (gnupg != null) [gnupg] ;
 
   outputHashAlgo = "sha256";
   outputHashMode = "recursive";

From 60788745c9dce2544e90a0d5638843f5259e9f9b Mon Sep 17 00:00:00 2001
From: Tuomas Tynkkynen <tuomas@tuxera.com>
Date: Sat, 11 Mar 2017 17:58:55 +0200
Subject: [PATCH 113/157] channel.nix: Use filterSource to exclude unnecessary
 files from nixpkgs

Currently, if you try to build a NixOS config including channel.nix, e.g.:

nix-build -I nixpkgs=. -I nixos-config=nixos/modules/installer/cd-dvd/installation-cd-minimal.nix nixos -A config.system.build.isoImage

twice in a row, you end up with two different build results. This is
caused by the 'result' symlink of the first build affecting the channel
contents of the second build.

If we use filterSource with a predicate that ignores the 'result'
symlinks, the problem is gone. Do the same thing for VIM/Emacs
swap/backup files to avoid even more 'spurious' rebuilds.

Additionally, filter out the '.git' directory at the same time, as we
'rm -rf' it from the result anyway. This avoids a considerable amount of
unnecessary file I/O copying and deleting the .git directory.
---
 nixos/modules/installer/cd-dvd/channel.nix | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix
index cd6e72755dea..663ff24c81f1 100644
--- a/nixos/modules/installer/cd-dvd/channel.nix
+++ b/nixos/modules/installer/cd-dvd/channel.nix
@@ -6,6 +6,16 @@
 with lib;
 
 let
+  # Do not include these things:
+  #   - The '.git' directory
+  #   - Result symlinks from nix-build ('result', 'result-2', 'result-bin', ...)
+  #   - VIM/Emacs swap/backup files ('.swp', '.swo', '.foo.swp', 'foo~', ...)
+  filterFn = path: type: let basename = baseNameOf (toString path); in
+    if type == "directory" then basename != ".git"
+    else if type == "symlink" then builtins.match "^result(|-.*)$" basename == null
+    else builtins.match "^((|\..*)\.sw[a-z]|.*~)$" basename == null;
+
+  nixpkgs = builtins.filterSource filterFn pkgs.path;
 
   # We need a copy of the Nix expressions for Nixpkgs and NixOS on the
   # CD.  These are installed into the "nixos" channel of the root
@@ -15,12 +25,11 @@ let
     { }
     ''
       mkdir -p $out
-      cp -prd ${pkgs.path} $out/nixos
+      cp -prd ${nixpkgs} $out/nixos
       chmod -R u+w $out/nixos
       if [ ! -e $out/nixos/nixpkgs ]; then
         ln -s . $out/nixos/nixpkgs
       fi
-      rm -rf $out/nixos/.git
       echo -n ${config.system.nixosVersionSuffix} > $out/nixos/.version-suffix
     '';
 

From 186cc512a68e228d8768f4c817f072b112b922d3 Mon Sep 17 00:00:00 2001
From: Tuomas Tynkkynen <tuomas@tuxera.com>
Date: Sat, 25 Mar 2017 02:12:14 +0200
Subject: [PATCH 114/157] freicoin: Fix eval

---
 pkgs/applications/altcoins/default.nix | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pkgs/applications/altcoins/default.nix b/pkgs/applications/altcoins/default.nix
index 9c19be3cc524..d304019953ae 100644
--- a/pkgs/applications/altcoins/default.nix
+++ b/pkgs/applications/altcoins/default.nix
@@ -16,7 +16,7 @@ rec {
   dogecoin  = callPackage ./dogecoin.nix { withGui = true; };
   dogecoind = callPackage ./dogecoin.nix { withGui = false; };
 
-  freicoin = callPackage ../freicoin.nix { boost = boost155; };
+  freicoin = callPackage ./freicoin.nix { boost = pkgs.boost155; };
   go-ethereum = callPackage ./go-ethereum.nix { };
 
   litecoin  = callPackage ./litecoin.nix { withGui = true; };
@@ -34,5 +34,4 @@ rec {
   primecoind = callPackage ./primecoin.nix { withGui = false; };
 
   stellar-core = callPackage ./stellar-core.nix { };
-
 }

From 22e58be888c954b9cb6893a6d3d8e8015e860672 Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Fri, 24 Mar 2017 21:37:56 -0500
Subject: [PATCH 115/157] advancecomp: 1.19 -> 1.23

---
 .../tools/compression/advancecomp/default.nix | 49 +++++++++----------
 1 file changed, 22 insertions(+), 27 deletions(-)

diff --git a/pkgs/tools/compression/advancecomp/default.nix b/pkgs/tools/compression/advancecomp/default.nix
index 5737f1eca15f..2f4b56ffcaf9 100644
--- a/pkgs/tools/compression/advancecomp/default.nix
+++ b/pkgs/tools/compression/advancecomp/default.nix
@@ -1,31 +1,26 @@
-{stdenv, fetchurl, zlib}:
-let
-  s = # Generated upstream information
-  rec {
-    baseName="advancecomp";
-    version="1.19";
-    name="${baseName}-${version}";
-    url="http://prdownloads.sourceforge.net/advancemame/advancecomp-1.19.tar.gz?download";
-    sha256="0irhmwcn9r4jc29442skqr1f3lafiaahxc3m3ybalmm37l6cb56m";
+{ stdenv, fetchFromGitHub
+, autoreconfHook, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "advancecomp-${version}";
+  version = "1.23";
+
+  src = fetchFromGitHub {
+    owner = "amadvance";
+    repo = "advancecomp";
+    rev = "v${version}";
+    sha256 = "1mrgmpjd9f7x16g847h1588mgryl26hlzfl40bc611259bb0bq7w"; 
   };
-  buildInputs = [
-    zlib
-  ];
-in
-stdenv.mkDerivation {
-  inherit (s) name version;
-  inherit buildInputs;
-  src = fetchurl {
-    inherit (s) url sha256;
-  };
-  meta = {
-    inherit (s) version;
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ zlib ];
+
+  meta = with stdenv.lib; {
     description = ''A set of tools to optimize deflate-compressed files'';
-    license = stdenv.lib.licenses.gpl2 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
-    updateWalker = true;
-    homepage = "http://advancemame.sourceforge.net/comp-readme.html";
-    downloadPage = "http://advancemame.sourceforge.net/comp-download.html";
+    license = licenses.gpl2 ;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+    homepage = https://github.com/amadvance/advancecomp;
+
   };
 }

From a7a3d910392147fae005890ae3eb78a2cd202b7e Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Sat, 25 Mar 2017 06:57:46 +0000
Subject: [PATCH 116/157] ocamlPackages.ppx_traverse_builtins: init at 0.9.0

This OCaml library defines the default methods for builtin types
(int, string, list, ...) for Ppx_traverse.

Homepage: https://github.com/janestreet/ppx_traverse_builtins
---
 .../janestreet/ppx_traverse_builtins.nix      | 21 +++++++++++++++++++
 pkgs/top-level/ocaml-packages.nix             |  2 ++
 2 files changed, 23 insertions(+)
 create mode 100644 pkgs/development/ocaml-modules/janestreet/ppx_traverse_builtins.nix

diff --git a/pkgs/development/ocaml-modules/janestreet/ppx_traverse_builtins.nix b/pkgs/development/ocaml-modules/janestreet/ppx_traverse_builtins.nix
new file mode 100644
index 000000000000..d84983ed6348
--- /dev/null
+++ b/pkgs/development/ocaml-modules/janestreet/ppx_traverse_builtins.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, ocaml, jbuilder, findlib }:
+
+stdenv.mkDerivation {
+	name = "ocaml${ocaml.version}-ppx_traverse_builtins-0.9.0";
+	src = fetchurl {
+		url = http://ocaml.janestreet.com/ocaml-core/v0.9/files/ppx_traverse_builtins-v0.9.0.tar.gz;
+		sha256 = "0zmf9kybll0xn8dsj10v260l0zwjyykimqml9rl7xqyjyl1rmnx6";
+	};
+
+	buildInputs = [ ocaml jbuilder findlib ];
+
+	inherit (jbuilder) installPhase;
+
+	meta = {
+		description = "Builtins for Ppx_traverse";
+		homepage = https://github.com/janestreet/ppx_traverse_builtins;
+		license = stdenv.lib.licenses.asl20;
+		inherit (ocaml.meta) platforms;
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+	};
+}
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index 54460f855db6..bca0c1dc2161 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -682,6 +682,8 @@ let
       then callPackage ../development/ocaml-modules/janestreet/ppx_jane-113_33_00.nix {}
       else callPackage ../development/ocaml-modules/janestreet/ppx-jane.nix {};
 
+    ppx_traverse_builtins = callPackage ../development/ocaml-modules/janestreet/ppx_traverse_builtins.nix {};
+
 
     # Core sublibs
     typerep =

From 6e0b7273a230b55433fe9ae2799fc53f2b33f8dc Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Sat, 25 Mar 2017 07:06:49 +0000
Subject: [PATCH 117/157] ocamlPackages.stdio: init at 0.9.0

Stdio implements simple input/output functionalities for OCaml.

Homepage: https://github.com/janestreet/stdio
---
 .../ocaml-modules/stdio/default.nix           | 22 +++++++++++++++++++
 pkgs/top-level/ocaml-packages.nix             |  2 ++
 2 files changed, 24 insertions(+)
 create mode 100644 pkgs/development/ocaml-modules/stdio/default.nix

diff --git a/pkgs/development/ocaml-modules/stdio/default.nix b/pkgs/development/ocaml-modules/stdio/default.nix
new file mode 100644
index 000000000000..873823300222
--- /dev/null
+++ b/pkgs/development/ocaml-modules/stdio/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, ocaml, jbuilder, findlib, base }:
+
+stdenv.mkDerivation {
+  name = "ocaml${ocaml.version}-stdio-0.9.0";
+
+  src = fetchurl {
+    url = http://ocaml.janestreet.com/ocaml-core/v0.9/files/stdio-v0.9.0.tar.gz;
+    sha256 = "008b5y03223107gfv8qawdfyjvf5g97l472i5p5v8mp512wr7kj5";
+  };
+
+  buildInputs = [ ocaml jbuilder findlib ];
+  propagatedBuildInputs = [ base ];
+
+  inherit (jbuilder) installPhase;
+
+  meta = {
+    license = stdenv.lib.licenses.asl20;
+    description = "Standard IO library for OCaml";
+    homepage = https://github.com/janestreet/stdio;
+    inherit (ocaml.meta) platforms;
+  };
+}
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index bca0c1dc2161..41347a2607db 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -516,6 +516,8 @@ let
 
     sqlite3EZ = callPackage ../development/ocaml-modules/sqlite3EZ { };
 
+    stdio = callPackage ../development/ocaml-modules/stdio { };
+
     stringext = callPackage ../development/ocaml-modules/stringext { };
 
     topkg = callPackage ../development/ocaml-modules/topkg { };

From b97dd5f560cee49ede14c9b7129b6e1bca3a3707 Mon Sep 17 00:00:00 2001
From: Periklis Tsirakidis <periklis.tsirakidis@mayflower.de>
Date: Mon, 20 Mar 2017 22:09:55 +0100
Subject: [PATCH 118/157] qt58: enable darwin compatibility

---
 .../libraries/qt-5/5.8/default.nix            |   6 +-
 .../qt-5/5.8/qtbase/cmake-paths-darwin.patch  | 384 ++++++++++++++++++
 .../libraries/qt-5/5.8/qtbase/default.nix     | 113 ++++--
 .../libraries/qt-5/5.8/qtbase/series          |   1 -
 4 files changed, 463 insertions(+), 41 deletions(-)
 create mode 100644 pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths-darwin.patch

diff --git a/pkgs/development/libraries/qt-5/5.8/default.nix b/pkgs/development/libraries/qt-5/5.8/default.nix
index f02b80706380..eb26f88f7258 100644
--- a/pkgs/development/libraries/qt-5/5.8/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/default.nix
@@ -106,13 +106,13 @@ let
 
       makeQtWrapper =
         makeSetupHook
-        { deps = [ makeWrapper dconf.lib gtk3 ]; }
-        ../make-qt-wrapper.sh;
+        { deps = [ makeWrapper ] ++ optionals (!stdenv.isDarwin) [ dconf.lib gtk3 ]; }
+        (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
 
       qmakeHook =
         makeSetupHook
         { deps = [ self.qtbase.dev ]; }
-        ../qmake-hook.sh;
+        (if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh);
 
     };
 
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths-darwin.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths-darwin.patch
new file mode 100644
index 000000000000..da7f36542ef9
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths-darwin.patch
@@ -0,0 +1,384 @@
+Index: qtbase-opensource-src-5.8.0/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ qtbase-opensource-src-5.8.0/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0)
+ endif()
+ !!ENDIF
+
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
+@@ -59,7 +35,10 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"@NIX_DEV@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    endif()
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+@@ -74,45 +53,17 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+         \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+     )
+
+-!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+-    set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+-    _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+-    if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+-        set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+-        \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
+-        )
+-    endif()
+-!!ENDIF
+ endmacro()
+ !!ENDIF
+
+ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+
+ !!IF !no_module_headers
+-!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+-    )
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
++    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"@NIX_OUT@/lib\" \"@NIX_OUT@/lib/$${MODULE_INCNAME}.framework/Headers\")
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -128,7 +80,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
++
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -253,28 +205,19 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_DEBUG_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -282,36 +225,23 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+ !!ENDIF // CMAKE_RELEASE_TYPE
+
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-    _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE
+     _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -328,11 +258,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
++        set(imported_location \"${PLUGIN_LOCATION}\")
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+Index: qtbase-opensource-src-5.8.0/src/gui/Qt5GuiConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/src/gui/Qt5GuiConfigExtras.cmake.in
++++ qtbase-opensource-src-5.8.0/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"@NIX_DEV@/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_propert
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"@NIX_DEV@/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.8.0/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ qtbase-opensource-src-5.8.0/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+     add_executable(Qt5::uic IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.8.0/src/corelib/Qt5CoreConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ qtbase-opensource-src-5.8.0/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
+     add_executable(Qt5::qmake IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
+     add_executable(Qt5::moc IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
+     add_executable(Qt5::rcc IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -131,7 +131,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -145,7 +145,7 @@ if (NOT TARGET Qt5::WinMain)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.8.0/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ qtbase-opensource-src-5.8.0/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.8.0/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ qtbase-opensource-src-5.8.0/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.8.0/src/dbus/Qt5DBusConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ qtbase-opensource-src-5.8.0/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.8.0/mkspecs/features/create_cmake.prf
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/mkspecs/features/create_cmake.prf
++++ qtbase-opensource-src-5.8.0/mkspecs/features/create_cmake.prf
+@@ -136,28 +136,28 @@ contains(CONFIG, plugin) {
+
+     win32 {
+         isEmpty(CMAKE_STATIC_TYPE) {
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.dll
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.dll
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}.dll
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}d.dll
+         } else:mingw {
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}.a
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}d.a
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}/$$PLUGIN_TYPE/lib$${TARGET}.a
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}d.a
+         } else {                         # MSVC static
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.lib
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.lib
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}.lib
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}d.lib
+         }
+     } else {
+         mac {
+             isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dylib
+             else: CMAKE_PlUGIN_EXT = .a
+
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+         } else {
+             isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .so
+             else: CMAKE_PlUGIN_EXT = .a
+
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+         }
+     }
+     cmake_target_file.input = $$PWD/data/cmake/Qt5PluginTarget.cmake.in
+Index: qtbase-opensource-src-5.8.0/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ qtbase-opensource-src-5.8.0/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -2,10 +2,10 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
index 7da02525f2de..f881c76c3ad9 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
@@ -4,6 +4,8 @@
 
   coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
   ruby,
+  # darwin support
+  darwin, libiconv, libcxx,
 
   dbus, fontconfig, freetype, glib, gtk3, harfbuzz, icu, libX11, libXcomposite,
   libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng, libtiff,
@@ -15,7 +17,8 @@
   cups ? null, mysql ? null, postgresql ? null,
 
   # options
-  mesaSupported, mesa,
+  mesaSupported ? (!stdenv.isDarwin),
+  mesa,
   buildExamples ? false,
   buildTests ? false,
   developerBuild ? false,
@@ -35,6 +38,7 @@ stdenv.mkDerivation {
 
   patches =
     copyPathsToStore (lib.readPathsFromFile ./. ./series)
+    ++ [(if stdenv.isDarwin then ./cmake-paths-darwin.patch else ./cmake-paths.patch)]
     ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch
     ++ lib.optionals mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
 
@@ -54,11 +58,11 @@ stdenv.mkDerivation {
       substituteInPlace src/network/kernel/qhostinfo_unix.cpp \
         --replace "@glibc@" "${stdenv.cc.libc.out}"
 
-      substituteInPlace src/plugins/platforms/xcb/qxcbcursor.cpp \
-        --replace "@libXcursor@" "${libXcursor.out}"
-
       substituteInPlace src/network/ssl/qsslsocket_openssl_symbols.cpp \
         --replace "@openssl@" "${openssl.out}"
+    '' + lib.optionalString stdenv.isLinux ''
+      substituteInPlace src/plugins/platforms/xcb/qxcbcursor.cpp \
+        --replace "@libXcursor@" "${libXcursor.out}"
 
       substituteInPlace src/dbus/qdbus_symbols.cpp \
         --replace "@dbus_libs@" "${dbus.lib}"
@@ -74,8 +78,23 @@ stdenv.mkDerivation {
       substituteInPlace mkspecs/common/linux.conf \
         --replace "@mesa_lib@" "${mesa.out}" \
         --replace "@mesa_inc@" "${mesa.dev or mesa}"
-    '';
-
+    ''+ lib.optionalString stdenv.isDarwin ''
+      sed -i \
+          -e 's|! /usr/bin/xcode-select --print-path >/dev/null 2>&1;|false;|' \
+          -e 's|! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1;|false;|' \
+          -e 's|sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)|sysroot="${darwin.apple_sdk.sdk}"|' \
+          -e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
+          -e 's|XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1`|XCRUN="clang -v 2>&1"|' \
+          -e 's#sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d \x27 \x27 -f 1))##' \
+          -e 's#val=$(echo $sdk_val $(echo $val | cut -s -d \x27 \x27 -f 2-))##' \
+          ./configure
+      sed -i '3,$d' ./mkspecs/features/mac/default_pre.prf
+      sed -i '26,$d' ./mkspecs/features/mac/default_post.prf
+      sed -i '1,$d' ./mkspecs/features/mac/sdk.prf
+      sed -i 's/QMAKE_LFLAGS_RPATH      = -Wl,-rpath,/QMAKE_LFLAGS_RPATH      =/' ./mkspecs/common/mac.conf
+     '';
+     # Note on the above: \x27 is a way if including a single-quote
+     # character in the sed string arguments.
 
   setOutputFlags = false;
   preConfigure = ''
@@ -102,7 +121,7 @@ stdenv.mkDerivation {
     -shared
     ${lib.optionalString developerBuild "-developer-build"}
     -accessibility
-    -rpath
+    -optimized-qmake
     -strip
     -no-reduce-relocations
     -system-proxies
@@ -114,15 +133,6 @@ stdenv.mkDerivation {
     -qml-debug
     -icu
     -pch
-    -glib
-    -xcb
-    -qpa xcb
-    -${lib.optionalString (cups == null) "no-"}cups
-
-    -no-eglfs
-    -no-directfb
-    -no-linuxfb
-    -no-kms
 
     ${lib.optionalString (!system-x86_64) "-no-sse2"}
     -no-sse3
@@ -135,16 +145,10 @@ stdenv.mkDerivation {
     -no-mips_dspr2
 
     -system-zlib
-    -system-libpng
     -system-libjpeg
     -system-harfbuzz
-    -system-xcb
-    -system-xkbcommon
     -system-pcre
     -openssl-linked
-    -dbus-linked
-    -libinput
-    -gtk
 
     -system-sqlite
     -${if mysql != null then "plugin" else "no"}-sql-mysql
@@ -155,6 +159,31 @@ stdenv.mkDerivation {
     -${lib.optionalString (buildExamples == false) "no"}make examples
     -${lib.optionalString (buildTests == false) "no"}make tests
     -v
+  '' + lib.optionalString (!stdenv.isDarwin) ''
+    -rpath
+    -glib
+    -xcb
+    -qpa xcb
+
+    -${lib.optionalString (cups == null) "no-"}cups
+
+    -no-eglfs
+    -no-directfb
+    -no-linuxfb
+    -no-kms
+
+    -libinput
+    -gtk
+    -system-libpng
+    -system-xcb
+    -system-xkbcommon
+    -dbus-linked
+  '' + lib.optionalString stdenv.isDarwin ''
+    -platform macx-clang
+    -no-use-gold-linker
+    -no-fontconfig
+    -qt-freetype
+    -qt-libpng
   '';
 
   # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
@@ -163,32 +192,44 @@ stdenv.mkDerivation {
   PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";
 
   propagatedBuildInputs = [
-    dbus glib libxml2 libxslt openssl pcre16 sqlite udev zlib
+    libxml2 libxslt openssl pcre16 sqlite zlib
+
+    # Text rendering
+    harfbuzz icu
 
     # Image formats
     libjpeg libpng libtiff
+  ]
+  ++ lib.optional mesaSupported mesa
+  ++ lib.optionals (!stdenv.isDarwin) [
+    dbus glib udev
 
     # Text rendering
-    fontconfig freetype harfbuzz icu
+    fontconfig freetype
 
     # X11 libs
     libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
     xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
-  ]
-  ++ lib.optional mesaSupported mesa;
+  ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    ApplicationServices Foundation CoreServices AppKit Carbon OpenGL AGL Cocoa
+    DiskArbitration darwin.cf-private libiconv darwin.apple_sdk.sdk
+  ]);
 
-  buildInputs =
-    [ gtk3 libinput ]
+  buildInputs = [ ]
+    ++ lib.optionals (!stdenv.isDarwin) [ gtk3 libinput ]
     ++ lib.optional developerBuild gdb
     ++ lib.optional (cups != null) cups
     ++ lib.optional (mysql != null) mysql.lib
     ++ lib.optional (postgresql != null) postgresql;
 
-  nativeBuildInputs =
-    [ bison flex gperf lndir patchelf perl pkgconfig python2 ];
+  nativeBuildInputs = [ bison flex gperf lndir perl pkgconfig python2 ] ++ lib.optional (!stdenv.isDarwin) patchelf;
 
   # freetype-2.5.4 changed signedness of some struct fields
-  NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare";
+  NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare"
+    + lib.optionalString stdenv.isDarwin " -D__MAC_OS_X_VERSION_MAX_ALLOWED=1090 -D__AVAILABILITY_INTERNAL__MAC_10_10=__attribute__((availability(macosx,introduced=10.10)))";
+  # Note that nixpkgs's objc4 is from macOS 10.11 while the SDK is
+  # 10.9 which necessitates the above macro definition that mentions
+  # 10.10
 
   postInstall = ''
     find "$out" -name "*.cmake" | while read file; do
@@ -218,7 +259,7 @@ stdenv.mkDerivation {
       # Move libtool archives and qmake projects
       if [ "z''${!outputLib}" != "z''${!outputDev}" ]; then
           pushd "''${!outputLib}"
-          find lib -name '*.a' -o -name '*.la' -o -name '*.prl' | \
+          find lib -name '*.a' -o -name '*.la'${if stdenv.isDarwin then "" else "-o -name '*.prl'"} | \
               while read -r file; do
                   mkdir -p "''${!outputDev}/$(dirname "$file")"
                   mv "''${!outputLib}/$file" "''${!outputDev}/$file"
@@ -226,14 +267,12 @@ stdenv.mkDerivation {
           popd
       fi
     ''
-
     # fixup .pc file (where to find 'moc' etc.)
     + lib.optionalString (!stdenv.isDarwin) ''
       sed -i "$dev/lib/pkgconfig/Qt5Core.pc" \
           -e "/^host_bins=/ c host_bins=$dev/bin"
     ''
-
-    # Don't move .prl files on darwin because they end up in
+    # Don' move .prl files on darwin because they end up in
     # "dev/lib/Foo.framework/Foo.prl" which interferes with subsequent
     # use of lndir in the qtbase setup-hook. On Linux, the .prl files
     # are in lib, and so do not cause a subsequent recreation of deep
@@ -265,8 +304,8 @@ stdenv.mkDerivation {
     homepage = http://www.qt.io;
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
-    maintainers = with maintainers; [ qknight ttuegel ];
-    platforms = platforms.linux;
+    maintainers = with maintainers; [ qknight ttuegel periklis ];
+    platforms = platforms.unix;
   };
 
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/series b/pkgs/development/libraries/qt-5/5.8/qtbase/series
index 44e2d9040807..2196d8383752 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/series
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/series
@@ -7,4 +7,3 @@ xdg-config-dirs.patch
 nix-profiles-library-paths.patch
 compose-search-path.patch
 libressl.patch
-cmake-paths.patch

From c7cd4fec60748a2541c4a696b82a59876f7d565a Mon Sep 17 00:00:00 2001
From: Kamil Chmielewski <kamil.chm@gmail.com>
Date: Sat, 25 Mar 2017 09:51:28 +0100
Subject: [PATCH 119/157] ponyc: 0.11.3 -> 0.11.4

---
 pkgs/development/compilers/ponyc/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/compilers/ponyc/default.nix b/pkgs/development/compilers/ponyc/default.nix
index f78eafa68afa..a386abec95bd 100644
--- a/pkgs/development/compilers/ponyc/default.nix
+++ b/pkgs/development/compilers/ponyc/default.nix
@@ -3,13 +3,13 @@
 
 stdenv.mkDerivation ( rec {
   name = "ponyc-${version}";
-  version = "0.11.3";
+  version = "0.11.4";
 
   src = fetchFromGitHub {
     owner = "ponylang";
     repo = "ponyc";
     rev = version;
-    sha256 = "08wh8rh17bf043glvn7778bwpxyzpm95kgfll645hf2m65n5ncsh";
+    sha256 = "0csssmc9dcm2ib9k5qhglnjyrqsmci9b5q0b5cxwvl5z1llib9hg";
   };
 
   buildInputs = [ llvm makeWrapper which ];

From 6c9bfa3bd78c357f9dc4c29a2c4d54ce5a7d4b7e Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Sat, 25 Mar 2017 09:27:11 +0000
Subject: [PATCH 120/157] ocamlPackages.angstrom: 0.3.0 -> 0.4.0

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

diff --git a/pkgs/development/ocaml-modules/angstrom/default.nix b/pkgs/development/ocaml-modules/angstrom/default.nix
index 755724bc8b82..fadb55907bfe 100644
--- a/pkgs/development/ocaml-modules/angstrom/default.nix
+++ b/pkgs/development/ocaml-modules/angstrom/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchFromGitHub, ocaml, ocamlbuild, cstruct, result, findlib, ocaml_oasis }:
 
 stdenv.mkDerivation rec {
-  version = "0.3.0";
+  version = "0.4.0";
   name = "ocaml-angstrom-${version}";
 
   src = fetchFromGitHub {
     owner  = "inhabitedtype";
     repo   = "angstrom";
     rev    = "${version}";
-    sha256 = "1x9pvy5vw98ns4pspj7i10pmgqyngn4v4cdlz5pbvwbrpwpn090q";
+    sha256 = "019s3jwhnswa914bgj1fa6q67k0bl2ahqdaqfnavcbyii8763kh2";
   };
 
   createFindlibDestdir = true;

From e3fd4ec6ceb8988c3d6bcace4d02073f63d73498 Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Sat, 25 Mar 2017 09:54:46 +0000
Subject: [PATCH 121/157] ocamlPackages.ocaml_mysql: 1.1.1 -> 1.2.1

---
 pkgs/development/ocaml-modules/mysql/default.nix | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/pkgs/development/ocaml-modules/mysql/default.nix b/pkgs/development/ocaml-modules/mysql/default.nix
index 9eafa055b240..3fa8e9d46b40 100644
--- a/pkgs/development/ocaml-modules/mysql/default.nix
+++ b/pkgs/development/ocaml-modules/mysql/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ocaml, findlib, mysql, camlp4 }:
+{ stdenv, fetchurl, ocaml, findlib, mysql }:
 
 # TODO: la versione stabile da' un errore di compilazione dovuto a
 # qualche cambiamento negli header .h
@@ -10,11 +10,11 @@ in
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
-  version = "1.1.1";
+  version = "1.2.1";
 
   src = fetchurl {
-    url = "https://forge.ocamlcore.org/frs/download.php/870/${pname}-${version}.tar.gz";
-    sha256 = "f896fa101a05d81b85af8122fe1c2809008a5e5fdca00f9ceeb7eec356369e3a";
+    url = "http://ygrek.org.ua/p/release/ocaml-mysql/${name}.tar.gz";
+    sha256 = "06mb2bq7v37wn0lza61917zqgb4bsg1xxb73myjyn88p6khl6yl2";
   };
 
   configureFlags = [ 
@@ -22,17 +22,12 @@ stdenv.mkDerivation rec {
      "--libdir=$out/lib/ocaml/${ocaml.version}/site-lib/mysql"
   ];
 
-  buildInputs = [ocaml findlib camlp4 ];
+  buildInputs = [ ocaml findlib ];
 
   createFindlibDestdir = true;
 
   propagatedBuildInputs = [ mysql.client ];
 
-  buildPhase = ''
-    make
-    make opt
-  '';
-
   meta = {
     homepage = http://ocaml-mysql.forge.ocamlcore.org;
     description = "Bindings for interacting with MySQL databases from ocaml";

From f6c9121d32f948b8f9d5a11daaaa96057d3a609c Mon Sep 17 00:00:00 2001
From: Kranium Gikos Mendoza <kranium@gikos.net>
Date: Fri, 24 Mar 2017 21:27:41 +1100
Subject: [PATCH 122/157] iterm2: 3.0.4 -> 3.0.14

---
 pkgs/applications/misc/iterm2/default.nix | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/misc/iterm2/default.nix b/pkgs/applications/misc/iterm2/default.nix
index 028e5d6b725a..fa2ac38d383b 100644
--- a/pkgs/applications/misc/iterm2/default.nix
+++ b/pkgs/applications/misc/iterm2/default.nix
@@ -2,16 +2,19 @@
 
 stdenv.mkDerivation rec {
   name = "iterm2-${version}";
-  version = "3.0.4";
+  version = "3.0.14";
 
   src = fetchFromGitHub {
     owner = "gnachman";
     repo = "iTerm2";
     rev = "v${version}";
-    sha256 = "0ffg9l2jvv503h13nd5rjkn5xrahswcqqwmm052qzd6d0lmqjm93";
+    sha256 = "03m0ja11w9910z96yi8fzq3436y8xl14q031rdb2w3sapjd54qrj";
   };
 
   patches = [ ./disable_updates.patch ];
+  postPatch = ''
+    sed -i -e 's/CODE_SIGN_IDENTITY = "Developer ID Application"/CODE_SIGN_IDENTITY = ""/g' ./iTerm2.xcodeproj/project.pbxproj
+  '';
   makeFlagsArray = ["Deployment"];
   installPhase = ''
     mkdir -p "$out/Applications"

From 101cb04b6ae7be2fe7076223c104c725f9b74521 Mon Sep 17 00:00:00 2001
From: Joachim Fasting <joachifm@fastmail.fm>
Date: Sat, 25 Mar 2017 11:53:45 +0100
Subject: [PATCH 123/157] surf-webkit2: 2017-03-06 -> 2017-03-22

Fixes a race condition
---
 pkgs/applications/networking/browsers/surf/webkit2.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/applications/networking/browsers/surf/webkit2.nix b/pkgs/applications/networking/browsers/surf/webkit2.nix
index 4a7b3d44e797..929bf7dbcb2f 100644
--- a/pkgs/applications/networking/browsers/surf/webkit2.nix
+++ b/pkgs/applications/networking/browsers/surf/webkit2.nix
@@ -6,9 +6,9 @@
 
 let
   # http://git.suckless.org/surf/log/?h=surf-webkit2
-  rev = "37e43501d80710533f3ec0bd61ee84916c8524a4";
-  sha256 = "1q388rzm4irpaam4z8xycbyh5dgkjlar5jn1iw7zfls1pbpzr5br";
-  date = "2017-03-06";
+  rev = "7e02344a615a61246ccce1c7f770e88fbd57756e";
+  sha256 = "11f93fbjhl7nfgwkcc45lcm3x1wk5h87ap8fbw9w855021i57pp6";
+  date = "2017-03-22";
 in
 
 stdenv.mkDerivation rec {

From bb5d0f3ded60c144a986ec0ed968dc35e9a949ee Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Sat, 25 Mar 2017 11:20:37 +0100
Subject: [PATCH 124/157] gdm: the patch is still necessary

---
 pkgs/desktops/gnome-3/3.22/core/gdm/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/desktops/gnome-3/3.22/core/gdm/default.nix b/pkgs/desktops/gnome-3/3.22/core/gdm/default.nix
index 7ba3c3734f84..0d8e46aeeced 100644
--- a/pkgs/desktops/gnome-3/3.22/core/gdm/default.nix
+++ b/pkgs/desktops/gnome-3/3.22/core/gdm/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   # Disable Access Control because our X does not support FamilyServerInterpreted yet
-  patches = [ #./xserver_path.patch # gdm now uses wayland
+  patches = [ ./xserver_path.patch
               ./sessions_dir.patch
               ./gdm-x-session_extra_args.patch
               ./gdm-session-worker_xserver-path.patch

From a381ee89cda19dc074753cee2d2c940c657c958d Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Sun, 26 Feb 2017 13:23:45 +0300
Subject: [PATCH 125/157] zenity: fix for non-GNOME 3

---
 pkgs/desktops/gnome-3/3.22/core/zenity/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/desktops/gnome-3/3.22/core/zenity/default.nix b/pkgs/desktops/gnome-3/3.22/core/zenity/default.nix
index 8f525945a6af..80f2dde534ec 100644
--- a/pkgs/desktops/gnome-3/3.22/core/zenity/default.nix
+++ b/pkgs/desktops/gnome-3/3.22/core/zenity/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, cairo, libxml2, libxslt, gnome3, pango
-, gnome_doc_utils, intltool, libX11, which, itstool }:
+, gnome_doc_utils, intltool, libX11, which, itstool, wrapGAppsHook }:
 
 stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gnome3.gtk libxml2 libxslt libX11 itstool ];
 
-  nativeBuildInputs = [ pkgconfig intltool gnome_doc_utils which ];
+  nativeBuildInputs = [ pkgconfig intltool gnome_doc_utils which wrapGAppsHook ];
 
   meta = with stdenv.lib; {
     platforms = platforms.linux;

From 4f9e590c06feb71ee08920d3e17ac62fee7f1780 Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Sat, 25 Mar 2017 12:51:36 +0100
Subject: [PATCH 126/157] gitkraken: clean-up

---
 .../version-management/gitkraken/default.nix     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/pkgs/applications/version-management/gitkraken/default.nix b/pkgs/applications/version-management/gitkraken/default.nix
index 6cc84c9e0987..d17af6f5188b 100644
--- a/pkgs/applications/version-management/gitkraken/default.nix
+++ b/pkgs/applications/version-management/gitkraken/default.nix
@@ -1,7 +1,7 @@
-{stdenv, lib, libXcomposite, libgnome_keyring, makeWrapper, udev, curl, alsaLib
-  ,libXfixes, atk, gtk2, libXrender, pango, gnome2, cairo, freetype, fontconfig
-  ,libX11, libXi, libXext, libXcursor, glib, libXScrnSaver, libxkbfile, libXtst
-  ,nss, nspr, cups, fetchurl, expat, gdk_pixbuf, libXdamage, libXrandr, dbus
+{ stdenv, lib, libXcomposite, libgnome_keyring, makeWrapper, udev, curl, alsaLib
+, libXfixes, atk, gtk2, libXrender, pango, gnome2, cairo, freetype, fontconfig
+, libX11, libXi, libXext, libXcursor, glib, libXScrnSaver, libxkbfile, libXtst
+, nss, nspr, cups, fetchurl, expat, gdk_pixbuf, libXdamage, libXrandr, dbus
 }:
 
 with stdenv.lib;
@@ -49,14 +49,16 @@ stdenv.mkDerivation rec {
     libgnome_keyring
   ];
 
-  phases = [ "unpackPhase" "installPhase" ];
+  nativeBuildInputs = [ makeWrapper ];
 
-  buildInputs = [ makeWrapper ];
+  dontBuild = true;
 
   installPhase = ''
     mkdir -p "$out/opt/gitkraken"
     cp -r ./* "$out/opt/gitkraken"
-    fixupPhase
+  '';
+
+  postFixup = ''
     patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
              --set-rpath "$libPath:$out/opt/gitkraken" "$out/opt/gitkraken/gitkraken"
     wrapProgram $out/opt/gitkraken/gitkraken \

From f77de6d3dccd21b3a79bc96b4e809ea8c651baa4 Mon Sep 17 00:00:00 2001
From: zimbatm <zimbatm@zimbatm.com>
Date: Sat, 25 Mar 2017 12:31:46 +0000
Subject: [PATCH 127/157] arcanist: 20160825 -> 20170323

---
 pkgs/development/tools/misc/arcanist/default.nix | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/tools/misc/arcanist/default.nix b/pkgs/development/tools/misc/arcanist/default.nix
index 33b782098c5f..760ad521cef6 100644
--- a/pkgs/development/tools/misc/arcanist/default.nix
+++ b/pkgs/development/tools/misc/arcanist/default.nix
@@ -4,19 +4,19 @@ let
   libphutil = fetchFromGitHub {
     owner = "phacility";
     repo = "libphutil";
-    rev = "5fd1af8b4f2b9631e2ceb06bd88d21f2416123c2";
-    sha256 = "06zkfkgwni8prr3cnsbf1h4s30k4v00y8ll1bcl6282xynnh3gf6";
+    rev = "01b33af6f4d570b34ad791cd5ccaa3ea7f77dcb9";
+    sha256 = "0glrxlj4cr2821pdc2yy2m5bss4yr1zx3sdgw3r5d8hbfz361nx7";
   };
   arcanist = fetchFromGitHub {
     owner = "phacility";
     repo = "arcanist";
-    rev = "9e82ef979e8148c43b9b8439025d505b1219e213";
-    sha256 = "0h7ny8wr3cjn105gyzhd4qmhhccd0ilalslsdjj10nxxw2cgn193";
+    rev = "3b6b523c2b236e3724a1e115f126cb6fd05fa128";
+    sha256 = "1pr2izwj446rf2v6x6v2wsj7iwnaxq3xg3qqipybyf1xpqfmh5q8";
   };
 in
 stdenv.mkDerivation rec {
   name    = "arcanist-${version}";
-  version = "20160825";
+  version = "20170323";
 
   src = [ arcanist libphutil ];
   buildInputs = [ php makeWrapper flex ];

From 6b8ad8b581576d45996a17822e80e6be281dffd9 Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Sat, 25 Mar 2017 13:54:57 +0100
Subject: [PATCH 128/157] networkd: fix setting both defaultGateway{,6}

---
 .../tasks/network-interfaces-systemd.nix      | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix
index 8b85ff0057f9..a365a01bfb1e 100644
--- a/nixos/modules/tasks/network-interfaces-systemd.nix
+++ b/nixos/modules/tasks/network-interfaces-systemd.nix
@@ -59,15 +59,16 @@ in
     systemd.network =
       let
         domains = cfg.search ++ (optional (cfg.domain != null) cfg.domain);
-        genericNetwork = override: {
-          DHCP = override (dhcpStr cfg.useDHCP);
-        } // optionalAttrs (cfg.defaultGateway != null) {
-          gateway = override [ cfg.defaultGateway.address ];
-        } // optionalAttrs (cfg.defaultGateway6 != null) {
-          gateway = override [ cfg.defaultGateway6.address ];
-        } // optionalAttrs (domains != [ ]) {
-          domains = override domains;
-        };
+        genericNetwork = override:
+          let gateway = optional (cfg.defaultGateway != null) cfg.defaultGateway.address
+            ++ optional (cfg.defaultGateway6 != null) cfg.defaultGateway6.address;
+          in {
+            DHCP = override (dhcpStr cfg.useDHCP);
+          } // optionalAttrs (gateway != [ ]) {
+            gateway = override gateway;
+          } // optionalAttrs (domains != [ ]) {
+            domains = override domains;
+          };
       in mkMerge [ {
         enable = true;
         networks."99-main" = genericNetwork mkDefault;

From 417844b596007a3e7e4ffcdbc9d46090af81de9c Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Sat, 25 Mar 2017 15:34:05 +0300
Subject: [PATCH 129/157] phpfpm service: don't use private /tmp

This breaks local PostgreSQL connections.
---
 nixos/modules/services/web-servers/phpfpm/default.nix | 1 -
 1 file changed, 1 deletion(-)

diff --git a/nixos/modules/services/web-servers/phpfpm/default.nix b/nixos/modules/services/web-servers/phpfpm/default.nix
index efb721c5773f..26f546022035 100644
--- a/nixos/modules/services/web-servers/phpfpm/default.nix
+++ b/nixos/modules/services/web-servers/phpfpm/default.nix
@@ -147,7 +147,6 @@ in {
           cfgFile = fpmCfgFile pool poolConfig;
         in {
           Slice = "phpfpm.slice";
-          PrivateTmp = true;
           PrivateDevices = true;
           ProtectSystem = "full";
           ProtectHome = true;

From 10725a63290efe6738fff68d953339f2dc043377 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Sat, 25 Mar 2017 10:25:54 -0400
Subject: [PATCH 130/157] git: 2.12.0 -> 2.12.2

---
 .../version-management/git-and-tools/git/default.nix          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index d6cc205bbae4..e1e01c1ed287 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -11,7 +11,7 @@
 }:
 
 let
-  version = "2.12.0";
+  version = "2.12.2";
   svn = subversionClient.override { perlBindings = true; };
 in
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
-    sha256 = "09r0lcjj5v2apj39f0ziqzjq2bi1jpnhszc9q4n0ab86g5j7c88q";
+    sha256 = "0jlccxx7l4c76h830y8lhrxr4kqksrxqlnmj3xb8sqbfa0irw6nj";
   };
 
   hardeningDisable = [ "format" ];

From 97ca8d1105d678da9bc5ae482ce88cc44ac56bde Mon Sep 17 00:00:00 2001
From: rbasso <rbasso@sharpgeeks.net>
Date: Sat, 25 Mar 2017 23:38:55 +0900
Subject: [PATCH 131/157] exercism: 2.3.0 -> 2.4.0

---
 pkgs/applications/misc/exercism/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/misc/exercism/default.nix b/pkgs/applications/misc/exercism/default.nix
index 962d8f8b31f3..d0b98863d203 100644
--- a/pkgs/applications/misc/exercism/default.nix
+++ b/pkgs/applications/misc/exercism/default.nix
@@ -2,7 +2,7 @@
 
 buildGoPackage rec {
   name    = "exercism-${version}";
-  version = "2.3.0";
+  version = "2.4.0";
 
   goPackagePath = "github.com/exercism/cli";
 
@@ -10,7 +10,7 @@ buildGoPackage rec {
     owner  = "exercism";
     repo   = "cli";
     rev    = "v${version}";
-    sha256 = "1zhvvmsh5kw739kylk0bqj1wa6vjyahz43dlxdpv42h8gfiiksf5";
+    sha256 = "1hl13sr4ymqg9sjhkxdmhf8cfw69cic3bysw34xfv2j6bjjxfwaa";
   };
 
   meta = with stdenv.lib; {

From ecd0e1a2c736a9a609cd820de0cb2861129482c3 Mon Sep 17 00:00:00 2001
From: Joachim Fasting <joachifm@fastmail.fm>
Date: Sat, 25 Mar 2017 15:59:13 +0100
Subject: [PATCH 132/157] torbrowser: reduce risk of stale Nix store references

This patch restructures the expression and wrapper to minimize Nix store
references captured by the user's state directory.

The previous version would write lots of references to the Nix store into
the user's state directory, resulting in synchronization issues between
the Store and the local state directory.  At best, this would cause TBB to
stop working when the version used to instantiate the local state was
garbage collected; at worst, a user would continue to use the old version
even after an upgrade.

To solve the issue, hard-code as much as possible at the Store side and
minimize the amount of stuff being copied into the local state dir.
Currently, only a few files generated at firefox startup and fontconfig
cache files end up capturing store paths; these files are simply removed
upon every startup.  Otherwise, no capture should occur and the user
should always be using the TBB associated with the tor-browser wrapper
script.

To check for stale Store paths, do
   `grep -Ero '/nix/store/[^/]+' ~/.local/share/tor-browser`
This command should *never* return any other store path than the one
associated with the current tor-browser wrapper script, even after an
update (assuming you've run tor-browser at least once after updating).
Deviations from this general rule are considered bugs from now on.

Note that no attempt has been made to support pluggable transports; they
are still broken with this patch (to be fixed in a follow-up patch).

User visible changes:
- Wrapper retains only environment variables required for TBB to work
- pulseaudioSupport can be toggled independently of mediaSupport (the
  latter weakly implies the former).
- Store local state under $TBB_HOME.  Defaults to $XDG_DATA_HOME/tor-browser
- Stop obnoxious first-run stuff (NoScript redirect, in particular)
- Set desktop item GenericName to Web Browser

Some minor enhancements:
- Disable Hydra builds
- Specify system -> source mapping to make it easier to
  extend supported platforms.
---
 .../browsers/torbrowser/default.nix           | 301 ++++++++++++++++++
 pkgs/tools/security/tor/torbrowser.nix        | 103 ------
 pkgs/top-level/all-packages.nix               |   2 +-
 3 files changed, 302 insertions(+), 104 deletions(-)
 create mode 100644 pkgs/applications/networking/browsers/torbrowser/default.nix
 delete mode 100644 pkgs/tools/security/tor/torbrowser.nix

diff --git a/pkgs/applications/networking/browsers/torbrowser/default.nix b/pkgs/applications/networking/browsers/torbrowser/default.nix
new file mode 100644
index 000000000000..da051c227d23
--- /dev/null
+++ b/pkgs/applications/networking/browsers/torbrowser/default.nix
@@ -0,0 +1,301 @@
+{ stdenv
+, fetchurl
+, makeDesktopItem
+
+# Common run-time dependencies
+, zlib
+
+# libxul run-time dependencies
+, alsaLib
+, atk
+, cairo
+, dbus
+, dbus_glib
+, fontconfig
+, freetype
+, gdk_pixbuf
+, glib
+, gtk2
+, libX11
+, libXext
+, libXrender
+, libXt
+, pango
+
+# Pulseaudio support
+, pulseaudioSupport ? mediaSupport
+, libpulseaudio
+
+# Media support (implies pulseaudio support)
+, mediaSupport ? false
+, gstreamer
+, gst-plugins-base
+, gst-plugins-good
+, gst-ffmpeg
+, gmp
+, ffmpeg
+}:
+
+with stdenv.lib;
+
+let
+  libPath = makeLibraryPath ([
+    alsaLib
+    atk
+    cairo
+    dbus
+    dbus_glib
+    fontconfig
+    freetype
+    gdk_pixbuf
+    glib
+    gtk2
+    libX11
+    libXext
+    libXrender
+    libXt
+    pango
+    stdenv.cc.cc
+    zlib
+  ]
+  ++ optionals pulseaudioSupport [ libpulseaudio ]
+  ++ optionals mediaSupport [
+    gstreamer
+    gst-plugins-base
+    gmp
+    ffmpeg
+  ]);
+
+  gstPluginsPath = concatMapStringsSep ":" (x:
+    "${x}/lib/gstreamer-0.10") [
+      gstreamer
+      gst-plugins-base
+      gst-plugins-good
+      gst-ffmpeg
+    ];
+
+  # Upstream source
+  version = "6.5.1";
+
+  lang = "en-US";
+
+  srcs = {
+    "x86_64-linux" = fetchurl {
+      url = "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux64-${version}_${lang}.tar.xz";
+      sha256 = "1p2bgavvyzahqpjg9vp14c0s50rmha3v1hs1c8zvz6fj8fgrhn0i";
+    };
+
+    "i686-linux" = fetchurl {
+      url = "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux32-${version}_${lang}.tar.xz";
+      sha256 = "1zfghr01bhpn39wqaw7hyx7yap7xyla4m3mrgz2vi9a5qsyxmbcr";
+    };
+  };
+in
+
+stdenv.mkDerivation rec {
+  name = "tor-browser-${version}";
+  inherit version;
+
+  src = srcs."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");
+
+  preferLocalBuild = true;
+
+  desktopItem = makeDesktopItem {
+    name = "torbrowser";
+    exec = "tor-browser";
+    icon = "torbrowser";
+    desktopName = "Tor Browser";
+    genericName = "Web Browser";
+    comment = meta.description;
+    categories = "Network;WebBrowser;Security;";
+  };
+
+  buildCommand = ''
+    # For convenience ...
+    TBB_IN_STORE=$out/share/tor-browser
+    interp=$(< $NIX_CC/nix-support/dynamic-linker)
+
+    # Unpack & enter
+    mkdir -p "$TBB_IN_STORE"
+    tar xf "${src}" -C "$TBB_IN_STORE" --strip-components=2
+    pushd "$TBB_IN_STORE"
+
+    # Set ELF interpreter
+    for exe in firefox TorBrowser/Tor/tor ; do
+      patchelf --set-interpreter "$interp" "$exe"
+    done
+
+    # The final libPath.  Note, we could split this into firefoxLibPath
+    # and torLibPath for accuracy, but this is more convenient ...
+    libPath=${libPath}:$TBB_IN_STORE:$TBB_IN_STORE/TorBrowser/Tor
+
+    # Prepare for autoconfig.
+    #
+    # See https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment
+    cat >defaults/pref/autoconfig.js <<EOF
+    //
+    pref("general.config.filename", "mozilla.cfg");
+    pref("general.config.obscure_value", 0);
+    EOF
+
+    # Hard-coded Firefox preferences.
+    cat >mozilla.cfg <<EOF
+    // First line must be a comment
+
+    // Always update via Nix
+    lockPref("app.update.auto", false);
+    lockPref("app.update.enabled", false);
+    lockPref("extensions.update.autoUpdateDefault", false);
+    lockPref("extensions.update.enabled", false);
+
+    // User should never change these.  Locking prevents these
+    // values from being written to prefs.js, avoiding Store
+    // path capture.
+    lockPref("extensions.torlauncher.torrc-defaults_path", "$TBB_IN_STORE/TorBrowser/Data/Tor/torrc-defaults");
+    lockPref("extensions.torlauncher.tor_path", "$TBB_IN_STORE/TorBrowser/Tor/tor");
+
+    // Reset pref that captures store paths.
+    clearPref("extensions.xpiState");
+
+    // Stop obnoxious first-run redirection.
+    lockPref("noscript.firstRunRedirection", false);
+    EOF
+
+    # Hard-code path to TBB fonts; see also FONTCONFIG_FILE in
+    # the wrapper below.
+    FONTCONFIG_FILE=$TBB_IN_STORE/TorBrowser/Data/fontconfig/fonts.conf
+    sed -i "$FONTCONFIG_FILE" \
+        -e "s,<dir>fonts</dir>,<dir>$TBB_IN_STORE/fonts</dir>,"
+
+    # Move default extension overrides into distribution dir, to avoid
+    # having to synchronize between local state and store.
+    mv TorBrowser/Data/Browser/profile.default/preferences/extension-overrides.js defaults/pref/torbrowser.js
+
+    # Hard-code paths to geoip data files, to prevent them from being
+    # copied into the local state directory.
+    cat >>TorBrowser/Data/Tor/torrc-defaults <<EOF
+    GeoIPFile $TBB_IN_STORE/TorBrowser/Data/Tor/geoip
+    GeoIPv6File $TBB_IN_STORE/TorBrowser/Data/Tor/geoip6
+    EOF
+
+    # Generate wrapper
+    mkdir -p $out/bin
+    cat > "$out/bin/tor-browser" << EOF
+    #! ${stdenv.shell}
+    set -o errexit -o nounset
+
+    # Enter local state directory.
+    REAL_HOME=\$HOME
+    TBB_HOME=\''${TBB_HOME:-''${XDG_DATA_HOME:-\$REAL_HOME/.local/share}/tor-browser}
+    HOME=\$TBB_HOME
+
+    mkdir -p "\$HOME"
+    cd "\$HOME"
+
+    # Initialize empty TBB local state directory hierarchy.  We
+    # intentionally mirror the layout that TBB would see if executed from
+    # the unpacked bundle dir.
+    mkdir -p "\$HOME/TorBrowser" "\$HOME/TorBrowser/Data"
+
+    # Initialize the Tor data directory.
+    mkdir -p "\$HOME/TorBrowser/Data/Tor"
+
+    # Initialize the browser profile state.  Note that the only data
+    # copied from the Store payload is the initial bookmark file, which is
+    # never updated once created.  All other files under user's profile
+    # dir are generated by TBB.
+    mkdir -p "\$HOME/TorBrowser/Data/Browser/profile.default"
+    cp -u --no-preserve=mode,owner "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/bookmarks.html" \
+      "\$HOME/TorBrowser/Data/Browser/profile.default/bookmarks.html"
+
+    # Clear out some files that tend to capture store references but are
+    # easily generated by firefox at startup.
+    rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/{compatibility.ini,extensions.ini,extensions.json}
+
+    # Ensure that we're always using the up-to-date extensions.
+    ln -snf "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/extensions" \
+      "\$HOME/TorBrowser/Data/Browser/profile.default/extensions"
+
+    ${optionalString pulseaudioSupport ''
+      # Figure out some envvars for pulseaudio
+      : "\''${XDG_RUNTIME_DIR:=/run/user/\$(id -u)}"
+      : "\''${XDG_CONFIG_HOME:=\$REAL_HOME/.config}"
+      : "\''${PULSE_SERVER:=\$XDG_RUNTIME_DIR/pulse/native}"
+      : "\''${PULSE_COOKIE:=\$XDG_CONFIG_HOME/pulse/cookie}"
+    ''}
+
+    # Font cache files capture store paths; clear them out on the off
+    # chance that TBB would continue using old font files.
+    rm -rf "\$HOME/.cache/fontconfig"
+
+    # Lift-off
+    #
+    # XAUTHORITY and DISPLAY are required for TBB to work at all.
+    #
+    # DBUS_SESSION_BUS_ADDRESS is inherited to avoid auto-launch; to
+    # prevent that, set it to an empty/invalid value prior to running
+    # tor-browser.
+    #
+    # PULSE_SERVER is necessary for audio playback.
+    #
+    # Setting FONTCONFIG_FILE is required to make fontconfig read the TBB
+    # fonts.conf; upstream uses FONTCONFIG_PATH, but FC_DEBUG=1024
+    # indicates the system fonts.conf being used instead.
+    exec env -i \
+      HOME="\$HOME" \
+      XAUTHORITY="\$XAUTHORITY" \
+      DISPLAY="\$DISPLAY" \
+      DBUS_SESSION_BUS_ADDRESS="\$DBUS_SESSION_BUS_ADDRESS" \
+      \
+      PULSE_SERVER="\''${PULSE_SERVER:-}" \
+      PULSE_COOKIE="\''${PULSE_COOKIE:-}" \
+      \
+      GST_PLUGIN_SYSTEM_PATH="${optionalString mediaSupport gstPluginsPath}" \
+      GST_REGISTRY="/dev/null" \
+      GST_REGISTRY_UPDATE="no" \
+      \
+      FONTCONFIG_FILE="$FONTCONFIG_FILE" \
+      \
+      LD_LIBRARY_PATH="$libPath" \
+      \
+      "$TBB_IN_STORE/firefox" \
+        --class "Tor Browser" \
+        -no-remote \
+        -profile "\$HOME/TorBrowser/Data/Browser/profile.default" \
+        "\''${@}"
+    EOF
+    chmod +x $out/bin/tor-browser
+
+    # Easier access to docs
+    mkdir -p $out/share/doc
+    ln -s $TBB_IN_STORE/TorBrowser/Docs $out/share/doc/tor-browser
+
+    # Install .desktop item
+    mkdir -p $out/share/applications
+    cp $desktopItem/share/applications"/"* $out/share/applications
+
+    # Install icons
+    mkdir -p $out/share/pixmaps
+    cp browser/icons/mozicon128.png $out/share/pixmaps/torbrowser.png
+
+    # Check installed apps
+    echo "Checking bundled Tor ..."
+    LD_LIBRARY_PATH=$libPath $TBB_IN_STORE/TorBrowser/Tor/tor --version >/dev/null
+
+    echo "Checking tor-browser wrapper ..."
+    DISPLAY="" XAUTHORITY="" DBUS_SESSION_BUS_ADDRESS="" TBB_HOME=$(mktemp -d) \
+      $out/bin/tor-browser --version >/dev/null
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Tor Browser Bundle";
+    homepage = https://www.torproject.org/;
+    platforms = attrNames srcs;
+    maintainers = with maintainers; [ offline matejc doublec thoughtpolice joachifm ];
+    hydraPlatforms = [];
+    # MPL2.0+, GPL+, &c.  While it's not entirely clear whether
+    # the compound is "libre" in a strict sense (some components place certain
+    # restrictions on redistribution), it's free enough for our purposes.
+    license = licenses.free;
+  };
+}
diff --git a/pkgs/tools/security/tor/torbrowser.nix b/pkgs/tools/security/tor/torbrowser.nix
deleted file mode 100644
index 80a92b4a932e..000000000000
--- a/pkgs/tools/security/tor/torbrowser.nix
+++ /dev/null
@@ -1,103 +0,0 @@
-{ stdenv, fetchurl, makeDesktopItem
-, libXrender, libX11, libXext, libXt, alsaLib, dbus, dbus_glib, glib, gtk2
-, atk, pango, freetype, fontconfig, gdk_pixbuf, cairo, zlib
-, gstreamer, gst-plugins-base, gst-plugins-good, gst-ffmpeg, gmp, ffmpeg
-, libpulseaudio
-, mediaSupport ? false
-}:
-
-let
-  libPath = stdenv.lib.makeLibraryPath ([
-    stdenv.cc.cc zlib glib alsaLib dbus dbus_glib gtk2 atk pango freetype
-    fontconfig gdk_pixbuf cairo libXrender libX11 libXext libXt
-  ] ++ stdenv.lib.optionals mediaSupport [
-    gstreamer gst-plugins-base gmp ffmpeg
-    libpulseaudio
-  ]);
-
-  # Ignored if !mediaSupport
-  gstPlugins = [ gstreamer gst-plugins-base gst-plugins-good gst-ffmpeg ];
-
-  gstPluginsPath = stdenv.lib.concatMapStringsSep ":" (x:
-    "${x}/lib/gstreamer-0.10") gstPlugins;
-in
-
-stdenv.mkDerivation rec {
-  name = "tor-browser-${version}";
-  version = "6.5.1";
-
-  src = fetchurl {
-    url = "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux${if stdenv.is64bit then "64" else "32"}-${version}_en-US.tar.xz";
-    sha256 = if stdenv.is64bit then
-      "1p2bgavvyzahqpjg9vp14c0s50rmha3v1hs1c8zvz6fj8fgrhn0i" else
-      "1zfghr01bhpn39wqaw7hyx7yap7xyla4m3mrgz2vi9a5qsyxmbcr";
-  };
-
-  preferLocalBuild = true;
-
-  desktopItem = makeDesktopItem {
-    name = "torbrowser";
-    exec = "tor-browser";
-    icon = "torbrowser";
-    desktopName = "Tor Browser";
-    genericName = "Tor Browser";
-    comment = meta.description;
-    categories = "Network;WebBrowser;Security;";
-  };
-
-  patchPhase = ''
-    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" Browser/firefox
-    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" Browser/TorBrowser/Tor/tor
-
-    sed -e "s,./TorBrowser,$out/share/tor-browser/Browser/TorBrowser,g" -i Browser/TorBrowser/Data/Tor/torrc-defaults
-  '';
-
-  doCheck = true;
-  checkPhase = ''
-    echo "Checking firefox..."
-    LD_LIBRARY_PATH=${libPath} Browser/firefox --help 1> /dev/null
-    echo "Checking tor..."
-    LD_LIBRARY_PATH=${libPath}:Browser/TorBrowser/Tor Browser/TorBrowser/Tor/tor --help 1> /dev/null
-  '';
-
-  installPhase = ''
-    mkdir -p $out/share/tor-browser
-    mkdir -p $out/bin
-    cp -R * $out/share/tor-browser
-
-    cat > "$out/bin/tor-browser" << EOF
-    #! ${stdenv.shell}
-    unset SESSION_MANAGER
-    export HOME="\$HOME/.torbrowser4"
-    if [ ! -d \$HOME ]; then
-      mkdir -p \$HOME && cp -R $out/share/tor-browser/Browser/TorBrowser/Data \$HOME/ && chmod -R +w \$HOME
-      echo "pref(\"extensions.torlauncher.tordatadir_path\", \"\$HOME/Data/Tor/\");" >> \
-        ~/Data/Browser/profile.default/preferences/extension-overrides.js
-      echo "pref(\"extensions.torlauncher.torrc-defaults_path\", \"\$HOME/Data/Tor/torrc-defaults\");" >> \
-        ~/Data/Browser/profile.default/preferences/extension-overrides.js
-      echo "pref(\"extensions.torlauncher.tor_path\", \"$out/share/tor-browser/Browser/TorBrowser/Tor/tor\");" >> \
-        ~/Data/Browser/profile.default/preferences/extension-overrides.js
-    fi
-    export FONTCONFIG_PATH=\$HOME/Data/fontconfig
-    export LD_LIBRARY_PATH=${libPath}:$out/share/tor-browser/Browser/TorBrowser/Tor
-    ${stdenv.lib.optionalString mediaSupport ''
-      export GST_PLUGIN_SYSTEM_PATH=${gstPluginsPath}
-    ''}
-    exec $out/share/tor-browser/Browser/firefox --class "Tor Browser" -no-remote -profile ~/Data/Browser/profile.default "\$@"
-    EOF
-    chmod +x $out/bin/tor-browser
-
-    mkdir -p $out/share/applications
-    cp $desktopItem/share/applications"/"* $out/share/applications
-
-    mkdir -p $out/share/pixmaps
-    cp Browser/browser/icons/mozicon128.png $out/share/pixmaps/torbrowser.png
-  '';
-
-  meta = with stdenv.lib; {
-    description = "Tor Browser Bundle";
-    homepage    = https://www.torproject.org/;
-    platforms   = platforms.linux;
-    maintainers = with maintainers; [ offline matejc doublec thoughtpolice joachifm ];
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 217137c210f2..7970732ce3f6 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4189,7 +4189,7 @@ with pkgs;
 
   tor-arm = callPackage ../tools/security/tor/tor-arm.nix { };
 
-  torbrowser = callPackage ../tools/security/tor/torbrowser.nix { };
+  torbrowser = callPackage ../applications/networking/browsers/torbrowser { };
 
   touchegg = callPackage ../tools/inputmethods/touchegg { };
 

From c0d9bce6f79b1840dbac41e707c6115dcb84bb49 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Sat, 25 Mar 2017 11:04:41 -0400
Subject: [PATCH 133/157] kotlin: 1.1 -> 1.1.1.

---
 pkgs/development/compilers/kotlin/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/compilers/kotlin/default.nix b/pkgs/development/compilers/kotlin/default.nix
index 33921ef02cd7..508ac254f0ac 100644
--- a/pkgs/development/compilers/kotlin/default.nix
+++ b/pkgs/development/compilers/kotlin/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, makeWrapper, jre, unzip }:
 
 stdenv.mkDerivation rec {
-  version = "1.1";
+  version = "1.1.1";
   name = "kotlin-${version}";
 
   src = fetchurl {
     url = "https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-compiler-${version}.zip";
-    sha256 = "179m5y56fi50qvxsm075h0547swib7n2pfdn8a4axk9wpwldni5a";
+    sha256 = "1c96l1bkll0l8c82cfzmph0z38f96r3x68zmggq4s8hhdqgwk8mc";
   };
 
   propagatedBuildInputs = [ jre ] ;

From 55d21cad95cf325e42c0919d1ed8a290d9207f4d Mon Sep 17 00:00:00 2001
From: Willi Butz <wbutz@cyberfnord.de>
Date: Sat, 25 Mar 2017 15:54:24 +0100
Subject: [PATCH 134/157] manticore: fix build, remove builder.sh (see #23253)

---
 .../compilers/manticore/builder.sh            | 24 ---------------
 .../compilers/manticore/default.nix           | 29 ++++++++++++++-----
 2 files changed, 22 insertions(+), 31 deletions(-)
 delete mode 100755 pkgs/development/compilers/manticore/builder.sh

diff --git a/pkgs/development/compilers/manticore/builder.sh b/pkgs/development/compilers/manticore/builder.sh
deleted file mode 100755
index ad72f50a1b31..000000000000
--- a/pkgs/development/compilers/manticore/builder.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!@shell@
-
-source $stdenv/setup
-echo "Building Manticore research compiler."
-set -xe
-
-PATH=$smlnj/bin:$PATH
-
-mkdir -p $out/bin
-
-# Manticore seems to use the MLB files from the build tree,
-# so for now we copy the whole build tree into the store:
-cd $out/
-tar xf $src
-mv manticore* repo_checkout
-cd repo_checkout/
-# TODO: At the very least, this could probably be cut down to a subset
-# of the repo.
-
-${autoconf}/bin/autoheader -Iconfig
-${autoconf}/bin/autoconf -Iconfig
-./configure --prefix=$out
-make build -j
-make install
diff --git a/pkgs/development/compilers/manticore/default.nix b/pkgs/development/compilers/manticore/default.nix
index 7e8312549da9..d068d744f203 100644
--- a/pkgs/development/compilers/manticore/default.nix
+++ b/pkgs/development/compilers/manticore/default.nix
@@ -1,14 +1,29 @@
-{ stdenv, fetchurl, coreutils, autoconf, automake, smlnj }:
+{ stdenv, fetchFromGitHub, coreutils, autoreconfHook, smlnj }:
 
-stdenv.mkDerivation rec {
+let
+    rev = "592a5714595b4448b646a7d49df04c285668c2f8";
+in stdenv.mkDerivation rec {
   name = "manticore-${version}";
   version = "2014.08.18";
-  builder = ./builder.sh;
-  src = fetchurl {
-    url = https://github.com/rrnewton/manticore_temp_mirror/archive/snapshot-20140818.tar.gz; 
-    sha256 = "1x52xpj5gbcpqjqm6aw6ssn901f353zypj3d5scm8i3ad777y29d";
+ 
+  src = fetchFromGitHub {
+    owner = "rrnewton";
+    repo = "manticore_temp_mirror";
+    sha256 = "1snwlm9a31wfgvzb80y7r7yvc6n0k0bi675lqwzll95as7cdswwi";
+    inherit rev;
   };
-  inherit stdenv coreutils autoconf automake smlnj;
+
+  enableParallelBuilding = false;
+ 
+  nativeBuildInputs = [ autoreconfHook ];
+  
+  buildInputs = [ coreutils smlnj ];
+
+  autoreconfFlags = "-Iconfig -vfi";
+
+  postPatch = "patchShebangs .";
+
+  preInstall = "mkdir -p $out/bin";
 
   meta = {
     description = "A parallel, pure variant of Standard ML";

From f087b7594150998652f6b7945b0ca86bceba9e79 Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Sat, 25 Mar 2017 11:13:25 -0400
Subject: [PATCH 135/157] nix-buffer support: Make process-environment changes
 actually local

---
 pkgs/build-support/emacs/buffer.nix | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pkgs/build-support/emacs/buffer.nix b/pkgs/build-support/emacs/buffer.nix
index 1cbac0709a66..6c5e0570fd0d 100644
--- a/pkgs/build-support/emacs/buffer.nix
+++ b/pkgs/build-support/emacs/buffer.nix
@@ -39,6 +39,8 @@
       (make-local-variable 'process-environment)
       (put 'process-environment 'permanent-local t)
       (inherit-local 'process-environment)
+      ; setenv modifies in place, so copy the environment first
+      (setq process-environment (copy-tree process-environment))
       (setenv "PATH" (concat "${lib.makeSearchPath "bin" pkgs}:" (getenv "PATH")))
       (inherit-local-permanent exec-path (append '(${builtins.concatStringsSep " " (map (p: "\"${p}/bin\"") pkgs)}) exec-path))
 

From dc10688edbfabe516a708e6dc2341fb5cfc2d3ad Mon Sep 17 00:00:00 2001
From: Richard Zetterberg <rzetterberg@users.noreply.github.com>
Date: Sat, 25 Mar 2017 16:34:02 +0100
Subject: [PATCH 136/157] nftables: adds information regarding nftables and
 Docker (#24326)

---
 nixos/modules/services/networking/nftables.nix | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/nixos/modules/services/networking/nftables.nix b/nixos/modules/services/networking/nftables.nix
index 029c3df89932..56b942054140 100644
--- a/nixos/modules/services/networking/nftables.nix
+++ b/nixos/modules/services/networking/nftables.nix
@@ -17,6 +17,17 @@ in
 
           This conflicts with the standard networking firewall, so make sure to
           disable it before using nftables.
+
+          Note that if you have Docker enabled you will not be able to use
+          nftables without intervention. Docker uses iptables internally to
+          setup NAT for containers. This module disables the ip_tables kernel
+          module, however Docker automatically loads the module. Please see [1]
+          for more information.
+
+          There are other programs that use iptables internally too, such as
+          libvirt.
+
+          [1]: https://github.com/NixOS/nixpkgs/issues/24318#issuecomment-289216273
         '';
     };
     networking.nftables.ruleset = mkOption {

From 65593e64c480493555ae21050a422e4c7ff9c7ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cillian=20de=20R=C3=B3iste?= <cillian.deroiste@gmail.com>
Date: Sat, 25 Mar 2017 16:49:29 +0100
Subject: [PATCH 137/157] drumgizmo: 0.9.11 -> 0.9.12

---
 pkgs/applications/audio/drumgizmo/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/audio/drumgizmo/default.nix b/pkgs/applications/audio/drumgizmo/default.nix
index eaf02bd2689e..a52301c34d7d 100644
--- a/pkgs/applications/audio/drumgizmo/default.nix
+++ b/pkgs/applications/audio/drumgizmo/default.nix
@@ -3,12 +3,12 @@
 }:
 
 stdenv.mkDerivation rec {
-  version = "0.9.11";
+  version = "0.9.12";
   name = "drumgizmo-${version}";
 
   src = fetchurl {
     url = "http://www.drumgizmo.org/releases/${name}/${name}.tar.gz";
-    sha256 = "04hf3nhccwr98n2081rrvfccz50nly6k3gbk9zxccp1522qz5xvf";
+    sha256 = "0kqrss9v3vpznmh4jgi3783wmprr645s3i485jlvdscpysjfkh6z";
   };
 
   configureFlags = [ "--enable-lv2" ];

From e3938c8e318b3ba76be735e0eb1652b640fb8d65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cillian=20de=20R=C3=B3iste?= <cillian.deroiste@gmail.com>
Date: Sat, 25 Mar 2017 17:04:44 +0100
Subject: [PATCH 138/157] drumkv1: 0.8.0 -> 0.8.1

---
 pkgs/applications/audio/drumkv1/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/audio/drumkv1/default.nix b/pkgs/applications/audio/drumkv1/default.nix
index 0a2e293d90be..064feeb02a39 100644
--- a/pkgs/applications/audio/drumkv1/default.nix
+++ b/pkgs/applications/audio/drumkv1/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "drumkv1-${version}";
-  version = "0.8.0";
+  version = "0.8.1";
 
   src = fetchurl {
     url = "mirror://sourceforge/drumkv1/${name}.tar.gz";
-    sha256 = "1n2kd468kn71yp2asmamprvblmdlvh0zd8lsh3598dwi4b7aa3ga";
+    sha256 = "0l6kjb1q9vslwy56836a0c65mf8z8ycam5vzz3k4qvd8g74bs1zq";
   };
 
   buildInputs = [ libjack2 alsaLib libsndfile liblo lv2 qt5.qtbase qt5.qttools ];

From 5861b8b1c9f8a0e394ae83d96ef99a9f10f4f0f0 Mon Sep 17 00:00:00 2001
From: Christine Koppelt <cko@users.noreply.github.com>
Date: Sat, 25 Mar 2017 17:29:02 +0100
Subject: [PATCH 139/157] nodejs-4_x: 4.6.0 -> 4.8.1

---
 pkgs/development/web/nodejs/v4.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/web/nodejs/v4.nix b/pkgs/development/web/nodejs/v4.nix
index 9a142a89677f..edef6f7663cc 100644
--- a/pkgs/development/web/nodejs/v4.nix
+++ b/pkgs/development/web/nodejs/v4.nix
@@ -10,11 +10,11 @@ let
   baseName = if enableNpm then "nodejs" else "nodejs-slim";
 in
   stdenv.mkDerivation (nodejs // rec {
-    version = "4.6.2";
+    version = "4.8.1";
     name = "${baseName}-${version}";
     src = fetchurl {
       url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.xz";
-      sha256 = "17ick2r2biyxs5zf83i8q8844fbcphm0d5g1z70mcrb86yrmi545";
+      sha256 = "0kcalypjf1036gr4mv1gy682hc1rp18ms3cv7mz0941qnizkzrms";
     };
 
   })

From 53dde421533d96de8c8c72c9d756042de800fd6b Mon Sep 17 00:00:00 2001
From: Willi Butz <wbutz@cyberfnord.de>
Date: Sat, 25 Mar 2017 19:43:42 +0100
Subject: [PATCH 140/157] manticore: fix compiling pml sources

Compiler depends on sources that weren't present in the output.
---
 pkgs/development/compilers/manticore/default.nix | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/pkgs/development/compilers/manticore/default.nix b/pkgs/development/compilers/manticore/default.nix
index d068d744f203..795830e0e707 100644
--- a/pkgs/development/compilers/manticore/default.nix
+++ b/pkgs/development/compilers/manticore/default.nix
@@ -21,7 +21,19 @@ in stdenv.mkDerivation rec {
 
   autoreconfFlags = "-Iconfig -vfi";
 
-  postPatch = "patchShebangs .";
+  unpackPhase = ''
+    mkdir -p $out
+    cd $out
+    unpackFile $src
+    mv manticore_temp_mirror-${rev}-src repo_checkout
+    cd repo_checkout
+    chmod u+w . -R
+  ''; 
+  
+  postPatch = ''
+    patchShebangs .
+    substituteInPlace configure.ac --replace 'MANTICORE_ROOT=`pwd`' 'MANTICORE_ROOT=$out/repo_checkout'
+  '';
 
   preInstall = "mkdir -p $out/bin";
 

From e5c927cb8de8a78cd2ed4ad1bf41ccbfef1dcfce Mon Sep 17 00:00:00 2001
From: Christine Koppelt <cko@users.noreply.github.com>
Date: Sat, 25 Mar 2017 20:14:04 +0100
Subject: [PATCH 141/157] NixOS Manual: Update version numbers

---
 nixos/doc/manual/development/sources.xml    | 14 ++++++-------
 nixos/doc/manual/installation/upgrading.xml | 22 ++++++++++-----------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/nixos/doc/manual/development/sources.xml b/nixos/doc/manual/development/sources.xml
index 7cd5ce0002c2..0b2528e9a779 100644
--- a/nixos/doc/manual/development/sources.xml
+++ b/nixos/doc/manual/development/sources.xml
@@ -27,8 +27,8 @@ a subdirectory of the Nixpkgs repository.) The remote
 <literal>channels</literal> refers to a read-only repository that
 tracks the Nixpkgs/NixOS channels (see <xref linkend="sec-upgrading"/>
 for more information about channels). Thus, the Git branch
-<literal>channels/nixos-14.12</literal> will contain the latest built
-and tested version available in the <literal>nixos-14.12</literal>
+<literal>channels/nixos-17.03</literal> will contain the latest built
+and tested version available in the <literal>nixos-17.03</literal>
 channel.</para>
 
 <para>It’s often inconvenient to develop directly on the master
@@ -39,9 +39,9 @@ branch based on your current NixOS version:
 
 <screen>
 $ nixos-version
-14.04.273.ea1952b (Baboon)
+17.09pre104379.6e0b727 (Hummingbird)
 
-$ git checkout -b local ea1952b
+$ git checkout -b local e3938c8
 </screen>
 
 Or, to base your local branch on the latest version available in a
@@ -49,17 +49,17 @@ NixOS channel:
 
 <screen>
 $ git remote update channels
-$ git checkout -b local channels/nixos-14.12
+$ git checkout -b local channels/nixos-17.03
 </screen>
 
-(Replace <literal>nixos-14.12</literal> with the name of the channel
+(Replace <literal>nixos-17.03</literal> with the name of the channel
 you want to use.) You can use <command>git merge</command> or
 <command>git rebase</command> to keep your local branch in sync with
 the channel, e.g.
 
 <screen>
 $ git remote update channels
-$ git merge channels/nixos-14.12
+$ git merge channels/nixos-17.03
 </screen>
 
 You can use <command>git cherry-pick</command> to copy commits from
diff --git a/nixos/doc/manual/installation/upgrading.xml b/nixos/doc/manual/installation/upgrading.xml
index c974523f886c..aee6523345c4 100644
--- a/nixos/doc/manual/installation/upgrading.xml
+++ b/nixos/doc/manual/installation/upgrading.xml
@@ -15,12 +15,12 @@ been built.  These channels are:
 <itemizedlist>
   <listitem>
     <para><emphasis>Stable channels</emphasis>, such as <literal
-    xlink:href="https://nixos.org/channels/nixos-14.12">nixos-14.12</literal>.
+    xlink:href="https://nixos.org/channels/nixos-17.03">nixos-17.03</literal>.
     These only get conservative bug fixes and package upgrades.  For
     instance, a channel update may cause the Linux kernel on your
-    system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but
-    not from 3.4.<replaceable>x</replaceable> to
-    3.11.<replaceable>x</replaceable> (a major change that has the
+    system to be upgraded from 4.9.16 to 4.9.17 (a minor bug fix), but
+    not from 4.9.<replaceable>x</replaceable> to
+    4.11.<replaceable>x</replaceable> (a major change that has the
     potential to break things).  Stable channels are generally
     maintained until the next stable branch is created.</para>
     <para></para>
@@ -34,7 +34,7 @@ been built.  These channels are:
   </listitem>
   <listitem>
     <para><emphasis>Small channels</emphasis>, such as <literal
-    xlink:href="https://nixos.org/channels/nixos-14.12-small">nixos-14.12-small</literal>
+    xlink:href="https://nixos.org/channels/nixos-17.03-small">nixos-17.03-small</literal>
     or <literal
     xlink:href="https://nixos.org/channels/nixos-unstable-small">nixos-unstable-small</literal>. These
     are identical to the stable and unstable channels described above,
@@ -55,8 +55,8 @@ appliances.)</para>
 
 <para>When you first install NixOS, you’re automatically subscribed to
 the NixOS channel that corresponds to your installation source.   For
-instance, if you installed from a 14.12 ISO, you will be subscribed to
-the <literal>nixos-14.12</literal> channel.  To see which NixOS
+instance, if you installed from a 17.03 ISO, you will be subscribed to
+the <literal>nixos-17.03</literal> channel.  To see which NixOS
 channel you’re subscribed to, run the following as root:
 
 <screen>
@@ -71,16 +71,16 @@ To switch to a different NixOS channel, do
 </screen>
 
 (Be sure to include the <literal>nixos</literal> parameter at the
-end.)  For instance, to use the NixOS 14.12 stable channel:
+end.)  For instance, to use the NixOS 17.03 stable channel:
 
 <screen>
-# nix-channel --add https://nixos.org/channels/nixos-14.12 nixos
+# nix-channel --add https://nixos.org/channels/nixos-17.03 nixos
 </screen>
 
 If you have a server, you may want to use the “small” channel instead:
 
 <screen>
-# nix-channel --add https://nixos.org/channels/nixos-14.12-small nixos
+# nix-channel --add https://nixos.org/channels/nixos-17.03-small nixos
 </screen>
 
 And if you want to live on the bleeding edge:
@@ -130,7 +130,7 @@ runs, see <command>systemctl list-timers</command>.)  You can also
 specify a channel explicitly, e.g.
 
 <programlisting>
-system.autoUpgrade.channel = https://nixos.org/channels/nixos-15.09;
+system.autoUpgrade.channel = https://nixos.org/channels/nixos-17.03;
 </programlisting>
 
 </para>

From a616f4ec9b7bccc04f78e10c685346170ae56a8f Mon Sep 17 00:00:00 2001
From: uwap <me@uwap.name>
Date: Sat, 25 Mar 2017 20:14:12 +0100
Subject: [PATCH 142/157] prosody: 0.9.10 -> 0.9.12 (#24269)

---
 pkgs/servers/xmpp/prosody/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/servers/xmpp/prosody/default.nix b/pkgs/servers/xmpp/prosody/default.nix
index f32e6d684526..3285456a3485 100644
--- a/pkgs/servers/xmpp/prosody/default.nix
+++ b/pkgs/servers/xmpp/prosody/default.nix
@@ -19,12 +19,12 @@ let
 in
 
 stdenv.mkDerivation rec {
-  version = "0.9.10";
+  version = "0.9.12";
   name = "prosody-${version}";
 
   src = fetchurl {
     url = "http://prosody.im/downloads/source/${name}.tar.gz";
-    sha256 = "0bv6s5c0iizz015hh1lxlwlw1iwvisywajm2rcrbdfyrskzfwdj8";
+    sha256 = "139yxqpinajl32ryrybvilh54ddb1q6s0ajjhlcs4a0rnwia6n8s";
   };
 
   communityModules = fetchhg {

From b00cfd49d50d46c6e8ae5257cbd98c11ba543df3 Mon Sep 17 00:00:00 2001
From: Franz Pletz <fpletz@fnordicwalking.de>
Date: Sat, 25 Mar 2017 20:44:16 +0100
Subject: [PATCH 143/157] irssi: 1.0.1 -> 1.0.2 for CVE-2017-7191

See https://irssi.org/security/irssi_sa_2017_03.txt.
---
 pkgs/applications/networking/irc/irssi/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/networking/irc/irssi/default.nix b/pkgs/applications/networking/irc/irssi/default.nix
index d46539a88b7d..7ab6a4438f3e 100644
--- a/pkgs/applications/networking/irc/irssi/default.nix
+++ b/pkgs/applications/networking/irc/irssi/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, pkgconfig, ncurses, glib, openssl, perl, libintlOrEmpty }:
 
 stdenv.mkDerivation rec {
-  version = "1.0.1";
+  version = "1.0.2";
   name = "irssi-${version}";
 
   src = fetchurl {
     url = "https://github.com/irssi/irssi/releases/download/${version}/${name}.tar.gz";
-    sha256 = "1nqrm376bipvh4x483vygydjzs05n4fmfzip1gfakq1vfqqfhshr";
+    sha256 = "1fas6dqz6g8m2400spvkhfxihj3w06qb917h4vhcb716g9wpjkwf";
   };
 
   nativeBuildInputs = [ pkgconfig ];

From 7b706900e7dd3ec55eb46a366f0bc47858fb7633 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Sat, 25 Mar 2017 21:03:46 +0100
Subject: [PATCH 144/157] graphicsmagick: patch for CVE-2017-6335

---
 .../graphicsmagick/cmyka-bounds.patch         | 36 +++++++++++++++++++
 .../graphics/graphicsmagick/default.nix       |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 pkgs/applications/graphics/graphicsmagick/cmyka-bounds.patch

diff --git a/pkgs/applications/graphics/graphicsmagick/cmyka-bounds.patch b/pkgs/applications/graphics/graphicsmagick/cmyka-bounds.patch
new file mode 100644
index 000000000000..dd375143277a
--- /dev/null
+++ b/pkgs/applications/graphics/graphicsmagick/cmyka-bounds.patch
@@ -0,0 +1,36 @@
+# HG changeset patch
+# User Bob Friesenhahn <bfriesen@GraphicsMagick.org>
+# Date 1487905610 21600
+# Node ID 6156b4c2992d855ece6079653b3b93c3229fc4b8
+# Parent  0392c4305a4369984ec8069055acc470c0a73647
+Fix out of bounds access when reading CMYKA tiff which claims wrong samples/pixel.
+
+diff -r 0392c4305a43 -r 6156b4c2992d coders/tiff.c
+--- a/coders/tiff.c	Sun Jan 29 10:04:57 2017 -0600
++++ b/coders/tiff.c	Thu Feb 23 21:06:50 2017 -0600
+@@ -1230,8 +1230,8 @@
+                   case 0:
+                     if (samples_per_pixel == 1)
+                       *quantum_type=GrayQuantum;
+-                      else
+-                        *quantum_type=RedQuantum;
++                    else
++                      *quantum_type=RedQuantum;
+                     break;
+                   case 1:
+                     *quantum_type=GreenQuantum;
+@@ -1411,12 +1411,12 @@
+               }
+             else
+               {
+-                if (image->matte)
++                if (image->matte && samples_per_pixel >= 5)
+                   {
+                     *quantum_type=CMYKAQuantum;
+                     *quantum_samples=5;
+                   }
+-                else
++                else if (samples_per_pixel >= 4)
+                   {
+                     *quantum_type=CMYKQuantum;
+                     *quantum_samples=4;
diff --git a/pkgs/applications/graphics/graphicsmagick/default.nix b/pkgs/applications/graphics/graphicsmagick/default.nix
index f655979c2ccc..0858dfba8b40 100644
--- a/pkgs/applications/graphics/graphicsmagick/default.nix
+++ b/pkgs/applications/graphics/graphicsmagick/default.nix
@@ -42,6 +42,7 @@ stdenv.mkDerivation {
       url = "https://sources.debian.net/data/main/g/graphicsmagick/1.3.25-7/debian/patches/CVE-2016-9830.patch";
       sha256 = "0qh15sd7nx7vf9sld4453iml951bwsx2fx84hxc7plhds2k3gjpa";
     })
+    ./cmyka-bounds.patch
   ];
 
   configureFlags = [

From 958668ab80552f0cc864b5ea72b22a22f4935e1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= <ed@cflags.cc>
Date: Sat, 25 Mar 2017 21:18:34 +0100
Subject: [PATCH 145/157] nixos, openafs-client: correct serviceConfig

---
 .../services/network-filesystems/openafs-client/default.nix      | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nixos/modules/services/network-filesystems/openafs-client/default.nix b/nixos/modules/services/network-filesystems/openafs-client/default.nix
index 6f51e287910a..f7c58c928633 100644
--- a/nixos/modules/services/network-filesystems/openafs-client/default.nix
+++ b/nixos/modules/services/network-filesystems/openafs-client/default.nix
@@ -76,6 +76,7 @@ in
       description = "AFS client";
       wantedBy = [ "multi-user.target" ];
       after = [ "network.target" ];
+      serviceConfig = { RemainAfterExit = true; };
 
       preStart = ''
         mkdir -p -m 0755 /afs

From 2db5c5cfe2aa4700dba8daef75e2e9f8e148c01e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= <ed@cflags.cc>
Date: Sat, 25 Mar 2017 21:18:34 +0100
Subject: [PATCH 146/157] jackett: init at 0.7.1197 + nixos module

---
 nixos/modules/module-list.nix           |  1 +
 nixos/modules/services/misc/jackett.nix | 44 +++++++++++++++++++++++++
 pkgs/servers/jackett/default.nix        | 30 +++++++++++++++++
 pkgs/top-level/all-packages.nix         |  2 ++
 4 files changed, 77 insertions(+)
 create mode 100644 nixos/modules/services/misc/jackett.nix
 create mode 100644 pkgs/servers/jackett/default.nix

diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 610c2a2b758a..145cf140847b 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -275,6 +275,7 @@
   ./services/misc/gpsd.nix
   #./services/misc/ihaskell.nix
   ./services/misc/irkerd.nix
+  ./services/misc/jackett.nix
   ./services/misc/leaps.nix
   ./services/misc/mantisbt.nix
   ./services/misc/mathics.nix
diff --git a/nixos/modules/services/misc/jackett.nix b/nixos/modules/services/misc/jackett.nix
new file mode 100644
index 000000000000..e467e7ee85b8
--- /dev/null
+++ b/nixos/modules/services/misc/jackett.nix
@@ -0,0 +1,44 @@
+{ config, pkgs, lib, mono, ... }:
+
+with lib;
+
+let
+  cfg = config.services.jackett;
+in
+{
+  options = {
+    services.jackett = {
+      enable = mkEnableOption "Jackett";
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.services.jackett = {
+      description = "Jackett";
+      after = [ "network.target" ];
+      wantedBy = [ "multi-user.target" ];
+      preStart = ''
+        test -d /var/lib/jackett/ || {
+          echo "Creating jackett data directory in /var/lib/jackett/"
+          mkdir -p /var/lib/jackett/
+        }
+        chown -R jackett /var/lib/jackett/
+        chmod 0700 /var/lib/jackett/
+      '';
+
+      serviceConfig = {
+        Type = "simple";
+        User = "jackett";
+        Group = "nogroup";
+        PermissionsStartOnly = "true";
+        ExecStart = "${pkgs.jackett}/bin/Jackett";
+        Restart = "on-failure";
+      };
+    };
+
+    users.extraUsers.jackett = {
+      home = "/var/lib/jackett";
+    };
+
+  };
+}
diff --git a/pkgs/servers/jackett/default.nix b/pkgs/servers/jackett/default.nix
new file mode 100644
index 000000000000..3b3f2e0cc0f1
--- /dev/null
+++ b/pkgs/servers/jackett/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, mono, curl, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "jackett-${version}";
+  version = "0.7.1197";
+
+  src = fetchurl {
+    url = "https://github.com/Jackett/Jackett/releases/download/v${version}/Jackett.Binaries.Mono.tar.gz";
+    sha256 = "0p9xdfbb8pda5a3knnw6145jky3bf10y1dj2clgsbbygi2xnam2v";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/{bin,share/${name}}
+    cp -r * $out/share/${name}
+
+    makeWrapper "${mono}/bin/mono" $out/bin/Jackett \
+      --add-flags "$out/share/${name}/JackettConsole.exe" \
+      --prefix LD_LIBRARY_PATH ':' "${curl.out}/lib"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "API Support for your favorite torrent trackers.";
+    homepage = https://github.com/Jackett/Jackett/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ edwtjo ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7970732ce3f6..3676d3c499c5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2436,6 +2436,8 @@ with pkgs;
 
   jaaa = callPackage ../applications/audio/jaaa { };
 
+  jackett = callPackage ../servers/jackett { };
+
   jade = callPackage ../tools/text/sgml/jade { };
 
   jd-gui = callPackage_i686 ../tools/security/jd-gui { };

From b35d22b30c8c6834842382c71124021372e837a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= <ed@cflags.cc>
Date: Sat, 25 Mar 2017 21:18:34 +0100
Subject: [PATCH 147/157] radarr: init at 0.2.0.553 + nixos module

---
 nixos/modules/module-list.nix          |  1 +
 nixos/modules/services/misc/radarr.nix | 44 ++++++++++++++++++++++++++
 pkgs/servers/radarr/default.nix        | 31 ++++++++++++++++++
 pkgs/top-level/all-packages.nix        |  2 ++
 4 files changed, 78 insertions(+)
 create mode 100644 nixos/modules/services/misc/radarr.nix
 create mode 100644 pkgs/servers/radarr/default.nix

diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 145cf140847b..4e9154f1740e 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -296,6 +296,7 @@
   ./services/misc/parsoid.nix
   ./services/misc/phd.nix
   ./services/misc/plex.nix
+  ./services/misc/radarr.nix
   ./services/misc/redmine.nix
   ./services/misc/rippled.nix
   ./services/misc/ripple-rest.nix
diff --git a/nixos/modules/services/misc/radarr.nix b/nixos/modules/services/misc/radarr.nix
new file mode 100644
index 000000000000..cc5efffca448
--- /dev/null
+++ b/nixos/modules/services/misc/radarr.nix
@@ -0,0 +1,44 @@
+{ config, pkgs, lib, mono, ... }:
+
+with lib;
+
+let
+  cfg = config.services.radarr;
+in
+{
+  options = {
+    services.radarr = {
+      enable = mkEnableOption "Radarr";
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.services.radarr = {
+      description = "Radarr";
+      after = [ "network.target" ];
+      wantedBy = [ "multi-user.target" ];
+      preStart = ''
+        test -d /var/lib/radarr/ || {
+          echo "Creating radarr data directory in /var/lib/radarr/"
+          mkdir -p /var/lib/radarr/
+        }
+        chown -R radarr /var/lib/radarr/
+        chmod 0700 /var/lib/radarr/
+      '';
+
+      serviceConfig = {
+        Type = "simple";
+        User = "radarr";
+        Group = "nogroup";
+        PermissionsStartOnly = "true";
+        ExecStart = "${pkgs.radarr}/bin/Radarr";
+        Restart = "on-failure";
+      };
+    };
+
+    users.extraUsers.radarr = {
+      home = "/var/lib/radarr";
+    };
+
+  };
+}
diff --git a/pkgs/servers/radarr/default.nix b/pkgs/servers/radarr/default.nix
new file mode 100644
index 000000000000..446927745a90
--- /dev/null
+++ b/pkgs/servers/radarr/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, mono, libmediainfo, sqlite, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "radarr-${version}";
+  version = "0.2.0.535";
+
+  src = fetchurl {
+    url = "https://github.com/Radarr/Radarr/releases/download/v${version}/Radarr.develop.${version}.linux.tar.gz";
+    sha256 = "1ccvblklqn5iki7gc16bzzbwms28mv4kxzv1nwhlm9vf0cw4qxbr";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/{bin,share/${name}}
+    cp -r * $out/share/${name}/.
+
+    makeWrapper "${mono}/bin/mono" $out/bin/Radarr \
+      --add-flags "$out/share/${name}/Radarr.exe" \
+      --prefix LD_LIBRARY_PATH ':' "${sqlite.out}/lib" \
+      --prefix LD_LIBRARY_PATH ':' "${libmediainfo}/lib"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A Usenet/BitTorrent movie downloader.";
+    homepage = https://radarr.video/;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ edwtjo ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3676d3c499c5..86205f329f04 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3670,6 +3670,8 @@ with pkgs;
 
   radamsa = callPackage ../tools/security/radamsa { };
 
+  radarr = callPackage ../servers/radarr { };
+
   radvd = callPackage ../tools/networking/radvd { };
 
   rambox = callPackage ../applications/networking/instant-messengers/rambox { };

From 5e0cbbbdb6600335dde8c25b25c62a329b02c284 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 25 Mar 2017 21:36:29 +0100
Subject: [PATCH 148/157] keepassx-community: 2.1.2 -> 2.1.3

fixes https://github.com/NixOS/security/issues/105
---
 pkgs/applications/misc/keepassx/community.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/misc/keepassx/community.nix b/pkgs/applications/misc/keepassx/community.nix
index c5bd9afd2cf6..a5defaf5c29b 100644
--- a/pkgs/applications/misc/keepassx/community.nix
+++ b/pkgs/applications/misc/keepassx/community.nix
@@ -7,13 +7,13 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "keepassx-community-${version}";
-  version = "2.1.2";
+  version = "2.1.3";
 
   src = fetchFromGitHub {
     owner = "keepassxreboot";
     repo = "keepassxc";
     rev = "${version}";
-    sha256 = "0ncc157xki1mzxfa41bgwjfsz5jq9sq750ka578lq61smyzh5lq6";
+    sha256 = "1zamk3dc44fn61b880i3l1r0np2sx2hs05cvcf2x4748r3xicacf";
   };
 
   cmakeFlags = optional (withKeePassHTTP) [ "-DWITH_XC_HTTP=ON" ];

From dc514b246ef0e4152e3b4566f9cda0134a585979 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= <ed@cflags.cc>
Date: Sat, 25 Mar 2017 21:41:46 +0100
Subject: [PATCH 149/157] i2pd: 2.11.0 -> 2.12.0

---
 pkgs/tools/networking/i2pd/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/tools/networking/i2pd/default.nix b/pkgs/tools/networking/i2pd/default.nix
index b7527cf97cec..7f7d68fd5753 100644
--- a/pkgs/tools/networking/i2pd/default.nix
+++ b/pkgs/tools/networking/i2pd/default.nix
@@ -4,13 +4,13 @@ stdenv.mkDerivation rec {
 
   name = pname + "-" + version;
   pname = "i2pd";
-  version = "2.11.0";
+  version = "2.12.0";
 
   src = fetchFromGitHub {
     owner = "PurpleI2P";
     repo = pname;
     rev = version;
-    sha256 = "1ky4ckv5p86xxgjkgxdi48c9q9h4pff2blilg03bxks8f8dxfy9f";
+    sha256 = "1m97s3c1fvhq6ql3zr2a2ia2n06cl8jgf28gjn4k3xg8m7s984dz";
   };
 
   buildInputs = [ boost zlib openssl ];

From 8c4339a9dcd34d33e16b3db5d911cc078164f0e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Sat, 25 Mar 2017 23:01:29 +0100
Subject: [PATCH 150/157] texlive: fix CVE-2016-10243

https://github.com/NixOS/security/issues/104
---
 pkgs/tools/typesetting/tex/texlive/combine.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix
index abfe951a33fe..c783316c6d55 100644
--- a/pkgs/tools/typesetting/tex/texlive/combine.nix
+++ b/pkgs/tools/typesetting/tex/texlive/combine.nix
@@ -111,6 +111,7 @@ in buildEnv {
         -e "s,\$SELFAUTODIR,$out/share,g" \
         -e "s,\$SELFAUTOPARENT,$out/share,g" \
         -e "s,\$SELFAUTOGRANDPARENT,$out/share,g" \
+        -e "/^mpost,/d" `# CVE-2016-10243` \
         "$cnfOrig" > ./texmf.cnf
 
       patchCnfLua "./texmfcnf.lua"

From 99434abff7cac3423986a1f0c9570268cc870c07 Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Sat, 25 Mar 2017 23:53:01 +0300
Subject: [PATCH 151/157] ibus: wrap with GTK dependencies

Without this ibus can't load its settings.
Also don't propagate PYTHONPATH.
---
 pkgs/tools/inputmethods/ibus/default.nix | 23 ++++++++++-------------
 pkgs/top-level/all-packages.nix          |  1 -
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix
index de375ed4529d..1654f57c8ed5 100644
--- a/pkgs/tools/inputmethods/ibus/default.nix
+++ b/pkgs/tools/inputmethods/ibus/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, makeWrapper
+{ stdenv, fetchurl, wrapGAppsHook
 , intltool, isocodes, pkgconfig
-, python3, pygobject3
+, python3
 , gtk2, gtk3, atk, dconf, glib, json_glib
 , dbus, libnotify, gobjectIntrospection, wayland
 , nodePackages
@@ -34,19 +34,21 @@ stdenv.mkDerivation rec {
   ];
 
   buildInputs = [
-    python3 pygobject3
+    python3
     intltool isocodes pkgconfig
     gtk2 gtk3 dconf
     json_glib
     dbus libnotify gobjectIntrospection wayland
   ];
 
-  propagatedBuildInputs = [ glib ];
+  propagatedBuildInputs = [ glib python3.pkgs.pygobject3 ];
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ wrapGAppsHook python3.pkgs.wrapPython ];
 
   outputs = [ "out" "dev" ];
 
+  enableParallelBuilding = true;
+
   preConfigure = ''
     # Fix hard-coded installation paths, so make does not try to overwrite our
     # Python installation.
@@ -59,14 +61,9 @@ stdenv.mkDerivation rec {
     substituteInPlace data/dconf/Makefile.in --replace "dconf update" "echo"
   '';
 
-  preFixup = ''
-    for f in "$out/bin"/*; do #*/
-      wrapProgram "$f" \
-        --prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
-        --prefix PYTHONPATH : "$PYTHONPATH" \
-        --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0" \
-        --prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules"
-    done
+  postFixup = ''
+    buildPythonPath $out
+    patchPythonScript $out/share/ibus/setup/main.py
   '';
 
   doInstallCheck = true;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 86205f329f04..43c2e553f0bd 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1266,7 +1266,6 @@ with pkgs;
   m17n_lib = callPackage ../tools/inputmethods/m17n-lib { };
 
   ibus = callPackage ../tools/inputmethods/ibus {
-    inherit (python3Packages) pygobject3;
     inherit (gnome3) dconf glib;
   };
 

From 66b05cd4e68408bf9026bb304f344b87c66feec3 Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Sat, 25 Mar 2017 23:53:14 +0300
Subject: [PATCH 152/157] ibus-engines: use wrapPythonPrograms

This is needed now that PYTHONPATH is not propagated. Also several packages
with additional dependencies are now properly wrapped.
---
 .../ibus-engines/ibus-anthy/default.nix       |  9 +++++----
 .../ibus-engines/ibus-hangul/default.nix      |  8 +++++---
 .../ibus-engines/ibus-libpinyin/default.nix   |  6 ++++--
 .../ibus-engines/ibus-m17n/default.nix        |  8 +++++---
 .../ibus-engines/ibus-mozc/default.nix        |  8 ++++----
 .../ibus-engines/ibus-table/default.nix       |  8 +++++---
 .../ibus-engines/ibus-uniemoji/default.nix    |  7 +++++++
 pkgs/top-level/all-packages.nix               | 19 ++++---------------
 8 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix
index 50059e9477a9..5d130d7ad807 100644
--- a/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, intltool, pkgconfig
-, anthy, ibus, glib, gobjectIntrospection, gtk3, python3, pygobject3
+, anthy, ibus, glib, gobjectIntrospection, gtk3, python3
 }:
 
 stdenv.mkDerivation rec {
@@ -15,15 +15,16 @@ stdenv.mkDerivation rec {
     maintainers  = with maintainers; [ gebner ericsagnes ];
   };
 
-  configureFlags = "--with-anthy-zipcode=${anthy}/share/anthy/zipcode.t";
+  configureFlags = [ "--with-anthy-zipcode=${anthy}/share/anthy/zipcode.t" ];
 
   buildInputs = [
-    anthy glib gobjectIntrospection gtk3 ibus python3 pygobject3
+    anthy glib gobjectIntrospection gtk3 ibus python3
   ];
 
-  nativeBuildInputs = [ intltool pkgconfig ];
+  nativeBuildInputs = [ intltool pkgconfig python3.pkgs.wrapPython ];
 
   postFixup = ''
+    wrapPythonPrograms
     substituteInPlace $out/share/ibus/component/anthy.xml --replace \$\{exec_prefix\} $out
   '';
 
diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix
index 1ada62580dbc..74253fa09fc0 100644
--- a/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, intltool, pkgconfig
-, gtk3, ibus, libhangul, librsvg, python3, pygobject3
+, gtk3, ibus, libhangul, librsvg, python3
 }:
 
 stdenv.mkDerivation rec {
@@ -11,9 +11,11 @@ stdenv.mkDerivation rec {
     sha256 = "120p9w7za6hi521hz8q235fkl4i3p1qqr8nqm4a3kxr0pcq40bd2";
   };
 
-  buildInputs = [ gtk3 ibus libhangul python3 pygobject3 ];
+  buildInputs = [ gtk3 ibus libhangul ];
 
-  nativeBuildInputs = [ intltool pkgconfig ];
+  nativeBuildInputs = [ intltool pkgconfig python3.pkgs.wrapPython ];
+
+  postFixup = "wrapPythonPrograms";
 
   meta = with stdenv.lib; {
     isIbusEngine = true;
diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix
index 799d66aac9b2..6293fa30d7a7 100644
--- a/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-libpinyin/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchFromGitHub, autoreconfHook
 , intltool, pkgconfig, sqlite, libpinyin, db
-, ibus, glib, gtk3, python3, pygobject3
+, ibus, glib, gtk3, python3
 }:
 
 stdenv.mkDerivation rec {
@@ -15,12 +15,14 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ ibus glib sqlite libpinyin python3 gtk3 db ];
-  nativeBuildInputs = [ autoreconfHook intltool pkgconfig ];
+  nativeBuildInputs = [ autoreconfHook intltool pkgconfig python3.pkgs.wrapPython ];
 
   postAutoreconf = ''
     intltoolize
   '';
 
+  postFixup = "wrapPythonPrograms";
+
   meta = with stdenv.lib; {
     isIbusEngine = true;
     description  = "IBus interface to the libpinyin input method";
diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix
index 2dbab7129555..2d25e6bf4304 100644
--- a/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-m17n/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchFromGitHub
 , autoreconfHook, pkgconfig
-, ibus, m17n_lib, m17n_db, gettext, python3, pygobject3
+, ibus, m17n_lib, m17n_db, gettext, python3
 }:
 
 stdenv.mkDerivation rec {
@@ -16,10 +16,12 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     ibus m17n_lib m17n_db gettext
-    python3 pygobject3
+    python3
   ];
 
-  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig python3.pkgs.wrapPython ];
+
+  postFixup = "wrapPythonPrograms";
 
   meta = with stdenv.lib; {
     isIbusEngine = true;
diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-mozc/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-mozc/default.nix
index 644725c29107..aa346f452749 100644
--- a/pkgs/tools/inputmethods/ibus-engines/ibus-mozc/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-mozc/default.nix
@@ -1,4 +1,4 @@
-{ clangStdenv, fetchFromGitHub, fetchsvn, gyp, which, ninja, python, pkgconfig, protobuf, ibus, gtk2, zinnia, qt4, libxcb, tegaki-zinnia-japanese }:
+{ clangStdenv, fetchFromGitHub, fetchsvn, which, ninja, python2, pkgconfig, protobuf, ibus, gtk2, zinnia, qt4, libxcb, tegaki-zinnia-japanese }:
 
 let
   japanese_usage_dictionary = fetchsvn {
@@ -19,7 +19,7 @@ in clangStdenv.mkDerivation rec {
     maintainers  = with maintainers; [ gebner ericsagnes ];
   };
 
-  nativeBuildInputs = [ gyp which ninja python pkgconfig ];
+  nativeBuildInputs = [ which ninja python2 python2.pkgs.gyp pkgconfig ];
   buildInputs = [ protobuf ibus gtk2 zinnia qt4 libxcb ];
 
   src = fetchFromGitHub {
@@ -36,8 +36,8 @@ in clangStdenv.mkDerivation rec {
 
   configurePhase = ''
     export GYP_DEFINES="document_dir=$out/share/doc/mozc use_libzinnia=1 use_libprotobuf=1 ibus_mozc_path=$out/lib/ibus-mozc/ibus-engine-mozc"
-    python src/build_mozc.py gyp --gypdir=${gyp}/bin --server_dir=$out/lib/mozc \
-    python src/unix/fcitx/fcitx.gyp gyp --gypdir=${gyp}/bin
+    python src/build_mozc.py gyp --gypdir=${python2.pkgs.gyp}/bin --server_dir=$out/lib/mozc \
+    python src/unix/fcitx/fcitx.gyp gyp --gypdir=${python2.pkgs.gyp}/bin
   '';
 
   preBuildPhase = ''
diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix
index c5090e5b949b..8900ebc120cf 100644
--- a/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub
 , autoreconfHook, docbook2x, pkgconfig
 , gtk3, dconf, gobjectIntrospection
-, ibus, python3, pygobject3 }:
+, ibus, python3 }:
 
 stdenv.mkDerivation rec {
   name = "ibus-table-${version}";
@@ -29,16 +29,18 @@ stdenv.mkDerivation rec {
   '';
 
   buildInputs = [
-    dconf gtk3 gobjectIntrospection ibus python3 pygobject3
+    dconf gtk3 gobjectIntrospection ibus python3
   ];
 
-  nativeBuildInputs = [ autoreconfHook docbook2x pkgconfig ];
+  nativeBuildInputs = [ autoreconfHook docbook2x pkgconfig python3.pkgs.wrapPython ];
 
   postUnpack = ''
     substituteInPlace $sourceRoot/engine/Makefile.am \
       --replace "docbook2man" "docbook2man --sgml"
   '';
 
+  postFixup = "wrapPythonPrograms";
+
   meta = with stdenv.lib; {
     isIbusEngine = true;
     description  = "An IBus framework for table-based input methods";
diff --git a/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix b/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix
index 161982ac6186..1ea7ef4251fe 100644
--- a/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-uniemoji/default.nix
@@ -15,6 +15,13 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = with python3Packages; [ pyxdg python-Levenshtein ];
 
+  nativeBuildInputs = [ python3Packages.wrapPython ];
+
+  postFixup = ''
+    buildPythonPath $out
+    patchPythonScript $out/share/ibus-uniemoji/uniemoji.py
+  '';
+
   makeFlags = [ "PREFIX=$(out)" "SYSCONFDIR=$(out)/etc"
                 "PYTHON=${python3Packages.python.interpreter}"
               ];
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 43c2e553f0bd..c33e8cf3c95d 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1272,30 +1272,19 @@ with pkgs;
   ibus-qt = callPackage ../tools/inputmethods/ibus/ibus-qt.nix { };
 
   ibus-engines = recurseIntoAttrs {
+    anthy = callPackage ../tools/inputmethods/ibus-engines/ibus-anthy { };
 
-    anthy = callPackage ../tools/inputmethods/ibus-engines/ibus-anthy {
-      inherit (python3Packages) pygobject3;
-    };
+    hangul = callPackage ../tools/inputmethods/ibus-engines/ibus-hangul { };
 
-    hangul = callPackage ../tools/inputmethods/ibus-engines/ibus-hangul {
-      inherit (python3Packages) pygobject3;
-    };
+    libpinyin = callPackage ../tools/inputmethods/ibus-engines/ibus-libpinyin { };
 
-    libpinyin = callPackage ../tools/inputmethods/ibus-engines/ibus-libpinyin {
-      inherit (python3Packages) pygobject3;
-    };
-
-    m17n = callPackage ../tools/inputmethods/ibus-engines/ibus-m17n {
-      inherit (python3Packages) pygobject3;
-    };
+    m17n = callPackage ../tools/inputmethods/ibus-engines/ibus-m17n { };
 
     mozc = callPackage ../tools/inputmethods/ibus-engines/ibus-mozc {
-      inherit (pythonPackages) gyp;
       protobuf = protobuf.override { stdenv = clangStdenv; };
     };
 
     table = callPackage ../tools/inputmethods/ibus-engines/ibus-table {
-      inherit (python3Packages) pygobject3;
       inherit (gnome3) dconf;
     };
 

From 3c090f0e5a61b9b16a95059c6bfaa6a59abe2ccd Mon Sep 17 00:00:00 2001
From: Willi Butz <wbutz@cyberfnord.de>
Date: Sun, 26 Mar 2017 01:13:11 +0100
Subject: [PATCH 153/157] spotify: 1.0.49.125.g72ee7853-111 ->
 1.0.52.717.g2f08534a-47

---
 pkgs/applications/audio/spotify/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/audio/spotify/default.nix b/pkgs/applications/audio/spotify/default.nix
index 6b4d8e33b503..8821da4362bb 100644
--- a/pkgs/applications/audio/spotify/default.nix
+++ b/pkgs/applications/audio/spotify/default.nix
@@ -8,7 +8,7 @@ let
   # Please update the stable branch!
   # Latest version number can be found at:
   # http://repository-origin.spotify.com/pool/non-free/s/spotify-client/
-  version = "1.0.49.125.g72ee7853-111";
+  version = "1.0.52.717.g2f08534a-47";
 
   deps = [
     alsaLib
@@ -53,7 +53,7 @@ stdenv.mkDerivation {
   src =
     fetchurl {
       url = "https://repository-origin.spotify.com/pool/non-free/s/spotify-client/spotify-client_${version}_amd64.deb";
-      sha256 = "0l008x06d257vcw6gq3q90hvv93cq6mxpj11by1np6bzzg61qv8x";
+      sha256 = "1xqd4pjb69zmbac5fq3pckgr4khlkzfkx8b029qzjc2hi52zfnj7";
     };
 
   buildInputs = [ dpkg makeWrapper ];

From 7bd73bdba3abdb21d591892bfc044fc258fccaee Mon Sep 17 00:00:00 2001
From: Cray Elliott <MP2E@archlinux.us>
Date: Sat, 25 Mar 2017 21:07:09 -0700
Subject: [PATCH 154/157] obs-studio: use upstream crash fixes, drop patch

---
 .../applications/video/obs-studio/default.nix |  6 +--
 .../obs-studio/segfault-patch-systray.patch   | 40 -------------------
 2 files changed, 2 insertions(+), 44 deletions(-)
 delete mode 100644 pkgs/applications/video/obs-studio/segfault-patch-systray.patch

diff --git a/pkgs/applications/video/obs-studio/default.nix b/pkgs/applications/video/obs-studio/default.nix
index a6238d9e808a..539314867ab9 100644
--- a/pkgs/applications/video/obs-studio/default.nix
+++ b/pkgs/applications/video/obs-studio/default.nix
@@ -27,12 +27,10 @@ in stdenv.mkDerivation rec {
   src = fetchFromGitHub {
     owner = "jp9000";
     repo = "obs-studio";
-    rev = "${version}";
-    sha256 = "0mvjmkq5zlcppjqy18933w7r7rz1mpr2jpf8ipd0famdlgyacix6";
+    rev = "624aa2a5";
+    sha256 = "1bs82rqyq7wjjg99mh23ap8z5bmrhjfnza5iyjx808fzqc0bgzaj";
   };
 
-  patches = [ ./segfault-patch-systray.patch ];
-
   nativeBuildInputs = [ cmake
                       ];
 
diff --git a/pkgs/applications/video/obs-studio/segfault-patch-systray.patch b/pkgs/applications/video/obs-studio/segfault-patch-systray.patch
deleted file mode 100644
index c66b07bb57ad..000000000000
--- a/pkgs/applications/video/obs-studio/segfault-patch-systray.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From c31e0f682431508ccd2d3c0f74e6e16fc71445d8 Mon Sep 17 00:00:00 2001
-From: Cray Elliott <MP2E@archlinux.us>
-Date: Fri, 10 Mar 2017 03:48:36 -0800
-Subject: [PATCH] Fix segfault in Linux when no system tray exists
-
-previously, switching workspaces while obs-studio is running resulted in a
-segfault if no system tray was available
----
- UI/window-basic-main.cpp | 16 +++++++++-------
- 1 file changed, 9 insertions(+), 7 deletions(-)
-
-diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp
-index 8590dd75..024854d6 100644
---- a/UI/window-basic-main.cpp
-+++ b/UI/window-basic-main.cpp
-@@ -2916,13 +2916,15 @@ void OBSBasic::closeEvent(QCloseEvent *event)
-
- void OBSBasic::changeEvent(QEvent *event)
- {
--	if (event->type() == QEvent::WindowStateChange &&
--	    isMinimized() &&
--	    trayIcon->isVisible() &&
--	    sysTrayMinimizeToTray()) {
--
--		ToggleShowHide();
--	}
-+  if (trayIcon) {
-+	  if (event->type() == QEvent::WindowStateChange &&
-+	      isMinimized() &&
-+	      trayIcon->isVisible() &&
-+	      sysTrayMinimizeToTray()) {
-+
-+	  	ToggleShowHide();
-+	  }
-+  }
- }
-
- void OBSBasic::on_actionShow_Recordings_triggered()
---
-2.12.0

From 1b78108bce5233cf887e585da2daab3fd0fb7bcc Mon Sep 17 00:00:00 2001
From: Mikhail Volkhov <volhovm.cs@gmail.com>
Date: Sun, 26 Mar 2017 08:43:47 +0300
Subject: [PATCH 155/157] bup: 0.28.1 -> 0.29

---
 pkgs/tools/backup/bup/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/tools/backup/bup/default.nix b/pkgs/tools/backup/bup/default.nix
index 4e035ab67acb..baf9e4f4e394 100644
--- a/pkgs/tools/backup/bup/default.nix
+++ b/pkgs/tools/backup/bup/default.nix
@@ -5,7 +5,7 @@
 
 assert par2Support -> par2cmdline != null;
 
-let version = "0.28.1"; in
+let version = "0.29"; in
 
 with stdenv.lib;
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     repo = "bup";
     owner = "bup";
     rev = version;
-    sha256 = "1hsxzrjvqa3pd74vmz8agiiwynrzynp1i726h0fzdsakc4adya4l";
+    sha256 = "1cc9kpq9bpln89m4ni6wqzh4c8zwxmgnhaibdxxfs5pk2mpl3ds5";
   };
 
   buildInputs = [ git python2Packages.python ];

From 03ddb417c3f64cb59ca2b0c4833db40b1313bf46 Mon Sep 17 00:00:00 2001
From: Kosyrev Serge <skosyrev@ptsecurity.com>
Date: Fri, 17 Mar 2017 23:03:33 +0300
Subject: [PATCH 156/157] vogl:  init at 2016-05-13

---
 pkgs/development/tools/vogl/default.nix | 47 +++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix         |  2 ++
 2 files changed, 49 insertions(+)
 create mode 100644 pkgs/development/tools/vogl/default.nix

diff --git a/pkgs/development/tools/vogl/default.nix b/pkgs/development/tools/vogl/default.nix
new file mode 100644
index 000000000000..f3967b0d9235
--- /dev/null
+++ b/pkgs/development/tools/vogl/default.nix
@@ -0,0 +1,47 @@
+{ fetchFromGitHub, stdenv
+, cmake, git, pkgconfig, wget, zip
+, makeQtWrapper, qtbase, qtx11extras
+, libdwarf, libjpeg_turbo, libunwind, lzma, tinyxml, libX11
+, SDL2, SDL2_gfx, SDL2_image, SDL2_ttf
+, freeglut, mesa, mesa_glu
+}:
+stdenv.mkDerivation rec {
+  name = "vogl-${version}";
+  version = "2016-05-13";
+
+  src = fetchFromGitHub {
+    owner  = "deepfire";
+    repo   = "vogl";
+    rev    = "cbc5f1853e294b363f16c4e00b3e0c49dbf74559";
+    sha256 = "17gwd73x3lnqv6ccqs48pzqwbzjhbn41c0x0l5zzirhiirb3yh0n";
+  };
+
+  nativeBuildInputs = [
+    cmake makeQtWrapper pkgconfig
+  ];
+
+  buildInputs = [
+    git wget zip
+    qtbase qtx11extras
+    libdwarf libjpeg_turbo libunwind lzma tinyxml libX11
+    SDL2 SDL2_gfx SDL2_image SDL2_ttf
+    freeglut mesa mesa_glu
+  ];
+
+  enableParallelBuilding = true;
+
+  dontUseCmakeBuildDir = true;
+  preConfigure = ''
+    cmakeDir=$PWD
+    mkdir -p vogl/vogl_build/release64 && cd $_
+  '';
+  cmakeFlags = '' -DCMAKE_VERBOSE=On -DCMAKE_BUILD_TYPE=Release -DBUILD_X64=On'';
+
+  meta = with stdenv.lib; {
+    description = "OpenGL capture / playback debugger.";
+    homepage = https://github.com/ValveSoftware/vogl;
+    license = licenses.mit;
+    maintainers = [ maintainers.deepfire ];
+    platforms = [ "x86_64-linux" "i686-linux" ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 217137c210f2..c78b1f6164ab 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15921,6 +15921,8 @@ with pkgs;
 
   vnstat = callPackage ../applications/networking/vnstat { };
 
+  vogl = qt57.callPackage ../development/tools/vogl { };
+
   volnoti = callPackage ../applications/misc/volnoti { };
 
   vorbis-tools = callPackage ../applications/audio/vorbis-tools { };

From 4a8b2c29420ef11af6d9abad8d8b6710eb397a23 Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Sun, 26 Mar 2017 08:35:10 +0000
Subject: [PATCH 157/157] sile: on Darwin, use AppKit for font selection

---
 pkgs/tools/typesetting/sile/default.nix | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/pkgs/tools/typesetting/sile/default.nix b/pkgs/tools/typesetting/sile/default.nix
index 382219a0a3a3..2c34a9aff32b 100644
--- a/pkgs/tools/typesetting/sile/default.nix
+++ b/pkgs/tools/typesetting/sile/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, pkgconfig
+{ stdenv, darwin, fetchurl, makeWrapper, pkgconfig
 , harfbuzz, icu, lpeg, luaexpat, luazlib, luafilesystem
 , fontconfig, lua, libiconv
 }:
@@ -26,7 +26,15 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [pkgconfig makeWrapper];
-  buildInputs = [ harfbuzz icu lua lpeg luaexpat luazlib luafilesystem fontconfig libiconv ];
+  buildInputs = [ harfbuzz icu lua lpeg luaexpat luazlib luafilesystem fontconfig libiconv ]
+  ++ optional stdenv.isDarwin darwin.apple_sdk.frameworks.AppKit
+  ;
+
+  preConfigure = optionalString stdenv.isDarwin ''
+    sed -i -e 's|@import AppKit;|#import <AppKit/AppKit.h>|' src/macfonts.m
+  '';
+
+  NIX_LDFLAGS = optionalString stdenv.isDarwin "-framework AppKit";
 
   LUA_PATH = luaPath;
   LUA_CPATH = luaCPath;
@@ -49,8 +57,8 @@ stdenv.mkDerivation rec {
       technologies and borrowing some ideas from graphical systems
       such as InDesign.
     '';
-    homepage = "http://www.sile-typesetter.org";
-    platforms = stdenv.lib.platforms.unix;
-    license = stdenv.lib.licenses.mit;
+    homepage = http://www.sile-typesetter.org;
+    platforms = platforms.unix;
+    license = licenses.mit;
   };
 }