From 5eb75ce205ac00b1a2403425b6b195627da0f699 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Sun, 9 Apr 2017 04:22:08 -0500
Subject: [PATCH 01/65] xcbuild: add app bundle specs

---
 pkgs/development/tools/xcbuild/platform.nix | 94 +++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix
index 34fc5b0f6202..a1f4eed8e605 100644
--- a/pkgs/development/tools/xcbuild/platform.nix
+++ b/pkgs/development/tools/xcbuild/platform.nix
@@ -101,6 +101,54 @@ let
         Name = "$(EXECUTABLE_NAME)";
       };
     }
+    {
+      Identifier = "com.apple.package-type.wrapper";
+      Type = "PackageType";
+      Name = "Wrapper";
+      DefaultBuildSettings = {
+        WRAPPER_SUFFIX = ".bundle";
+        WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
+        CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)/Contents";
+        EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
+        EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/MacOS";
+        EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)";
+        INFOPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/Info.plist";
+        INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings";
+        PKGINFO_PATH = "$(CONTENTS_FOLDER_PATH)/PkgInfo";
+        PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist";
+        VERSIONPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/version.plist";
+        PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";
+        PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders";
+        EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Executables";
+        FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks";
+        SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks";
+        SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedSupport";
+        UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources";
+        LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj";
+        DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation";
+        PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns";
+        SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts";
+      };
+      ProductReference = {
+        FileType = "wrapper.cfbundle";
+        Name = "$(WRAPPER_NAME)";
+        IsLaunchable = "NO";
+      };
+    }
+    {
+      Identifier = "com.apple.package-type.wrapper.application";
+      Type = "PackageType";
+      BasedOn = "com.apple.package-type.wrapper";
+      Name = "Application Wrapper";
+      DefaultBuildSettings = {
+        GENERATE_PKGINFO_FILE = "YES";
+      };
+      ProductReference = {
+        FileType = "wrapper.application";
+        Name = "$(WRAPPER_NAME)";
+        IsLaunchable = "YES";
+      };
+    }
   ];
 
   # Based off of the MacOSX Product Types.xcpsec file. All
@@ -125,6 +173,52 @@ let
       Name = "Dynamic Library";
       PackageTypes = [ "com.apple.package-type.mach-o-dylib" ];
     }
+    {
+      Type = "ProductType";
+      Identifier = "com.apple.product-type.bundle";
+      Name = "Bundle";
+      DefaultTargetName = "Bundle";
+      DefaultBuildProperties = {
+        FULL_PRODUCT_NAME = "$(WRAPPER_NAME)";
+        MACH_O_TYPE = "mh_bundle";
+        WRAPPER_PREFIX = "";
+        WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
+        WRAPPER_EXTENSION = "bundle";
+        WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
+        FRAMEWORK_FLAG_PREFIX = "-framework";
+        LIBRARY_FLAG_PREFIX = "-l";
+        LIBRARY_FLAG_NOSPACE = "YES";
+        STRIP_STYLE = "non-global";
+        GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
+      };
+      PackageTypes = [ "com.apple.package-type.wrapper" ];
+      IsWrapper = "YES";
+      HasInfoPlist = "YES";
+      HasInfoPlistStrings = "YES";
+    }
+    {
+      Identifier = "com.apple.product-type.application";
+      Type = "ProductType";
+      BasedOn = "com.apple.product-type.bundle";
+      Name = "Application";
+      DefaultTargetName = "Application";
+      DefaultBuildProperties = {
+        MACH_O_TYPE = "mh_execute";
+        GCC_DYNAMIC_NO_PIC = "NO";
+        GCC_SYMBOLS_PRIVATE_EXTERN = "YES";
+        GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
+        WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
+        WRAPPER_EXTENSION = "app";
+        INSTALL_PATH = "$(LOCAL_APPS_DIR)";
+        STRIP_STYLE = "all";
+      };
+      PackageTypes = [ "com.apple.package-type.wrapper.application" ];
+      CanEmbedCompilerSanitizerLibraries = "YES";
+      RunpathSearchPathForEmbeddedFrameworks = "@executable_path/../Frameworks";
+      ValidateEmbeddedBinaries = "YES";
+      ProvisioningProfileSupported = "YES";
+      ProvisioningProfileRequired = "NO";
+    }
   ];
 
 in

From a78af29ae7e7d2d0c0737271cfdb0ff710493e1d Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Sun, 9 Apr 2017 04:22:44 -0500
Subject: [PATCH 02/65] install_name_tool: remove

cctools provides install_name_tool
---
 .../darwin/install_name_tool/default.nix      | 29 -------------------
 pkgs/top-level/all-packages.nix               |  2 --
 pkgs/top-level/python-packages.nix            |  3 +-
 3 files changed, 1 insertion(+), 33 deletions(-)
 delete mode 100644 pkgs/os-specific/darwin/install_name_tool/default.nix

diff --git a/pkgs/os-specific/darwin/install_name_tool/default.nix b/pkgs/os-specific/darwin/install_name_tool/default.nix
deleted file mode 100644
index 581eb31cc71c..000000000000
--- a/pkgs/os-specific/darwin/install_name_tool/default.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ stdenv }:
-
-assert stdenv.isDarwin;
-
-stdenv.mkDerivation {
-  name = "install_name_tool";
-  src = "/usr/bin/install_name_tool";
-
-  unpackPhase = "true";
-  dontBuild = true;
-
-  installPhase = ''
-    mkdir -p "$out"/bin
-    ln -s "$src" "$out"/bin
-  '';
-
-  meta = with stdenv.lib; {
-    description = "Change dynamic shared library install names";
-    homepage    = https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man1/install_name_tool.1.html;
-    maintainers = with maintainers; [ lovek323 ];
-    platforms   = platforms.darwin;
-
-    longDescription = ''
-      Install_name_tool changes the dynamic shared library install names and or
-      adds, changes or deletes the rpaths recorded in a Mach-O binary.
-    '';
-  };
-}
-
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e0ef39ce64f6..ca033e4ffdc1 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -547,8 +547,6 @@ with pkgs;
 
   reattach-to-user-namespace = callPackage ../os-specific/darwin/reattach-to-user-namespace {};
 
-  install_name_tool = callPackage ../os-specific/darwin/install_name_tool { };
-
   xcodeenv = callPackage ../development/mobile/xcodeenv { };
 
   titaniumenv = callPackage ../development/mobile/titaniumenv {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 8fd95ea65d75..266f11a73ff7 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -28918,8 +28918,7 @@ EOF
     };
 
     propagatedBuildInputs = with self; [ cffi ];
-    buildInputs = [ pkgs.libspotify ]
-      ++ stdenv.lib.optional stdenv.isDarwin pkgs.install_name_tool;
+    buildInputs = [ pkgs.libspotify ];
 
     # python zip complains about old timestamps
     preConfigure = ''

From 38fa9910642bc819484726aec596f4827b10ba2f Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Sun, 9 Apr 2017 04:24:16 -0500
Subject: [PATCH 03/65] pinentry_mac: use xcbuild

---
 pkgs/tools/security/pinentry-mac/default.nix | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/tools/security/pinentry-mac/default.nix b/pkgs/tools/security/pinentry-mac/default.nix
index 7116d1777d6d..ba3e8b1818d0 100644
--- a/pkgs/tools/security/pinentry-mac/default.nix
+++ b/pkgs/tools/security/pinentry-mac/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv }:
+{ fetchurl, stdenv, xcbuild }:
 
 stdenv.mkDerivation rec {
   name = "pinentry-mac-0.9.4";
@@ -8,9 +8,9 @@ stdenv.mkDerivation rec {
     sha256 = "037ebb010377d3a3879ae2a832cefc4513f5c397d7d887d7b86b4e5d9a628271";
   };
 
-  postPatch = ''
-    substituteInPlace ./Makefile --replace "xcodebuild" "/usr/bin/xcodebuild"
-  '';
+  buildInputs = [ xcbuild ];
+
+  dontUseXcbuild = true;
 
   installPhase = ''
     mkdir -p $out/Applications

From 34422f428d583f57b3cbdaf6bbcc1e0ca61662c4 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Sun, 9 Apr 2017 04:27:21 -0500
Subject: [PATCH 04/65] ibtool: add to toolchain

- init package
- add into xcbuild/toolchain.nix
---
 pkgs/development/tools/xcbuild/toolchain.nix |  5 ++++-
 pkgs/os-specific/darwin/ibtool/default.nix   | 20 ++++++++++++++++++++
 pkgs/top-level/all-packages.nix              |  2 ++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 pkgs/os-specific/darwin/ibtool/default.nix

diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix
index 4313f0051473..cdf4a673cc5f 100644
--- a/pkgs/development/tools/xcbuild/toolchain.nix
+++ b/pkgs/development/tools/xcbuild/toolchain.nix
@@ -1,6 +1,7 @@
 {stdenv, writeText, toolchainName, xcbuild, fetchurl
 , llvm, cctools, gcc, bootstrap_cmds, binutils
-, yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper}:
+, yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper
+, ibtool}:
 
 let
 
@@ -89,6 +90,8 @@ stdenv.mkDerivation {
     ln -s ${cctools}/bin/pagestuff
     ln -s ${cctools}/bin/ranlib
     ln -s ${cctools}/bin/redo_prebinding
+
+    ln -s ${ibtool}/bin/ibtool
   '' +
     # No point including the entire gcc closure if we don't already have it
     (if stdenv.cc.isClang then ''
diff --git a/pkgs/os-specific/darwin/ibtool/default.nix b/pkgs/os-specific/darwin/ibtool/default.nix
new file mode 100644
index 000000000000..556426ac62d9
--- /dev/null
+++ b/pkgs/os-specific/darwin/ibtool/default.nix
@@ -0,0 +1,20 @@
+{ stdenv }:
+
+assert stdenv.isDarwin;
+
+stdenv.mkDerivation {
+  name = "ibtool";
+  src = "/usr/bin/ibtool";
+
+  unpackPhase = "true";
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p "$out"/bin
+    ln -s "$src" "$out"/bin
+  '';
+
+  meta = with stdenv.lib; {
+    platforms   = platforms.darwin;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ca033e4ffdc1..30f6598f975c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18407,4 +18407,6 @@ with pkgs;
   ghc-standalone-archive = callPackage ../os-specific/darwin/ghc-standalone-archive { inherit (darwin) cctools; };
 
   messenger-for-desktop = callPackage ../applications/networking/instant-messengers/messenger-for-desktop {};
+
+  ibtool = callPackage ../os-specific/darwin/ibtool {};
 }

From 87e6b2c50fb4520d9ef910418f3c686d830dc3df Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Sun, 9 Apr 2017 04:27:56 -0500
Subject: [PATCH 05/65] xcbuild: try to fix sdk not found

This is an attempt to get rid of the issues with sdk not found in
xcbuild when building pinentry_mac.
---
 pkgs/development/tools/xcbuild/platform.nix | 2 +-
 pkgs/development/tools/xcbuild/wrapper.nix  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix
index a1f4eed8e605..01693ce8e5b9 100644
--- a/pkgs/development/tools/xcbuild/platform.nix
+++ b/pkgs/development/tools/xcbuild/platform.nix
@@ -241,6 +241,6 @@ stdenv.mkDerivation {
 
     mkdir -p $out/Developer/SDKs/
     cd $out/Developer/SDKs/
-    ln -s ${sdk}
+    ln -s ${sdk} macosx10.10.sdk
   '';
 }
diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix
index ab6605e91b10..3dfc7f363439 100644
--- a/pkgs/development/tools/xcbuild/wrapper.nix
+++ b/pkgs/development/tools/xcbuild/wrapper.nix
@@ -60,9 +60,13 @@ stdenv.mkDerivation {
       --add-flags "DERIVED_DATA_DIR=." \
       --set DEVELOPER_DIR "$out"
     wrapProgram $out/bin/xcrun \
+      --add-flags "-sdk macosx10.10" \
       --set DEVELOPER_DIR "$out"
     wrapProgram $out/bin/xcode-select \
       --set DEVELOPER_DIR "$out"
+
+    mkdir -p $out/usr/bin/
+    ln -s $out/bin/xcrun $out/usr/bin/xcrun
   '';
 
   inherit (xcbuild) meta;

From 785f6ce5d66505661ee416adc8ca0ef99fa38424 Mon Sep 17 00:00:00 2001
From: "Andrew R. M" <andrewmiller237@gmail.com>
Date: Mon, 10 Apr 2017 10:31:00 -0400
Subject: [PATCH 06/65] pass: Fix clipboard functionality

Add the patch that was removed that allows pass's clip() function to
work with single binary coreutils. This version of the patch is also
applied to darwin.sh, so this should fix the clipboard functionality in
darwin as well.
---
 pkgs/tools/security/pass/default.nix          |  3 +-
 .../set-correct-program-name-for-sleep.patch  | 69 +++++++++++++++++++
 2 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 pkgs/tools/security/pass/set-correct-program-name-for-sleep.patch

diff --git a/pkgs/tools/security/pass/default.nix b/pkgs/tools/security/pass/default.nix
index 62f1a3a05dd0..83394d984ad7 100644
--- a/pkgs/tools/security/pass/default.nix
+++ b/pkgs/tools/security/pass/default.nix
@@ -21,7 +21,8 @@ stdenv.mkDerivation rec {
     sha256 = "002mw7j0m33bw483rllzhcf41wp3ixka8yma6kqrfaj57jyw66hn";
   };
 
-  patches = stdenv.lib.optional stdenv.isDarwin ./no-darwin-getopt.patch;
+  patches = [ ./set-correct-program-name-for-sleep.patch 
+            ] ++ stdenv.lib.optional stdenv.isDarwin ./no-darwin-getopt.patch;
 
   nativeBuildInputs = [ makeWrapper ];
 
diff --git a/pkgs/tools/security/pass/set-correct-program-name-for-sleep.patch b/pkgs/tools/security/pass/set-correct-program-name-for-sleep.patch
new file mode 100644
index 000000000000..782e06e20fd9
--- /dev/null
+++ b/pkgs/tools/security/pass/set-correct-program-name-for-sleep.patch
@@ -0,0 +1,69 @@
+From 25b44e00ed5df8ffe2782d38ad5cd9f514379599 Mon Sep 17 00:00:00 2001
+From: "Andrew R. M" <andrewmiller237@gmail.com>
+Date: Sat, 8 Apr 2017 13:50:01 -0400
+Subject: [PATCH] Patch the clip() function to work even when using
+ single-binary coreutils
+
+---
+ src/password-store.sh  | 4 ++--
+ src/platform/cygwin.sh | 4 ++--
+ src/platform/darwin.sh | 4 ++--
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/password-store.sh b/src/password-store.sh
+index 6a4172d..4dbd6b8 100755
+--- a/src/password-store.sh
++++ b/src/password-store.sh
+@@ -155,11 +155,11 @@ clip() {
+ 	# variable. Specifically, it cannot store nulls nor (non-trivally) store
+ 	# trailing new lines.
+ 	local sleep_argv0="password store sleep on display $DISPLAY"
+-	pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
++	pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5
+ 	local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | base64)"
+ 	echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard"
+ 	(
+-		( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
++		( exec -a "$sleep_argv0" bash <(echo trap 'kill %1' TERM\; sleep "$CLIP_TIME & wait") )
+ 		local now="$(xclip -o -selection "$X_SELECTION" | base64)"
+ 		[[ $now != $(echo -n "$1" | base64) ]] && before="$now"
+ 
+diff --git a/src/platform/cygwin.sh b/src/platform/cygwin.sh
+index 6e5dd86..f3574c4 100644
+--- a/src/platform/cygwin.sh
++++ b/src/platform/cygwin.sh
+@@ -3,11 +3,11 @@
+ 
+ clip() {
+ 	local sleep_argv0="password store sleep on display $DISPLAY"
+-	pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
++	pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5
+ 	local before="$(base64 < /dev/clipboard)"
+ 	echo -n "$1" > /dev/clipboard
+ 	(
+-		( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
++		( exec -a "$sleep_argv0" bash <(echo sleep "$CLIP_TIME") )
+ 		local now="$(base64 < /dev/clipboard)"
+ 		[[ $now != $(echo -n "$1" | base64) ]] && before="$now"
+ 		echo "$before" | base64 -d > /dev/clipboard
+diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
+index 86eb325..deb04c4 100644
+--- a/src/platform/darwin.sh
++++ b/src/platform/darwin.sh
+@@ -3,11 +3,11 @@
+ 
+ clip() {
+ 	local sleep_argv0="password store sleep for user $(id -u)"
+-	pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
++	pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5
+ 	local before="$(pbpaste | openssl base64)"
+ 	echo -n "$1" | pbcopy
+ 	(
+-		( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
++		( exec -a "$sleep_argv0" bash <(echo sleep "$CLIP_TIME") )
+ 		local now="$(pbpaste | openssl base64)"
+ 		[[ $now != $(echo -n "$1" | openssl base64) ]] && before="$now"
+ 		echo "$before" | openssl base64 -d | pbcopy
+-- 
+2.12.2
+

From 769b991be6c44292c09cc2a6a3f5d882b6110ec0 Mon Sep 17 00:00:00 2001
From: Aneesh Agrawal <aneeshusa@gmail.com>
Date: Tue, 21 Mar 2017 16:49:17 -0400
Subject: [PATCH 07/65] openssh: 7.4p1 -> 7.5p1

Release notes are available at https://www.openssh.com/txt/release-7.5.
Mostly a bugfix release, no major backwards-incompatible changes.

Remove deprecated `UsePrivilegeSeparation` option,
which is now mandatory.
---
 nixos/modules/services/networking/ssh/sshd.nix | 2 --
 pkgs/tools/networking/openssh/default.nix      | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index 42b50d0426a9..bebf4e145ca8 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -316,8 +316,6 @@ in
 
         UsePAM yes
 
-        UsePrivilegeSeparation sandbox
-
         AddressFamily ${if config.networking.enableIPv6 then "any" else "inet"}
         ${concatMapStrings (port: ''
           Port ${toString port}
diff --git a/pkgs/tools/networking/openssh/default.nix b/pkgs/tools/networking/openssh/default.nix
index 1c66900c06b7..79cdac874891 100644
--- a/pkgs/tools/networking/openssh/default.nix
+++ b/pkgs/tools/networking/openssh/default.nix
@@ -21,8 +21,8 @@ let
   gssapiSrc = fetchpatch {
     name = "openssh-gssapi.patch";
     url = "https://anonscm.debian.org/cgit/pkg-ssh/openssh.git/plain/debian"
-        + "/patches/gssapi.patch?id=255b8554a50b5c75fca63f76b1ac837c0d4fb7aa";
-    sha256 = "0yg9iq7vb2fkvy36ar0jxk29pkw0h3dhv5vn8qncc3pgwx3617n2";
+        + "/patches/gssapi.patch?id=a18d56bd84f04292ec9178b4b17ef6d56a0c7aef";
+    sha256 = "1sb929lfc3s45km2vpylmlbb6mpqcbr74xl6gx2s4cgnsrfd9kp3";
   };
 
 in
@@ -31,11 +31,11 @@ stdenv.mkDerivation rec {
   # Please ensure that openssh_with_kerberos still builds when
   # bumping the version here!
   name = "openssh-${version}";
-  version = "7.4p1";
+  version = "7.5p1";
 
   src = fetchurl {
     url = "mirror://openbsd/OpenSSH/portable/${name}.tar.gz";
-    sha256 = "1l8r3x4fr2kb6xm95s7kjdif1wp6f94d4kljh4qjj9109shw87qv";
+    sha256 = "1w7rb5gbrikxdkp8w7zxnci4549gk4bw1lml01s59w5rzb2y6ilq";
   };
 
   prePatch = optionalString hpnSupport

From 47a5f9acee9d75c7549802a2526013631510403d Mon Sep 17 00:00:00 2001
From: Benjamin Staffin <benley@gmail.com>
Date: Mon, 10 Apr 2017 22:41:55 -0400
Subject: [PATCH 08/65] nixos: Add nm-openvpn to the networkmanager group

This is to satisfy the polkit restriction limiting
org.freedesktop.NetworkManager.* dbus messages to members of that
group.

Should help with #24806
---
 nixos/modules/services/networking/networkmanager.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index 7fb2be786980..220107a24118 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -241,6 +241,7 @@ in {
     users.extraUsers = [{
       name = "nm-openvpn";
       uid = config.ids.uids.nm-openvpn;
+      extraGroups = [ "networkmanager" ];
     }];
 
     systemd.packages = cfg.packages;

From 5db1fe64c0a30e8a10cfb524018a471df2bbc3fa Mon Sep 17 00:00:00 2001
From: Benjamin Staffin <benley@gmail.com>
Date: Mon, 10 Apr 2017 23:00:10 -0400
Subject: [PATCH 09/65] plasma-nm: patch in the correct path to openvpn
 executable

Fixes #24808
---
 .../plasma-nm/0002-openvpn-binary-path.patch        | 13 +++++++++++++
 pkgs/desktops/plasma-5/plasma-nm/default.nix        |  6 +++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch

diff --git a/pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch b/pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch
new file mode 100644
index 000000000000..3bc871f09063
--- /dev/null
+++ b/pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch
@@ -0,0 +1,13 @@
+diff --git a/vpn/openvpn/openvpnadvancedwidget.cpp b/vpn/openvpn/openvpnadvancedwidget.cpp
+index 2f11ba1d..310f11b4 100644
+--- a/vpn/openvpn/openvpnadvancedwidget.cpp
++++ b/vpn/openvpn/openvpnadvancedwidget.cpp
+@@ -75,7 +75,7 @@ OpenVpnAdvancedWidget::OpenVpnAdvancedWidget(const NetworkManager::VpnSetting::P
+     connect(m_ui->cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &OpenVpnAdvancedWidget::proxyTypeChanged);
+ 
+     // start openVPN process and get its cipher list
+-    const QString openVpnBinary = QStandardPaths::findExecutable("openvpn", QStringList() << "/sbin" << "/usr/sbin");
++    const QString openVpnBinary = "@openvpn@/bin/openvpn";
+     const QStringList ciphersArgs(QLatin1String("--show-ciphers"));
+     const QStringList versionArgs(QLatin1String("--version"));
+ 
diff --git a/pkgs/desktops/plasma-5/plasma-nm/default.nix b/pkgs/desktops/plasma-5/plasma-nm/default.nix
index da57653bb083..5d5b73d875c9 100644
--- a/pkgs/desktops/plasma-5/plasma-nm/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-nm/default.nix
@@ -4,7 +4,7 @@
 , knotifications, kservice, kwallet, kwidgetsaddons, kwindowsystem
 , kxmlgui, mobile_broadband_provider_info
 , modemmanager-qt, networkmanager-qt, openconnect, plasma-framework
-, qca-qt5, qtdeclarative, solid
+, qca-qt5, qtdeclarative, solid, openvpn
 }:
 
 plasmaPackage {
@@ -14,6 +14,10 @@ plasmaPackage {
       src = ./0001-mobile-broadband-provider-info-path.patch;
       inherit mobile_broadband_provider_info;
     })
+    (substituteAll {
+      src = ./0002-openvpn-binary-path.patch;
+      inherit openvpn;
+    })
   ];
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [

From 7c75940c5e63161fbb6e75c1f8b204fca60e7dcd Mon Sep 17 00:00:00 2001
From: Benjamin Staffin <benley@gmail.com>
Date: Mon, 10 Apr 2017 23:47:51 -0400
Subject: [PATCH 10/65] plasma-nm: enable parallel building

This thing takes a long time to build.
---
 pkgs/desktops/plasma-5/plasma-nm/default.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pkgs/desktops/plasma-5/plasma-nm/default.nix b/pkgs/desktops/plasma-5/plasma-nm/default.nix
index 5d5b73d875c9..736d59b40412 100644
--- a/pkgs/desktops/plasma-5/plasma-nm/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-nm/default.nix
@@ -27,4 +27,5 @@ plasmaPackage {
     mobile_broadband_provider_info modemmanager-qt networkmanager-qt openconnect
     qca-qt5 solid
   ];
+  enableParallelBuilding = true;
 }

From f1fdc988844926f90c855f55b66955d61034569a Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Tue, 11 Apr 2017 01:03:11 -0500
Subject: [PATCH 11/65] pugixml: fixup darwin

---
 .../development/libraries/pugixml/default.nix |  3 ---
 .../libraries/pugixml/no-long-long.patch      | 19 -------------------
 2 files changed, 22 deletions(-)
 delete mode 100644 pkgs/development/libraries/pugixml/no-long-long.patch

diff --git a/pkgs/development/libraries/pugixml/default.nix b/pkgs/development/libraries/pugixml/default.nix
index 8c40ff2be20b..d9d0afa2bde8 100644
--- a/pkgs/development/libraries/pugixml/default.nix
+++ b/pkgs/development/libraries/pugixml/default.nix
@@ -18,9 +18,6 @@ stdenv.mkDerivation rec {
     sed -ire '/PUGIXML_HAS_LONG_LONG/ s/^\/\///' src/pugiconfig.hpp
   '';
 
-  patches = []
-    ++ stdenv.lib.optionals stdenv.isDarwin [ ./no-long-long.patch ];
-
   meta = with stdenv.lib; {
     description = "Light-weight, simple and fast XML parser for C++ with XPath support";
     homepage = http://pugixml.org/;
diff --git a/pkgs/development/libraries/pugixml/no-long-long.patch b/pkgs/development/libraries/pugixml/no-long-long.patch
deleted file mode 100644
index 46c54e85a1d0..000000000000
--- a/pkgs/development/libraries/pugixml/no-long-long.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Get rid of long-long feature. This breaks on AppleClang compilers.
----
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 40a7ab0..c84f0f7 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -26,9 +26,9 @@ else()
- endif()
- 
- # Enable C++11 long long for compilers that are capable of it
--if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STRLESS 3.1)
--	target_compile_features(pugixml PUBLIC cxx_long_long_type)
--endif()
-+# if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STRLESS 3.1)
-+# 	target_compile_features(pugixml PUBLIC cxx_long_long_type)
-+# endif()
- 
- set_target_properties(pugixml PROPERTIES VERSION 1.7 SOVERSION 1)
- 

From c178ee4726f2123515b47e7853442e16ec3883ed Mon Sep 17 00:00:00 2001
From: Daniel Brockman <daniel@brockman.se>
Date: Tue, 11 Apr 2017 05:39:03 +0200
Subject: [PATCH 12/65] ethabi: 0.2.1 -> 1.0.4

---
 pkgs/applications/altcoins/ethabi.nix | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkgs/applications/altcoins/ethabi.nix b/pkgs/applications/altcoins/ethabi.nix
index b92a656c0833..d2532e0d41e9 100644
--- a/pkgs/applications/altcoins/ethabi.nix
+++ b/pkgs/applications/altcoins/ethabi.nix
@@ -4,16 +4,16 @@ with rustPlatform;
 
 buildRustPackage rec {
   name = "ethabi-${version}";
-  version = "0.2.1";
+  version = "1.0.4";
 
   src = fetchFromGitHub {
-    owner = "ethcore";
+    owner = "paritytech";
     repo = "ethabi";
-    rev = "fbed04984cab0db8767e01054ee16271b8e36281";
-    sha256 = "1zgyyg1i5wmz8l1405yg5jmq4ddq530sl7018pkkc7l6cjj3bbhd";
+    rev = "18ddc983d77b2a97e6c322abcc23bec59940d65f";
+    sha256 = "1rg7ydvnhlg8w6blilm3cv6v4q51x1hgrbkln2ikhpdq0vakp5fd";
   };
 
-  depsSha256 = "0srxv0wbhvyflc967lkpd2mx5nk7asx2cbxa0qxvas16wy6vxz52";
+  depsSha256 = "1n4rxipna307r4xppb2iaads7kpa3yjv99fimvpn8l0f999ir2rz";
 
   meta = {
     description = "Ethereum function call encoding (ABI) utility";

From bb2eb5b0e8d18424e87918819c9291f3b697e92f Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Tue, 11 Apr 2017 03:22:32 -0500
Subject: [PATCH 13/65] ibtool: use xib2nib src

---
 pkgs/development/tools/ibtool/default.nix   | 22 +++++++++++++++++++++
 pkgs/development/tools/ibtool/nsplist.nix   | 14 +++++++++++++
 pkgs/development/tools/ibtool/plist-cpp.nix | 14 +++++++++++++
 pkgs/os-specific/darwin/ibtool/default.nix  | 20 -------------------
 pkgs/top-level/all-packages.nix             |  2 +-
 5 files changed, 51 insertions(+), 21 deletions(-)
 create mode 100644 pkgs/development/tools/ibtool/default.nix
 create mode 100644 pkgs/development/tools/ibtool/nsplist.nix
 create mode 100644 pkgs/development/tools/ibtool/plist-cpp.nix
 delete mode 100644 pkgs/os-specific/darwin/ibtool/default.nix

diff --git a/pkgs/development/tools/ibtool/default.nix b/pkgs/development/tools/ibtool/default.nix
new file mode 100644
index 000000000000..17b9a77a7a18
--- /dev/null
+++ b/pkgs/development/tools/ibtool/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, callPackage, fetchFromGitHub, pugixml, boost }:
+
+let
+
+  NSPlist = callPackage ./nsplist.nix { };
+  PlistCpp = callPackage ./plist-cpp.nix { inherit NSPlist; };
+
+in
+
+stdenv.mkDerivation {
+  name = "xib2nib-730e177";
+
+  src = fetchFromGitHub {
+    owner = "matthewbauer";
+    repo = "xib2nib";
+    rev = "636fe783e8625bbdd7bfeaf85470ba3eb7b90359";
+    sha256 = "08fhx8rww95h1fpl1cwhd82bcqv1k51k542v4kawjf8w814g5y1c";
+  };
+
+  buildInputs = [ PlistCpp pugixml boost ];
+  makeFlags = [ "PREFIX=$(out)" ];
+}
diff --git a/pkgs/development/tools/ibtool/nsplist.nix b/pkgs/development/tools/ibtool/nsplist.nix
new file mode 100644
index 000000000000..557cb5b3bd58
--- /dev/null
+++ b/pkgs/development/tools/ibtool/nsplist.nix
@@ -0,0 +1,14 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation {
+  name = "nsplist-713decf";
+
+  src = fetchFromGitHub {
+    owner = "matthewbauer";
+    repo = "NSPlist";
+    rev = "713decf06c1ef6c39a707bc99eb45ac9925f2b8a";
+    sha256 = "0v4yfiwfd08hmh2ydgy6pnmlzjbd96k78dsla9pfd56ka89aw74r";
+  };
+
+  buildInputs = [ cmake ];
+}
diff --git a/pkgs/development/tools/ibtool/plist-cpp.nix b/pkgs/development/tools/ibtool/plist-cpp.nix
new file mode 100644
index 000000000000..3e15489898d7
--- /dev/null
+++ b/pkgs/development/tools/ibtool/plist-cpp.nix
@@ -0,0 +1,14 @@
+{ stdenv, fetchFromGitHub, cmake, boost, NSPlist, pugixml }:
+
+stdenv.mkDerivation {
+  name = "plistcpp-11615d";
+
+  src = fetchFromGitHub {
+    owner = "matthewbauer";
+    repo = "PlistCpp";
+    rev = "11615deab3369356a182dabbf5bae30574967264";
+    sha256 = "10jn6bvm9vn6492zix2pd724v5h4lccmkqg3lxfw8r0qg3av0yzv";
+  };
+
+  buildInputs = [ cmake boost NSPlist pugixml ];
+}
diff --git a/pkgs/os-specific/darwin/ibtool/default.nix b/pkgs/os-specific/darwin/ibtool/default.nix
deleted file mode 100644
index 556426ac62d9..000000000000
--- a/pkgs/os-specific/darwin/ibtool/default.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ stdenv }:
-
-assert stdenv.isDarwin;
-
-stdenv.mkDerivation {
-  name = "ibtool";
-  src = "/usr/bin/ibtool";
-
-  unpackPhase = "true";
-  dontBuild = true;
-
-  installPhase = ''
-    mkdir -p "$out"/bin
-    ln -s "$src" "$out"/bin
-  '';
-
-  meta = with stdenv.lib; {
-    platforms   = platforms.darwin;
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 30f6598f975c..9c909a49a97c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18408,5 +18408,5 @@ with pkgs;
 
   messenger-for-desktop = callPackage ../applications/networking/instant-messengers/messenger-for-desktop {};
 
-  ibtool = callPackage ../os-specific/darwin/ibtool {};
+  ibtool = callPackage ../development/tools/ibtool {};
 }

From 3ab45f4b369c9c741b55ddedeaac4c797dc61c04 Mon Sep 17 00:00:00 2001
From: Franz Pletz <fpletz@fnordicwalking.de>
Date: Tue, 11 Apr 2017 18:08:51 +0200
Subject: [PATCH 14/65] treewide: use boolToString function

---
 lib/trivial.nix                               |  5 ++++
 .../config/fonts/fontconfig-penultimate.nix   |  2 +-
 nixos/modules/config/fonts/fontconfig.nix     |  2 +-
 nixos/modules/services/cluster/kubernetes.nix | 14 +++++------
 .../continuous-integration/hydra/default.nix  |  2 +-
 .../modules/services/databases/cassandra.nix  |  8 +++---
 nixos/modules/services/databases/mongodb.nix  |  2 --
 nixos/modules/services/logging/graylog.nix    |  5 ++--
 nixos/modules/services/misc/cgminer.nix       |  2 +-
 nixos/modules/services/misc/confd.nix         |  2 +-
 .../modules/services/misc/matrix-synapse.nix  | 25 +++++++++----------
 nixos/modules/services/misc/nix-daemon.nix    |  4 +--
 .../services/misc/taskserver/default.nix      |  2 +-
 .../modules/services/monitoring/collectd.nix  |  2 +-
 nixos/modules/services/monitoring/grafana.nix | 12 ++++-----
 .../services/network-filesystems/netatalk.nix |  2 +-
 .../services/network-filesystems/samba.nix    |  2 +-
 .../services/network-filesystems/tahoe.nix    |  6 ++---
 nixos/modules/services/networking/aiccu.nix   | 15 ++++++-----
 nixos/modules/services/networking/btsync.nix  |  9 +++----
 .../networking/firefox/sync-server.nix        |  2 +-
 nixos/modules/services/networking/i2pd.nix    | 20 +++++++--------
 .../networking/ircd-hybrid/default.nix        |  2 +-
 .../modules/services/networking/mosquitto.nix |  2 +-
 nixos/modules/services/networking/murmur.nix  | 10 ++++----
 nixos/modules/services/networking/prosody.nix |  4 +--
 nixos/modules/services/networking/sslh.nix    |  2 +-
 nixos/modules/services/networking/znc.nix     |  2 +-
 .../services/security/oauth2_proxy.nix        | 17 ++++++-------
 .../modules/services/torrent/transmission.nix |  3 +--
 .../services/web-apps/atlassian/crowd.nix     |  2 +-
 .../services/web-apps/quassel-webserver.nix   |  4 +--
 nixos/modules/services/web-apps/tt-rss.nix    |  2 --
 .../services/x11/display-managers/sddm.nix    |  2 +-
 .../services/x11/hardware/multitouch.nix      |  2 +-
 .../java-modules/build-maven-package.nix      |  2 +-
 .../ocaml-modules/mtime/default.nix           | 10 +++++---
 .../ocaml-modules/nocrypto/default.nix        |  2 +-
 .../ocaml-modules/notty/default.nix           |  2 +-
 pkgs/development/ocaml-modules/vg/default.nix | 14 ++++++-----
 40 files changed, 111 insertions(+), 118 deletions(-)

diff --git a/lib/trivial.nix b/lib/trivial.nix
index acbd687dd98f..62906339e605 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -30,6 +30,11 @@ rec {
   /* boolean “and” */
   and = x: y: x && y;
 
+  /* Convert a boolean to a string.
+     Note that toString on a bool returns "1" and "".
+  */
+  boolToString = b: if b then "true" else "false";
+
   /* Merge two attribute sets shallowly, right side trumps left
 
      Example:
diff --git a/nixos/modules/config/fonts/fontconfig-penultimate.nix b/nixos/modules/config/fonts/fontconfig-penultimate.nix
index 83d6532774e3..3e163b8ec51e 100644
--- a/nixos/modules/config/fonts/fontconfig-penultimate.nix
+++ b/nixos/modules/config/fonts/fontconfig-penultimate.nix
@@ -5,7 +5,7 @@ with lib;
 let
   cfg = config.fonts.fontconfig;
 
-  fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
+  fcBool = x: "<bool>" + (boolToString x) + "</bool>";
 
   # back-supported fontconfig version and package
   # version is used for font cache generation
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index d44b583447a3..12f5ca2e7993 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -20,7 +20,7 @@ with lib;
 
 let cfg = config.fonts.fontconfig;
 
-    fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
+    fcBool = x: "<bool>" + (boolToString x) + "</bool>";
 
     # back-supported fontconfig version and package
     # version is used for font cache generation
diff --git a/nixos/modules/services/cluster/kubernetes.nix b/nixos/modules/services/cluster/kubernetes.nix
index 9ccc7295019a..bf7b44c698cb 100644
--- a/nixos/modules/services/cluster/kubernetes.nix
+++ b/nixos/modules/services/cluster/kubernetes.nix
@@ -612,8 +612,8 @@ in {
             --require-kubeconfig \
             --address=${cfg.kubelet.address} \
             --port=${toString cfg.kubelet.port} \
-            --register-node=${if cfg.kubelet.registerNode then "true" else "false"} \
-            --register-schedulable=${if cfg.kubelet.registerSchedulable then "true" else "false"} \
+            --register-node=${boolToString cfg.kubelet.registerNode} \
+            --register-schedulable=${boolToString cfg.kubelet.registerSchedulable} \
             ${optionalString (cfg.kubelet.tlsCertFile != null)
               "--tls-cert-file=${cfg.kubelet.tlsCertFile}"} \
             ${optionalString (cfg.kubelet.tlsKeyFile != null)
@@ -621,7 +621,7 @@ in {
             --healthz-bind-address=${cfg.kubelet.healthz.bind} \
             --healthz-port=${toString cfg.kubelet.healthz.port} \
             --hostname-override=${cfg.kubelet.hostname} \
-            --allow-privileged=${if cfg.kubelet.allowPrivileged then "true" else "false"} \
+            --allow-privileged=${boolToString cfg.kubelet.allowPrivileged} \
             --root-dir=${cfg.dataDir} \
             --cadvisor_port=${toString cfg.kubelet.cadvisorPort} \
             ${optionalString (cfg.kubelet.clusterDns != "")
@@ -670,14 +670,14 @@ in {
             --bind-address=0.0.0.0 \
             ${optionalString (cfg.apiserver.advertiseAddress != null)
               "--advertise-address=${cfg.apiserver.advertiseAddress}"} \
-            --allow-privileged=${if cfg.apiserver.allowPrivileged then "true" else "false"} \
+            --allow-privileged=${boolToString cfg.apiserver.allowPrivileged}\
             ${optionalString (cfg.apiserver.tlsCertFile != null)
               "--tls-cert-file=${cfg.apiserver.tlsCertFile}"} \
             ${optionalString (cfg.apiserver.tlsKeyFile != null)
               "--tls-private-key-file=${cfg.apiserver.tlsKeyFile}"} \
             ${optionalString (cfg.apiserver.tokenAuth != null)
               "--token-auth-file=${cfg.apiserver.tokenAuth}"} \
-            --kubelet-https=${if cfg.apiserver.kubeletHttps then "true" else "false"} \
+            --kubelet-https=${boolToString cfg.apiserver.kubeletHttps} \
             ${optionalString (cfg.apiserver.kubeletClientCaFile != null)
               "--kubelet-certificate-authority=${cfg.apiserver.kubeletClientCaFile}"} \
             ${optionalString (cfg.apiserver.kubeletClientCertFile != null)
@@ -719,7 +719,7 @@ in {
           ExecStart = ''${cfg.package}/bin/kube-scheduler \
             --address=${cfg.scheduler.address} \
             --port=${toString cfg.scheduler.port} \
-            --leader-elect=${if cfg.scheduler.leaderElect then "true" else "false"} \
+            --leader-elect=${boolToString cfg.scheduler.leaderElect} \
             --kubeconfig=${kubeconfig} \
             ${optionalString cfg.verbose "--v=6"} \
             ${optionalString cfg.verbose "--log-flush-frequency=1s"} \
@@ -744,7 +744,7 @@ in {
             --address=${cfg.controllerManager.address} \
             --port=${toString cfg.controllerManager.port} \
             --kubeconfig=${kubeconfig} \
-            --leader-elect=${if cfg.controllerManager.leaderElect then "true" else "false"} \
+            --leader-elect=${boolToString cfg.controllerManager.leaderElect} \
             ${if (cfg.controllerManager.serviceAccountKeyFile!=null)
               then "--service-account-private-key-file=${cfg.controllerManager.serviceAccountKeyFile}"
               else "--service-account-private-key-file=/var/run/kubernetes/apiserver.key"} \
diff --git a/nixos/modules/services/continuous-integration/hydra/default.nix b/nixos/modules/services/continuous-integration/hydra/default.nix
index fa550f68b338..57f592a2e550 100644
--- a/nixos/modules/services/continuous-integration/hydra/default.nix
+++ b/nixos/modules/services/continuous-integration/hydra/default.nix
@@ -328,7 +328,7 @@ in
           IN_SYSTEMD = "1"; # to get log severity levels
         };
         serviceConfig =
-          { ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v --option build-use-substitutes ${if cfg.useSubstitutes then "true" else "false"}";
+          { ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v --option build-use-substitutes ${boolToString cfg.useSubstitutes}";
             ExecStopPost = "${cfg.package}/bin/hydra-queue-runner --unlock";
             User = "hydra-queue-runner";
             Restart = "always";
diff --git a/nixos/modules/services/databases/cassandra.nix b/nixos/modules/services/databases/cassandra.nix
index 5df4ae57f809..1e5cd8f54130 100644
--- a/nixos/modules/services/databases/cassandra.nix
+++ b/nixos/modules/services/databases/cassandra.nix
@@ -21,8 +21,8 @@ let
   cassandraConf = ''
     cluster_name: ${cfg.clusterName}
     num_tokens: 256
-    auto_bootstrap: ${if cfg.autoBootstrap then "true" else "false"}
-    hinted_handoff_enabled: ${if cfg.hintedHandOff then "true" else "false"}
+    auto_bootstrap: ${boolToString cfg.autoBootstrap}
+    hinted_handoff_enabled: ${boolToString cfg.hintedHandOff}
     hinted_handoff_throttle_in_kb: ${builtins.toString cfg.hintedHandOffThrottle}
     max_hints_delivery_threads: 2
     max_hint_window_in_ms: 10800000 # 3 hours
@@ -62,7 +62,7 @@ let
     rpc_keepalive: true
     rpc_server_type: sync
     thrift_framed_transport_size_in_mb: 15
-    incremental_backups: ${if cfg.incrementalBackups then "true" else "false"}
+    incremental_backups: ${boolToString cfg.incrementalBackups}
     snapshot_before_compaction: false
     auto_snapshot: true
     column_index_size_in_kb: 64
@@ -89,7 +89,7 @@ let
       truststore: ${cfg.trustStorePath}
       truststore_password: ${cfg.trustStorePassword}
     client_encryption_options:
-      enabled: ${if cfg.clientEncryption then "true" else "false"}
+      enabled: ${boolToString cfg.clientEncryption}
       keystore: ${cfg.keyStorePath}
       keystore_password: ${cfg.keyStorePassword}
     internode_compression: all
diff --git a/nixos/modules/services/databases/mongodb.nix b/nixos/modules/services/databases/mongodb.nix
index 38e46a0c6ef9..c56564f57f36 100644
--- a/nixos/modules/services/databases/mongodb.nix
+++ b/nixos/modules/services/databases/mongodb.nix
@@ -4,8 +4,6 @@ with lib;
 
 let
 
-  b2s = x: if x then "true" else "false";
-
   cfg = config.services.mongodb;
 
   mongodb = cfg.package;
diff --git a/nixos/modules/services/logging/graylog.nix b/nixos/modules/services/logging/graylog.nix
index 95283096662e..9f0fb11f0252 100644
--- a/nixos/modules/services/logging/graylog.nix
+++ b/nixos/modules/services/logging/graylog.nix
@@ -4,16 +4,15 @@ with lib;
 
 let
   cfg = config.services.graylog;
-  configBool = b: if b then "true" else "false";
 
   confFile = pkgs.writeText "graylog.conf" ''
-    is_master = ${configBool cfg.isMaster}
+    is_master = ${boolToString cfg.isMaster}
     node_id_file = ${cfg.nodeIdFile}
     password_secret = ${cfg.passwordSecret}
     root_username = ${cfg.rootUsername}
     root_password_sha2 = ${cfg.rootPasswordSha2}
     elasticsearch_cluster_name = ${cfg.elasticsearchClusterName}
-    elasticsearch_discovery_zen_ping_multicast_enabled = ${configBool cfg.elasticsearchDiscoveryZenPingMulticastEnabled}
+    elasticsearch_discovery_zen_ping_multicast_enabled = ${boolToString cfg.elasticsearchDiscoveryZenPingMulticastEnabled}
     elasticsearch_discovery_zen_ping_unicast_hosts = ${cfg.elasticsearchDiscoveryZenPingUnicastHosts}
     message_journal_dir = ${cfg.messageJournalDir}
     mongodb_uri = ${cfg.mongodbUri}
diff --git a/nixos/modules/services/misc/cgminer.nix b/nixos/modules/services/misc/cgminer.nix
index 5f97cc034148..d5071d8ff767 100644
--- a/nixos/modules/services/misc/cgminer.nix
+++ b/nixos/modules/services/misc/cgminer.nix
@@ -6,7 +6,7 @@ let
   cfg = config.services.cgminer;
 
   convType = with builtins;
-    v: if isBool v then (if v then "true" else "false") else toString v;
+    v: if isBool v then boolToString v else toString v;
   mergedHwConfig =
     mapAttrsToList (n: v: ''"${n}": "${(concatStringsSep "," (map convType v))}"'')
       (foldAttrs (n: a: [n] ++ a) [] cfg.hardware);
diff --git a/nixos/modules/services/misc/confd.nix b/nixos/modules/services/misc/confd.nix
index fe13013286b8..8e9bec15dd4f 100755
--- a/nixos/modules/services/misc/confd.nix
+++ b/nixos/modules/services/misc/confd.nix
@@ -12,7 +12,7 @@ let
     nodes = [ ${concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ]
     prefix = "${cfg.prefix}"
     log-level = "${cfg.logLevel}"
-    watch = ${if cfg.watch then "true" else "false"}
+    watch = ${boolToString cfg.watch}
   '';
 
 in {
diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix
index 4a1bea50c14e..ae9826968b1f 100644
--- a/nixos/modules/services/misc/matrix-synapse.nix
+++ b/nixos/modules/services/misc/matrix-synapse.nix
@@ -5,9 +5,8 @@ with lib;
 let
   cfg = config.services.matrix-synapse;
   logConfigFile = pkgs.writeText "log_config.yaml" cfg.logConfig;
-  mkResource = r: ''{names: ${builtins.toJSON r.names}, compress: ${fromBool r.compress}}'';
-  mkListener = l: ''{port: ${toString l.port}, bind_address: "${l.bind_address}", type: ${l.type}, tls: ${fromBool l.tls}, x_forwarded: ${fromBool l.x_forwarded}, resources: [${concatStringsSep "," (map mkResource l.resources)}]}'';
-  fromBool = x: if x then "true" else "false";
+  mkResource = r: ''{names: ${builtins.toJSON r.names}, compress: ${boolToString r.compress}}'';
+  mkListener = l: ''{port: ${toString l.port}, bind_address: "${l.bind_address}", type: ${l.type}, tls: ${boolToString l.tls}, x_forwarded: ${boolToString l.x_forwarded}, resources: [${concatStringsSep "," (map mkResource l.resources)}]}'';
   configFile = pkgs.writeText "homeserver.yaml" ''
 ${optionalString (cfg.tls_certificate_path != null) ''
 tls_certificate_path: "${cfg.tls_certificate_path}"
@@ -18,7 +17,7 @@ tls_private_key_path: "${cfg.tls_private_key_path}"
 ${optionalString (cfg.tls_dh_params_path != null) ''
 tls_dh_params_path: "${cfg.tls_dh_params_path}"
 ''}
-no_tls: ${fromBool cfg.no_tls}
+no_tls: ${boolToString cfg.no_tls}
 ${optionalString (cfg.bind_port != null) ''
 bind_port: ${toString cfg.bind_port}
 ''}
@@ -30,7 +29,7 @@ bind_host: "${cfg.bind_host}"
 ''}
 server_name: "${cfg.server_name}"
 pid_file: "/var/run/matrix-synapse.pid"
-web_client: ${fromBool cfg.web_client}
+web_client: ${boolToString cfg.web_client}
 ${optionalString (cfg.public_baseurl != null) ''
 public_baseurl: "${cfg.public_baseurl}"
 ''}
@@ -58,8 +57,8 @@ media_store_path: "/var/lib/matrix-synapse/media"
 uploads_path: "/var/lib/matrix-synapse/uploads"
 max_upload_size: "${cfg.max_upload_size}"
 max_image_pixels: "${cfg.max_image_pixels}"
-dynamic_thumbnails: ${fromBool cfg.dynamic_thumbnails}
-url_preview_enabled: ${fromBool cfg.url_preview_enabled}
+dynamic_thumbnails: ${boolToString cfg.dynamic_thumbnails}
+url_preview_enabled: ${boolToString cfg.url_preview_enabled}
 ${optionalString (cfg.url_preview_enabled == true) ''
 url_preview_ip_range_blacklist: ${builtins.toJSON cfg.url_preview_ip_range_blacklist}
 url_preview_ip_range_whitelist: ${builtins.toJSON cfg.url_preview_ip_range_whitelist}
@@ -67,10 +66,10 @@ url_preview_url_blacklist: ${builtins.toJSON cfg.url_preview_url_blacklist}
 ''}
 recaptcha_private_key: "${cfg.recaptcha_private_key}"
 recaptcha_public_key: "${cfg.recaptcha_public_key}"
-enable_registration_captcha: ${fromBool cfg.enable_registration_captcha}
+enable_registration_captcha: ${boolToString cfg.enable_registration_captcha}
 turn_uris: ${builtins.toJSON cfg.turn_uris}
 turn_shared_secret: "${cfg.turn_shared_secret}"
-enable_registration: ${fromBool cfg.enable_registration}
+enable_registration: ${boolToString cfg.enable_registration}
 ${optionalString (cfg.registration_shared_secret != null) ''
 registration_shared_secret: "${cfg.registration_shared_secret}"
 ''}
@@ -78,15 +77,15 @@ recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify"
 turn_user_lifetime: "${cfg.turn_user_lifetime}"
 user_creation_max_duration: ${cfg.user_creation_max_duration}
 bcrypt_rounds: ${cfg.bcrypt_rounds}
-allow_guest_access: ${fromBool cfg.allow_guest_access}
+allow_guest_access: ${boolToString cfg.allow_guest_access}
 trusted_third_party_id_servers: ${builtins.toJSON cfg.trusted_third_party_id_servers}
 room_invite_state_types: ${builtins.toJSON cfg.room_invite_state_types}
 ${optionalString (cfg.macaroon_secret_key != null) ''
   macaroon_secret_key: "${cfg.macaroon_secret_key}"
 ''}
-expire_access_token: ${fromBool cfg.expire_access_token}
-enable_metrics: ${fromBool cfg.enable_metrics}
-report_stats: ${fromBool cfg.report_stats}
+expire_access_token: ${boolToString cfg.expire_access_token}
+enable_metrics: ${boolToString cfg.enable_metrics}
+report_stats: ${boolToString cfg.report_stats}
 signing_key_path: "/var/lib/matrix-synapse/homeserver.signing.key"
 key_refresh_interval: "${cfg.key_refresh_interval}"
 perspectives:
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 4fe89838e29d..bf1304ee7ac2 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -41,12 +41,12 @@ let
         build-users-group = nixbld
         build-max-jobs = ${toString (cfg.maxJobs)}
         build-cores = ${toString (cfg.buildCores)}
-        build-use-sandbox = ${if (builtins.isBool cfg.useSandbox) then (if cfg.useSandbox then "true" else "false") else cfg.useSandbox}
+        build-use-sandbox = ${if (builtins.isBool cfg.useSandbox) then boolToString cfg.useSandbox else cfg.useSandbox}
         build-sandbox-paths = ${toString cfg.sandboxPaths} /bin/sh=${sh} $(echo $extraPaths)
         binary-caches = ${toString cfg.binaryCaches}
         trusted-binary-caches = ${toString cfg.trustedBinaryCaches}
         binary-cache-public-keys = ${toString cfg.binaryCachePublicKeys}
-        auto-optimise-store = ${if cfg.autoOptimiseStore then "true" else "false"}
+        auto-optimise-store = ${boolToString cfg.autoOptimiseStore}
         ${optionalString cfg.requireSignedBinaryCaches ''
           signed-binary-caches = *
         ''}
diff --git a/nixos/modules/services/misc/taskserver/default.nix b/nixos/modules/services/misc/taskserver/default.nix
index ba9f52f1904b..ab9a6ce32f46 100644
--- a/nixos/modules/services/misc/taskserver/default.nix
+++ b/nixos/modules/services/misc/taskserver/default.nix
@@ -128,7 +128,7 @@ let
         certBits = cfg.pki.auto.bits;
         clientExpiration = cfg.pki.auto.expiration.client;
         crlExpiration = cfg.pki.auto.expiration.crl;
-        isAutoConfig = if needToCreateCA then "True" else "False";
+        isAutoConfig = boolToString needToCreateCA;
       }}" > "$out/main.py"
       cat > "$out/setup.py" <<EOF
       from setuptools import setup
diff --git a/nixos/modules/services/monitoring/collectd.nix b/nixos/modules/services/monitoring/collectd.nix
index 641da60e9adc..79a8a1ff5aed 100644
--- a/nixos/modules/services/monitoring/collectd.nix
+++ b/nixos/modules/services/monitoring/collectd.nix
@@ -8,7 +8,7 @@ let
   conf = pkgs.writeText "collectd.conf" ''
     BaseDir "${cfg.dataDir}"
     PIDFile "${cfg.pidFile}"
-    AutoLoadPlugin ${if cfg.autoLoadPlugin then "true" else "false"}
+    AutoLoadPlugin ${boolToString cfg.autoLoadPlugin}
     Hostname "${config.networking.hostName}"
 
     LoadPlugin syslog
diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix
index 97806d5d83eb..4fbacef788f9 100644
--- a/nixos/modules/services/monitoring/grafana.nix
+++ b/nixos/modules/services/monitoring/grafana.nix
@@ -5,8 +5,6 @@ with lib;
 let
   cfg = config.services.grafana;
 
-  b2s = val: if val then "true" else "false";
-
   envOptions = {
     PATHS_DATA = cfg.dataDir;
     PATHS_PLUGINS = "${cfg.dataDir}/plugins";
@@ -32,16 +30,16 @@ let
     SECURITY_ADMIN_PASSWORD = cfg.security.adminPassword;
     SECURITY_SECRET_KEY = cfg.security.secretKey;
 
-    USERS_ALLOW_SIGN_UP = b2s cfg.users.allowSignUp;
-    USERS_ALLOW_ORG_CREATE = b2s cfg.users.allowOrgCreate;
-    USERS_AUTO_ASSIGN_ORG = b2s cfg.users.autoAssignOrg;
+    USERS_ALLOW_SIGN_UP = boolToString cfg.users.allowSignUp;
+    USERS_ALLOW_ORG_CREATE = boolToString cfg.users.allowOrgCreate;
+    USERS_AUTO_ASSIGN_ORG = boolToString cfg.users.autoAssignOrg;
     USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
 
-    AUTH_ANONYMOUS_ENABLED = b2s cfg.auth.anonymous.enable;
+    AUTH_ANONYMOUS_ENABLED = boolToString cfg.auth.anonymous.enable;
     AUTH_ANONYMOUS_ORG_NAME = cfg.auth.anonymous.org_name;
     AUTH_ANONYMOUS_ORG_ROLE = cfg.auth.anonymous.org_role;
 
-    ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable;
+    ANALYTICS_REPORTING_ENABLED = boolToString cfg.analytics.reporting.enable;
   } // cfg.extraOptions;
 
 in {
diff --git a/nixos/modules/services/network-filesystems/netatalk.nix b/nixos/modules/services/network-filesystems/netatalk.nix
index bff54406a2b0..1dd869043f0c 100644
--- a/nixos/modules/services/network-filesystems/netatalk.nix
+++ b/nixos/modules/services/network-filesystems/netatalk.nix
@@ -9,7 +9,7 @@ let
   extmapFile = pkgs.writeText "extmap.conf" cfg.extmap;
 
   afpToString = x: if builtins.typeOf x == "bool"
-                   then (if x then "true" else "false")
+                   then boolToString x
                    else toString x;
 
   volumeConfig = name:
diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix
index 6ae5292fc303..87c4f7a8ebcb 100644
--- a/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixos/modules/services/network-filesystems/samba.nix
@@ -5,7 +5,7 @@ with lib;
 let
 
   smbToString = x: if builtins.typeOf x == "bool"
-                   then (if x then "true" else "false")
+                   then boolToString x
                    else toString x;
 
   cfg = config.services.samba;
diff --git a/nixos/modules/services/network-filesystems/tahoe.nix b/nixos/modules/services/network-filesystems/tahoe.nix
index 3d78ac096a2b..9815a5434ee3 100644
--- a/nixos/modules/services/network-filesystems/tahoe.nix
+++ b/nixos/modules/services/network-filesystems/tahoe.nix
@@ -290,14 +290,14 @@ in
                 shares.total = ${toString settings.client.shares.total}
 
                 [storage]
-                enabled = ${if settings.storage.enable then "true" else "false"}
+                enabled = ${boolToString settings.storage.enable}
                 reserved_space = ${settings.storage.reservedSpace}
 
                 [helper]
-                enabled = ${if settings.helper.enable then "true" else "false"}
+                enabled = ${boolToString settings.helper.enable}
 
                 [sftpd]
-                enabled = ${if settings.sftpd.enable then "true" else "false"}
+                enabled = ${boolToString settings.sftpd.enable}
                 ${optionalString (settings.sftpd.port != null)
                   "port = ${toString settings.sftpd.port}"}
                 ${optionalString (settings.sftpd.hostPublicKeyFile != null)
diff --git a/nixos/modules/services/networking/aiccu.nix b/nixos/modules/services/networking/aiccu.nix
index aeb0910d6246..ac755270951b 100644
--- a/nixos/modules/services/networking/aiccu.nix
+++ b/nixos/modules/services/networking/aiccu.nix
@@ -5,7 +5,6 @@ with lib;
 let
 
   cfg = config.services.aiccu;
-  showBool = b: if b then "true" else "false";
   notNull = a: ! isNull a;
   configFile = pkgs.writeText "aiccu.conf" ''
     ${if notNull cfg.username then "username " + cfg.username else ""}
@@ -13,16 +12,16 @@ let
     protocol ${cfg.protocol}
     server ${cfg.server}
     ipv6_interface ${cfg.interfaceName}
-    verbose ${showBool cfg.verbose}
+    verbose ${boolToString cfg.verbose}
     daemonize true
-    automatic ${showBool cfg.automatic}
-    requiretls ${showBool cfg.requireTLS}
+    automatic ${boolToString cfg.automatic}
+    requiretls ${boolToString cfg.requireTLS}
     pidfile ${cfg.pidFile}
-    defaultroute ${showBool cfg.defaultRoute}
+    defaultroute ${boolToString cfg.defaultRoute}
     ${if notNull cfg.setupScript then cfg.setupScript else ""}
-    makebeats ${showBool cfg.makeHeartBeats}
-    noconfigure ${showBool cfg.noConfigure}
-    behindnat ${showBool cfg.behindNAT}
+    makebeats ${boolToString cfg.makeHeartBeats}
+    noconfigure ${boolToString cfg.noConfigure}
+    behindnat ${boolToString cfg.behindNAT}
     ${if cfg.localIPv4Override then "local_ipv4_override" else ""}
   '';
 
diff --git a/nixos/modules/services/networking/btsync.nix b/nixos/modules/services/networking/btsync.nix
index 92e9fa7be419..6e479a5860ac 100644
--- a/nixos/modules/services/networking/btsync.nix
+++ b/nixos/modules/services/networking/btsync.nix
@@ -9,7 +9,6 @@ let
 
   listenAddr = cfg.httpListenAddr + ":" + (toString cfg.httpListenPort);
 
-  boolStr = x: if x then "true" else "false";
   optionalEmptyStr = b: v: optionalString (b != "") v;
 
   webUIConfig = optionalString cfg.enableWebUI
@@ -31,7 +30,7 @@ let
   sharedFoldersRecord =
     concatStringsSep "," (map (entry:
       let helper = attr: v:
-        if (entry ? attr) then boolStr entry.attr else boolStr v;
+        if (entry ? attr) then boolToString entry.attr else boolToString v;
       in
       ''
         {
@@ -65,11 +64,11 @@ let
         "listening_port":  ${toString cfg.listeningPort},
         "use_gui":         false,
 
-        "check_for_updates": ${boolStr cfg.checkForUpdates},
-        "use_upnp":          ${boolStr cfg.useUpnp},
+        "check_for_updates": ${boolToString cfg.checkForUpdates},
+        "use_upnp":          ${boolToString cfg.useUpnp},
         "download_limit":    ${toString cfg.downloadLimit},
         "upload_limit":      ${toString cfg.uploadLimit},
-        "lan_encrypt_data":  ${boolStr cfg.encryptLAN},
+        "lan_encrypt_data":  ${boolToString cfg.encryptLAN},
 
         ${webUIConfig}
         ${sharedFoldersConfig}
diff --git a/nixos/modules/services/networking/firefox/sync-server.nix b/nixos/modules/services/networking/firefox/sync-server.nix
index 5c14ceff6a0d..3a95b9c4ec94 100644
--- a/nixos/modules/services/networking/firefox/sync-server.nix
+++ b/nixos/modules/services/networking/firefox/sync-server.nix
@@ -19,7 +19,7 @@ let
     [syncserver]
     public_url = ${cfg.publicUrl}
     ${optionalString (cfg.sqlUri != "") "sqluri = ${cfg.sqlUri}"}
-    allow_new_users = ${if cfg.allowNewUsers then "true" else "false"}
+    allow_new_users = ${boolToString cfg.allowNewUsers}
 
     [browserid]
     backend = tokenserver.verifiers.LocalVerifier
diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix
index c5b27350b3c2..24a3196bed46 100644
--- a/nixos/modules/services/networking/i2pd.nix
+++ b/nixos/modules/services/networking/i2pd.nix
@@ -10,8 +10,6 @@ let
 
   extip = "EXTIP=\$(${pkgs.curl.bin}/bin/curl -sLf \"http://jsonip.com\" | ${pkgs.gawk}/bin/awk -F'\"' '{print $4}')";
 
-  toYesNo = b: if b then "true" else "false";
-
   mkEndpointOpt = name: addr: port: {
     enable = mkEnableOption name;
     name = mkOption {
@@ -76,10 +74,10 @@ let
 
   i2pdConf = pkgs.writeText "i2pd.conf"
   ''
-  ipv4 = ${toYesNo cfg.enableIPv4}
-  ipv6 = ${toYesNo cfg.enableIPv6}
-  notransit = ${toYesNo cfg.notransit}
-  floodfill = ${toYesNo cfg.floodfill}
+  ipv4 = ${boolToString cfg.enableIPv4}
+  ipv6 = ${boolToString cfg.enableIPv6}
+  notransit = ${boolToString cfg.notransit}
+  floodfill = ${boolToString cfg.floodfill}
   netid = ${toString cfg.netid}
   ${if isNull cfg.bandwidth then "" else "bandwidth = ${toString cfg.bandwidth}" }
   ${if isNull cfg.port then "" else "port = ${toString cfg.port}"}
@@ -88,14 +86,14 @@ let
   transittunnels = ${toString cfg.limits.transittunnels}
 
   [upnp]
-  enabled = ${toYesNo cfg.upnp.enable}
+  enabled = ${boolToString cfg.upnp.enable}
   name = ${cfg.upnp.name}
 
   [precomputation]
-  elgamal = ${toYesNo cfg.precomputation.elgamal}
+  elgamal = ${boolToString cfg.precomputation.elgamal}
 
   [reseed]
-  verify = ${toYesNo cfg.reseed.verify}
+  verify = ${boolToString cfg.reseed.verify}
   file = ${cfg.reseed.file}
   urls = ${builtins.concatStringsSep "," cfg.reseed.urls}
 
@@ -107,11 +105,11 @@ let
       (proto: let portStr = toString proto.port; in
         ''
           [${proto.name}]
-          enabled = ${toYesNo proto.enable}
+          enabled = ${boolToString proto.enable}
           address = ${proto.address}
           port = ${toString proto.port}
           ${if proto ? keys then "keys = ${proto.keys}" else ""}
-          ${if proto ? auth then "auth = ${toYesNo proto.auth}" else ""}
+          ${if proto ? auth then "auth = ${boolToString proto.auth}" else ""}
           ${if proto ? user then "user = ${proto.user}" else ""}
           ${if proto ? pass then "pass = ${proto.pass}" else ""}
           ${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""}
diff --git a/nixos/modules/services/networking/ircd-hybrid/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix
index ede57c5046d3..bd583fb020ec 100644
--- a/nixos/modules/services/networking/ircd-hybrid/default.nix
+++ b/nixos/modules/services/networking/ircd-hybrid/default.nix
@@ -12,7 +12,7 @@ let
     substFiles = [ "=>/conf" ./ircd.conf ];
     inherit (pkgs) ircdHybrid coreutils su iproute gnugrep procps;
 
-    ipv6Enabled = if config.networking.enableIPv6 then "true" else "false";
+    ipv6Enabled = boolToString config.networking.enableIPv6;
 
     inherit (cfg) serverName sid description adminEmail
             extraPort;
diff --git a/nixos/modules/services/networking/mosquitto.nix b/nixos/modules/services/networking/mosquitto.nix
index 2325424ff3c5..5451500b56f6 100644
--- a/nixos/modules/services/networking/mosquitto.nix
+++ b/nixos/modules/services/networking/mosquitto.nix
@@ -16,7 +16,7 @@ let
     pid_file /run/mosquitto/pid
     acl_file ${aclFile}
     persistence true
-    allow_anonymous ${if cfg.allowAnonymous then "true" else "false"}
+    allow_anonymous ${boolToString cfg.allowAnonymous}
     bind_address ${cfg.host}
     port ${toString cfg.port}
     ${listenerConf}
diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix
index 81f968ae9fe1..c961857c77af 100644
--- a/nixos/modules/services/networking/murmur.nix
+++ b/nixos/modules/services/networking/murmur.nix
@@ -26,21 +26,21 @@ let
 
     textmessagelength=${toString cfg.textMsgLength}
     imagemessagelength=${toString cfg.imgMsgLength}
-    allowhtml=${if cfg.allowHtml then "true" else "false"}
+    allowhtml=${boolToString cfg.allowHtml}
     logdays=${toString cfg.logDays}
-    bonjour=${if cfg.bonjour then "true" else "false"}
-    sendversion=${if cfg.sendVersion then "true" else "false"}
+    bonjour=${babelToString cfg.bonjour}
+    sendversion=${babelToString cfg.sendVersion}
 
     ${if cfg.registerName     == "" then "" else "registerName="+cfg.registerName}
     ${if cfg.registerPassword == "" then "" else "registerPassword="+cfg.registerPassword}
     ${if cfg.registerUrl      == "" then "" else "registerUrl="+cfg.registerUrl}
     ${if cfg.registerHostname == "" then "" else "registerHostname="+cfg.registerHostname}
 
-    certrequired=${if cfg.clientCertRequired then "true" else "false"}
+    certrequired=${babelToString cfg.clientCertRequired}
     ${if cfg.sslCert == "" then "" else "sslCert="+cfg.sslCert}
     ${if cfg.sslKey  == "" then "" else "sslKey="+cfg.sslKey}
     ${if cfg.sslCa   == "" then "" else "sslCA="+cfg.sslCa}
-    
+
     ${cfg.extraConfig}
   '';
 in
diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix
index feaa007de15e..fb9c9dc67f24 100644
--- a/nixos/modules/services/networking/prosody.nix
+++ b/nixos/modules/services/networking/prosody.nix
@@ -219,7 +219,7 @@ in
 
       data_path = "/var/lib/prosody"
 
-      allow_registration = ${ if cfg.allowRegistration then "true" else "false" };
+      allow_registration = ${boolToString cfg.allowRegistration};
 
       ${ optionalString cfg.modules.console "console_enabled = true;" }
 
@@ -244,7 +244,7 @@ in
 
       ${ lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: ''
         VirtualHost "${v.domain}"
-          enabled = ${if v.enabled then "true" else "false"};
+          enabled = ${boolToString v.enabled};
           ${ optionalString (v.ssl != null) (createSSLOptsStr v.ssl) }
           ${ v.extraConfig }
         '') cfg.virtualHosts) }
diff --git a/nixos/modules/services/networking/sslh.nix b/nixos/modules/services/networking/sslh.nix
index bd584a3a85d3..e3d65c49fbf2 100644
--- a/nixos/modules/services/networking/sslh.nix
+++ b/nixos/modules/services/networking/sslh.nix
@@ -5,7 +5,7 @@ with lib;
 let
   cfg = config.services.sslh;
   configFile = pkgs.writeText "sslh.conf" ''
-    verbose: ${if cfg.verbose then "true" else "false"};
+    verbose: ${boolToString cfg.verbose};
     foreground: true;
     inetd: false;
     numeric: false;
diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix
index 6d68b790e869..1c63d800e260 100644
--- a/nixos/modules/services/networking/znc.nix
+++ b/nixos/modules/services/networking/znc.nix
@@ -35,7 +35,7 @@ let
             Port = ${toString confOpts.port}
             IPv4 = true
             IPv6 = true
-            SSL = ${if confOpts.useSSL then "true" else "false"}
+            SSL = ${boolToString confOpts.useSSL}
     </Listener>
     
     <User ${confOpts.userName}>
diff --git a/nixos/modules/services/security/oauth2_proxy.nix b/nixos/modules/services/security/oauth2_proxy.nix
index caa7d9d50812..e292fd9851e3 100644
--- a/nixos/modules/services/security/oauth2_proxy.nix
+++ b/nixos/modules/services/security/oauth2_proxy.nix
@@ -10,9 +10,6 @@ let
   #   repeatedArgs (arg: "--arg=${arg}") args
   repeatedArgs = concatMapStringsSep " ";
 
-  # 'toString' doesn't quite do what we want for bools.
-  fromBool = x: if x then "true" else "false";
-
   # oauth2_proxy provides many options that are only relevant if you are using
   # a certain provider. This set maps from provider name to a function that
   # takes the configuration and returns a string that can be inserted into the
@@ -49,24 +46,24 @@ let
     --client-secret='${cfg.clientSecret}' \
     ${optionalString (!isNull cfg.cookie.domain) "--cookie-domain='${cfg.cookie.domain}'"} \
     --cookie-expire='${cfg.cookie.expire}' \
-    --cookie-httponly=${fromBool cfg.cookie.httpOnly} \
+    --cookie-httponly=${boolToString cfg.cookie.httpOnly} \
     --cookie-name='${cfg.cookie.name}' \
     --cookie-secret='${cfg.cookie.secret}' \
-    --cookie-secure=${fromBool cfg.cookie.secure} \
+    --cookie-secure=${boolToString cfg.cookie.secure} \
     ${optionalString (!isNull cfg.cookie.refresh) "--cookie-refresh='${cfg.cookie.refresh}'"} \
     ${optionalString (!isNull cfg.customTemplatesDir) "--custom-templates-dir='${cfg.customTemplatesDir}'"} \
     ${repeatedArgs (x: "--email-domain='${x}'") cfg.email.domains} \
     --http-address='${cfg.httpAddress}' \
-    ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${fromBool cfg.htpasswd.displayForm}"} \
+    ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${boolToString cfg.htpasswd.displayForm}"} \
     ${optionalString (!isNull cfg.loginURL) "--login-url='${cfg.loginURL}'"} \
-    --pass-access-token=${fromBool cfg.passAccessToken} \
-    --pass-basic-auth=${fromBool cfg.passBasicAuth} \
-    --pass-host-header=${fromBool cfg.passHostHeader} \
+    --pass-access-token=${boolToString cfg.passAccessToken} \
+    --pass-basic-auth=${boolToString cfg.passBasicAuth} \
+    --pass-host-header=${boolToString cfg.passHostHeader} \
     --proxy-prefix='${cfg.proxyPrefix}' \
     ${optionalString (!isNull cfg.profileURL) "--profile-url='${cfg.profileURL}'"} \
     ${optionalString (!isNull cfg.redeemURL) "--redeem-url='${cfg.redeemURL}'"} \
     ${optionalString (!isNull cfg.redirectURL) "--redirect-url='${cfg.redirectURL}'"} \
-    --request-logging=${fromBool cfg.requestLogging} \
+    --request-logging=${boolToString cfg.requestLogging} \
     ${optionalString (!isNull cfg.scope) "--scope='${cfg.scope}'"} \
     ${repeatedArgs (x: "--skip-auth-regex='${x}'") cfg.skipAuthRegexes} \
     ${optionalString (!isNull cfg.signatureKey) "--signature-key='${cfg.signatureKey}'"} \
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index 5b2e4ca16066..1f319df794b5 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -15,8 +15,7 @@ let
 
   # Strings must be quoted, ints and bools must not (for settings.json).
   toOption = x:
-    if x == true then "true"
-    else if x == false then "false"
+    if isBool x then boolToString x
     else if isInt x then toString x
     else toString ''"${x}"'';
 
diff --git a/nixos/modules/services/web-apps/atlassian/crowd.nix b/nixos/modules/services/web-apps/atlassian/crowd.nix
index ce41aa4f1e18..b54c91d7de92 100644
--- a/nixos/modules/services/web-apps/atlassian/crowd.nix
+++ b/nixos/modules/services/web-apps/atlassian/crowd.nix
@@ -137,7 +137,7 @@ in
 
         sed -e 's,port="8095",port="${toString cfg.listenPort}" address="${cfg.listenAddress}",' \
         '' + (lib.optionalString cfg.proxy.enable ''
-          -e 's,compression="on",compression="off" protocol="HTTP/1.1" proxyName="${cfg.proxy.name}" proxyPort="${toString cfg.proxy.port}" scheme="${cfg.proxy.scheme}" secure="${if cfg.proxy.secure then "true" else "false"}",' \
+          -e 's,compression="on",compression="off" protocol="HTTP/1.1" proxyName="${cfg.proxy.name}" proxyPort="${toString cfg.proxy.port}" scheme="${cfg.proxy.scheme}" secure="${boolToString cfg.proxy.secure}",' \
         '') + ''
           ${pkg}/apache-tomcat/conf/server.xml.dist > ${cfg.home}/server.xml
       '';
diff --git a/nixos/modules/services/web-apps/quassel-webserver.nix b/nixos/modules/services/web-apps/quassel-webserver.nix
index d19e4bc58277..2ba5698d6cb1 100644
--- a/nixos/modules/services/web-apps/quassel-webserver.nix
+++ b/nixos/modules/services/web-apps/quassel-webserver.nix
@@ -12,11 +12,11 @@ let
         port: ${toString cfg.quasselCorePort},  // quasselcore port
         initialBacklogLimit: ${toString cfg.initialBacklogLimit},  // Amount of backlogs to fetch per buffer on connection
         backlogLimit: ${toString cfg.backlogLimit},  // Amount of backlogs to fetch per buffer after first retrieval
-        securecore: ${if cfg.secureCore then "true" else "false"},  // Connect to the core using SSL
+        securecore: ${boolToString cfg.secureCore},  // Connect to the core using SSL
         theme: '${cfg.theme}'  // Default UI theme
       },
       themes: ['default', 'darksolarized'],  //  Available themes
-      forcedefault: ${if cfg.forceHostAndPort then "true" else "false"},  // Will force default host and port to be used, and will hide the corresponding fields in the UI
+      forcedefault: ${boolToString cfg.forceHostAndPort},  // Will force default host and port to be used, and will hide the corresponding fields in the UI
       prefixpath: '${cfg.prefixPath}'  // Configure this if you use a reverse proxy
     };
   '';
diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix
index 5193814da725..76b0ee6da968 100644
--- a/nixos/modules/services/web-apps/tt-rss.nix
+++ b/nixos/modules/services/web-apps/tt-rss.nix
@@ -6,8 +6,6 @@ let
 
   configVersion = 26;
 
-  boolToString = b: if b then "true" else "false";
-
   cacheDir = "cache";
   lockDir = "lock";
   feedIconsDir = "feed-icons";
diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix
index affc1261d196..99c03ca81c2d 100644
--- a/nixos/modules/services/x11/display-managers/sddm.nix
+++ b/nixos/modules/services/x11/display-managers/sddm.nix
@@ -59,7 +59,7 @@ let
     [Autologin]
     User=${cfg.autoLogin.user}
     Session=${defaultSessionName}.desktop
-    Relogin=${if cfg.autoLogin.relogin then "true" else "false"}
+    Relogin=${boolToString cfg.autoLogin.relogin}
     ''}
 
     ${cfg.extraConfig}
diff --git a/nixos/modules/services/x11/hardware/multitouch.nix b/nixos/modules/services/x11/hardware/multitouch.nix
index 0e9eb0214947..c03bb3b494fb 100644
--- a/nixos/modules/services/x11/hardware/multitouch.nix
+++ b/nixos/modules/services/x11/hardware/multitouch.nix
@@ -74,7 +74,7 @@ in {
           MatchIsTouchpad "on"
           Identifier "Touchpads"
           Driver "mtrack"
-          Option "IgnorePalm" "${if cfg.ignorePalm then "true" else "false"}"
+          Option "IgnorePalm" "${boolToString cfg.ignorePalm}"
           Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}"
           Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}"
           Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}"
diff --git a/pkgs/development/java-modules/build-maven-package.nix b/pkgs/development/java-modules/build-maven-package.nix
index d83b43ffd75a..b3c3e1732e0d 100644
--- a/pkgs/development/java-modules/build-maven-package.nix
+++ b/pkgs/development/java-modules/build-maven-package.nix
@@ -27,7 +27,7 @@ in stdenv.mkDerivation rec {
     echo "<settings><mirrors>\
       <mirror><id>tmpm2</id><url>file://$out/m2</url><mirrorOf>*</mirrorOf></mirror></mirrors>\
       <localRepository>$out/m2/</localRepository></settings>" >> $out/m2/settings.xml
-    ${maven}/bin/mvn ${optionalString (quiet) "-q"} clean package -Dmaven.test.skip=${if skipTests then "true" else "false"} -Danimal.sniffer.skip=true -gs $out/m2/settings.xml
+    ${maven}/bin/mvn ${optionalString (quiet) "-q"} clean package -Dmaven.test.skip=${boolToString skipTests} -Danimal.sniffer.skip=true -gs $out/m2/settings.xml
     cp ./target/*.jar $out/m2/${m2Path}
     cp -v ./target/*.jar $out/target/
   '';
diff --git a/pkgs/development/ocaml-modules/mtime/default.nix b/pkgs/development/ocaml-modules/mtime/default.nix
index a26109bd4f95..5e18d1fd6e42 100644
--- a/pkgs/development/ocaml-modules/mtime/default.nix
+++ b/pkgs/development/ocaml-modules/mtime/default.nix
@@ -1,7 +1,9 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, js_of_ocaml
+{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, opam, js_of_ocaml
 , jsooSupport ? !(stdenv.lib.versionAtLeast ocaml.version "4.04")
 }:
 
+with lib;
+
 stdenv.mkDerivation {
   name = "ocaml${ocaml.version}-mtime-0.8.3";
 
@@ -15,7 +17,7 @@ stdenv.mkDerivation {
   buildInputs = [ ocaml findlib ocamlbuild opam ]
   ++ stdenv.lib.optional jsooSupport js_of_ocaml;
 
-  buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true jsoo=${if jsooSupport then "true" else "false"}";
+  buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true jsoo=${boolToString jsooSupport}";
 
   installPhase = "opam-installer -i --prefix=$out --libdir=$OCAMLFIND_DESTDIR";
 
@@ -23,7 +25,7 @@ stdenv.mkDerivation {
     description = "Monotonic wall-clock time for OCaml";
     homepage = http://erratique.ch/software/mtime;
     inherit (ocaml.meta) platforms;
-    maintainers = [ stdenv.lib.maintainers.vbgl ];
-    license = stdenv.lib.licenses.bsd3;
+    maintainers = [ maintainers.vbgl ];
+    license = licenses.bsd3;
   };
 }
diff --git a/pkgs/development/ocaml-modules/nocrypto/default.nix b/pkgs/development/ocaml-modules/nocrypto/default.nix
index f9240f7507cf..91ab694eb6f2 100644
--- a/pkgs/development/ocaml-modules/nocrypto/default.nix
+++ b/pkgs/development/ocaml-modules/nocrypto/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   buildPhase = ''
     LD_LIBRARY_PATH=${cpuid}/lib/ocaml/${ocaml.version}/site-lib/stubslibs/ \
-    ${topkg.buildPhase} --with-lwt ${if withLwt then "true" else "false"}
+    ${topkg.buildPhase} --with-lwt ${boolToString withLwt}
   '';
   inherit (topkg) installPhase;
 
diff --git a/pkgs/development/ocaml-modules/notty/default.nix b/pkgs/development/ocaml-modules/notty/default.nix
index b967728d048c..950395bd7eaa 100644
--- a/pkgs/development/ocaml-modules/notty/default.nix
+++ b/pkgs/development/ocaml-modules/notty/default.nix
@@ -29,7 +29,7 @@ buildOcaml rec {
                           optional withLwt lwt;
 
   buildPhase = topkg.buildPhase
-  + " --with-lwt ${if withLwt then "true" else "false"}";
+  + " --with-lwt ${boolToString withLwt}";
 
   inherit (topkg) installPhase;
 
diff --git a/pkgs/development/ocaml-modules/vg/default.nix b/pkgs/development/ocaml-modules/vg/default.nix
index cb7878ac731e..ba33081486d7 100644
--- a/pkgs/development/ocaml-modules/vg/default.nix
+++ b/pkgs/development/ocaml-modules/vg/default.nix
@@ -1,16 +1,17 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg
+{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg
 , uchar, result, gg, uutf, otfm, js_of_ocaml,
   pdfBackend ? true, # depends on uutf and otfm
   htmlcBackend ? true # depends on js_of_ocaml
 }:
 
+with lib;
+
 let
   inherit (stdenv.lib) optionals versionAtLeast;
 
   pname = "vg";
   version = "0.9.0";
   webpage = "http://erratique.ch/software/${pname}";
-  sob = b: if b then "true" else "false";
 in
 
 assert versionAtLeast ocaml.version "4.02.0";
@@ -35,13 +36,14 @@ stdenv.mkDerivation rec {
   unpackCmd = "tar xjf $src";
 
   buildPhase = topkg.buildPhase
-  + " --with-uutf ${sob pdfBackend} --with-otfm ${sob pdfBackend}"
-  + " --with-js_of_ocaml ${sob htmlcBackend}"
-  + " --with-cairo2 false";
+    + " --with-uutf ${boolToString pdfBackend}"
+    + " --with-otfm ${boolToString pdfBackend}"
+    + " --with-js_of_ocaml ${boolToString htmlcBackend}"
+    + " --with-cairo2 false";
 
   inherit (topkg) installPhase;
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "Declarative 2D vector graphics for OCaml";
     longDescription = ''
     Vg is an OCaml module for declarative 2D vector graphics. In Vg, images

From c90058e7748e95f01ceed9544c14fbf753fe77f0 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 02:59:18 -0500
Subject: [PATCH 15/65] ibtool: update to newer hash

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

diff --git a/pkgs/development/tools/ibtool/default.nix b/pkgs/development/tools/ibtool/default.nix
index 17b9a77a7a18..bc4bf4bb9483 100644
--- a/pkgs/development/tools/ibtool/default.nix
+++ b/pkgs/development/tools/ibtool/default.nix
@@ -13,8 +13,8 @@ stdenv.mkDerivation {
   src = fetchFromGitHub {
     owner = "matthewbauer";
     repo = "xib2nib";
-    rev = "636fe783e8625bbdd7bfeaf85470ba3eb7b90359";
-    sha256 = "08fhx8rww95h1fpl1cwhd82bcqv1k51k542v4kawjf8w814g5y1c";
+    rev = "97c6a53aab83d919805efcae33cf80690e953d1e";
+    sha256 = "08442f4xg7racknj35nr56a4c62gvdgdw55pssbkn2qq0rfzziqq";
   };
 
   buildInputs = [ PlistCpp pugixml boost ];

From 457570f61a2fdad28d56117c0dc7d285a5c06236 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 02:59:54 -0500
Subject: [PATCH 16/65] pinentry_mac: switch to pure version

Fixes #24734
---
 pkgs/tools/security/pinentry-mac/default.nix | 14 ++++++++------
 pkgs/top-level/all-packages.nix              |  4 +++-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/pkgs/tools/security/pinentry-mac/default.nix b/pkgs/tools/security/pinentry-mac/default.nix
index ba3e8b1818d0..6aa14ab90e74 100644
--- a/pkgs/tools/security/pinentry-mac/default.nix
+++ b/pkgs/tools/security/pinentry-mac/default.nix
@@ -1,20 +1,22 @@
-{ fetchurl, stdenv, xcbuild }:
+{ fetchurl, stdenv, fetchFromGitHub, xcbuild, libiconv, Cocoa, ncurses }:
 
 stdenv.mkDerivation rec {
   name = "pinentry-mac-0.9.4";
 
-  src = fetchurl {
-    url = "https://github.com/GPGTools/pinentry-mac/archive/v0.9.4.tar.gz";
-    sha256 = "037ebb010377d3a3879ae2a832cefc4513f5c397d7d887d7b86b4e5d9a628271";
+  src = fetchFromGitHub {
+    owner = "matthewbauer";
+    repo = "pinentry-mac";
+    rev = "77fc993d1040ed2319d9e53af78146be318c1fdd";
+    sha256 = "0rkmp6wb8wvmhipavn1bdmbw6564hc2b99dxqysr6yxr2xqs6fcz";
   };
 
-  buildInputs = [ xcbuild ];
+  buildInputs = [ xcbuild libiconv Cocoa ncurses ];
 
   dontUseXcbuild = true;
 
   installPhase = ''
     mkdir -p $out/Applications
-    mv build/Release/pinentry-mac.app $out/Applications
+    mv pinentry-mac-*/Build/Products/Release/pinentry-mac.app $out/Applications
   '';
 
   passthru = {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 9c909a49a97c..95b50aa463f6 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3479,7 +3479,9 @@ with pkgs;
     libcap = if stdenv.isDarwin then null else libcap;
   };
 
-  pinentry_mac = callPackage ../tools/security/pinentry-mac { };
+  pinentry_mac = callPackage ../tools/security/pinentry-mac {
+    inherit (darwin.apple_sdk.frameworks) Cocoa;
+  };
 
   pingtcp = callPackage ../tools/networking/pingtcp { };
 

From f6860a6685553098bd7c295f0d435ec934ae7cef Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 03:21:58 -0500
Subject: [PATCH 17/65] xcbuild: remove unnecessary flags

---
 pkgs/development/tools/xcbuild/platform.nix | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix
index 01693ce8e5b9..cacf9467356b 100644
--- a/pkgs/development/tools/xcbuild/platform.nix
+++ b/pkgs/development/tools/xcbuild/platform.nix
@@ -177,7 +177,6 @@ let
       Type = "ProductType";
       Identifier = "com.apple.product-type.bundle";
       Name = "Bundle";
-      DefaultTargetName = "Bundle";
       DefaultBuildProperties = {
         FULL_PRODUCT_NAME = "$(WRAPPER_NAME)";
         MACH_O_TYPE = "mh_bundle";
@@ -189,7 +188,6 @@ let
         LIBRARY_FLAG_PREFIX = "-l";
         LIBRARY_FLAG_NOSPACE = "YES";
         STRIP_STYLE = "non-global";
-        GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
       };
       PackageTypes = [ "com.apple.package-type.wrapper" ];
       IsWrapper = "YES";
@@ -201,23 +199,12 @@ let
       Type = "ProductType";
       BasedOn = "com.apple.product-type.bundle";
       Name = "Application";
-      DefaultTargetName = "Application";
       DefaultBuildProperties = {
         MACH_O_TYPE = "mh_execute";
-        GCC_DYNAMIC_NO_PIC = "NO";
-        GCC_SYMBOLS_PRIVATE_EXTERN = "YES";
-        GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
         WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
         WRAPPER_EXTENSION = "app";
-        INSTALL_PATH = "$(LOCAL_APPS_DIR)";
-        STRIP_STYLE = "all";
       };
       PackageTypes = [ "com.apple.package-type.wrapper.application" ];
-      CanEmbedCompilerSanitizerLibraries = "YES";
-      RunpathSearchPathForEmbeddedFrameworks = "@executable_path/../Frameworks";
-      ValidateEmbeddedBinaries = "YES";
-      ProvisioningProfileSupported = "YES";
-      ProvisioningProfileRequired = "NO";
     }
   ];
 

From d697e5c8ee16c4a364aedf0d0ecde1fd9e4c9c9e Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 03:23:28 -0500
Subject: [PATCH 18/65] ibtool: rename xib2nib

---
 pkgs/development/tools/xcbuild/toolchain.nix             | 4 ++--
 pkgs/development/tools/{ibtool => xib2nib}/default.nix   | 0
 pkgs/development/tools/{ibtool => xib2nib}/nsplist.nix   | 0
 pkgs/development/tools/{ibtool => xib2nib}/plist-cpp.nix | 0
 pkgs/top-level/all-packages.nix                          | 2 +-
 5 files changed, 3 insertions(+), 3 deletions(-)
 rename pkgs/development/tools/{ibtool => xib2nib}/default.nix (100%)
 rename pkgs/development/tools/{ibtool => xib2nib}/nsplist.nix (100%)
 rename pkgs/development/tools/{ibtool => xib2nib}/plist-cpp.nix (100%)

diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix
index cdf4a673cc5f..9e34360909f9 100644
--- a/pkgs/development/tools/xcbuild/toolchain.nix
+++ b/pkgs/development/tools/xcbuild/toolchain.nix
@@ -1,7 +1,7 @@
 {stdenv, writeText, toolchainName, xcbuild, fetchurl
 , llvm, cctools, gcc, bootstrap_cmds, binutils
 , yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper
-, ibtool}:
+, xib2nib}:
 
 let
 
@@ -91,7 +91,7 @@ stdenv.mkDerivation {
     ln -s ${cctools}/bin/ranlib
     ln -s ${cctools}/bin/redo_prebinding
 
-    ln -s ${ibtool}/bin/ibtool
+    ln -s ${xib2nib}/bin/ibtool
   '' +
     # No point including the entire gcc closure if we don't already have it
     (if stdenv.cc.isClang then ''
diff --git a/pkgs/development/tools/ibtool/default.nix b/pkgs/development/tools/xib2nib/default.nix
similarity index 100%
rename from pkgs/development/tools/ibtool/default.nix
rename to pkgs/development/tools/xib2nib/default.nix
diff --git a/pkgs/development/tools/ibtool/nsplist.nix b/pkgs/development/tools/xib2nib/nsplist.nix
similarity index 100%
rename from pkgs/development/tools/ibtool/nsplist.nix
rename to pkgs/development/tools/xib2nib/nsplist.nix
diff --git a/pkgs/development/tools/ibtool/plist-cpp.nix b/pkgs/development/tools/xib2nib/plist-cpp.nix
similarity index 100%
rename from pkgs/development/tools/ibtool/plist-cpp.nix
rename to pkgs/development/tools/xib2nib/plist-cpp.nix
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 95b50aa463f6..e7500292dcf4 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18410,5 +18410,5 @@ with pkgs;
 
   messenger-for-desktop = callPackage ../applications/networking/instant-messengers/messenger-for-desktop {};
 
-  ibtool = callPackage ../development/tools/ibtool {};
+  xib2nib = callPackage ../development/tools/xib2nib {};
 }

From 1781ec934f5a815d13b768a77a4bde8798db26d3 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 03:28:33 -0500
Subject: [PATCH 19/65] xib2nib: move nsplist, plistcpp to own folder

These libraries could be used by other packages so list them in
all-packages.nix as well.
---
 .../nsplist.nix => libraries/NSPlist/default.nix}        | 2 +-
 .../plist-cpp.nix => libraries/PlistCpp/default.nix}     | 2 +-
 pkgs/development/tools/xib2nib/default.nix               | 9 +--------
 pkgs/top-level/all-packages.nix                          | 5 +++++
 4 files changed, 8 insertions(+), 10 deletions(-)
 rename pkgs/development/{tools/xib2nib/nsplist.nix => libraries/NSPlist/default.nix} (91%)
 rename pkgs/development/{tools/xib2nib/plist-cpp.nix => libraries/PlistCpp/default.nix} (92%)

diff --git a/pkgs/development/tools/xib2nib/nsplist.nix b/pkgs/development/libraries/NSPlist/default.nix
similarity index 91%
rename from pkgs/development/tools/xib2nib/nsplist.nix
rename to pkgs/development/libraries/NSPlist/default.nix
index 557cb5b3bd58..c06d98876de8 100644
--- a/pkgs/development/tools/xib2nib/nsplist.nix
+++ b/pkgs/development/libraries/NSPlist/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, cmake }:
 
 stdenv.mkDerivation {
-  name = "nsplist-713decf";
+  name = "NSPlist-713decf";
 
   src = fetchFromGitHub {
     owner = "matthewbauer";
diff --git a/pkgs/development/tools/xib2nib/plist-cpp.nix b/pkgs/development/libraries/PlistCpp/default.nix
similarity index 92%
rename from pkgs/development/tools/xib2nib/plist-cpp.nix
rename to pkgs/development/libraries/PlistCpp/default.nix
index 3e15489898d7..511915be39f5 100644
--- a/pkgs/development/tools/xib2nib/plist-cpp.nix
+++ b/pkgs/development/libraries/PlistCpp/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, cmake, boost, NSPlist, pugixml }:
 
 stdenv.mkDerivation {
-  name = "plistcpp-11615d";
+  name = "PlistCpp-11615d";
 
   src = fetchFromGitHub {
     owner = "matthewbauer";
diff --git a/pkgs/development/tools/xib2nib/default.nix b/pkgs/development/tools/xib2nib/default.nix
index bc4bf4bb9483..5f516ee97cbe 100644
--- a/pkgs/development/tools/xib2nib/default.nix
+++ b/pkgs/development/tools/xib2nib/default.nix
@@ -1,11 +1,4 @@
-{ stdenv, callPackage, fetchFromGitHub, pugixml, boost }:
-
-let
-
-  NSPlist = callPackage ./nsplist.nix { };
-  PlistCpp = callPackage ./plist-cpp.nix { inherit NSPlist; };
-
-in
+{ stdenv, callPackage, fetchFromGitHub, pugixml, boost, PlistCpp }:
 
 stdenv.mkDerivation {
   name = "xib2nib-730e177";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e7500292dcf4..b981dd492d5b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18410,5 +18410,10 @@ with pkgs;
 
   messenger-for-desktop = callPackage ../applications/networking/instant-messengers/messenger-for-desktop {};
 
+  NSPlist = callPackage ../development/libraries/NSPlist {};
+
+  PlistCpp = callPackage ../development/libraries/PlistCpp {};
+
   xib2nib = callPackage ../development/tools/xib2nib {};
+
 }

From 3d1d805245c1b0788e1ce4a01d8455e30ac15739 Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 05:20:33 -0500
Subject: [PATCH 20/65] Revert "xcbuild: try to fix sdk not found"

This reverts commit 87e6b2c50fb4520d9ef910418f3c686d830dc3df.
---
 pkgs/development/tools/xcbuild/platform.nix | 2 +-
 pkgs/development/tools/xcbuild/wrapper.nix  | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix
index cacf9467356b..31692d9bee68 100644
--- a/pkgs/development/tools/xcbuild/platform.nix
+++ b/pkgs/development/tools/xcbuild/platform.nix
@@ -228,6 +228,6 @@ stdenv.mkDerivation {
 
     mkdir -p $out/Developer/SDKs/
     cd $out/Developer/SDKs/
-    ln -s ${sdk} macosx10.10.sdk
+    ln -s ${sdk}
   '';
 }
diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix
index 3dfc7f363439..ab6605e91b10 100644
--- a/pkgs/development/tools/xcbuild/wrapper.nix
+++ b/pkgs/development/tools/xcbuild/wrapper.nix
@@ -60,13 +60,9 @@ stdenv.mkDerivation {
       --add-flags "DERIVED_DATA_DIR=." \
       --set DEVELOPER_DIR "$out"
     wrapProgram $out/bin/xcrun \
-      --add-flags "-sdk macosx10.10" \
       --set DEVELOPER_DIR "$out"
     wrapProgram $out/bin/xcode-select \
       --set DEVELOPER_DIR "$out"
-
-    mkdir -p $out/usr/bin/
-    ln -s $out/bin/xcrun $out/usr/bin/xcrun
   '';
 
   inherit (xcbuild) meta;

From 6239da6ade413ce89503d608c9b827ac17359e64 Mon Sep 17 00:00:00 2001
From: Matthias Beyer <mail@beyermatthias.de>
Date: Wed, 12 Apr 2017 13:05:22 +0200
Subject: [PATCH 21/65] diamond: init at 0.8.36

---
 .../science/biology/diamond/default.nix       | 41 +++++++++++++++++++
 .../diamond/diamond-0.8.36-no-warning.patch   | 20 +++++++++
 pkgs/top-level/all-packages.nix               |  2 +
 3 files changed, 63 insertions(+)
 create mode 100644 pkgs/applications/science/biology/diamond/default.nix
 create mode 100644 pkgs/applications/science/biology/diamond/diamond-0.8.36-no-warning.patch

diff --git a/pkgs/applications/science/biology/diamond/default.nix b/pkgs/applications/science/biology/diamond/default.nix
new file mode 100644
index 000000000000..a45e5df2f528
--- /dev/null
+++ b/pkgs/applications/science/biology/diamond/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, cmake, gcc, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "diamond-0.8.36";
+
+  src = fetchurl {
+    url = "https://github.com/bbuchfink/diamond/archive/v0.8.36.tar.gz";
+    sha256 = "092smzzjcg51n3x4h84k52ijpz9m40ri838j9k2i463ribc3c8rh";
+  };
+
+  patches = [
+    ./diamond-0.8.36-no-warning.patch
+  ];
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zlib ];
+
+  meta = with stdenv.lib; {
+    description = "Accelerated BLAST compatible local sequence aligner";
+    longDescription = ''
+      A sequence aligner for protein and translated DNA
+      searches and functions as a drop-in replacement for the NCBI BLAST
+      software tools. It is suitable for protein-protein search as well as
+      DNA-protein search on short reads and longer sequences including contigs
+      and assemblies, providing a speedup of BLAST ranging up to x20,000.
+
+      DIAMOND is developed by Benjamin Buchfink. Feel free to contact him for support (Email Twitter).
+
+      If you use DIAMOND in published research, please cite
+      B. Buchfink, Xie C., D. Huson,
+      "Fast and sensitive protein alignment using DIAMOND",
+      Nature Methods 12, 59-60 (2015).
+        '';
+    homepage = https://github.com/bbuchfink/diamond;
+    license = {
+      fullName = "University of Tuebingen, Benjamin Buchfink";
+      url = https://raw.githubusercontent.com/bbuchfink/diamond/master/src/COPYING;
+    };
+    maintainers = [ maintainers.metabar ];
+  };
+}
diff --git a/pkgs/applications/science/biology/diamond/diamond-0.8.36-no-warning.patch b/pkgs/applications/science/biology/diamond/diamond-0.8.36-no-warning.patch
new file mode 100644
index 000000000000..a16d475c5564
--- /dev/null
+++ b/pkgs/applications/science/biology/diamond/diamond-0.8.36-no-warning.patch
@@ -0,0 +1,20 @@
+diff -u -r diamond-0.8.36/src/dp/scalar_traceback.h diamond-0.8.36-patched/src/dp/scalar_traceback.h
+--- diamond-0.8.36/src/dp/scalar_traceback.h	2017-02-06 16:32:05.000000000 +0100
++++ diamond-0.8.36-patched/src/dp/scalar_traceback.h	2017-02-23 15:13:24.000000000 +0100
+@@ -19,6 +19,7 @@
+ #ifndef SCALAR_TRACEBACK_H_
+ #define SCALAR_TRACEBACK_H_
+ 
++#include <cmath>
+ #include <exception>
+ #include "../basic/score_matrix.h"
+ 
+@@ -31,7 +32,7 @@
+ template<>
+ inline bool almost_equal<float>(float x, float y)
+ {
+-	return abs(x - y) < 0.001f;
++	return std::abs(x - y) < 0.001f;
+ }
+ 
+ template<typename _score>
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 800ed948c27d..74c99f7fa57b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17192,6 +17192,8 @@ with pkgs;
 
   bcftools = callPackage ../applications/science/biology/bcftools { };
 
+  diamond = callPackage ../applications/science/biology/diamond { };
+
   ecopcr = callPackage ../applications/science/biology/ecopcr { };
 
   emboss = callPackage ../applications/science/biology/emboss { };

From 13e9cc15f147fd2f472a53c4b40588f48b73e0b5 Mon Sep 17 00:00:00 2001
From: Tristan Helmich <tristan.helmich@gmail.com>
Date: Wed, 12 Apr 2017 15:12:53 +0200
Subject: [PATCH 22/65] smokeping service: restart on-failure

---
 nixos/modules/services/networking/smokeping.nix | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix
index bac794745277..c5c131cb4c50 100644
--- a/nixos/modules/services/networking/smokeping.nix
+++ b/nixos/modules/services/networking/smokeping.nix
@@ -288,8 +288,11 @@ in
     };
     systemd.services.smokeping = {
       wantedBy = [ "multi-user.target"];
-      serviceConfig.User = cfg.user;
-      serviceConfig.PermissionsStartOnly = true;
+      serviceConfig = {
+        User = cfg.user;
+        PermissionsStartOnly = true;
+        Restart = "on-failure";
+      };
       preStart = ''
         mkdir -m 0755 -p ${smokepingHome}/cache ${smokepingHome}/data
         rm -f ${smokepingHome}/cropper

From f08e89d2568925d4b94f1d62d6a2f9e4e8a57fbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lengyel=20Bal=C3=A1zs?= <ikervagyok@gmail.com>
Date: Wed, 12 Apr 2017 16:10:46 +0200
Subject: [PATCH 23/65] chromium: flashplayer: 25.0.0.127 -> 25.0.0.148

---
 pkgs/applications/networking/browsers/chromium/plugins.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix
index f202aee38283..581a45da3d8c 100644
--- a/pkgs/applications/networking/browsers/chromium/plugins.nix
+++ b/pkgs/applications/networking/browsers/chromium/plugins.nix
@@ -94,12 +94,12 @@ let
 
   flash = stdenv.mkDerivation rec {
     name = "flashplayer-ppapi-${version}";
-    version = "25.0.0.127";
+    version = "25.0.0.148";
 
     src = fetchzip {
       url = "https://fpdownload.adobe.com/pub/flashplayer/pdc/"
           + "${version}/flash_player_ppapi_linux.x86_64.tar.gz";
-      sha256 = "1gf0ncclkk3h4vj9kkhbqj1nnnm54gwm5mdcs4p4pl8i339scs14";
+      sha256 = "1888n0mbzhbvi95kq19fzw310p7nr9h3g5d3nyzq5fnvj0lcfxsf";
       stripRoot = false;
     };
 

From f94e0a0dc72dc718c424d2992ce17ccc2eacbab2 Mon Sep 17 00:00:00 2001
From: laMudri <lamudri@gmail.com>
Date: Wed, 12 Apr 2017 17:46:07 +0100
Subject: [PATCH 24/65] thunderbird: add option to enable calendar

---
 .../applications/networking/mailreaders/thunderbird/default.nix | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pkgs/applications/networking/mailreaders/thunderbird/default.nix b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
index 661d499d34e6..69286202823b 100644
--- a/pkgs/applications/networking/mailreaders/thunderbird/default.nix
+++ b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
@@ -7,6 +7,7 @@
 , autoconf213, which, m4
 , writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
 , enableGTK3 ? false, gtk3, wrapGAppsHook
+, enableCalendar ? true
 , debugBuild ? false
 , # If you want the resulting program to call itself "Thunderbird" instead
   # of "Earlybird" or whatever, enable this option.  However, those
@@ -77,6 +78,7 @@ stdenv.mkDerivation rec {
       "--disable-gconf"
       "--enable-default-toolkit=cairo-gtk${if enableGTK3 then "3" else "2"}"
     ]
+      ++ lib.optional enableCalendar "--enable-calendar"
       ++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
                         else [ "--disable-debug" "--enable-release"
                                "--disable-debug-symbols"

From e2abd55a3b4e4b758f4397feeb344674cf114d1c Mon Sep 17 00:00:00 2001
From: Sean Haugh <seanphaugh@gmail.com>
Date: Wed, 12 Apr 2017 16:13:03 -0500
Subject: [PATCH 25/65] licenses: add MirOS license

---
 lib/licenses.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/licenses.nix b/lib/licenses.nix
index 4d4a3c1a9544..000a55224ea7 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -357,6 +357,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
     fullName = "Lucent Public License v1.02";
   };
 
+  miros = {
+    fullname = "MirOS License";
+    url = https://opensource.org/licenses/MirOS;
+  };
+
   # spdx.org does not (yet) differentiate between the X11 and Expat versions
   # for details see http://en.wikipedia.org/wiki/MIT_License#Various_versions
   mit = spdx {

From 5eb098dbd84320b004fcc51e4a6c47ce362e0514 Mon Sep 17 00:00:00 2001
From: Yann Hodique <hodiquey@vmware.com>
Date: Wed, 12 Apr 2017 14:21:59 -0700
Subject: [PATCH 26/65] hugo: 0.18.1 -> 0.20

---
 pkgs/applications/misc/hugo/default.nix |   4 +-
 pkgs/applications/misc/hugo/deps.nix    | 479 +++++++++++++-----------
 2 files changed, 255 insertions(+), 228 deletions(-)

diff --git a/pkgs/applications/misc/hugo/default.nix b/pkgs/applications/misc/hugo/default.nix
index 05a4db7a2500..895299f75b64 100644
--- a/pkgs/applications/misc/hugo/default.nix
+++ b/pkgs/applications/misc/hugo/default.nix
@@ -2,7 +2,7 @@
 
 buildGoPackage rec {
   name = "hugo-${version}";
-  version = "0.18.1";
+  version = "0.20";
 
   goPackagePath = "github.com/spf13/hugo";
 
@@ -10,7 +10,7 @@ buildGoPackage rec {
     owner = "spf13";
     repo = "hugo";
     rev = "v${version}";
-    sha256 = "1nmabcrq96b339in2yr2zwcd41nadr4bha3rlpyaxlzbyyhz2f81";
+    sha256 = "1dzvwldhf73ycmazq9xnridj7p3m3q6qv47rvk3vgj0xj6c107ij";
   };
 
   goDeps = ./deps.nix;
diff --git a/pkgs/applications/misc/hugo/deps.nix b/pkgs/applications/misc/hugo/deps.nix
index 0a95b083c0b8..e2e2d093dded 100644
--- a/pkgs/applications/misc/hugo/deps.nix
+++ b/pkgs/applications/misc/hugo/deps.nix
@@ -1,173 +1,38 @@
 [
-  {
-    goPackagePath = "golang.org/x/sys";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/sys";
-      rev = "d9157a9621b69ad1d8d77a1933590c416593f24f";
-      sha256 = "1asdbp7rj1j1m1aar1a022wpcwbml6zih6cpbxaw7b2m8v8is931";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/yaml.v2";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/yaml.v2";
-      rev = "a83829b6f1293c91addabc89d0571c246397bbf4";
-      sha256 = "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/crypto";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/crypto";
-      rev = "575fdbe86e5dd89229707ebec0575ce7d088a4a6";
-      sha256 = "1kgv1mkw9y404pk3lcwbs0vgl133mwyp294i18jg9hp10s5d56xa";
-    };
-  }
-  {
-    goPackagePath = "github.com/gorilla/websocket";
-    fetch = {
-      type = "git";
-      url = "https://github.com/gorilla/websocket";
-      rev = "a622679ebd7a3b813862379232f645f8e690e43f";
-      sha256 = "1nc9jbcmgya1i6dmf6sbcqsnxi9hbjg6dz1z0k7zmc6xdwlq0y4q";
-    };
-  }
-  {
-    goPackagePath = "github.com/inconshreveable/mousetrap";
-    fetch = {
-      type = "git";
-      url = "https://github.com/inconshreveable/mousetrap";
-      rev = "9dbb96d2c3a964935b0870b5abaea13c98b483aa";
-      sha256 = "1f9g8vm18qv1rcb745a4iahql9vfrz0jni9mnzriab2wy1pfdl5b";
-    };
-  }
-  {
-    goPackagePath = "github.com/kardianos/osext";
-    fetch = {
-      type = "git";
-      url = "https://github.com/kardianos/osext";
-      rev = "29ae4ffbc9a6fe9fb2bc5029050ce6996ea1d3bc";
-      sha256 = "1mawalaz84i16njkz6f9fd5jxhcbxkbsjnav3cmqq2dncv2hyv8a";
-    };
-  }
-  {
-    goPackagePath = "github.com/hashicorp/hcl";
-    fetch = {
-      type = "git";
-      url = "https://github.com/hashicorp/hcl";
-      rev = "54864211433d45cb780682431585b3e573b49e4a";
-      sha256 = "07l2dydzjpdgm2d4a72hkmincn455j3nrafg6hs3c23bkvizj950";
-    };
-  }
-  {
-    goPackagePath = "github.com/hashicorp/go-multierror";
-    fetch = {
-      type = "git";
-      url = "https://github.com/hashicorp/go-multierror";
-      rev = "56912fb08d85084aa318edcf2bba735b97cf35c5";
-      sha256 = "0s01cqdab2f7fxkkjjk2wqx05a1shnwlvfn45h2pi3i4gapvcn0r";
-    };
-  }
   {
     goPackagePath = "github.com/BurntSushi/toml";
     fetch = {
       type = "git";
       url = "https://github.com/BurntSushi/toml";
-      rev = "056c9bc7be7190eaa7715723883caffa5f8fa3e4";
-      sha256 = "0gkgkw04ndr5y7hrdy0r4v2drs5srwfcw2bs1gyas066hwl84xyw";
+      rev = "99064174e013895bbd9b025c31100bd1d9b590ca";
+      sha256 = "058qrar8rvw3wb0ci1mf1axnqq2729cvv9zmdr4ms2nn9s97yiz9";
     };
   }
   {
-    goPackagePath = "github.com/mitchellh/mapstructure";
+    goPackagePath = "github.com/PuerkitoBio/purell";
     fetch = {
       type = "git";
-      url = "https://github.com/mitchellh/mapstructure";
-      rev = "281073eb9eb092240d33ef253c404f1cca550309";
-      sha256 = "1zjx9fv29639sp1fn84rxs830z7gp7bs38yd5y1hl5adb8s5x1mh";
+      url = "https://github.com/PuerkitoBio/purell";
+      rev = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4";
+      sha256 = "0vsxyn1fbm7g873b8kf3hcsgqgncb5nmfq3zfsc35a9yhzarka91";
     };
   }
   {
-    goPackagePath = "golang.org/x/text";
+    goPackagePath = "github.com/PuerkitoBio/urlesc";
     fetch = {
       type = "git";
-      url = "https://go.googlesource.com/text";
-      rev = "5eb8d4684c4796dd36c74f6452f2c0fa6c79597e";
-      sha256 = "1cjwm2pv42dbfqc6ylr7jmma902zg4gng5aarqrbjf1k2nf2vs14";
+      url = "https://github.com/PuerkitoBio/urlesc";
+      rev = "5bd2802263f21d8788851d5305584c82a5c75d7e";
+      sha256 = "15y5r3asvm7196m3nza5xvdvlc2k11p6lfs6hi917hl7r9vgi6mp";
     };
   }
   {
-    goPackagePath = "github.com/shurcooL/sanitized_anchor_name";
+    goPackagePath = "github.com/bep/gitmap";
     fetch = {
       type = "git";
-      url = "https://github.com/shurcooL/sanitized_anchor_name";
-      rev = "10ef21a441db47d8b13ebcc5fd2310f636973c77";
-      sha256 = "1cnbzcf47cn796rcjpph1s64qrabhkv5dn9sbynsy7m9zdwr5f01";
-    };
-  }
-  {
-    goPackagePath = "github.com/russross/blackfriday";
-    fetch = {
-      type = "git";
-      url = "https://github.com/russross/blackfriday";
-      rev = "d18b67ae0afd61dae240896eae1785f00709aa31";
-      sha256 = "1l78hz8k1ixry5fjw29834jz1q5ysjcpf6kx2ggjj1s6xh0bfzvf";
-    };
-  }
-  {
-    goPackagePath = "github.com/yosssi/ace";
-    fetch = {
-      type = "git";
-      url = "https://github.com/yosssi/ace";
-      rev = "71afeb714739f9d5f7e1849bcd4a0a5938e1a70d";
-      sha256 = "15k7ji8m3nqbwhnsvp82j4qa45sgvwv2giliw2xkdwi2g7mfrn8k";
-    };
-  }
-  {
-    goPackagePath = "github.com/spf13/viper";
-    fetch = {
-      type = "git";
-      url = "https://github.com/spf13/viper";
-      rev = "ec4eb2fa8549869ae7a2accd4fcc83d1c0555c15";
-      sha256 = "018niqyrg09andj3g08jalflq2ypz9bp7qb1mbk50kfly29lkih7";
-    };
-  }
-  {
-    goPackagePath = "github.com/spf13/pflag";
-    fetch = {
-      type = "git";
-      url = "https://github.com/spf13/pflag";
-      rev = "b83537d79690b75cac5e021b036ae16792bf0f20";
-      sha256 = "19blhq00rnynv11nnvixisx4h1429rp5bik13k661ixw0421qqyx";
-    };
-  }
-  {
-    goPackagePath = "github.com/spf13/jwalterweatherman";
-    fetch = {
-      type = "git";
-      url = "https://github.com/spf13/jwalterweatherman";
-      rev = "33c24e77fb80341fe7130ee7c594256ff08ccc46";
-      sha256 = "1knvzspqzc2bh58q16zggzc8gcabjp5gr7zk4k7nx5ij4092cg0z";
-    };
-  }
-  {
-    goPackagePath = "github.com/fsnotify/fsnotify";
-    fetch = {
-      type = "git";
-      url = "https://github.com/fsnotify/fsnotify";
-      rev = "30411dbcefb7a1da7e84f75530ad3abe4011b4f8";
-      sha256 = "0kbpvyi6p9942k0vmcw5z13mja47f7hq7nqd332pn2zydss6kddm";
-    };
-  }
-  {
-    goPackagePath = "github.com/magiconair/properties";
-    fetch = {
-      type = "git";
-      url = "https://github.com/magiconair/properties";
-      rev = "c265cfa48dda6474e208715ca93e987829f572f8";
-      sha256 = "1ab9ywwsrdq5mvrcwl7m3276y1q4dfwinbv88vgpqwcqai9wkpp3";
+      url = "https://github.com/bep/gitmap";
+      rev = "dcb907b39a0690430d435eb8f63cd8811961231f";
+      sha256 = "0bw4spyiidrvd8rls9g57mwxykfmv57qi9mcnjadbqrpv92br856";
     };
   }
   {
@@ -180,39 +45,21 @@
     };
   }
   {
-    goPackagePath = "github.com/eknkc/amber";
+    goPackagePath = "github.com/chaseadamsio/goorgeous";
     fetch = {
       type = "git";
-      url = "https://github.com/eknkc/amber";
-      rev = "91774f050c1453128146169b626489e60108ec03";
-      sha256 = "1rb8bm35h8a77q4py6r3818cpwh7kpq1kh2ib2rb4i5s7z75ciis";
+      url = "https://github.com/chaseadamsio/goorgeous";
+      rev = "42b0ec184e93fc9fd2c0402f099a4939aba68407";
+      sha256 = "00mlv64q34d0vdq7p88hlsck4lsnk2pnxghx1jzy99r7wvs34am3";
     };
   }
   {
-    goPackagePath = "github.com/spf13/afero";
+    goPackagePath = "github.com/cpuguy83/go-md2man";
     fetch = {
       type = "git";
-      url = "https://github.com/spf13/afero";
-      rev = "1a8ecf8b9da1fb5306e149e83128fc447957d2a8";
-      sha256 = "1nrg0gmqnl4h6zjmi4mdhrwnl3l34nzxpq2hsr3nizfvrx5gqbzw";
-    };
-  }
-  {
-    goPackagePath = "github.com/spf13/cast";
-    fetch = {
-      type = "git";
-      url = "https://github.com/spf13/cast";
-      rev = "27b586b42e29bec072fe7379259cc719e1289da6";
-      sha256 = "1y73pfxdvm1bfpghwsfxj8gl4miv6fpzi9azxcknp6rcjn1gmq0x";
-    };
-  }
-  {
-    goPackagePath = "github.com/spf13/cobra";
-    fetch = {
-      type = "git";
-      url = "https://github.com/spf13/cobra";
-      rev = "bc81c21bd0d8be5ba2d6630a505d79d4467566e7";
-      sha256 = "1sp8gl25cjx0yibh6q1i8d5rbxpwaal3z8vz372wfmbz002say8r";
+      url = "https://github.com/cpuguy83/go-md2man";
+      rev = "a65d4d2de4d5f7c74868dfa9b202a3c8be315aaa";
+      sha256 = "1rm3zjrmfpzy0l3qp02xmd5pqzl77pdql9pbxhl0k1qw2vfzrjv6";
     };
   }
   {
@@ -225,57 +72,66 @@
     };
   }
   {
-    goPackagePath = "github.com/spf13/fsync";
+    goPackagePath = "github.com/eknkc/amber";
     fetch = {
       type = "git";
-      url = "https://github.com/spf13/fsync";
-      rev = "cb2da332d00cbc04e4f3f677520dc3e7cc11874b";
-      sha256 = "03ib2xj80cbz77hx2baanyi50qr40akrybg49fzdvdm3lv9x100z";
+      url = "https://github.com/eknkc/amber";
+      rev = "9be5e8aae85904f63d505e0c00e5e0881d44ef4d";
+      sha256 = "1hmsqxwajgpmg1svzjqxf4n81qy7qs6m39cjv69jkhz9lpwc305j";
     };
   }
   {
-    goPackagePath = "github.com/cpuguy83/go-md2man";
+    goPackagePath = "github.com/fortytw2/leaktest";
     fetch = {
       type = "git";
-      url = "https://github.com/cpuguy83/go-md2man";
-      rev = "2724a9c9051aa62e9cca11304e7dd518e9e41599";
-      sha256 = "1j2bigs7ixy20cdqd246nxr417md2qcyvkfk3x94992cr88d0vyj";
+      url = "https://github.com/fortytw2/leaktest";
+      rev = "0db74e8cd5adacfcc982838c6e185789e4b44e14";
+      sha256 = "11s04f1pliqw185ai1dbpqn5rahc3yzv2fp5zdanjvql4168499m";
     };
   }
   {
-    goPackagePath = "github.com/miekg/mmark";
+    goPackagePath = "github.com/fsnotify/fsnotify";
     fetch = {
       type = "git";
-      url = "https://github.com/miekg/mmark";
-      rev = "adb5c3e2e9f3e7da9bd25291edda8e66c0045a2a";
-      sha256 = "0fycz17fj37fh95lfshdrfwrgkzi3hl1kgnily0cxc9zwfbap3qa";
+      url = "https://github.com/fsnotify/fsnotify";
+      rev = "4da3e2cfbabc9f751898f250b49f2439785783a1";
+      sha256 = "1y2l9jaf99j6gidcfdgq3hifxyiwv4f7awpll80p170ixdbqxvl3";
     };
   }
   {
-    goPackagePath = "github.com/spf13/nitro";
+    goPackagePath = "github.com/gorilla/websocket";
     fetch = {
       type = "git";
-      url = "https://github.com/spf13/nitro";
-      rev = "24d7ef30a12da0bdc5e2eb370a79c659ddccf0e8";
-      sha256 = "143sbpx0jdgf8f8ayv51x6l4jg6cnv6nps6n60qxhx4vd90s6mib";
+      url = "https://github.com/gorilla/websocket";
+      rev = "adf16b31781325cbd41085c5be901d95b4d1f33d";
+      sha256 = "0f93k3igbqqwsl734lxnkbfajc4lcyzg4szg15vb26qn939b5ccx";
     };
   }
   {
-    goPackagePath = "github.com/PuerkitoBio/purell";
+    goPackagePath = "github.com/hashicorp/hcl";
     fetch = {
       type = "git";
-      url = "https://github.com/PuerkitoBio/purell";
-      rev = "1d5d1cfad45d42ec5f81fa8ef23de09cebc6dcc3";
-      sha256 = "12k82576ka21c6572yy2v81kxpjrgf9mffjlz469g3vs0g3nkwlb";
+      url = "https://github.com/hashicorp/hcl";
+      rev = "80e628d796135357b3d2e33a985c666b9f35eee1";
+      sha256 = "0l85a7ir60hycb3mqsxmrz18f1kax03k55afsahr8xf46pjp5pyb";
     };
   }
   {
-    goPackagePath = "github.com/pkg/sftp";
+    goPackagePath = "github.com/inconshreveable/mousetrap";
     fetch = {
       type = "git";
-      url = "https://github.com/pkg/sftp";
-      rev = "d4c18e7ffdc496a38de67dde6e29b2f364afc472";
-      sha256 = "0cnl83k317gxskayfj3xwr4bl0vcbjvlwi3q0vjwvircynb6xscj";
+      url = "https://github.com/inconshreveable/mousetrap";
+      rev = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75";
+      sha256 = "1mn0kg48xkd74brf48qf5hzp0bc6g8cf5a77w895rl3qnlpfw152";
+    };
+  }
+  {
+    goPackagePath = "github.com/kardianos/osext";
+    fetch = {
+      type = "git";
+      url = "https://github.com/kardianos/osext";
+      rev = "9b883c5eb462dd5cb1b0a7a104fe86bc6b9bd391";
+      sha256 = "0cyhbgsxwdfnwy57pdfivvjfy951gxbg9qlsjbwm6vs3gfws07mr";
     };
   }
   {
@@ -292,26 +148,35 @@
     fetch = {
       type = "git";
       url = "https://github.com/kyokomi/emoji";
-      rev = "17c5e7085c9d59630aa578df67f4469481fbe7a9";
-      sha256 = "0qs4mi7z1lghiyiw7s2bz5y959wj9ifmhyqh39xwqk69d690jwlp";
+      rev = "7e06b236c489543f53868841f188a294e3383eab";
+      sha256 = "1q2j0k5a8qqka1syc9zwmf1cvm6k628kf2g1nmghp2kdr7q1xmyb";
     };
   }
   {
-    goPackagePath = "github.com/pkg/errors";
+    goPackagePath = "github.com/magiconair/properties";
     fetch = {
       type = "git";
-      url = "https://github.com/pkg/errors";
-      rev = "494e70f7620561491c2ca11e185bbef4b70060da";
-      sha256 = "0a0961ixl67vryhnzyzhai357c9n9a7v3vpkpqrh32spn033gjd9";
+      url = "https://github.com/magiconair/properties";
+      rev = "9c47895dc1ce54302908ab8a43385d1f5df2c11c";
+      sha256 = "0497bacr3gc7352gcwb07wyw7vb9m04xfd82mw0hpnzzw3kfnav3";
     };
   }
   {
-    goPackagePath = "github.com/PuerkitoBio/urlesc";
+    goPackagePath = "github.com/miekg/mmark";
     fetch = {
       type = "git";
-      url = "https://github.com/PuerkitoBio/urlesc";
-      rev = "5fa9ff0392746aeae1c4b37fcc42c65afa7a9587";
-      sha256 = "0dppkmfs0hb5vcqli191x9yss5vvlx29qxjcywhdfirc89rn0sni";
+      url = "https://github.com/miekg/mmark";
+      rev = "2d4f1dd6f87cad351b9323bbaa6f6c586f0c4bee";
+      sha256 = "1ak54nvmryx73g16q6qaac9x0klhbxxmk1j6zlnfvvibnkj2pa90";
+    };
+  }
+  {
+    goPackagePath = "github.com/mitchellh/mapstructure";
+    fetch = {
+      type = "git";
+      url = "https://github.com/mitchellh/mapstructure";
+      rev = "bfdb1a85537d60bc7e954e600c250219ea497417";
+      sha256 = "141kkh801jyp1r6hba14krydqg1iivp13j12is70j0g05z9fbji8";
     };
   }
   {
@@ -319,17 +184,8 @@
     fetch = {
       type = "git";
       url = "https://github.com/nicksnyder/go-i18n";
-      rev = "e6c90c3ceece7f43060f843b495c3c9c031f5575";
-      sha256 = "1i1hqvq05lk12wnrhayca66pvfbyjnj7dm0lr0hn5qhb2i8k84kd";
-    };
-  }
-  {
-    goPackagePath = "github.com/pelletier/go-toml";
-    fetch = {
-      type = "git";
-      url = "https://github.com/pelletier/go-toml";
-      rev = "45932ad32dfdd20826f5671da37a5f3ce9f26a8d";
-      sha256 = "1rs25xqlpz2j9gqii144qnkvhsgzhwgy9ild7yvxhnbs2mybgix7";
+      rev = "4df9b06c0c1ffd8538a3cfa9d888f8f52985b302";
+      sha256 = "1cbbvq9l822p7vrscvaah3zybsj5yxcsq9fgvgsg062njbb0x41f";
     };
   }
   {
@@ -337,17 +193,188 @@
     fetch = {
       type = "git";
       url = "https://github.com/pelletier/go-buffruneio";
-      rev = "df1e16fde7fc330a0ca68167c23bf7ed6ac31d6d";
-      sha256 = "0jwn2g4jfdb3wvpqisd8h055099pwx6c5i3bb4zxk5l9vybg1c5f";
+      rev = "c37440a7cf42ac63b919c752ca73a85067e05992";
+      sha256 = "0l83p1gg6g5mmhmxjisrhfimhbm71lwn1r2w7d6siwwqm9q08sd2";
     };
   }
   {
-    goPackagePath = "github.com/bep/gitmap";
+    goPackagePath = "github.com/pelletier/go-toml";
     fetch = {
       type = "git";
-      url = "https://github.com/bep/gitmap";
-      rev = "a1a71abe12823e27ae7507189fe2e914ba9626ac";
-      sha256 = "0qfhb72y6wbypaqv6dkl42syifnhps3qcy1karpd6ziw4pxak18g";
+      url = "https://github.com/pelletier/go-toml";
+      rev = "fee7787d3f811af92276f5ff10107092e95b7a1d";
+      sha256 = "0srx5hr35f9qzn5dnqqa0msyjknwn7vcq0jmlkvfxgaq0ygd6s3r";
+    };
+  }
+  {
+    goPackagePath = "github.com/pkg/errors";
+    fetch = {
+      type = "git";
+      url = "https://github.com/pkg/errors";
+      rev = "248dadf4e9068a0b3e79f02ed0a610d935de5302";
+      sha256 = "03l80r0i9bxl0vz363w62k4a8apzglgbrz6viwym3044sxkl1qks";
+    };
+  }
+  {
+    goPackagePath = "github.com/pkg/sftp";
+    fetch = {
+      type = "git";
+      url = "https://github.com/pkg/sftp";
+      rev = "4d0e916071f68db74f8a73926335f809396d6b42";
+      sha256 = "0l4n4ld0lx53s0hgz5rhk8gn7kr51adsr0cs6wlqm296xlcfp52h";
+    };
+  }
+  {
+    goPackagePath = "github.com/russross/blackfriday";
+    fetch = {
+      type = "git";
+      url = "https://github.com/russross/blackfriday";
+      rev = "5f33e7b7878355cd2b7e6b8eefc48a5472c69f70";
+      sha256 = "0d7faqxrxvh8hwc1r8gbasgmr8x5blxvzciwspir2yafjfbqy87k";
+    };
+  }
+  {
+    goPackagePath = "github.com/shurcooL/sanitized_anchor_name";
+    fetch = {
+      type = "git";
+      url = "https://github.com/shurcooL/sanitized_anchor_name";
+      rev = "1dba4b3954bc059efc3991ec364f9f9a35f597d2";
+      sha256 = "0pwap8lp79pldd95a1qi3xhlsa17m8zddpgc5jzvk6d1cjpsm6qg";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/afero";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/afero";
+      rev = "9be650865eab0c12963d8753212f4f9c66cdcf12";
+      sha256 = "12dhh6d07304lsjv7c4p95hkip0hnshqhwivdw39pbypgg0p8y34";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/cast";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/cast";
+      rev = "ce135a4ebeee6cfe9a26c93ee0d37825f26113c7";
+      sha256 = "1a2ahiyynn1kdjznqvzjfm5g5bc098gfw857bw9qikhdljvsnjiy";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/cobra";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/cobra";
+      rev = "7be4beda01ec05d0b93d80b3facd2b6f44080d94";
+      sha256 = "0jd2ya8kn763z16c3q5jl1x6raw2f3xq3vbaf4ppiy70zqzscmyg";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/fsync";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/fsync";
+      rev = "12a01e648f05a938100a26858d2d59a120307a18";
+      sha256 = "1vvbgxbbsc4mvi1axgqgn9pzjz1p495dsmwpc7mr8qxh8f6s0nhv";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/jwalterweatherman";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/jwalterweatherman";
+      rev = "fa7ca7e836cf3a8bb4ebf799f472c12d7e903d66";
+      sha256 = "0404b7bzx7cq1b2bgdb3gs7gjzm4vvg1hl2y9mcm4m6vz56vbcz8";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/nitro";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/nitro";
+      rev = "24d7ef30a12da0bdc5e2eb370a79c659ddccf0e8";
+      sha256 = "143sbpx0jdgf8f8ayv51x6l4jg6cnv6nps6n60qxhx4vd90s6mib";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/pflag";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/pflag";
+      rev = "9ff6c6923cfffbcd502984b8e0c80539a94968b7";
+      sha256 = "0mfrxzyl8x7araa126lh8l3sihbbgfbzgkrg3v3cx7y4n3wrsqvn";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/viper";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/viper";
+      rev = "7538d73b4eb9511d85a9f1dfef202eeb8ac260f4";
+      sha256 = "0i4q715bjp018zw1b52zgx79j4s7s8l26dyrw8cslshibkx0frnl";
+    };
+  }
+  {
+    goPackagePath = "github.com/stretchr/testify";
+    fetch = {
+      type = "git";
+      url = "https://github.com/stretchr/testify";
+      rev = "4d4bfba8f1d1027c4fdbe371823030df51419987";
+      sha256 = "1d3yz1d2s88byjzmn60jbi1m9s552f7ghzbzik97fbph37i8yjhp";
+    };
+  }
+  {
+    goPackagePath = "github.com/yosssi/ace";
+    fetch = {
+      type = "git";
+      url = "https://github.com/yosssi/ace";
+      rev = "ea038f4770b6746c3f8f84f14fa60d9fe1205b56";
+      sha256 = "1kbvbc56grrpnl65grygd23gyn3nkkhxdg8awhzkjmd0cvki8w1f";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/crypto";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/crypto";
+      rev = "453249f01cfeb54c3d549ddb75ff152ca243f9d8";
+      sha256 = "0akybbzgi3v507a39bgnkk79rfhj8gflr7538g5a0177z5i9ygwa";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/net";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/net";
+      rev = "906cda9512f77671ab44f8c8563b13a8e707b230";
+      sha256 = "0aa33n5a2zzrm2pnjyc3xkdmf8hq2qpafgdp8v6fxfb0swqjl2n3";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/sys";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/sys";
+      rev = "075e574b89e4c2d22f2286a7e2b919519c6f3547";
+      sha256 = "1p38siwqcbd592lphaqpigl7scshkfy67k6jcwscbcsl6akw51km";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/text";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/text";
+      rev = "0ad425fe45e885577bef05dc1c50f72e33188b16";
+      sha256 = "1jz0i8iagfd703flx5z006kisjixpm8iy4hiwywgbh31wypsxxyl";
+    };
+  }
+  {
+    goPackagePath = "gopkg.in/yaml.v2";
+    fetch = {
+      type = "git";
+      url = "https://gopkg.in/yaml.v2";
+      rev = "a3f3340b5840cee44f372bddb5880fcbc419b46a";
+      sha256 = "1djb53a8ikwgkfpf8namgf4d8pq1mq6q9q2c7q0z8x4dxf3whxj7";
     };
   }
 ]

From 80c295f50fe42a6df48d4504b0bd8420ed04e75d Mon Sep 17 00:00:00 2001
From: Fernando J Pando <fernando.pando@stelligent.com>
Date: Mon, 20 Mar 2017 12:36:57 -0400
Subject: [PATCH 27/65] pythonPackages.distro: init 1.0.3

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

diff --git a/pkgs/development/python-modules/distro/default.nix b/pkgs/development/python-modules/distro/default.nix
new file mode 100644
index 000000000000..9b79d82328f7
--- /dev/null
+++ b/pkgs/development/python-modules/distro/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchPypi, buildPythonPackage, pytest, pytestcov, tox }:
+
+buildPythonPackage rec {
+  name = "${pname}-${version}";
+  pname = "distro";
+  version = "1.0.3";
+
+  buildInputs = [ pytest pytestcov tox];
+
+  checkPhase = ''
+    touch tox.ini
+    tox
+  '';
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1kmjdz1kxspsmps73m2kzhxz86jj43ikx825hmgmwbx793ywv69d";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/nir0s/distro;
+    description = "Linux Distribution - a Linux OS platform information API.";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ nand0p ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index e13978469345..7c5a1d06f377 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -32191,6 +32191,8 @@ EOF
 
   nitpick = callPackage ../applications/version-management/nitpick { };
 
+  distro = callPackage ../development/python-modules/distro { };
+
 });
 
 in fix' (extends overrides packages)

From c919ceda06dad76968a27050b1091492c363156e Mon Sep 17 00:00:00 2001
From: Sean Haugh <seanphaugh@gmail.com>
Date: Wed, 12 Apr 2017 16:13:12 -0500
Subject: [PATCH 28/65] envypn-font: init at 1.7.1

---
 pkgs/data/fonts/envypn-font/default.nix | 36 +++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix         |  2 ++
 2 files changed, 38 insertions(+)
 create mode 100644 pkgs/data/fonts/envypn-font/default.nix

diff --git a/pkgs/data/fonts/envypn-font/default.nix b/pkgs/data/fonts/envypn-font/default.nix
new file mode 100644
index 000000000000..203b68f5e5d2
--- /dev/null
+++ b/pkgs/data/fonts/envypn-font/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, mkfontdir, mkfontscale }:
+
+stdenv.mkDerivation rec {
+  name = "envypn-font-1.7.1";
+
+  src = fetchurl {
+    url = "https://ywstd.fr/files/p/envypn-font/envypn-font-1.7.1.tar.gz";
+    sha256 = "bda67b6bc6d5d871a4d46565d4126729dfb8a0de9611dae6c68132a7b7db1270";
+  };
+
+  buildInputs = [ mkfontdir mkfontscale ];
+
+  unpackPhase = ''
+    tar -xzf $src --strip-components=1
+  '';
+
+  installPhase = ''
+    # install the pcf fonts (for xorg applications)
+    fontDir="$out/share/fonts/envypn"
+    mkdir -p "$fontDir"
+    mv *.pcf.gz "$fontDir"
+
+    cd "$fontDir"
+    mkfontdir
+    mkfontscale
+  '';
+
+  meta = with stdenv.lib; {
+    description = ''
+      Readable bitmap font inspired by Envy Code R
+    '';
+    homepage = "http://ywstd.fr/p/pj/#envypn";
+    license = licenses.miros;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e20c102ea900..cf1712edea40 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12437,6 +12437,8 @@ with pkgs;
 
   encode-sans = callPackage ../data/fonts/encode-sans { };
 
+  envypn-font = callPackage ../data/fonts/envypn-font { };
+
   fantasque-sans-mono = callPackage ../data/fonts/fantasque-sans-mono {};
 
   fira = callPackage ../data/fonts/fira { };

From 416337b95c8adfcd2072be4a4b577f613f8af742 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Wed, 12 Apr 2017 19:33:03 -0400
Subject: [PATCH 29/65] atom: 1.15.0 -> 1.16.0

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

diff --git a/pkgs/applications/editors/atom/default.nix b/pkgs/applications/editors/atom/default.nix
index 60e17982b5be..e9546c16d62b 100644
--- a/pkgs/applications/editors/atom/default.nix
+++ b/pkgs/applications/editors/atom/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "atom-${version}";
-  version = "1.15.0";
+  version = "1.16.0";
 
   src = fetchurl {
     url = "https://github.com/atom/atom/releases/download/v${version}/atom-amd64.deb";
-    sha256 = "0w790b9m94m28bx7n94pg2zjxrcjf13228lsb0pl8kyfsk2k2glx";
+    sha256 = "10qzhfz34i7x7z5fv5a73a6aiwxvanyn0v825a6yz9qfc2mg4shd";
     name = "${name}.deb";
   };
 

From 47e82ef817a170186037fa4294d8c858fc9e2b06 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Wed, 12 Apr 2017 19:40:05 -0400
Subject: [PATCH 30/65] gradle: 3.4.1 -> 3.5

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

diff --git a/pkgs/development/tools/build-managers/gradle/default.nix b/pkgs/development/tools/build-managers/gradle/default.nix
index 28b6601cab6f..51aaf5e6a79a 100644
--- a/pkgs/development/tools/build-managers/gradle/default.nix
+++ b/pkgs/development/tools/build-managers/gradle/default.nix
@@ -52,12 +52,12 @@ rec {
   };
 
   gradle_latest = gradleGen rec {
-    name = "gradle-3.4.1";
-    nativeVersion = "0.13";
+    name = "gradle-3.5";
+    nativeVersion = "0.14";
 
     src = fetchurl {
       url = "http://services.gradle.org/distributions/${name}-bin.zip";
-      sha256 = "1cpria3qry4778pxcmqvnaqcyq36abj1fgw4pq115k3rsj9v27fv";
+      sha256 = "046i268zkg89ps7c1sq8yx9lbn9kighh4gcskxmzf3qriiwm0x0b";
     };
   };
 

From 1fd7bf9ee3e7e26526aca139ea881afd478932c3 Mon Sep 17 00:00:00 2001
From: Dan Peebles <pumpkin@me.com>
Date: Wed, 12 Apr 2017 20:30:07 -0400
Subject: [PATCH 31/65] nano: remove unnecessary Darwin-specific behavior

It seems to compile just fine without this now that we're on 2.8.1
---
 pkgs/applications/editors/nano/default.nix | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/pkgs/applications/editors/nano/default.nix b/pkgs/applications/editors/nano/default.nix
index 645880a13e05..bfc3b7c79faf 100644
--- a/pkgs/applications/editors/nano/default.nix
+++ b/pkgs/applications/editors/nano/default.nix
@@ -36,15 +36,6 @@ in stdenv.mkDerivation rec {
     --sysconfdir=/etc
     ${optionalString (!enableNls) "--disable-nls"}
     ${optionalString enableTiny "--enable-tiny"}
-  ''
-  # Unclear why (perhaps an impurity?) but for some reason it decides that REG_ENHANCED is available
-  # during configure but then can't find it at build time.
-    + optionalString stdenv.isDarwin ''
-    nano_cv_flag_reg_extended=REG_EXTENDED
-  '';
-
-  postPatch = optionalString stdenv.isDarwin ''
-    substituteInPlace src/text.c --replace "__time_t" "time_t"
   '';
 
   postInstall = ''

From 4672fe6998c04b7f8b56785b7bc42efc9f013d2f Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 20:03:29 -0500
Subject: [PATCH 32/65] pinentry_mac: use precompiled .nib's

sadly, xib2nib hasn't been working like i though. I've just
precompiled into our modified pinentry_mac. Eventually we can get this
fixed but it's not as easy as first thought.
---
 pkgs/tools/security/pinentry-mac/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/tools/security/pinentry-mac/default.nix b/pkgs/tools/security/pinentry-mac/default.nix
index 6aa14ab90e74..4cba1c7e6172 100644
--- a/pkgs/tools/security/pinentry-mac/default.nix
+++ b/pkgs/tools/security/pinentry-mac/default.nix
@@ -6,8 +6,8 @@ stdenv.mkDerivation rec {
   src = fetchFromGitHub {
     owner = "matthewbauer";
     repo = "pinentry-mac";
-    rev = "77fc993d1040ed2319d9e53af78146be318c1fdd";
-    sha256 = "0rkmp6wb8wvmhipavn1bdmbw6564hc2b99dxqysr6yxr2xqs6fcz";
+    rev = "d60aa902644a1f0126ec50e79937423a3a7c3bc4";
+    sha256 = "0xp4rdyj0mw6gg1z1wraggb1qlkjb5845mibrz3nj0l692da52nq";
   };
 
   buildInputs = [ xcbuild libiconv Cocoa ncurses ];

From 9e5fe7738a5abdd2357c3d72899ca1712a36de3a Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 12 Apr 2017 20:07:55 -0500
Subject: [PATCH 33/65] xib2nib: add meta

also:
- NSPlist
- PlistCpp
---
 pkgs/development/libraries/NSPlist/default.nix  | 7 +++++++
 pkgs/development/libraries/PlistCpp/default.nix | 8 ++++++++
 pkgs/development/tools/xib2nib/default.nix      | 7 +++++++
 3 files changed, 22 insertions(+)

diff --git a/pkgs/development/libraries/NSPlist/default.nix b/pkgs/development/libraries/NSPlist/default.nix
index c06d98876de8..bfee99619840 100644
--- a/pkgs/development/libraries/NSPlist/default.nix
+++ b/pkgs/development/libraries/NSPlist/default.nix
@@ -11,4 +11,11 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ matthewbauer ];
+    description = "Parses .plist files";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
 }
diff --git a/pkgs/development/libraries/PlistCpp/default.nix b/pkgs/development/libraries/PlistCpp/default.nix
index 511915be39f5..f7703b731b99 100644
--- a/pkgs/development/libraries/PlistCpp/default.nix
+++ b/pkgs/development/libraries/PlistCpp/default.nix
@@ -11,4 +11,12 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ cmake boost NSPlist pugixml ];
+
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ matthewbauer ];
+    description = "CPP bindings for Plist";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
 }
diff --git a/pkgs/development/tools/xib2nib/default.nix b/pkgs/development/tools/xib2nib/default.nix
index 5f516ee97cbe..d585a35b0bc5 100644
--- a/pkgs/development/tools/xib2nib/default.nix
+++ b/pkgs/development/tools/xib2nib/default.nix
@@ -12,4 +12,11 @@ stdenv.mkDerivation {
 
   buildInputs = [ PlistCpp pugixml boost ];
   makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ matthewbauer ];
+    description = "Compiles CocoaTouch .xib files into .nib";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
 }

From acf45e0f9ce28107b1218414d05c93287b97f59b Mon Sep 17 00:00:00 2001
From: mucaho <mucaho@gmail.com>
Date: Thu, 13 Apr 2017 01:38:01 +0200
Subject: [PATCH 34/65] pythonPackages.pluginbase: init at 0.5

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

diff --git a/pkgs/development/python-modules/pluginbase/default.nix b/pkgs/development/python-modules/pluginbase/default.nix
new file mode 100644
index 000000000000..9d90c617fc16
--- /dev/null
+++ b/pkgs/development/python-modules/pluginbase/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchPypi, buildPythonPackage, pytest, tox }:
+
+buildPythonPackage rec {
+  name = "${pname}-${version}";
+  version = "0.5";
+  pname = "pluginbase";
+
+  buildInputs = [ pytest tox ];
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1palagrlszs4f4f5j6npzl4d195vclrlza3qr524z2h758j31y5l";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/mitsuhiko/pluginbase;
+    description = "A support library for building plugins sytems in Python";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 7c5a1d06f377..a16f9342cb01 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -32191,6 +32191,8 @@ EOF
 
   nitpick = callPackage ../applications/version-management/nitpick { };
 
+  pluginbase = callPackage ../development/python-modules/pluginbase { };
+
   distro = callPackage ../development/python-modules/distro { };
 
 });

From fe2ced1ea895a224b97a4d3cfb47782cdd0ceb0a Mon Sep 17 00:00:00 2001
From: mucaho <mucaho@gmail.com>
Date: Thu, 13 Apr 2017 01:39:18 +0200
Subject: [PATCH 35/65] pythonPackages.node-semver: init at 0.1.1

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

diff --git a/pkgs/development/python-modules/node-semver/default.nix b/pkgs/development/python-modules/node-semver/default.nix
new file mode 100644
index 000000000000..0bd569fd4ad3
--- /dev/null
+++ b/pkgs/development/python-modules/node-semver/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchPypi, buildPythonPackage, pytest, tox }:
+
+buildPythonPackage rec {
+  name = "${pname}-${version}";
+  version = "0.1.1";
+  pname = "node-semver";
+
+  buildInputs = [ pytest tox ];
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1b3xiqgl436q33grbkh4chpfchl8i2dmcpggbb2q4vgv3vjy97p2";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/podhmo/python-semver;
+    description = "A port of node-semver";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index a16f9342cb01..e8453d23a5de 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -32193,6 +32193,8 @@ EOF
 
   pluginbase = callPackage ../development/python-modules/pluginbase { };
 
+  node-semver = callPackage ../development/python-modules/node-semver { };
+
   distro = callPackage ../development/python-modules/distro { };
 
 });

From 8d5e55a0f0b1c546ec69701a54a6cd43c4aa5339 Mon Sep 17 00:00:00 2001
From: mucaho <mucaho@gmail.com>
Date: Thu, 13 Apr 2017 01:40:33 +0200
Subject: [PATCH 36/65] conan: init at 0.21.2

---
 .../tools/build-managers/conan/default.nix    | 28 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 ++
 2 files changed, 30 insertions(+)
 create mode 100644 pkgs/development/tools/build-managers/conan/default.nix

diff --git a/pkgs/development/tools/build-managers/conan/default.nix b/pkgs/development/tools/build-managers/conan/default.nix
new file mode 100644
index 000000000000..417e492f7d0b
--- /dev/null
+++ b/pkgs/development/tools/build-managers/conan/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, pythonPackages }:
+
+pythonPackages.buildPythonApplication rec {
+  name = "${pname}-${version}";
+  version = "0.21.2";
+  pname = "conan";
+
+  src = pythonPackages.fetchPypi {
+    inherit pname version;
+    sha256 = "0x9s5h81d885xdrjw5x99q18lhmj11kalrs6xnjy2phrr8qzil8c";
+  };
+
+  propagatedBuildInputs = with pythonPackages; [
+    requests2 fasteners pyyaml pyjwt colorama patch
+    bottle pluginbase six distro pylint node-semver
+  ];
+
+  # enable tests once all of these pythonPackages available:
+  # [ nose nose_parameterized mock WebTest codecov ]
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    homepage = https://conan.io;
+    description = "Decentralized and portable C/C++ package manager";
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e20c102ea900..55ea877c2376 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6407,6 +6407,8 @@ with pkgs;
 
   complexity = callPackage ../development/tools/misc/complexity { };
 
+  conan = callPackage ../development/tools/build-managers/conan { };
+
   cookiecutter = pythonPackages.cookiecutter;
 
   ctags = callPackage ../development/tools/misc/ctags { };

From b306e672a18aa3fccc58eebf6e329df851db0ae8 Mon Sep 17 00:00:00 2001
From: Andrew Cann <shum@canndrew.org>
Date: Thu, 13 Apr 2017 11:53:35 +0800
Subject: [PATCH 37/65] hivemind: init at git-2017-04-13

Hivemind is a peer-to-peer oracle protocol which absorbs accurate data
into a blockchain so that bitcoin-users can speculate in prediction
markets.
---
 pkgs/applications/altcoins/default.nix  |  3 ++
 pkgs/applications/altcoins/hivemind.nix | 39 +++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 pkgs/applications/altcoins/hivemind.nix

diff --git a/pkgs/applications/altcoins/default.nix b/pkgs/applications/altcoins/default.nix
index fbc3d1c36f91..b51acea061f1 100644
--- a/pkgs/applications/altcoins/default.nix
+++ b/pkgs/applications/altcoins/default.nix
@@ -22,6 +22,9 @@ rec {
   freicoin = callPackage ./freicoin.nix { boost = pkgs.boost155; };
   go-ethereum = callPackage ./go-ethereum.nix { };
 
+  hivemind = callPackage ./hivemind.nix { withGui = true; };
+  hivemindd = callPackage ./hivemind.nix { withGui = false; };
+
   litecoin  = callPackage ./litecoin.nix { withGui = true; };
   litecoind = callPackage ./litecoin.nix { withGui = false; };
 
diff --git a/pkgs/applications/altcoins/hivemind.nix b/pkgs/applications/altcoins/hivemind.nix
new file mode 100644
index 000000000000..179a96c04499
--- /dev/null
+++ b/pkgs/applications/altcoins/hivemind.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook, openssl, db48, boost
+, zlib, miniupnpc, qt4, utillinux, protobuf, qrencode, libevent
+, withGui }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "hivemind" + (toString (optional (!withGui) "d")) + "-" + version;
+  version = "git-2017-04-13";
+
+  src = fetchFromGitHub {
+    owner = "bitcoin-hivemind";
+    repo = "hivemind";
+    rev = "147973cfe76867410578d91d6f0a8df105cab4e0";
+    sha256 = "1ndqqma1b0sh2gn7cl8d9fg44q0g2g42jr2y0nifkjgfjn3c7l5h";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ openssl db48 boost zlib
+                  miniupnpc protobuf libevent]
+                  ++ optionals stdenv.isLinux [ utillinux ]
+                  ++ optionals withGui [ qt4 qrencode ];
+
+  configureFlags = [ "--with-boost-libdir=${boost.out}/lib" 
+                     "--with-incompatible-bdb"
+                   ] ++ optionals withGui [ "--with-gui=qt4" ];
+
+  meta = {
+    description = "Peer-to-Peer oracle protocol";
+    longDescription= ''
+      Hivemind is a Peer-to-Peer Oracle Protocol which absorbs accurate data
+      into a blockchain so that Bitcoin-users can speculate in Prediction
+      Markets.
+    '';
+    homepage = "https://bitcoinhivemind.com";
+    maintainers = with maintainers; [ canndrew ];
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}

From 42d7fa2c7160d513c9e043b9f6e1ba6b58b4deaa Mon Sep 17 00:00:00 2001
From: Andrew Cann <shum@canndrew.org>
Date: Thu, 13 Apr 2017 16:40:32 +0800
Subject: [PATCH 38/65] hivemind: rename unstable package

---
 pkgs/applications/altcoins/hivemind.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/applications/altcoins/hivemind.nix b/pkgs/applications/altcoins/hivemind.nix
index 179a96c04499..1b2682f7d4c0 100644
--- a/pkgs/applications/altcoins/hivemind.nix
+++ b/pkgs/applications/altcoins/hivemind.nix
@@ -5,7 +5,7 @@
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "hivemind" + (toString (optional (!withGui) "d")) + "-" + version;
-  version = "git-2017-04-13";
+  version = "unstable";
 
   src = fetchFromGitHub {
     owner = "bitcoin-hivemind";

From 5ca7e8a69ae94d4c122c7fa69d77e749e83dbebc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 13 Apr 2017 12:26:45 +0200
Subject: [PATCH 39/65] fcron: do not chmod at all

fcron does handle permissions on its own correctly
---
 nixos/modules/services/scheduling/fcron.nix | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix
index bd1ecb40969b..bc631bdd0447 100644
--- a/nixos/modules/services/scheduling/fcron.nix
+++ b/nixos/modules/services/scheduling/fcron.nix
@@ -143,10 +143,12 @@ in
       };
 
       preStart = ''
-        ${pkgs.coreutils}/bin/mkdir -m 0770 -p /var/spool/fcron
-        ${pkgs.coreutils}/bin/chown -R fcron:fcron /var/spool/fcron
+        install \
+          --mode 0770 \
+          --owner fcron \
+          --group fcron \
+          --directory /var/spool/fcron
         # load system crontab file
-        set -x
         #${pkgs.fcron}/bin/fcrontab -u systab ${pkgs.writeText "systab" cfg.systab}
       '';
 

From d3c737a080b20638394139948934557d081a6d0a Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Thu, 13 Apr 2017 13:06:11 +0200
Subject: [PATCH 40/65] gcc-snapshot: 7-20161211 -> 7-20170409

---
 pkgs/development/compilers/gcc/snapshot/default.nix | 4 ++--
 pkgs/top-level/all-packages.nix                     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix
index 81bed7119ea5..12eb8b3a5425 100644
--- a/pkgs/development/compilers/gcc/snapshot/default.nix
+++ b/pkgs/development/compilers/gcc/snapshot/default.nix
@@ -60,7 +60,7 @@ assert langGo -> langCC;
 with stdenv.lib;
 with builtins;
 
-let version = "7-20161211";
+let version = "7-20170409";
 
     # Whether building a cross-compiler for GNU/Hurd.
     crossGNU = cross != null && cross.config == "i586-pc-gnu";
@@ -217,7 +217,7 @@ stdenv.mkDerivation ({
 
   src = fetchurl {
     url = "mirror://gcc/snapshots/${version}/gcc-${version}.tar.bz2";
-    sha256 = "114rrrm5d5cawmr3161d2wgjlzkb9l1imj1p7fnypwz7y85l1661";
+    sha256 = "19197rw1xrpkb8h10lfgn6zj7yj52x95hdmr0x5lg8i4v3i23b67";
   };
 
   inherit patches;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 14b732889ab2..de7a44f50abb 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5085,7 +5085,7 @@ with pkgs;
     cross = null;
     libcCross = if targetPlatform != buildPlatform then libcCross else null;
 
-    isl = if !stdenv.isDarwin then isl_0_14 else null;
+    isl = isl_0_17;
   }));
 
   gfortran = gfortran5;

From 73c8797d169efffe2207b79615d4af6294cd097e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <Mic92@users.noreply.github.com>
Date: Thu, 13 Apr 2017 13:42:28 +0200
Subject: [PATCH 41/65] gce/create-gce.sh: rewrite using nix-shell shebang and
 bash (#24869)

* google-cloud-sdk: 150.0.0 -> 151.0.0

- gce/create-gce.sh: rewrite using nix-shell shebang and bash
- allows to run the script without being the same directory
- nix-shell install google-cloud-sdk
- some shellcheck cleanups and scripting best practice
- gce/create-gce.sh: do not clobber NIX_PATH: this allows NIX_PATH to be overwritten to build a different release
- gce/create-gce.sh: remove legacy hydra option
---
 nixos/maintainers/scripts/gce/create-gce.sh   | 28 ++++++++++++-------
 pkgs/tools/admin/google-cloud-sdk/default.nix |  8 +++---
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/nixos/maintainers/scripts/gce/create-gce.sh b/nixos/maintainers/scripts/gce/create-gce.sh
index 7f8a0d23027a..ef1801fe54be 100755
--- a/nixos/maintainers/scripts/gce/create-gce.sh
+++ b/nixos/maintainers/scripts/gce/create-gce.sh
@@ -1,15 +1,23 @@
-#! /bin/sh -e
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p google-cloud-sdk
 
-BUCKET_NAME=${BUCKET_NAME:-nixos-images}
-export NIX_PATH=nixpkgs=../../../..
-export NIXOS_CONFIG=$(dirname $(readlink -f $0))/../../../modules/virtualisation/google-compute-image.nix
-export TIMESTAMP=$(date +%Y%m%d%H%M)
+set -euo pipefail
+
+BUCKET_NAME="${BUCKET_NAME:-nixos-images}"
+TIMESTAMP="$(date +%Y%m%d%H%M)"
+export TIMESTAMP
 
 nix-build '<nixpkgs/nixos>' \
-   -A config.system.build.googleComputeImage --argstr system x86_64-linux -o gce --option extra-binary-caches http://hydra.nixos.org -j 10
+   -A config.system.build.googleComputeImage \
+   --arg configuration "{ imports = [ <nixpkgs/nixos/modules/virtualisation/google-compute-image.nix> ]; }" \
+   --argstr system x86_64-linux \
+   -o gce \
+   -j 10
 
-img=$(echo gce/*.tar.gz)
-if ! gsutil ls gs://${BUCKET_NAME}/$(basename $img); then
-  gsutil cp $img gs://${BUCKET_NAME}/$(basename $img)
+img_path=$(echo gce/*.tar.gz)
+img_name=$(basename "$img_path")
+img_id=$(echo "$img_name" | sed 's|.raw.tar.gz$||;s|\.|-|g;s|_|-|g')
+if ! gsutil ls "gs://${BUCKET_NAME}/$img_name"; then
+  gsutil cp "$img_path" "gs://${BUCKET_NAME}/$img_name"
 fi
-gcloud compute images create $(basename $img .raw.tar.gz | sed 's|\.|-|' | sed 's|_|-|') --source-uri gs://${BUCKET_NAME}/$(basename $img)
+gcloud compute images create "$img_id" --source-uri "gs://${BUCKET_NAME}/$img_name"
diff --git a/pkgs/tools/admin/google-cloud-sdk/default.nix b/pkgs/tools/admin/google-cloud-sdk/default.nix
index 7c410a1a4f4f..67bbb510b13d 100644
--- a/pkgs/tools/admin/google-cloud-sdk/default.nix
+++ b/pkgs/tools/admin/google-cloud-sdk/default.nix
@@ -7,23 +7,23 @@ assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" || stden
 
 stdenv.mkDerivation rec {
   name = "google-cloud-sdk-${version}";
-  version = "150.0.0";
+  version = "151.0.0";
 
   src =
     if stdenv.system == "i686-linux" then
       fetchurl {
         url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${name}-linux-x86.tar.gz";
-        sha256 = "0zg6jnn93dq53glds4cghksyghb4d4z0i2h38na0r88mr8hzmx1l";
+        sha256 = "1d1h6jiqs3grsb6c61v6dkb4l2qv6v8g7wbzgaqkmn09xdbaq40l";
       }
     else if stdenv.system == "x86_64-darwin" then
       fetchurl {
         url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${name}-darwin-x86_64.tar.gz";
-        sha256 = "1vbc360z2da3blwx51asw7jh0v0v6wsrv20z36yq0hccmljlh24w";
+        sha256 = "05idf0g505s8diaz28ij9yqig2wwn43lyppfs483m7vnx5hk62j5";
       }
     else
       fetchurl {
         url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${name}-linux-x86_64.tar.gz";
-        sha256 = "1q66aap3qidfsa8gm13jff3dprx8qarhjkx5ib65439fy4zj0bca";
+        sha256 = "01hf7pp1v57dxx6f2pz7j13fjdnrfp7gjmzjdlhlx4rnvxrd6i3f";
       };
 
   buildInputs = [python27 makeWrapper];

From 15bb499df939674c992b1c42e915821193116af2 Mon Sep 17 00:00:00 2001
From: Michael Leandersson <tripokey@gmail.com>
Date: Wed, 12 Apr 2017 17:24:17 +0200
Subject: [PATCH 42/65] kakoune: 2017-02-09-> 2017-04-12

fixes #24847
fixes #24738
---
 pkgs/applications/editors/kakoune/default.nix | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/pkgs/applications/editors/kakoune/default.nix b/pkgs/applications/editors/kakoune/default.nix
index 4590939b516a..067aff5ee69b 100644
--- a/pkgs/applications/editors/kakoune/default.nix
+++ b/pkgs/applications/editors/kakoune/default.nix
@@ -3,25 +3,20 @@
 with stdenv.lib;
 
 stdenv.mkDerivation rec {
-  name = "kakoune-nightly-${version}";
-  version = "2017-02-09";
+  name = "kakoune-unstable-${version}";
+  version = "2017-04-12";
   src = fetchFromGitHub {
     repo = "kakoune";
     owner = "mawww";
-    rev = "9ba1665e58ee84b6596d89e6ef75f7c32e7c6c14";
-    sha256 = "1l25mzq64a481qlsyh25rzp5rzajrkx4dq29677z85lnjqn30wbi";
+    rev = "7482d117cc85523e840dff595134dcb9cdc62207";
+    sha256 = "08j611y192n9vln9i94ldlvz3k0sg79dkmfc0b1vczrmaxhpgpfh";
   };
   buildInputs = [ ncurses boost asciidoc docbook_xsl libxslt ];
 
-  buildPhase = ''
-    sed -ie 's#--no-xmllint#--no-xmllint --xsltproc-opts="--nonet"#g' src/Makefile
-    substituteInPlace src/Makefile --replace "boost_regex-mt" "boost_regex"
+  postPatch = ''
     export PREFIX=$out
-    (cd src && make )
-  '';
-
-  installPhase = ''
-    (cd src && make install)
+    cd src
+    sed -ie 's#--no-xmllint#--no-xmllint --xsltproc-opts="--nonet"#g' Makefile
   '';
 
   meta = {

From d606717588827d26e7838ecb1580bf7928f4369e Mon Sep 17 00:00:00 2001
From: Toni Schmidbauer <toni@stderr.at>
Date: Thu, 6 Apr 2017 09:55:57 +0200
Subject: [PATCH 43/65] davmail: 4.7.2 -> 4.8.0

---
 pkgs/applications/networking/davmail/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/applications/networking/davmail/default.nix b/pkgs/applications/networking/davmail/default.nix
index bb4a4a710094..a349d1fb53e4 100644
--- a/pkgs/applications/networking/davmail/default.nix
+++ b/pkgs/applications/networking/davmail/default.nix
@@ -1,10 +1,10 @@
 { fetchurl, stdenv, jre, glib, libXtst, gtk2, makeWrapper }:
 
 stdenv.mkDerivation rec {
-  name = "davmail-4.7.2";
+  name = "davmail-4.8.0";
   src = fetchurl {
-    url = "mirror://sourceforge/davmail/4.7.1/davmail-linux-x86_64-4.7.1-2416.tgz";
-    sha256 = "196jr44kksb197biz984z664llf9z3d8rlnjm2iqcmgkjhx1mgy3";
+    url = "mirror://sourceforge/davmail/4.8.0/davmail-linux-x86_64-4.8.0-2479.tgz";
+    sha256 = "0e650c4a060d64fd2b270ddb00baa906aac617865d5e60c9f526a281cdb27b62";
   };
 
   buildInputs = [ makeWrapper ];

From 1dee38f259c28f08a9694923301290fa82f5d81f Mon Sep 17 00:00:00 2001
From: Marco Maggesi <maggesi@math.unifi.it>
Date: Thu, 13 Apr 2017 14:12:50 +0200
Subject: [PATCH 44/65] BLCR 0.8.5b4 *do* work with Linux 3.10.

---
 pkgs/os-specific/linux/blcr/default.nix | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pkgs/os-specific/linux/blcr/default.nix b/pkgs/os-specific/linux/blcr/default.nix
index c2e3fa4b9e1f..ab1a93b3a703 100644
--- a/pkgs/os-specific/linux/blcr/default.nix
+++ b/pkgs/os-specific/linux/blcr/default.nix
@@ -1,14 +1,10 @@
 { stdenv, lib, fetchurl, kernel, perl, makeWrapper }:
 
-# BLCR 0.8.5 should works for kernel version up to 3.7.1
-# BLCR 0.8.6 should works for kernel version up to 3.17.x
+# BLCR version 0.8.6 should works with linux kernel up to version 3.17.x
 
 assert stdenv.isLinux;
 assert builtins.compareVersions "3.18" kernel.version == 1;
 
-# it doesn't compile anymore on 3.12
-assert lib.versionAtLeast kernel.version "3.14";
-
 stdenv.mkDerivation {
   name = "blcr_${kernel.version}-0.8.6pre4";
 

From 20fea7f4491919e93dae9b83e861b4bab881f568 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 13 Apr 2017 14:32:48 +0200
Subject: [PATCH 45/65] davmail: remove unrelated files from $out/bin

---
 .../networking/davmail/default.nix            | 28 ++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/pkgs/applications/networking/davmail/default.nix b/pkgs/applications/networking/davmail/default.nix
index a349d1fb53e4..b491f287e701 100644
--- a/pkgs/applications/networking/davmail/default.nix
+++ b/pkgs/applications/networking/davmail/default.nix
@@ -7,19 +7,21 @@ stdenv.mkDerivation rec {
     sha256 = "0e650c4a060d64fd2b270ddb00baa906aac617865d5e60c9f526a281cdb27b62";
   };
 
-  buildInputs = [ makeWrapper ];
-
-  meta = {
-    description = "A Java application which presents a Microsoft Exchange server as local CALDAV, IMAP and SMTP servers";
-    maintainers = [ stdenv.lib.maintainers.hinton ];
-    platforms = stdenv.lib.platforms.all;
-    homepage = "http://davmail.sourceforce.net/";
-    license = stdenv.lib.licenses.gpl2;
-  };
+  nativeBuildInputs = [ makeWrapper ];
 
   installPhase = ''
-  mkdir -p $out/bin
-  cp ./* $out/bin/ -R
-  wrapProgram $out/bin/davmail.sh --prefix PATH : ${jre}/bin --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
-   '';
+    mkdir -p $out/share/davmail
+    cp -R ./* $out/share/davmail
+    makeWrapper $out/share/davmail/davmail.sh $out/bin/davmail \
+      --prefix PATH : ${jre}/bin \
+      --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://davmail.sourceforce.net/;
+    description = "A Java application which presents a Microsoft Exchange server as local CALDAV, IMAP and SMTP servers";
+    maintainers = [ maintainers.hinton ];
+    platforms = platforms.all;
+    license = licenses.gpl2;
+  };
 }

From dcbb2bf75149adb2ca33b773a85a54e6fddffb61 Mon Sep 17 00:00:00 2001
From: Christoph-Simon Senjak <you@example.com>
Date: Thu, 13 Apr 2017 01:14:03 +0200
Subject: [PATCH 46/65] teamviewer: keep RTlib directory

Added the formerly deleted RTlib directory, included its
patchelf commands. Beforehand the client failed, because
TVGuiDelegate did not find all symbols.

fixes #24862
---
 .../networking/remote/teamviewer/default.nix       | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pkgs/applications/networking/remote/teamviewer/default.nix b/pkgs/applications/networking/remote/teamviewer/default.nix
index 288fa4383610..5c9e96c65277 100644
--- a/pkgs/applications/networking/remote/teamviewer/default.nix
+++ b/pkgs/applications/networking/remote/teamviewer/default.nix
@@ -9,7 +9,7 @@ let
 
   mkLdPath = ps: lib.makeLibraryPath (with ps; [ qt4 dbus alsaLib ]);
 
-  deps = ps: (with ps; [ dbus alsaLib fontconfig freetype libpng12 libjpeg ]) ++ (with ps.xlibs; [ libX11 libXext libXdamage libXrandr libXrender libXfixes libSM libXtst ]);
+  deps = ps: (with ps; [ dbus zlib alsaLib fontconfig freetype libpng12 libjpeg ]) ++ (with ps.xlibs; [ libX11 libXext libXdamage libXrandr libXrender libXfixes libSM libXtst libXinerama]);
   tvldpath32 = lib.makeLibraryPath (with pkgsi686Linux; [ qt4 "$out/share/teamviewer/tv_bin/wine" ] ++ deps pkgsi686Linux);
   tvldpath64 = lib.makeLibraryPath (deps pkgs);
 in
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     rm -R \
       $out/share/teamviewer/logfiles \
       $out/share/teamviewer/config \
-      $out/share/teamviewer/tv_bin/{xdg-utils,RTlib} \
+      $out/share/teamviewer/tv_bin/xdg-utils \
       $out/share/teamviewer/tv_bin/script/{teamviewer_setup,teamviewerd.sysv,teamviewerd.service,teamviewerd.*.conf,libdepend,tv-delayed-start.sh}
 
     ln -s $out/share/teamviewer/tv_bin/script/teamviewer $out/bin
@@ -57,13 +57,13 @@ stdenv.mkDerivation rec {
 
     sed -i "s,/opt/teamviewer,$out/share/teamviewer,g" desktop/com.teamviewer.*.desktop
 
-    for i in teamviewer-config teamviewerd TeamViewer_Desktop TVGuiDelegate TVGuiSlave.32 wine/bin/*; do
+    for i in teamviewer-config teamviewerd TeamViewer_Desktop TVGuiDelegate TVGuiSlave.32 wine/bin/* RTlib/libQtCore.so.4; do
       echo "patching $i"
-      patchelf --set-interpreter $(cat ${ld32}) --set-rpath ${tvldpath32} $i || true
+      patchelf --set-interpreter $(cat ${ld32}) --set-rpath $out/share/teamviewer/tv_bin/RTlib:${tvldpath32} $i || true
     done
-    for i in resources/*.so wine/drive_c/TeamViewer/tvwine.dll.so wine/lib/*.so* wine/lib/wine/*.so; do
+    for i in resources/*.so wine/drive_c/TeamViewer/tvwine.dll.so wine/lib/*.so* wine/lib/wine/*.so RTlib/*.so* ;  do
       echo "patching $i"
-      patchelf --set-rpath ${tvldpath32} $i || true
+      patchelf --set-rpath $out/share/teamviewer/tv_bin/RTlib:${tvldpath32} $i || true
     done
     ${if stdenv.system == "x86_64-linux" then ''
       patchelf --set-interpreter $(cat ${ld64}) --set-rpath ${tvldpath64} TVGuiSlave.64
@@ -81,6 +81,6 @@ stdenv.mkDerivation rec {
     license = licenses.unfree;
     description = "Desktop sharing application, providing remote support and online meetings";
     platforms = [ "i686-linux" "x86_64-linux" ];
-    maintainers = with maintainers; [ jagajaga ];
+    maintainers = with maintainers; [ jagajaga dasuxullebt ];
   };
 }

From 1f32d4b4eb50a78613cc9a3866c4d50d03fbe2b0 Mon Sep 17 00:00:00 2001
From: Tuomas Tynkkynen <tuomas@tuxera.com>
Date: Thu, 13 Apr 2017 16:28:09 +0300
Subject: [PATCH 47/65] make-bootstrap-tools.nix: Fix bzip2

Apparently our native bzip2 builds switched to using dynamic libraries at some point.
---
 pkgs/stdenv/linux/make-bootstrap-tools-cross.nix | 3 +--
 pkgs/stdenv/linux/make-bootstrap-tools.nix       | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
index 1a762bd87c79..613edfafd954 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
@@ -221,8 +221,7 @@ rec {
         # GCC has certain things built in statically. See
         # pkgs/stdenv/linux/default.nix for the details.
         cp -d ${isl}/lib/libisl*.so* $out/lib
-        # Also this is needed since bzip2 uses a custom build system
-        # for native builds but autoconf (via a patch) for cross builds
+
         cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
 
         # Copy binutils.
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 42015a79a3e0..2ce73eb781d8 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -122,6 +122,8 @@ rec {
         cp -d ${zlib.out}/lib/libz.so* $out/lib
         cp -d ${libelf}/lib/libelf.so* $out/lib
 
+        cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
+
         # Copy binutils.
         for i in as ld ar ranlib nm strip readelf objdump; do
           cp ${binutils.out}/bin/$i $out/bin

From d4fbb4779b88190e5b3a376360eb5fb97dba2f57 Mon Sep 17 00:00:00 2001
From: zimbatm <zimbatm@zimbatm.com>
Date: Thu, 13 Apr 2017 15:27:19 +0100
Subject: [PATCH 48/65] terraform: 0.9.2 -> 0.9.3

---
 .../networking/cluster/terraform/default.nix    | 17 +++--------------
 pkgs/top-level/all-packages.nix                 |  4 ++--
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/pkgs/applications/networking/cluster/terraform/default.nix b/pkgs/applications/networking/cluster/terraform/default.nix
index aad5d1a80326..76984fed3404 100644
--- a/pkgs/applications/networking/cluster/terraform/default.nix
+++ b/pkgs/applications/networking/cluster/terraform/default.nix
@@ -49,20 +49,9 @@ in {
     sha256 = "0ibgpcpvz0bmn3cw60nzsabsrxrbmmym1hv7fx6zmjxiwd68w5gb";
   };
 
-  terraform_0_9_2 = generic {
-    version = "0.9.2";
-    sha256 = "1yj5x1d10028fm3v3gjyjdn128ps0as345hr50y8x3vn86n70lxl";
-
-    patches = [
-      (fetchpatch {
-        url = "https://github.com/hashicorp/terraform/pull/13237.patch";
-        sha256 = "03c2nq12gvqqp12znvl3lmiviwsqksx4nrplv09fns2kz2gyfnbm";
-      })
-      (fetchpatch {
-        url = "https://github.com/hashicorp/terraform/pull/13248.patch";
-        sha256 = "0awj8gaic0j7a69is95f2rll3yip4n6avai1jh20b1x7dybdrp5m";
-      })
-    ];
+  terraform_0_9_3 = generic {
+    version = "0.9.3";
+    sha256 = "00z72lwv0cprz1jjy0cr8dicl00zwc1zwsxzjssqnq0187sswkxw";
 
     postPatch = ''
       rm builtin/providers/dns/data_dns_cname_record_set_test.go
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e0573f504fd7..14a3e9c9fb6e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18193,10 +18193,10 @@ with pkgs;
   inherit (callPackage ../applications/networking/cluster/terraform {})
     terraform_0_8_5
     terraform_0_8_8
-    terraform_0_9_2;
+    terraform_0_9_3;
 
   terraform_0_8 = terraform_0_8_8;
-  terraform_0_9 = terraform_0_9_2;
+  terraform_0_9 = terraform_0_9_3;
   terraform = terraform_0_9;
 
   terragrunt = callPackage ../applications/networking/cluster/terragrunt {

From 798e358a02aab8c9156020d99f7beda1061f1988 Mon Sep 17 00:00:00 2001
From: Yann Hodique <hodiquey@vmware.com>
Date: Thu, 13 Apr 2017 08:10:39 -0700
Subject: [PATCH 49/65] cayley: init at 0.6.1

---
 pkgs/servers/cayley/default.nix |  30 ++++
 pkgs/servers/cayley/deps.nix    | 272 ++++++++++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix |   2 +
 3 files changed, 304 insertions(+)
 create mode 100644 pkgs/servers/cayley/default.nix
 create mode 100644 pkgs/servers/cayley/deps.nix

diff --git a/pkgs/servers/cayley/default.nix b/pkgs/servers/cayley/default.nix
new file mode 100644
index 000000000000..9249d7cc347d
--- /dev/null
+++ b/pkgs/servers/cayley/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  name = "cayley-${version}";
+  version = "0.6.1";
+
+  goPackagePath = "github.com/cayleygraph/cayley";
+
+  src = fetchFromGitHub {
+    owner = "cayleygraph";
+    repo = "cayley";
+    rev = "v${version}";
+    sha256 = "1r0kw3y32bqm7g37svzrch2qj9n45p93xmsrf7dj1cg4wwkb65ry";
+  };
+
+  goDeps = ./deps.nix;
+
+  buildFlagsArray = ''
+    -ldflags=
+      -X=main.Version=${version}
+  '';
+  
+  meta = {
+    homepage = "https://cayley.io/";
+    description = "A graph database inspired by Freebase and Knowledge Graph";
+    maintainers = with stdenv.lib.maintainers; [ sigma ];
+    license = stdenv.lib.licenses.asl20;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/pkgs/servers/cayley/deps.nix b/pkgs/servers/cayley/deps.nix
new file mode 100644
index 000000000000..1e6fadf9f4d8
--- /dev/null
+++ b/pkgs/servers/cayley/deps.nix
@@ -0,0 +1,272 @@
+[
+  {
+    goPackagePath = "github.com/badgerodon/peg";
+    fetch = {
+      type = "git";
+      url = "https://github.com/badgerodon/peg";
+      rev = "9e5f7f4d07ca576562618c23e8abadda278b684f";
+      sha256 = "12vd7hzdgknn8byz77lmvcrz9m5lvmffdnz2wwk83304przkra11";
+    };
+  }
+  {
+    goPackagePath = "github.com/boltdb/bolt";
+    fetch = {
+      type = "git";
+      url = "https://github.com/boltdb/bolt";
+      rev = "a705895fdad108f053eae7ee011ed94a0541ee13";
+      sha256 = "0ql67l2hmjhplkl80j9a49qlra4qx671il5rgn58afkvk20cgq2r";
+    };
+  }
+  {
+    goPackagePath = "github.com/cznic/mathutil";
+    fetch = {
+      type = "git";
+      url = "https://github.com/cznic/mathutil";
+      rev = "f9551431b78e71ee24939a1e9d8f49f43898b5cd";
+      sha256 = "1158mlwzryyna1qslr9v88i0k8x6m8vs4rljnnwh04rmd63ksj75";
+    };
+  }
+  {
+    goPackagePath = "github.com/davecgh/go-spew";
+    fetch = {
+      type = "git";
+      url = "https://github.com/davecgh/go-spew";
+      rev = "2df174808ee097f90d259e432cc04442cf60be21";
+      sha256 = "0jghd5dmwqpcjbxij9yjj8sjzll9s65i2qnxd8rdzwh77xdsfm9g";
+    };
+  }
+  {
+    goPackagePath = "github.com/dlclark/regexp2";
+    fetch = {
+      type = "git";
+      url = "https://github.com/dlclark/regexp2";
+      rev = "4009c9dc49dd8906bfd4d479c255470d6a477ce5";
+      sha256 = "1r6f0q1jvn1lkwqlrmmg5d90p6zss8s64jyp91hp6i97vpahq8xz";
+    };
+  }
+  {
+    goPackagePath = "github.com/dop251/goja";
+    fetch = {
+      type = "git";
+      url = "https://github.com/dop251/goja";
+      rev = "64f863c4eb0329df18ecd1dab1e03609556bfaca";
+      sha256 = "0smipfs7fja286nvlr7q4b8f815br0nia0k4xp8y5fvprrzrm64h";
+    };
+  }
+  {
+    goPackagePath = "github.com/gogo/protobuf";
+    fetch = {
+      type = "git";
+      url = "https://github.com/gogo/protobuf";
+      rev = "50d1bd39ce4e7a96b75e3e040be9caf79dbb4c61";
+      sha256 = "09cad9j98pdqh1sp191j92ng6lvw9la3k3v6m5mv38nwirpwzra1";
+    };
+  }
+  {
+    goPackagePath = "github.com/golang/glog";
+    fetch = {
+      type = "git";
+      url = "https://github.com/golang/glog";
+      rev = "23def4e6c14b4da8ac2ed8007337bc5eb5007998";
+      sha256 = "0jb2834rw5sykfr937fxi8hxi2zy80sj2bdn9b3jb4b26ksqng30";
+    };
+  }
+  {
+    goPackagePath = "github.com/golang/protobuf";
+    fetch = {
+      type = "git";
+      url = "https://github.com/golang/protobuf";
+      rev = "888eb0692c857ec880338addf316bd662d5e630e";
+      sha256 = "1vhx2dwr71hma9z3dfb3l1yrkjlry0glwxknxzyp9ds51i6pjiq0";
+    };
+  }
+  {
+    goPackagePath = "github.com/hashicorp/go-cleanhttp";
+    fetch = {
+      type = "git";
+      url = "https://github.com/hashicorp/go-cleanhttp";
+      rev = "ad28ea4487f05916463e2423a55166280e8254b5";
+      sha256 = "0xw0qas3ixg8p2xh09hhc81km0mfn9lbnfgrdb309hzcwhmiyqjm";
+    };
+  }
+  {
+    goPackagePath = "github.com/julienschmidt/httprouter";
+    fetch = {
+      type = "git";
+      url = "https://github.com/julienschmidt/httprouter";
+      rev = "b59a38004596b696aca7aa2adccfa68760864d86";
+      sha256 = "0j1w2fkcghyw3lcsc13lwf2zqar9xyni2g7fqp4aq8g08ii7paac";
+    };
+  }
+  {
+    goPackagePath = "github.com/lib/pq";
+    fetch = {
+      type = "git";
+      url = "https://github.com/lib/pq";
+      rev = "0dad96c0b94f8dee039aa40467f767467392a0af";
+      sha256 = "06c38iy37251mh8jy9s8n97b01pjnqpq8ii77nnmqh1dsph37jz4";
+    };
+  }
+  {
+    goPackagePath = "github.com/linkeddata/gojsonld";
+    fetch = {
+      type = "git";
+      url = "https://github.com/linkeddata/gojsonld";
+      rev = "a223ef39bb925d36d4c410d3e35b0e34e370cc31";
+      sha256 = "1i3vl7gbkq2xl2wyv0kszj0x32vp8jw1cf0ngpdqdhdvnbfi1w7i";
+    };
+  }
+  {
+    goPackagePath = "github.com/pborman/uuid";
+    fetch = {
+      type = "git";
+      url = "https://github.com/pborman/uuid";
+      rev = "ca53cad383cad2479bbba7f7a1a05797ec1386e4";
+      sha256 = "0rcx669bbjkkwdlw81spnra4ffgzd4rbpywnrj3w41m9vq6mk1gn";
+    };
+  }
+  {
+    goPackagePath = "github.com/peterh/liner";
+    fetch = {
+      type = "git";
+      url = "https://github.com/peterh/liner";
+      rev = "1bb0d1c1a25ed393d8feb09bab039b2b1b1fbced";
+      sha256 = "05ihxpmp6x3hw71xzvjdgxnyvyx2s4lf23xqnfjj16s4j4qidc48";
+    };
+  }
+  {
+    goPackagePath = "github.com/pmezard/go-difflib";
+    fetch = {
+      type = "git";
+      url = "https://github.com/pmezard/go-difflib";
+      rev = "d8ed2627bdf02c080bf22230dbb337003b7aba2d";
+      sha256 = "0w1jp4k4zbnrxh3jvh8fgbjgqpf2hg31pbj8fb32kh26px9ldpbs";
+    };
+  }
+  {
+    goPackagePath = "github.com/robertkrimen/otto";
+    fetch = {
+      type = "git";
+      url = "https://github.com/robertkrimen/otto";
+      rev = "d1b4d8ef0e0e4b088c8328c95ca63ab9ebd8fc9d";
+      sha256 = "0i31p3paz3n7qi2v1g77lm3cx2hssgwgcfpar4qc2vj7m4766884";
+    };
+  }
+  {
+    goPackagePath = "github.com/russross/blackfriday";
+    fetch = {
+      type = "git";
+      url = "https://github.com/russross/blackfriday";
+      rev = "17bb7999de6cfb791d4f8986cc00b3309b370cdb";
+      sha256 = "1md0sjw69mj359cb4c8ghzllcbn2lnkvby1203wl0pf5wbyfvm5s";
+    };
+  }
+  {
+    goPackagePath = "github.com/shurcooL/sanitized_anchor_name";
+    fetch = {
+      type = "git";
+      url = "https://github.com/shurcooL/sanitized_anchor_name";
+      rev = "8e87604bec3c645a4eeaee97dfec9f25811ff20d";
+      sha256 = "05b6yj23c3xx446kanhaj1l83av8676z7si8n1f4sqy2pp7s966v";
+    };
+  }
+  {
+    goPackagePath = "github.com/sirupsen/logrus";
+    fetch = {
+      type = "git";
+      url = "https://github.com/sirupsen/logrus";
+      rev = "08a8a7c27e3d058a8989316a850daad1c10bf4ab";
+      sha256 = "1fbh1b42alvpbw87v0v2hanliaqp6fm4h9n7byk921mcv6dai8fl";
+    };
+  }
+  {
+    goPackagePath = "github.com/stretchr/testify";
+    fetch = {
+      type = "git";
+      url = "https://github.com/stretchr/testify";
+      rev = "f390dcf405f7b83c997eac1b06768bb9f44dec18";
+      sha256 = "1l3z0ggdcjspfmm6k9glmh52a9x50806k6yldxql73p4bpynsd9g";
+    };
+  }
+  {
+    goPackagePath = "github.com/syndtr/goleveldb";
+    fetch = {
+      type = "git";
+      url = "https://github.com/syndtr/goleveldb";
+      rev = "4875955338b0a434238a31165cb87255ab6e9e4a";
+      sha256 = "0786j6kizrlskqz196ng4d13363d44whl849jcv1q07yab2nq40i";
+    };
+  }
+  {
+    goPackagePath = "github.com/syndtr/gosnappy";
+    fetch = {
+      type = "git";
+      url = "https://github.com/syndtr/gosnappy";
+      rev = "156a073208e131d7d2e212cb749feae7c339e846";
+      sha256 = "08lf8smnp4imj5fkph9sbqzb4a5n191q9m6b2c5kamp19i9h2y6z";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/net";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/net";
+      rev = "6a513affb38dc9788b449d59ffed099b8de18fa0";
+      sha256 = "1g07c05s3ccq0086f0f200k9cfjjzxd4r9nrdilkmy44lbhhrval";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/sys";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/sys";
+      rev = "a646d33e2ee3172a661fc09bca23bb4889a41bc8";
+      sha256 = "1jniqg2nv5zhdzfm9gwfx0s9q8mwxrgcxdbkd6cddk9w0qgji9dc";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/text";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/text";
+      rev = "5a42fa2464759cbb7ee0af9de00b54d69f09a29c";
+      sha256 = "0far6mb2ikwzr7icn0yqi9ygl8kv2wsaasyprbqb9qapr0dqjw0s";
+    };
+  }
+  {
+    goPackagePath = "google.golang.org/appengine";
+    fetch = {
+      type = "git";
+      url = "https://github.com/golang/appengine";
+      rev = "4f7eeb5305a4ba1966344836ba4af9996b7b4e05";
+      sha256 = "09pgvlk5ay3f0avi1bawpy8khi3rmkfl36l2yr3ryp8z12i9k2qj";
+    };
+  }
+  {
+    goPackagePath = "gopkg.in/mgo.v2";
+    fetch = {
+      type = "git";
+      url = "https://gopkg.in/mgo.v2";
+      rev = "c6a7dce14133ccac2dcac3793f1d6e2ef048503a";
+      sha256 = "0rg232q1bkq3y3kd5816hgk1jpf7i38aha5q5ia7j6p9xashz7vj";
+    };
+  }
+  {
+    goPackagePath = "github.com/go-sql-driver/mysql";
+    fetch = {
+      type = "git";
+      url = "https://github.com/go-sql-driver/mysql";
+      rev = "2e00b5cd70399450106cec6431c2e2ce3cae5034";
+      sha256 = "085g48jq9hzmlcxg122n0c4pi41sc1nn2qpx1vrl2jfa8crsppa5";
+    };
+  }
+  {
+    goPackagePath = "github.com/dennwc/graphql";
+    fetch = {
+      type = "git";
+      url = "https://github.com/dennwc/graphql";
+      rev = "fd5c4aa13f2119414084f229600de0d73f174436";
+      sha256 = "11f9jwfc2j646732gkcjb332ih9fxh04j31zmhvqswx75gvk9wzs";
+    };
+  }
+]
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e0573f504fd7..b919b98d9c62 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10587,6 +10587,8 @@ with pkgs;
   bosun = callPackage ../servers/monitoring/bosun { };
   scollector = bosun;
 
+  cayley = callPackage ../servers/cayley { };
+
   charybdis = callPackage ../servers/irc/charybdis {};
 
   couchdb = callPackage ../servers/http/couchdb {

From 78635ce26b84dea646c7b00598c2596477882ce3 Mon Sep 17 00:00:00 2001
From: Kamil Chmielewski <kamil.chm@gmail.com>
Date: Thu, 13 Apr 2017 18:45:11 +0200
Subject: [PATCH 50/65] vim-elixir: 2017-03-29 -> 2017-04-13

---
 pkgs/misc/vim-plugins/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix
index 90559742057f..f818962b8ae0 100644
--- a/pkgs/misc/vim-plugins/default.nix
+++ b/pkgs/misc/vim-plugins/default.nix
@@ -647,11 +647,11 @@ rec {
   };
 
   vim-elixir = buildVimPluginFrom2Nix { # created by nix#NixDerivation
-    name = "vim-elixir-2017-03-29";
+    name = "vim-elixir-2017-04-13";
     src = fetchgit {
       url = "https://github.com/elixir-lang/vim-elixir";
-      rev = "9482415ab27fddf8125524f54d9e500bb9541756";
-      sha256 = "1layanqayf2arg8cvpsx768p544znwsvwispnk01d0c73d2p5llq";
+      rev = "8781ff7c675d0cbfb4859f91698365c2eecf3205";
+      sha256 = "0990qbzs2cn3k07xrn4xcczl7kpapygpa0ypkwpgxamyk0lgjlr8";
     };
     dependencies = [];
 

From 034ea00b98101922fd70507692f87b97fbccf836 Mon Sep 17 00:00:00 2001
From: Robert Helgesson <robert@rycee.net>
Date: Thu, 13 Apr 2017 20:45:41 +0200
Subject: [PATCH 51/65] pythonPackages.PyICU: 1.9.5 -> 1.9.6

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

diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index dd84c3f14aab..9f0dbb91068d 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -20679,11 +20679,11 @@ in {
   };
 
   PyICU = buildPythonPackage rec {
-    name = "PyICU-1.9.5";
+    name = "PyICU-1.9.6";
 
     src = pkgs.fetchurl {
       url = "mirror://pypi/P/PyICU/${name}.tar.gz";
-      sha256 = "16rmxy9y0qhqqna2v49i7nzwm09as699rbyvh4raw7w602w55c3k";
+      sha256 = "0l151zhhyiazzdz8skpxgrw1x4nqa9pq2cwni6d97anmg97i7hn5";
     };
 
     buildInputs = [ pkgs.icu ];

From de0f09035377d4ebd6d183168d7e94bff82eecf5 Mon Sep 17 00:00:00 2001
From: Robert Helgesson <robert@rycee.net>
Date: Thu, 13 Apr 2017 23:44:03 +0200
Subject: [PATCH 52/65] josm: 11639 -> 11826

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

diff --git a/pkgs/applications/misc/josm/default.nix b/pkgs/applications/misc/josm/default.nix
index 6dd0f532f183..753d27b33767 100644
--- a/pkgs/applications/misc/josm/default.nix
+++ b/pkgs/applications/misc/josm/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "josm-${version}";
-  version = "11639";
+  version = "11826";
 
   src = fetchurl {
     url = "https://josm.openstreetmap.de/download/josm-snapshot-${version}.jar";
-    sha256 = "1xq074jfk58gh5xmm8s9sjbcbnl34dpx7wsgq9n60phciya90sfb";
+    sha256 = "0x59n6klkxkaqcqgbkscdynyp0grfxdil2fxmg710yp8vkzg0zk2";
   };
 
   phases = [ "installPhase" ];

From 77c8470e0a76607f32b290b263fad5e3ecc0f2d6 Mon Sep 17 00:00:00 2001
From: Benjamin Staffin <benley@gmail.com>
Date: Thu, 13 Apr 2017 18:11:10 -0400
Subject: [PATCH 53/65] latte-dock: 0.5.98 -> 0.6.0

---
 pkgs/applications/misc/latte-dock/default.nix | 45 +++++++++++--------
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/pkgs/applications/misc/latte-dock/default.nix b/pkgs/applications/misc/latte-dock/default.nix
index 8792a07e3e9b..cdde0beb8270 100644
--- a/pkgs/applications/misc/latte-dock/default.nix
+++ b/pkgs/applications/misc/latte-dock/default.nix
@@ -1,26 +1,33 @@
-{ stdenv, lib, cmake, plasma-framework, fetchFromGitHub }:
+{ stdenv, lib, cmake, xorg, plasma-framework, fetchFromGitHub, kdeWrapper }:
 
-let version = "0.5.98"; in
+let version = "0.6.0";
 
-stdenv.mkDerivation {
-  name = "latte-dock-${version}";
+    unwrapped = stdenv.mkDerivation {
+      name = "latte-dock-${version}";
 
-  src = fetchFromGitHub {
-    owner = "psifidotos";
-    repo = "Latte-Dock";
-    rev = version;
-    sha256 = "0z02ipbbv0dmcxs2g3dq5h62klhijni1i4ikq903hjg0j2cqg5xh";
-  };
+      src = fetchFromGitHub {
+        owner = "psifidotos";
+        repo = "Latte-Dock";
+        rev = "v${version}";
+        sha256 = "1967hx4lavy96vvik8d5m2c6ycd2mlf9cmhrv40zr0784ni0ikyv";
+      };
 
-  buildInputs = [ plasma-framework ];
+      buildInputs = [ plasma-framework xorg.libpthreadstubs xorg.libXdmcp ];
 
-  nativeBuildInputs = [ cmake ];
+      nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
-    description = "Dock-style app launcher based on Plasma frameworks";
-    homepage = https://github.com/psifidotos/Latte-Dock;
-    license = licenses.gpl2;
-    platforms = platforms.unix;
-    maintainers = [ maintainers.benley ];
-  };
+      enableParallelBuilding = true;
+
+      meta = with stdenv.lib; {
+        description = "Dock-style app launcher based on Plasma frameworks";
+        homepage = https://github.com/psifidotos/Latte-Dock;
+        license = licenses.gpl2;
+        platforms = platforms.unix;
+        maintainers = [ maintainers.benley ];
+      };
+    };
+
+in kdeWrapper {
+  inherit unwrapped;
+  targets = [ "bin/latte-dock" ];
 }

From 6f69681dad1c937614dbbb767f95480ea630d781 Mon Sep 17 00:00:00 2001
From: David Johnson <djohnson.m@gmail.com>
Date: Thu, 13 Apr 2017 23:21:38 -0500
Subject: [PATCH 54/65] Add hardening, bump hash to HaLVM

---
 pkgs/development/compilers/halvm/2.4.0.nix           | 8 ++++----
 pkgs/development/haskell-modules/generic-builder.nix | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkgs/development/compilers/halvm/2.4.0.nix b/pkgs/development/compilers/halvm/2.4.0.nix
index c167f4bdd75a..08e74bdb78e9 100644
--- a/pkgs/development/compilers/halvm/2.4.0.nix
+++ b/pkgs/development/compilers/halvm/2.4.0.nix
@@ -8,13 +8,13 @@ stdenv.mkDerivation rec {
   isHaLVM = true;
   isGhcjs = false;
   src = fetchgit {
-    rev = "6aa72c9b047fd8ddff857c994a5a895461fc3925";
+    rev = "65fad65966eb7e60f234453a35aeb564a09d2595";
     url = "https://github.com/GaloisInc/HaLVM";
-    sha256 = "05cg4w6fw5ajmpmh8g2msprnygmr4isb3pphqhlddfqwyvqhl167";
+    sha256 = "09633h38w0z20cz0wcfp9z5kzv8v1zwcv0wqvgq3c8svqbrxp28k";
   };
   prePatch = ''
-    sed -i '312 d' Makefile
-    sed -i '316,446 d' Makefile # Removes RPM packaging
+    sed -i '305 d' Makefile
+    sed -i '309,439 d' Makefile # Removes RPM packaging
     sed -i '20 d' src/scripts/halvm-cabal.in
     sed -ie 's|ld |${binutils}/bin/ld |g' src/scripts/ldkernel.in
   '';
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index d39e1bacd71d..0c51f208f462 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
-, jailbreak-cabal, hscolour, cpphs, nodejs
+, jailbreak-cabal, hscolour, cpphs, nodejs, lib
 }: let isCross = (ghc.cross or null) != null; in
 
 { pname
@@ -53,7 +53,7 @@
 , shellHook ? ""
 , coreSetup ? false # Use only core packages to build Setup.hs.
 , useCpphs ? false
-, hardeningDisable ? []
+, hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all"
 } @ args:
 
 assert editedCabalFile != null -> revision != null;

From da20d0e488ba645e6c9271705209333cfdd703db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Fri, 14 Apr 2017 11:05:42 +0200
Subject: [PATCH 55/65] murmur service: fix typos from #24830

---
 nixos/modules/services/networking/murmur.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix
index c961857c77af..13d7c3254f9d 100644
--- a/nixos/modules/services/networking/murmur.nix
+++ b/nixos/modules/services/networking/murmur.nix
@@ -28,15 +28,15 @@ let
     imagemessagelength=${toString cfg.imgMsgLength}
     allowhtml=${boolToString cfg.allowHtml}
     logdays=${toString cfg.logDays}
-    bonjour=${babelToString cfg.bonjour}
-    sendversion=${babelToString cfg.sendVersion}
+    bonjour=${boolToString cfg.bonjour}
+    sendversion=${boolToString cfg.sendVersion}
 
     ${if cfg.registerName     == "" then "" else "registerName="+cfg.registerName}
     ${if cfg.registerPassword == "" then "" else "registerPassword="+cfg.registerPassword}
     ${if cfg.registerUrl      == "" then "" else "registerUrl="+cfg.registerUrl}
     ${if cfg.registerHostname == "" then "" else "registerHostname="+cfg.registerHostname}
 
-    certrequired=${babelToString cfg.clientCertRequired}
+    certrequired=${boolToString cfg.clientCertRequired}
     ${if cfg.sslCert == "" then "" else "sslCert="+cfg.sslCert}
     ${if cfg.sslKey  == "" then "" else "sslKey="+cfg.sslKey}
     ${if cfg.sslCa   == "" then "" else "sslCA="+cfg.sslCa}

From 7f09c06c5858f52d1fdfe82e89f92c4864e4f57f Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Wed, 22 Mar 2017 17:05:00 +0100
Subject: [PATCH 56/65] usbredir: Use dev output

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

diff --git a/pkgs/development/libraries/usbredir/default.nix b/pkgs/development/libraries/usbredir/default.nix
index 76912f19ab5f..f4ec02422242 100644
--- a/pkgs/development/libraries/usbredir/default.nix
+++ b/pkgs/development/libraries/usbredir/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ pkgconfig libusb ];
   propagatedBuildInputs = [ libusb ];
 
+  outputs = [ "out" "dev" ];
+
   meta = with stdenv.lib; {
     description = "USB traffic redirection protocol";
     homepage = http://spice-space.org/page/UsbRedir;

From 77e71c2f99d0d3216aacd46291ad722d9ceccc19 Mon Sep 17 00:00:00 2001
From: Matthias Beyer <mail@beyermatthias.de>
Date: Fri, 14 Apr 2017 11:34:13 +0200
Subject: [PATCH 57/65] mutt: 1.8.0 -> 1.8.1

From the announce email:

    This is a bug fix release.  In particular, it has fixes for setenv,
    sidebar_whitelist, some refresh issues, and a potential segfault.
    Details can be seen in the ChangeLog file.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
---
 pkgs/applications/networking/mailreaders/mutt/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/networking/mailreaders/mutt/default.nix b/pkgs/applications/networking/mailreaders/mutt/default.nix
index 92d1a3446c0d..8eb1169b5a24 100644
--- a/pkgs/applications/networking/mailreaders/mutt/default.nix
+++ b/pkgs/applications/networking/mailreaders/mutt/default.nix
@@ -20,11 +20,11 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "mutt-${version}";
-  version = "1.8.0";
+  version = "1.8.1";
 
   src = fetchurl {
     url = "http://ftp.mutt.org/pub/mutt/${name}.tar.gz";
-    sha256 = "1axdcylyv0p194y6lj1jx127g5yc74zqzzxdc014cjw02bd1x125";
+    sha256 = "1b8dggq5x1b77a9i9250b3jhv2iddfzhr9rix1yfzckdms65mr8b";
   };
 
   patchPhase = optionalString (openssl != null) ''

From 72605647a40c8099c626884a784693390b442907 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Fri, 14 Apr 2017 11:41:36 +0200
Subject: [PATCH 58/65] flashplayer: 25.0.0.127 -> 25.0.0.148

---
 .../browsers/mozilla-plugins/flashplayer/default.nix | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix
index 72a1f171dec6..bf0b91544ad0 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix
@@ -60,7 +60,7 @@
 
 let
   arch =
-    if      stdenv.system == "x86_64-linux" then
+    if stdenv.system == "x86_64-linux" then
       "x86_64"
     else if stdenv.system == "i686-linux"   then
       "i386"
@@ -73,7 +73,7 @@ let
 in
 stdenv.mkDerivation rec {
   name = "flashplayer-${version}";
-  version = "25.0.0.127";
+  version = "25.0.0.148";
 
   src = fetchurl {
     url =
@@ -84,14 +84,14 @@ stdenv.mkDerivation rec {
     sha256 =
       if debug then
         if arch == "x86_64" then
-          "0d37rwbqszl593pggph8pm8jwn05fppys7q8vk1jrk9jaz262iva"
+          "1jxxnbd357ndw8b64lw4pwkg9j0shy0ns7xw0f36awimq7bclr8d"
         else
-          "0lhngdx1q51kfpw3a961h9p9n1fnspk9pmg21i069hvd0h143arx"
+          "1k0zyy4mz307r7ph4pnmyqaa0fdw2f52apala6dbrys0wdl05yfg"
       else
         if arch == "x86_64" then
-          "1yasj9xzmb6ly9209b1hmrqrzxrr1bafsfjszsr3yf994hql6nzn"
+          "0n77a2z0928vd4bjgx69igzxvn8l9wrfh79j6knygdpnsbr3pybj"
         else
-          "02vs12cm6fpl2fif1lij9y15m89wk6aizc8sbjiw6w59wixn3p9d";
+          "1cb1h37av4icfhl4vjngsa3nfcrcdvzliwxdg22rshimlkfgr7vx";
   };
 
   nativeBuildInputs = [ unzip ];

From 6a1f168b1ee6cd01e5eece33d6151bf658f232a0 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Fri, 14 Apr 2017 11:42:32 +0200
Subject: [PATCH 59/65] flashplayer-standalone: 25.0.0.127 -> 25.0.0.148

---
 .../mozilla-plugins/flashplayer/standalone.nix         | 10 ++++------
 pkgs/top-level/all-packages.nix                        |  6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
index 178b86b61c66..4d65a7e9a629 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
@@ -49,15 +49,13 @@
 
 let
   arch =
-    if      stdenv.system == "x86_64-linux" then
+    if stdenv.system == "x86_64-linux" then
       "x86_64"
-    else if stdenv.system == "i686-linux"   then
-      "i386"
     else throw "Flash Player is not supported on this platform";
 in
 stdenv.mkDerivation rec {
   name = "flashplayer-standalone-${version}";
-  version = "25.0.0.127";
+  version = "25.0.0.148";
 
   src = fetchurl {
     url =
@@ -67,9 +65,9 @@ stdenv.mkDerivation rec {
         "https://fpdownload.macromedia.com/pub/flashplayer/updaters/25/flash_player_sa_linux.x86_64.tar.gz";
     sha256 =
       if debug then
-        "07a8x1n997lmkxj74bkygh60shwzxzcvfxpz07pxj1nmvakmin51"
+        "1pkzpip8d3m92kyzap00xxq40yilgmaqnc47nak3i7gnbic8fa2r"
       else
-        "0rzxfcvjjwbd1m6pyby8km4g5834zy5d5sih7xq3czds9x0a2jp2";
+        "0xxsbxnkf9xnljy6sn61jqx9xd1w0lm5mbw4ca7xk5rkc84ik91z";
   };
 
   nativeBuildInputs = [ unzip ];
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e6704f45be71..309ef69e6eec 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -13766,15 +13766,15 @@ with pkgs;
   flac = callPackage ../applications/audio/flac { };
 
   flashplayer = callPackage ../applications/networking/browsers/mozilla-plugins/flashplayer {
-      debug = config.flashplayer.debug or false;
+    debug = config.flashplayer.debug or false;
   };
 
   flashplayer-standalone = callPackage ../applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix {
-      debug = config.flashplayer.debug or false;
+    debug = config.flashplayer.debug or false;
   };
 
   flashplayer-standalone-debugger = flashplayer-standalone.override {
-      debug = true;
+    debug = true;
   };
 
   fluxbox = callPackage ../applications/window-managers/fluxbox { };

From c395568b7a959c8a95a91097fb1e517ced21a46c Mon Sep 17 00:00:00 2001
From: Tristan Helmich <tristan.helmich@gmail.com>
Date: Fri, 17 Mar 2017 17:20:48 +0100
Subject: [PATCH 60/65] openssh_hpn: use new sources and version (7_5_P1)

Close #23990.
---
 pkgs/tools/networking/openssh/default.nix | 31 ++++++++++-------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/pkgs/tools/networking/openssh/default.nix b/pkgs/tools/networking/openssh/default.nix
index 79cdac874891..0bcb0baaab8b 100644
--- a/pkgs/tools/networking/openssh/default.nix
+++ b/pkgs/tools/networking/openssh/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, zlib, openssl, perl, libedit, pkgconfig, pam
+{ stdenv, fetchurl, fetchpatch, zlib, openssl, perl, libedit, pkgconfig, pam, autoreconfHook
 , etcDir ? null
 , hpnSupport ? false
 , withKerberos ? false
@@ -12,11 +12,6 @@ assert withGssapiPatches -> withKerberos;
 
 let
 
-  hpnSrc = fetchurl {
-    url = mirror://sourceforge/hpnssh/openssh-6.6p1-hpnssh14v5.diff.gz;
-    sha256 = "682b4a6880d224ee0b7447241b684330b731018585f1ba519f46660c10d63950";
-  };
-
   # **please** update this patch when you update to a new openssh release.
   gssapiSrc = fetchpatch {
     name = "openssh-gssapi.patch";
@@ -33,16 +28,16 @@ stdenv.mkDerivation rec {
   name = "openssh-${version}";
   version = "7.5p1";
 
-  src = fetchurl {
-    url = "mirror://openbsd/OpenSSH/portable/${name}.tar.gz";
-    sha256 = "1w7rb5gbrikxdkp8w7zxnci4549gk4bw1lml01s59w5rzb2y6ilq";
-  };
-
-  prePatch = optionalString hpnSupport
-    ''
-      gunzip -c ${hpnSrc} | patch -p1
-      export NIX_LDFLAGS="$NIX_LDFLAGS -lgcc_s"
-    '';
+  src = if hpnSupport then
+      fetchurl {
+        url = "https://github.com/rapier1/openssh-portable/archive/hpn-KitchenSink-7_5_P1.tar.gz";
+        sha256 = "1hasdcfjl6xf5nbbbvqyyq5v7ad10nywrq89j7naxz9wln58nhnn";
+      }
+    else
+      fetchurl {
+        url = "mirror://openbsd/OpenSSH/portable/${name}.tar.gz";
+        sha256 = "1w7rb5gbrikxdkp8w7zxnci4549gk4bw1lml01s59w5rzb2y6ilq";
+      };
 
   patches =
     [
@@ -55,7 +50,8 @@ stdenv.mkDerivation rec {
     ++ optional withGssapiPatches gssapiSrc;
 
   buildInputs = [ zlib openssl libedit pkgconfig pam ]
-    ++ optional withKerberos kerberos;
+    ++ optional withKerberos kerberos
+    ++ optional hpnSupport autoreconfHook;
 
   # I set --disable-strip because later we strip anyway. And it fails to strip
   # properly when cross building.
@@ -94,6 +90,5 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.bsd2;
     platforms = platforms.unix;
     maintainers = with maintainers; [ eelco aneeshusa ];
-    broken = hpnSupport; # probably after 6.7 update
   };
 }

From 862fc1b46592d974e020979ef03e569c82aece13 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Fri, 14 Apr 2017 19:04:55 +0800
Subject: [PATCH 61/65] tensor: init at (post) 0.3

---
 .../instant-messengers/tensor/default.nix     | 55 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 +
 2 files changed, 57 insertions(+)
 create mode 100644 pkgs/applications/networking/instant-messengers/tensor/default.nix

diff --git a/pkgs/applications/networking/instant-messengers/tensor/default.nix b/pkgs/applications/networking/instant-messengers/tensor/default.nix
new file mode 100644
index 000000000000..ed78274c799d
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/tensor/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchgit, qtbase, qtquickcontrols, qmakeHook, makeQtWrapper, makeDesktopItem }:
+
+let
+  rev = "f3f3056d770d7fb4a21c610cee7936ee900569f5";
+
+in stdenv.mkDerivation rec {
+  name = "tensor-git-${stdenv.lib.strings.substring 0 8 rev}";
+
+  src = fetchgit {
+    url = "https://github.com/davidar/tensor.git";
+    fetchSubmodules = true;
+    inherit rev;
+    sha256 = "19in8c7a2hxsx2c4lj540w5c3pn1882645m21l91mcriynqr67k9";
+  };
+
+  parallelBuilding = true;
+
+  buildInputs = [ qtbase qtquickcontrols ];
+  nativeBuildInputs = [ qmakeHook makeQtWrapper ];
+
+  desktopItem = makeDesktopItem {
+    name = "tensor";
+    exec = "@bin@";
+    icon = "tensor.png";
+    comment = meta.description;
+    desktopName = "Tensor Matrix Client";
+    genericName = meta.description;
+    categories = "Chat;Utility";
+    mimeType = "text/xml";
+  };
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 tensor $out/bin/tensor
+    install -Dm644 client/logo.png \
+                   $out/share/icons/hicolor/512x512/apps/tensor.png
+    install -Dm644 ${desktopItem}/share/applications/tensor.desktop \
+                   $out/share/applications/tensor.desktop
+
+    wrapQtProgram $out/bin/tensor
+
+    substituteInPlace $out/share/applications/tensor.desktop \
+      --subst-var-by bin $out/bin/tensor
+
+    runHook postInstall
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://matrix.org/docs/projects/client/tensor.html;
+    description = "Cross-platform Qt5/QML-based Matrix client";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ peterhoeg ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 309ef69e6eec..39aeecfcdbb1 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -652,6 +652,8 @@ with pkgs;
 
   blink = callPackage ../applications/networking/instant-messengers/blink { };
 
+  tensor = libsForQt5.callPackage ../applications/networking/instant-messengers/tensor { };
+
   blink1-tool = callPackage ../tools/misc/blink1-tool { };
 
   blitz = callPackage ../development/libraries/blitz {

From 31a28a38a10bd46579c0566fe03ca3f60fa33c72 Mon Sep 17 00:00:00 2001
From: Ignat Loskutov <ignat.loskutov@gmail.com>
Date: Wed, 12 Apr 2017 14:22:08 +0300
Subject: [PATCH 62/65] pythonPackages.bleach: remove the 'platforms'
 attribute; update homepage

---
 pkgs/top-level/python-packages.nix | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index e13978469345..8568b7096a75 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2986,11 +2986,10 @@ in {
         to do lots of things, you're probably outside the use cases. Either
         trust those users, or don't.
       '';
-      homepage = https://github.com/jsocol/bleach;
-      downloadPage = https://github.com/jsocol/bleach/releases;
+      homepage = https://github.com/mozilla/bleach;
+      downloadPage = https://github.com/mozilla/bleach/releases;
       license = licenses.asl20;
       maintainers = with maintainers; [ prikhi ];
-      platforms = platforms.linux;
     };
   };
 

From 31fef05c7ca0f7e55773b75a1db71c8fc2fe07c0 Mon Sep 17 00:00:00 2001
From: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Thu, 13 Apr 2017 19:26:05 +0000
Subject: [PATCH 63/65] ocamlPackages.lwt: 2.6.0 -> 2.7.1

---
 .../development/ocaml-modules/lwt/default.nix | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/ocaml-modules/lwt/default.nix b/pkgs/development/ocaml-modules/lwt/default.nix
index d3a373ab4dbc..53d5a25a39eb 100644
--- a/pkgs/development/ocaml-modules/lwt/default.nix
+++ b/pkgs/development/ocaml-modules/lwt/default.nix
@@ -1,19 +1,30 @@
 { stdenv, fetchzip, which, cryptopp, ocaml, findlib, ocamlbuild, camlp4
 , ocaml_react, ocaml_ssl, libev, pkgconfig, ncurses, ocaml_oasis, glib
-, ppx_tools, result
+, ppx_tools, result, cppo
 , ppxSupport ? stdenv.lib.versionAtLeast ocaml.version "4.02"
 }:
 
+let param =
+  if stdenv.lib.versionAtLeast ocaml.version "4.02"
+  then {
+    version = "2.7.1";
+    sha256 = "0w7f59havrl2fsnvs84lm7wlqpsrldg80gy5afpnpr21zkw22g8w";
+  } else {
+    version = "2.6.0";
+    sha256 = "0f1h83zh60rspm4fxd96z9h5bkhq1n1q968hgq92sq4a6bfi1c2w";
+  };
+in
+
 stdenv.mkDerivation rec {
   name = "ocaml-lwt-${version}";
-  version = "2.6.0";
+  inherit (param) version;
 
   src = fetchzip {
     url = "https://github.com/ocsigen/lwt/archive/${version}.tar.gz";
-    sha256 = "0f1h83zh60rspm4fxd96z9h5bkhq1n1q968hgq92sq4a6bfi1c2w";
+    inherit (param) sha256;
   };
 
-  buildInputs = [ ocaml_oasis pkgconfig which cryptopp ocaml findlib ocamlbuild glib ncurses camlp4 ]
+  buildInputs = [ ocaml_oasis pkgconfig which cryptopp ocaml findlib ocamlbuild glib ncurses camlp4 cppo ]
   ++ stdenv.lib.optional ppxSupport ppx_tools;
 
   propagatedBuildInputs = [ result ocaml_react ocaml_ssl libev ];

From b6f88093a21efdf3cc24ac716015b4db5e9e3df0 Mon Sep 17 00:00:00 2001
From: Armijn Hemel <armijn@tjaldur.nl>
Date: Fri, 14 Apr 2017 15:13:10 +0200
Subject: [PATCH 64/65] icoutils: update to 0.31.3

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

diff --git a/pkgs/tools/graphics/icoutils/default.nix b/pkgs/tools/graphics/icoutils/default.nix
index 70f9e29d0f5d..8b26f4ce3c83 100644
--- a/pkgs/tools/graphics/icoutils/default.nix
+++ b/pkgs/tools/graphics/icoutils/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, libpng, perl, perlPackages, makeWrapper }:
 
 stdenv.mkDerivation rec {
-  name = "icoutils-0.31.1";
+  name = "icoutils-0.31.3";
 
   src = fetchurl {
     url = "mirror://savannah/icoutils/${name}.tar.bz2";
-    sha256 = "14rhd7p7v0rvxsfnrgxf5l4rl6n52h2aq09583glqpgjg0y9vqi6";
+    sha256 = "d4651de8e3f9e28d24b5343a2b7564f49754e5fe7d211c5d4dd60dcd65c8a152";
   };
 
   buildInputs = [ makeWrapper libpng perl ];

From 9a10e5ae462bcbaeae7e556695b9329eba4cb72a Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Wed, 12 Apr 2017 15:44:18 +0200
Subject: [PATCH 65/65] nano: 2.8.0 -> 2.8.1

See http://lists.gnu.org/archive/html/info-gnu/2017-04/msg00005.html
for release announcement

(cherry picked from commit 474d112b7a942afd9206e0f8a81b6ba9bb9b95bc)
---
 pkgs/applications/editors/nano/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/editors/nano/default.nix b/pkgs/applications/editors/nano/default.nix
index cd220a4bd7e3..bfc3b7c79faf 100644
--- a/pkgs/applications/editors/nano/default.nix
+++ b/pkgs/applications/editors/nano/default.nix
@@ -20,11 +20,11 @@ let
 
 in stdenv.mkDerivation rec {
   name = "nano-${version}";
-  version = "2.8.0";
+  version = "2.8.1";
 
   src = fetchurl {
     url = "mirror://gnu/nano/${name}.tar.xz";
-    sha256 = "1hjxr0kgq3q1fcns9y4lj0dbhjf33j3pa2wayrb3p3c8v3sbrh8m";
+    sha256 = "02vdnv30ms2s53ch5j4ldch5sxwjsg3098zkvwrwhi9k6yxshdg9";
   };
 
   nativeBuildInputs = [ texinfo ] ++ optional enableNls gettext;