summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/altcoins/go-ethereum.nix4
-rw-r--r--pkgs/applications/audio/mpc123/default.nix2
-rw-r--r--pkgs/applications/audio/mpg321/default.nix2
-rw-r--r--pkgs/applications/editors/emacs-modes/calfw/default.nix2
-rw-r--r--pkgs/applications/editors/emacs-modes/jdee/default.nix2
-rw-r--r--pkgs/applications/editors/texmacs/default.nix2
-rw-r--r--pkgs/applications/editors/tiled/default.nix6
-rw-r--r--pkgs/applications/graphics/geeqie/default.nix2
-rw-r--r--pkgs/applications/graphics/gimp/2.8.nix57
-rw-r--r--pkgs/applications/graphics/gimp/default.nix95
-rw-r--r--pkgs/applications/graphics/gimp/plugins/default.nix65
-rw-r--r--pkgs/applications/graphics/gimp/wrapper.nix7
-rw-r--r--pkgs/applications/graphics/ocrad/default.nix2
-rw-r--r--pkgs/applications/graphics/panotools/default.nix2
-rw-r--r--pkgs/applications/graphics/qtpfsgui/default.nix2
-rw-r--r--pkgs/applications/graphics/sane/xsane.nix6
-rw-r--r--pkgs/applications/graphics/scantailor/advanced.nix2
-rw-r--r--pkgs/applications/graphics/scantailor/default.nix2
-rw-r--r--pkgs/applications/graphics/ufraw/default.nix26
-rw-r--r--pkgs/applications/graphics/viewnior/default.nix2
-rw-r--r--pkgs/applications/graphics/xfig/default.nix2
-rw-r--r--pkgs/applications/misc/calibre/no_updates_dialog.patch12
-rw-r--r--pkgs/applications/misc/dbeaver/default.nix4
-rw-r--r--pkgs/applications/misc/gcalcli/default.nix63
-rw-r--r--pkgs/applications/misc/mwic/default.nix4
-rw-r--r--pkgs/applications/misc/pdf-quench/default.nix36
-rw-r--r--pkgs/applications/misc/qpdfview/default.nix17
-rw-r--r--pkgs/applications/misc/vit/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix3
-rw-r--r--pkgs/applications/networking/browsers/chromium/patches/neon_buildfix.patch21
-rw-r--r--pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/bitlbee/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/qtox/default.nix31
-rw-r--r--pkgs/applications/networking/instant-messengers/quaternion/default.nix11
-rw-r--r--pkgs/applications/networking/instant-messengers/ratox/default.nix18
-rw-r--r--pkgs/applications/networking/instant-messengers/ratox/ldlibs.patch5
-rw-r--r--pkgs/applications/networking/instant-messengers/riot/riot-web.nix4
-rw-r--r--pkgs/applications/networking/instant-messengers/telepathy/gabble/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/telepathy/haze/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/telepathy/idle/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/telepathy/salut/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/toxic/default.nix4
-rw-r--r--pkgs/applications/networking/instant-messengers/utox/default.nix24
-rw-r--r--pkgs/applications/networking/instant-messengers/wire-desktop/default.nix2
-rw-r--r--pkgs/applications/networking/mailreaders/notmuch/default.nix4
-rw-r--r--pkgs/applications/networking/p2p/gnunet/default.nix2
-rw-r--r--pkgs/applications/networking/p2p/gnunet/git.nix92
-rw-r--r--pkgs/applications/networking/p2p/gnunet/svn.nix2
-rw-r--r--pkgs/applications/networking/sync/rclone/default.nix4
-rw-r--r--pkgs/applications/office/gnucash/2.6.nix2
-rw-r--r--pkgs/applications/office/gnucash/default.nix2
-rw-r--r--pkgs/applications/science/machine-learning/torch/torch-distro.nix2
-rw-r--r--pkgs/applications/science/misc/megam/default.nix2
-rw-r--r--pkgs/applications/science/misc/tulip/default.nix2
-rw-r--r--pkgs/applications/video/makemkv/default.nix12
-rw-r--r--pkgs/applications/video/qstopmotion/default.nix2
-rw-r--r--pkgs/applications/virtualization/qemu/default.nix12
-rw-r--r--pkgs/applications/virtualization/qemu/riscv.nix30
-rw-r--r--pkgs/applications/virtualization/qemu/statfs-flags.patch197
-rw-r--r--pkgs/desktops/gnome-3/core/folks/default.nix2
-rw-r--r--pkgs/development/compilers/gprolog/default.nix2
-rw-r--r--pkgs/development/compilers/mit-scheme/default.nix2
-rw-r--r--pkgs/development/guile-modules/guile-lib/default.nix2
-rw-r--r--pkgs/development/guile-modules/guile-ncurses/default.nix2
-rw-r--r--pkgs/development/libraries/audio/rtaudio/default.nix4
-rw-r--r--pkgs/development/libraries/cddlib/default.nix44
-rw-r--r--pkgs/development/libraries/clutter-gst/default.nix2
-rw-r--r--pkgs/development/libraries/clutter-gtk/default.nix2
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix3
-rw-r--r--pkgs/development/libraries/gegl/4.0.nix38
-rw-r--r--pkgs/development/libraries/goocanvas/2.x.nix4
-rw-r--r--pkgs/development/libraries/gperftools/default.nix8
-rw-r--r--pkgs/development/libraries/ldb/default.nix7
-rw-r--r--pkgs/development/libraries/libcanberra/default.nix2
-rw-r--r--pkgs/development/libraries/libchamplain/default.nix2
-rw-r--r--pkgs/development/libraries/libchop/default.nix2
-rw-r--r--pkgs/development/libraries/libgpod/default.nix2
-rw-r--r--pkgs/development/libraries/libqmatrixclient/default.nix20
-rw-r--r--pkgs/development/libraries/libressl/default.nix13
-rw-r--r--pkgs/development/libraries/libtoxcore/default.nix81
-rw-r--r--pkgs/development/libraries/libxmi/default.nix2
-rw-r--r--pkgs/development/libraries/mypaint-brushes/default.nix35
-rw-r--r--pkgs/development/libraries/tokyo-tyrant/default.nix2
-rw-r--r--pkgs/development/libraries/vcdimager/default.nix2
-rw-r--r--pkgs/development/python-modules/hdbscan/default.nix30
-rw-r--r--pkgs/development/python-modules/patsy/default.nix36
-rw-r--r--pkgs/development/python-modules/pymc3/default.nix64
-rw-r--r--pkgs/development/tools/analysis/flow/default.nix4
-rw-r--r--pkgs/development/tools/gllvm/default.nix6
-rw-r--r--pkgs/development/tools/misc/complexity/default.nix2
-rw-r--r--pkgs/games/instead/default.nix4
-rw-r--r--pkgs/games/openmw/default.nix2
-rw-r--r--pkgs/games/tuxpaint/default.nix46
-rw-r--r--pkgs/games/tuxpaint/tuxpaint-completion.diff16
-rw-r--r--pkgs/misc/drivers/hplip/default.nix6
-rw-r--r--pkgs/os-specific/bsd/default.nix3
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix261
-rw-r--r--pkgs/os-specific/bsd/openbsd/default.nix42
-rw-r--r--pkgs/os-specific/bsd/openbsd/nc.patch421
-rw-r--r--pkgs/os-specific/darwin/darling/default.nix17
-rw-r--r--pkgs/os-specific/gnu/mig/default.nix2
-rw-r--r--pkgs/os-specific/linux/kernel/hardened-config.nix3
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.14.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.16.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.4.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.9.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-testing.nix6
-rw-r--r--pkgs/os-specific/linux/pam_u2f/default.nix4
-rw-r--r--pkgs/os-specific/linux/wireguard/default.nix4
-rw-r--r--pkgs/servers/http/myserver/default.nix2
-rw-r--r--pkgs/servers/monitoring/uchiwa/bower-packages.nix12
-rw-r--r--pkgs/servers/monitoring/uchiwa/src.nix4
-rw-r--r--pkgs/servers/nextcloud/default.nix4
-rw-r--r--pkgs/servers/pies/default.nix2
-rw-r--r--pkgs/tools/X11/xnee/default.nix2
-rw-r--r--pkgs/tools/admin/awscli/default.nix10
-rw-r--r--pkgs/tools/admin/dehydrated/default.nix4
-rw-r--r--pkgs/tools/filesystems/mtools/default.nix2
-rw-r--r--pkgs/tools/graphics/asymptote/default.nix4
-rw-r--r--pkgs/tools/graphics/gmic/default.nix51
-rw-r--r--pkgs/tools/graphics/logstalgia/default.nix2
-rw-r--r--pkgs/tools/misc/grc/default.nix4
-rw-r--r--pkgs/tools/misc/grub/pvgrub_image/default.nix2
-rw-r--r--pkgs/tools/misc/grub/trusted.nix2
-rw-r--r--pkgs/tools/misc/picocom/default.nix2
-rw-r--r--pkgs/tools/misc/sweep-visualizer/default.nix9
-rw-r--r--pkgs/tools/misc/tealdeer/default.nix34
-rw-r--r--pkgs/tools/misc/urjtag/default.nix2
-rw-r--r--pkgs/tools/networking/connect/default.nix2
-rw-r--r--pkgs/tools/networking/inetutils/default.nix2
-rw-r--r--pkgs/tools/networking/mailutils/default.nix2
-rw-r--r--pkgs/tools/networking/miniupnpd/default.nix4
-rw-r--r--pkgs/tools/networking/netcat-openbsd/default.nix51
-rw-r--r--pkgs/tools/networking/netcat/default.nix (renamed from pkgs/tools/networking/netcat-gnu/default.nix)0
-rw-r--r--pkgs/tools/networking/nss-mdns/default.nix14
-rw-r--r--pkgs/tools/networking/p2p/amule/default.nix2
-rw-r--r--pkgs/tools/networking/p2p/seeks/default.nix2
-rw-r--r--pkgs/tools/networking/p2p/tahoe-lafs/default.nix2
-rw-r--r--pkgs/tools/networking/strongswan/default.nix16
-rw-r--r--pkgs/tools/networking/telnet/default.nix2
-rw-r--r--pkgs/tools/networking/toxvpn/default.nix19
-rw-r--r--pkgs/tools/security/gnupg/1.nix2
-rw-r--r--pkgs/tools/security/monkeysphere/default.nix5
-rw-r--r--pkgs/tools/security/notary/default.nix32
-rw-r--r--pkgs/tools/security/notary/no-git-usage.patch15
-rw-r--r--pkgs/tools/security/pcsc-scm-scl011/default.nix3
-rw-r--r--pkgs/tools/security/pius/default.nix2
-rw-r--r--pkgs/tools/system/freeipmi/default.nix2
-rw-r--r--pkgs/tools/system/osquery/default.nix2
-rw-r--r--pkgs/tools/system/psstop/default.nix24
-rw-r--r--pkgs/tools/text/highlight/default.nix6
-rw-r--r--pkgs/tools/text/namazu/default.nix2
-rw-r--r--pkgs/tools/text/numdiff/default.nix2
-rw-r--r--pkgs/tools/text/xml/html-xml-utils/default.nix4
-rw-r--r--pkgs/tools/text/xml/xmlformat/default.nix28
-rw-r--r--pkgs/tools/video/dvgrab/default.nix2
-rw-r--r--pkgs/top-level/aliases.nix1
-rw-r--r--pkgs/top-level/all-packages.nix47
-rw-r--r--pkgs/top-level/python-packages.nix23
160 files changed, 1349 insertions, 1339 deletions
diff --git a/pkgs/applications/altcoins/go-ethereum.nix b/pkgs/applications/altcoins/go-ethereum.nix
index 65e1dbc9b198..a47b7fa3168f 100644
--- a/pkgs/applications/altcoins/go-ethereum.nix
+++ b/pkgs/applications/altcoins/go-ethereum.nix
@@ -2,7 +2,7 @@
 
 buildGoPackage rec {
   name = "go-ethereum-${version}";
-  version = "1.8.3";
+  version = "1.8.6";
   goPackagePath = "github.com/ethereum/go-ethereum";
 
   # Fix for usb-related segmentation faults on darwin
@@ -27,7 +27,7 @@ buildGoPackage rec {
     owner = "ethereum";
     repo = "go-ethereum";
     rev = "v${version}";
-    sha256 = "1vdrf3fi4arr6aivyp5myj4jy7apqbiqa6brr3jplmc07q1yijnf";
+    sha256 = "1n6f34r7zlc64l1q8xzcjk5sljdznjwp81d9naapprhpqb8g01gl";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/audio/mpc123/default.nix b/pkgs/applications/audio/mpc123/default.nix
index ac945bee7f74..efaef97257e0 100644
--- a/pkgs/applications/audio/mpc123/default.nix
+++ b/pkgs/applications/audio/mpc123/default.nix
@@ -27,6 +27,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu; # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux; # arbitrary choice
   };
 }
diff --git a/pkgs/applications/audio/mpg321/default.nix b/pkgs/applications/audio/mpg321/default.nix
index ee0ebf234ce5..3ffc5265f7a0 100644
--- a/pkgs/applications/audio/mpg321/default.nix
+++ b/pkgs/applications/audio/mpg321/default.nix
@@ -30,6 +30,6 @@ stdenv.mkDerivation rec {
     homepage = http://mpg321.sourceforge.net/;
     license = licenses.gpl2;
     maintainers = [ maintainers.rycee ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/applications/editors/emacs-modes/calfw/default.nix b/pkgs/applications/editors/emacs-modes/calfw/default.nix
index c173684fab4c..091635feda6f 100644
--- a/pkgs/applications/editors/emacs-modes/calfw/default.nix
+++ b/pkgs/applications/editors/emacs-modes/calfw/default.nix
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl3Plus;
 
     maintainers = with stdenv.lib.maintainers; [ chaoflow ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/editors/emacs-modes/jdee/default.nix b/pkgs/applications/editors/emacs-modes/jdee/default.nix
index e47da7a41934..306fe66823c8 100644
--- a/pkgs/applications/editors/emacs-modes/jdee/default.nix
+++ b/pkgs/applications/editors/emacs-modes/jdee/default.nix
@@ -92,7 +92,7 @@ in
       license = stdenv.lib.licenses.gpl2Plus;
 
       maintainers = [ ];
-      platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+      platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
 
       broken = true;
     };
diff --git a/pkgs/applications/editors/texmacs/default.nix b/pkgs/applications/editors/texmacs/default.nix
index 447e729d4f9b..d3d95e5886a5 100644
--- a/pkgs/applications/editors/texmacs/default.nix
+++ b/pkgs/applications/editors/texmacs/default.nix
@@ -41,6 +41,6 @@ stdenv.mkDerivation {
 
   meta = common.meta // {
     maintainers = [ stdenv.lib.maintainers.roconnor ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/applications/editors/tiled/default.nix b/pkgs/applications/editors/tiled/default.nix
index 8444ff6eaecc..b23db38e0f45 100644
--- a/pkgs/applications/editors/tiled/default.nix
+++ b/pkgs/applications/editors/tiled/default.nix
@@ -3,13 +3,13 @@
 
 stdenv.mkDerivation rec {
   name = "tiled-${version}";
-  version = "1.1.4";
+  version = "1.1.5";
 
   src = fetchFromGitHub {
     owner = "bjorn";
     repo = "tiled";
     rev = "v${version}";
-    sha256 = "0ln8lis9g23wp3w70xwbkzqmmbkd02cdx6z7msw9lrpkjzkj7mlr";
+    sha256 = "1l8sx0qfkm7n2ag0ns01vrs8mzcxzva00in4xqz4zgd505qx5q9v";
   };
 
   nativeBuildInputs = [ pkgconfig qmake ];
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "Free, easy to use and flexible tile map editor";
-    homepage = http://www.mapeditor.org/;
+    homepage = https://www.mapeditor.org/;
     license = with licenses; [
       bsd2	# libtiled and tmxviewer
       gpl2Plus	# all the rest
diff --git a/pkgs/applications/graphics/geeqie/default.nix b/pkgs/applications/graphics/geeqie/default.nix
index d034f5d64d93..a1ea88da84be 100644
--- a/pkgs/applications/graphics/geeqie/default.nix
+++ b/pkgs/applications/graphics/geeqie/default.nix
@@ -49,6 +49,6 @@ stdenv.mkDerivation rec {
     homepage = http://geeqie.sourceforge.net;
 
     maintainers = with maintainers; [ jfrankenau pSub ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
deleted file mode 100644
index 3802fff2ad21..000000000000
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, intltool, babl, gegl, gtk2, glib, gdk_pixbuf
-, pango, cairo, freetype, fontconfig, lcms, libpng, libjpeg, poppler, libtiff
-, webkit, libmng, librsvg, libwmf, zlib, libzip, ghostscript, aalib, jasper
-, python2Packages, libexif, gettext, xorg
-, AppKit, Cocoa, gtk-mac-integration }:
-
-let
-  inherit (python2Packages) pygtk wrapPython python;
-in stdenv.mkDerivation rec {
-  name = "gimp-${version}";
-  version = "2.8.22";
-
-  # This declarations for `gimp-with-plugins` wrapper,
-  # (used for determining $out/lib/gimp/${majorVersion}/ paths)
-  majorVersion = "2.0";
-  targetPluginDir = "$out/lib/gimp/${majorVersion}/plug-ins";
-  targetScriptDir = "$out/lib/gimp/${majorVersion}/scripts";
-
-  src = fetchurl {
-    url = "http://download.gimp.org/pub/gimp/v2.8/${name}.tar.bz2";
-    sha256 = "12k3lp938qdc9cqj29scg55f3bb8iav2fysd29w0s49bqmfa71wi";
-  };
-
-  buildInputs =
-    [ pkgconfig intltool babl gegl gtk2 glib gdk_pixbuf pango cairo
-      freetype fontconfig lcms libpng libjpeg poppler libtiff webkit
-      libmng librsvg libwmf zlib libzip ghostscript aalib jasper
-      python pygtk libexif gettext xorg.libXpm
-      wrapPython
-    ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ AppKit Cocoa gtk-mac-integration ];
-
-  pythonPath = [ pygtk ];
-
-  postFixup = ''
-    wrapPythonProgramsIn $out/lib/gimp/2.0/plug-ins/
-    wrapProgram $out/bin/gimp \
-      --prefix PYTHONPATH : "$PYTHONPATH" \
-      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
-  '';
-
-  passthru = { gtk = gtk2; }; # probably its a good idea to use the same gtk in plugins ?
-
-  #configureFlags = [ "--disable-print" ];
-
-  enableParallelBuilding = true;
-
-  # "screenshot" needs this.
-  NIX_LDFLAGS = "-rpath ${xorg.libX11.out}/lib";
-
-  meta = {
-    description = "The GNU Image Manipulation Program";
-    homepage = https://www.gimp.org/;
-    license = stdenv.lib.licenses.gpl3Plus;
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix
new file mode 100644
index 000000000000..2536367f6ceb
--- /dev/null
+++ b/pkgs/applications/graphics/gimp/default.nix
@@ -0,0 +1,95 @@
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, intltool, babl, gegl, gtk2, glib, gdk_pixbuf, isocodes
+, pango, cairo, freetype, fontconfig, lcms, libpng, libjpeg, poppler, poppler_data, libtiff
+, libmng, librsvg, libwmf, zlib, libzip, ghostscript, aalib, shared-mime-info
+, python2Packages, libexif, gettext, xorg, glib-networking, libmypaint, gexiv2
+, harfbuzz, mypaint-brushes, libwebp, libgudev, openexr
+, AppKit, Cocoa, gtk-mac-integration }:
+
+let
+  inherit (python2Packages) pygtk wrapPython python;
+in stdenv.mkDerivation rec {
+  name = "gimp-${version}";
+  version = "2.10.0";
+
+  src = fetchurl {
+    url = "http://download.gimp.org/pub/gimp/v${stdenv.lib.versions.majorMinor version}/${name}.tar.bz2";
+    sha256 = "1qkxaigbfkx26xym5nzrgfrmn97cbnhn63v1saaha2nbi3xrdk3z";
+  };
+
+  patches = [
+    # fix rpath of python library https://bugzilla.gnome.org/show_bug.cgi?id=795620
+    (fetchurl {
+      url = https://bugzilla.gnome.org/attachment.cgi?id=371482;
+      sha256 = "18bysndh61pvlv255xapdrfpsl5ivm51wp1w7xgk9vky9z2y3llc";
+    })
+
+    # fix absolute paths stored in configuration
+    (fetchpatch {
+      url = https://git.gnome.org/browse/gimp/patch/?id=0fce8fdb3c056acead8322c976a96fb6fba793b6;
+      sha256 = "09845i3bdpdbf13razr04ksvwydxcvzhjwlb4dfgdv5q203g2ris";
+    })
+    (fetchpatch {
+      url = https://git.gnome.org/browse/gimp/patch/?id=f6b586237cb8c912c1503f8e6086edd17f07d4df;
+      sha256 = "0s68885ip2wgjvsl5vqi2f1xhxdjpzqprifzgdl1vnv6gqmfy3bh";
+    })
+
+    # fix pc file (needed e.g. for building plug-ins)
+    (fetchpatch {
+      url = https://git.gnome.org/browse/gimp/patch/?id=7e19906827d301eb70275dba089849a632a0eabe;
+      sha256 = "0cbjfbwvzg2hqihg3rpsga405v7z2qahj22dfqn2jrb2gbhrjcp1";
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig intltool gettext wrapPython ];
+  propagatedBuildInputs = [ gegl ]; # needed by gimp-2.0.pc
+  buildInputs = [
+    babl gegl gtk2 glib gdk_pixbuf pango cairo gexiv2 harfbuzz isocodes libgudev
+    freetype fontconfig lcms libpng libjpeg poppler poppler_data libtiff openexr
+    libmng librsvg libwmf zlib libzip ghostscript aalib shared-mime-info libwebp
+    python pygtk libexif xorg.libXpm glib-networking libmypaint mypaint-brushes
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [ AppKit Cocoa gtk-mac-integration ];
+
+  pythonPath = [ pygtk ];
+
+  # Check if librsvg was built with --disable-pixbuf-loader.
+  PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk_pixbuf.moduleDir}";
+
+  preConfigure = ''
+    # The check runs before glib-networking is registered
+    export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES"
+  '';
+
+  postFixup = ''
+    wrapPythonProgramsIn $out/lib/gimp/${passthru.majorVersion}/plug-ins/
+    wrapProgram $out/bin/gimp-${stdenv.lib.versions.majorMinor version} \
+      --prefix PYTHONPATH : "$PYTHONPATH" \
+      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
+  '';
+
+  passthru = rec {
+    # The declarations for `gimp-with-plugins` wrapper,
+    # used for determining plug-in installation paths
+    majorVersion = "${stdenv.lib.versions.major version}.0";
+    targetPluginDir = "lib/gimp/${majorVersion}/plug-ins";
+    targetScriptDir = "lib/gimp/${majorVersion}/scripts";
+
+    # probably its a good idea to use the same gtk in plugins ?
+    gtk = gtk2;
+  };
+
+  configureFlags = [
+    "--without-webkit" # old version is required
+  ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "The GNU Image Manipulation Program";
+    homepage = https://www.gimp.org/;
+    maintainers = with maintainers; [ jtojnar ];
+    license = licenses.gpl3Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix
index 0d4215dd5bc2..01d086cc4ed4 100644
--- a/pkgs/applications/graphics/gimp/plugins/default.nix
+++ b/pkgs/applications/graphics/gimp/plugins/default.nix
@@ -12,12 +12,12 @@ let
     prePhases = "extraLib";
     extraLib = ''
       installScripts(){
-        mkdir -p ${targetScriptDir};
-        for p in "$@"; do cp "$p" ${targetScriptDir}; done
+        mkdir -p $out/${targetScriptDir};
+        for p in "$@"; do cp "$p" $out/${targetScriptDir}; done
       }
       installPlugins(){
-        mkdir -p ${targetPluginDir};
-        for p in "$@"; do cp "$p" ${targetPluginDir}; done
+        mkdir -p $out/${targetPluginDir};
+        for p in "$@"; do cp "$p" $out/${targetPluginDir}; done
       }
     '';
   }
@@ -35,15 +35,6 @@ let
     installPhase = "installScripts ${src}";
   };
 
- libLQR = pluginDerivation {
-    name = "liblqr-1-0.4.1";
-    # required by lqrPlugin, you don't havet to install this lib explicitely
-    src = fetchurl {
-      url = http://registry.gimp.org/files/liblqr-1-0.4.1.tar.bz2;
-      sha256 = "02g90wag7xi5rjlmwq8h0qs666b1i2sa90s4303hmym40il33nlz";
-    };
-  };
-
 in
 rec {
   gap = pluginDerivation {
@@ -97,6 +88,7 @@ rec {
       url = "http://registry.gimp.org/files/${name}.tar.bz2";
       sha256 = "1gqf3hchz7n7v5kpqkhqh8kwnxbsvlb5cr2w2n7ngrvl56f5xs1h";
     };
+    meta.broken = true;
   };
 
   resynthesizer = pluginDerivation {
@@ -147,6 +139,7 @@ rec {
       sha256 = "1zzvbczly7k456c0y6s92a1i8ph4ywmbvdl8i4rcc29l4qd2z8fw";
     };
     installPhase = "installPlugins src/texturize";
+    meta.broken = true; # https://github.com/lmanul/gimp-texturize/issues/1
   };
 
   waveletSharpen = pluginDerivation {
@@ -166,54 +159,18 @@ rec {
        Layer/Liquid Rescale
     */
     name = "lqr-plugin-0.6.1";
-    buildInputs = with pkgs; [ libLQR ];
+    buildInputs = with pkgs; [ liblqr1 ];
     src = fetchurl {
       url = http://registry.gimp.org/files/gimp-lqr-plugin-0.6.1.tar.bz2;
       sha256 = "00hklkpcimcbpjly4rjhfipaw096cpy768g9wixglwrsyqhil7l9";
     };
-    #postInstall = ''mkdir -p $out/nix-support; echo "${libLQR}" > "$out/nix-support/propagated-user-env-packages"'';
+    #postInstall = ''mkdir -p $out/nix-support; echo "${liblqr1}" > "$out/nix-support/propagated-user-env-packages"'';
     installPhase = "installPlugins src/gimp-lqr-plugin";
   };
 
-  gmic =
-    pluginDerivation rec {
-      inherit (pkgs.gmic) name src meta;
+  gmic = pkgs.gmic.gimpPlugin;
 
-      buildInputs = with pkgs; [ fftw opencv curl ];
-
-      sourceRoot = "${name}/src";
-
-      buildFlags = "gimp";
-
-      installPhase = "installPlugins gmic_gimp";
-  };
-
-  # this is more than a gimp plugin !
-  # either load the raw image with gimp (and the import dialog will popup)
-  # or use the binary
-  ufraw = pluginDerivation rec {
-    name = "ufraw-0.19.2";
-    buildInputs = with pkgs; [ gtkimageview lcms ];
-      # --enable-mime - install mime files, see README for more information
-      # --enable-extras - build extra (dcraw, nikon-curve) executables
-      # --enable-dst-correction - enable DST correction for file timestamps.
-      # --enable-contrast - enable the contrast setting option.
-      # --enable-interp-none: enable 'None' interpolation (mostly for debugging).
-      # --with-lensfun: use the lensfun library - experimental feature, read this before using it.
-      # --with-prefix=PREFIX - use also PREFIX as an input prefix for the build
-      # --with-dosprefix=PREFIX - PREFIX in the the prefix in dos format (needed only for ms-window
-    configureFlags = "--enable-extras --enable-dst-correction --enable-contrast";
-
-    src = fetchurl {
-      url = "mirror://sourceforge/ufraw/${name}.tar.gz";
-      sha256 = "1lxba7pb3vcsq94dwapg9bk9mb3ww6r3pvvcyb0ah5gh2sgzxgkk";
-    };
-    installPhase = "
-      installPlugins ufraw-gimp
-      mkdir -p $out/bin
-      cp ufraw $out/bin
-    ";
-  };
+  ufraw = pkgs.ufraw.gimpPlugin;
 
   gimplensfun = pluginDerivation rec {
     version = "0.2.4";
@@ -239,7 +196,7 @@ rec {
 
       license = stdenv.lib.licenses.gpl3Plus;
       maintainers = [ ];
-      platforms = stdenv.lib.platforms.gnu;
+      platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
     };
   };
 
diff --git a/pkgs/applications/graphics/gimp/wrapper.nix b/pkgs/applications/graphics/gimp/wrapper.nix
index 7455a69dde97..ec529519159b 100644
--- a/pkgs/applications/graphics/gimp/wrapper.nix
+++ b/pkgs/applications/graphics/gimp/wrapper.nix
@@ -1,9 +1,10 @@
 { stdenv, lib, symlinkJoin, gimp, makeWrapper, gimpPlugins, plugins ? null}:
 
 let
-allPlugins = lib.filter (pkg: builtins.isAttrs pkg && pkg.type == "derivation") (lib.attrValues gimpPlugins);
+allPlugins = lib.filter (pkg: builtins.isAttrs pkg && pkg.type == "derivation" && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
 selectedPlugins = if plugins == null then allPlugins else plugins;
 extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
+versionBranch = stdenv.lib.versions.majorMinor gimp.version;
 
 in symlinkJoin {
   name = "gimp-with-plugins-${gimp.version}";
@@ -13,14 +14,14 @@ in symlinkJoin {
   buildInputs = [ makeWrapper ];
 
   postBuild = ''
-    for each in gimp-2.8 gimp-console-2.8; do
+    for each in gimp-${versionBranch} gimp-console-${versionBranch}; do
       wrapProgram $out/bin/$each \
         --set GIMP2_PLUGINDIR "$out/lib/gimp/2.0" \
         ${toString extraArgs}
     done
     set +x
     for each in gimp gimp-console; do
-      ln -sf "$each-2.8" $out/bin/$each
+      ln -sf "$each-${versionBranch}" $out/bin/$each
     done
   '';
 }
diff --git a/pkgs/applications/graphics/ocrad/default.nix b/pkgs/applications/graphics/ocrad/default.nix
index ac67759c258c..d88117916279 100644
--- a/pkgs/applications/graphics/ocrad/default.nix
+++ b/pkgs/applications/graphics/ocrad/default.nix
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
 
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ pSub ];
-    platforms = platforms.gnu;  # arbitrary choice
+    platforms = platforms.gnu ++ platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/applications/graphics/panotools/default.nix b/pkgs/applications/graphics/panotools/default.nix
index 9ca90d2f5df3..719aca5096a5 100644
--- a/pkgs/applications/graphics/panotools/default.nix
+++ b/pkgs/applications/graphics/panotools/default.nix
@@ -18,6 +18,6 @@ stdenv.mkDerivation rec {
     description = "Free software suite for authoring and displaying virtual reality panoramas";
     license = stdenv.lib.licenses.gpl2Plus;
 
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/applications/graphics/qtpfsgui/default.nix b/pkgs/applications/graphics/qtpfsgui/default.nix
index d3edc40cbea2..4be7d230b5f4 100644
--- a/pkgs/applications/graphics/qtpfsgui/default.nix
+++ b/pkgs/applications/graphics/qtpfsgui/default.nix
@@ -36,6 +36,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/graphics/sane/xsane.nix b/pkgs/applications/graphics/sane/xsane.nix
index ad02e1a80231..ca0f49e0c948 100644
--- a/pkgs/applications/graphics/sane/xsane.nix
+++ b/pkgs/applications/graphics/sane/xsane.nix
@@ -1,9 +1,9 @@
 { stdenv, fetchurl, sane-backends, sane-frontends, libX11, gtk2, pkgconfig, libpng
 , libusb ? null
-, gimpSupport ? false, gimp_2_8 ? null
+, gimpSupport ? false, gimp ? null
 }:
 
-assert gimpSupport -> gimp_2_8 != null;
+assert gimpSupport -> gimp != null;
 
 stdenv.mkDerivation rec {
   name = "xsane-0.999";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [libpng sane-backends sane-frontends libX11 gtk2 ]
     ++ (if libusb != null then [libusb] else [])
-    ++ stdenv.lib.optional gimpSupport gimp_2_8;
+    ++ stdenv.lib.optional gimpSupport gimp;
 
   meta = {
     homepage = http://www.sane-project.org/;
diff --git a/pkgs/applications/graphics/scantailor/advanced.nix b/pkgs/applications/graphics/scantailor/advanced.nix
index bea4fe9b2c6c..1fb8d572e95b 100644
--- a/pkgs/applications/graphics/scantailor/advanced.nix
+++ b/pkgs/applications/graphics/scantailor/advanced.nix
@@ -44,6 +44,6 @@ stdenv.mkDerivation rec {
     description = "Interactive post-processing tool for scanned pages";
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ jfrankenau ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/applications/graphics/scantailor/default.nix b/pkgs/applications/graphics/scantailor/default.nix
index ec7af8829073..395179ff70ae 100644
--- a/pkgs/applications/graphics/scantailor/default.nix
+++ b/pkgs/applications/graphics/scantailor/default.nix
@@ -19,6 +19,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl3Plus;
 
     maintainers = [ stdenv.lib.maintainers.viric ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/graphics/ufraw/default.nix b/pkgs/applications/graphics/ufraw/default.nix
index fc8e7a62c2ba..50cd9485a3e8 100644
--- a/pkgs/applications/graphics/ufraw/default.nix
+++ b/pkgs/applications/graphics/ufraw/default.nix
@@ -1,6 +1,9 @@
 { fetchurl, stdenv, pkgconfig, gtk2, gettext, bzip2, zlib
+, withGimpPlugin ? true, gimp ? null
 , libjpeg, libtiff, cfitsio, exiv2, lcms2, gtkimageview, lensfun }:
 
+assert withGimpPlugin -> gimp != null;
+
 stdenv.mkDerivation rec {
   name = "ufraw-0.22";
 
@@ -10,10 +13,23 @@ stdenv.mkDerivation rec {
     sha256 = "0pm216pg0vr44gwz9vcvq3fsf8r5iayljhf5nis2mnw7wn6d5azp";
   };
 
-  buildInputs =
-    [ pkgconfig gtk2 gtkimageview gettext bzip2 zlib
-      libjpeg libtiff cfitsio exiv2 lcms2 lensfun
-    ];
+  outputs = [ "out" ] ++ stdenv.lib.optional withGimpPlugin "gimpPlugin";
+
+  nativeBuildInputs = [ pkgconfig gettext ];
+  buildInputs = [
+    gtk2 gtkimageview bzip2 zlib
+    libjpeg libtiff cfitsio exiv2 lcms2 lensfun
+  ] ++ stdenv.lib.optional withGimpPlugin gimp;
+
+  configureFlags = [
+    "--enable-extras"
+    "--enable-dst-correction"
+    "--enable-contrast"
+  ] ++ stdenv.lib.optional withGimpPlugin "--with-gimp";
+
+  postInstall = stdenv.lib.optionalString withGimpPlugin ''
+    moveToOutput "lib/gimp" "$gimpPlugin"
+  '';
 
   meta = {
     homepage = http://ufraw.sourceforge.net/;
@@ -33,6 +49,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu;  # needs GTK+
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # needs GTK+
   };
 }
diff --git a/pkgs/applications/graphics/viewnior/default.nix b/pkgs/applications/graphics/viewnior/default.nix
index c655cadef400..5afd7a0237d0 100644
--- a/pkgs/applications/graphics/viewnior/default.nix
+++ b/pkgs/applications/graphics/viewnior/default.nix
@@ -38,6 +38,6 @@ stdenv.mkDerivation rec {
 
     maintainers = [ stdenv.lib.maintainers.smironov ];
 
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/graphics/xfig/default.nix b/pkgs/applications/graphics/xfig/default.nix
index c70b1029b791..545675ab1545 100644
--- a/pkgs/applications/graphics/xfig/default.nix
+++ b/pkgs/applications/graphics/xfig/default.nix
@@ -42,6 +42,6 @@ stdenv.mkDerivation {
   meta = {
     description = "An interactive drawing tool for X11";
     homepage = http://xfig.org;
-    platforms = stdenv.lib.platforms.gnu;         # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;         # arbitrary choice
   };
 }
diff --git a/pkgs/applications/misc/calibre/no_updates_dialog.patch b/pkgs/applications/misc/calibre/no_updates_dialog.patch
index 4d37c3b642f5..faaaf2c19949 100644
--- a/pkgs/applications/misc/calibre/no_updates_dialog.patch
+++ b/pkgs/applications/misc/calibre/no_updates_dialog.patch
@@ -13,15 +13,3 @@ diff -burN calibre-2.9.0.orig/src/calibre/gui2/main.py calibre-2.9.0/src/calibre
      parser.add_option('--ignore-plugins', default=False, action='store_true',
              help=_('Ignore custom plugins, useful if you installed a plugin'
                  ' that is preventing calibre from starting'))
-diff -burN calibre-2.9.0.orig/src/calibre/gui2/update.py calibre-2.9.0/src/calibre/gui2/update.py
---- calibre-2.9.0.orig/src/calibre/gui2/update.py	2014-11-09 20:09:54.082231864 +0800
-+++ calibre-2.9.0/src/calibre/gui2/update.py	2014-11-09 20:17:49.954767115 +0800
-@@ -154,6 +154,8 @@
-             self.update_checker.signal.update_found.connect(self.update_found,
-                     type=Qt.QueuedConnection)
-             self.update_checker.start()
-+        else:
-+            self.update_checker = None
- 
-     def recalc_update_label(self, number_of_plugin_updates):
-         self.update_found(self.last_newest_calibre_version, number_of_plugin_updates)
diff --git a/pkgs/applications/misc/dbeaver/default.nix b/pkgs/applications/misc/dbeaver/default.nix
index 002d8fc8f23b..edc1497294fc 100644
--- a/pkgs/applications/misc/dbeaver/default.nix
+++ b/pkgs/applications/misc/dbeaver/default.nix
@@ -7,7 +7,7 @@
 
 stdenv.mkDerivation rec {
   name = "dbeaver-ce-${version}";
-  version = "5.0.3";
+  version = "5.0.4";
 
   desktopItem = makeDesktopItem {
     name = "dbeaver";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "https://dbeaver.jkiss.org/files/${version}/dbeaver-ce-${version}-linux.gtk.x86_64.tar.gz";
-    sha256 = "0pk40jzmd23cv690a8wslxbb4xp4msq2zwh7xm0hvs64ykm9a581";
+    sha256 = "0dfs2xa490dypp4qz8v0wj6d2bjnfqhjmlskpzrf8ih416lz1bd3";
   };
 
   installPhase = ''
diff --git a/pkgs/applications/misc/gcalcli/default.nix b/pkgs/applications/misc/gcalcli/default.nix
index d3ba5a97333a..6a7a7ae604de 100644
--- a/pkgs/applications/misc/gcalcli/default.nix
+++ b/pkgs/applications/misc/gcalcli/default.nix
@@ -1,7 +1,38 @@
-{ stdenv, lib, fetchFromGitHub, pythonPackages
+{ stdenv, lib, fetchFromGitHub, python2
 , libnotify ? null }:
 
-pythonPackages.buildPythonApplication rec {
+let
+  py = python2.override {
+    packageOverrides = self: super: {
+      google_api_python_client = super.google_api_python_client.overridePythonAttrs (oldAttrs: rec {
+        version = "1.5.1";
+        src = oldAttrs.src.override {
+          inherit version;
+          sha256 = "1ggxk094vqr4ia6yq7qcpa74b4x5cjd5mj74rq0xx9wp2jkrxmig";
+        };
+      });
+
+      oauth2client = super.oauth2client.overridePythonAttrs (oldAttrs: rec {
+        version = "1.4.12";
+        src = oldAttrs.src.override {
+          inherit version;
+          sha256 = "0phfk6s8bgpap5xihdk1xv2lakdk1pb3rg6hp2wsg94hxcxnrakl";
+        };
+      });
+
+      uritemplate = super.uritemplate.overridePythonAttrs (oldAttrs: rec {
+        version = "0.6";
+        src = oldAttrs.src.override {
+          inherit version;
+          sha256 = "1zapwg406vkwsirnzc6mwq9fac4az8brm6d9bp5xpgkyxc5263m3";
+        };
+        # there are no checks in this version
+        doCheck = false;
+      });
+    };
+  };
+
+in with py.pkgs; buildPythonApplication rec {
   version = "3.4.0";
   name = "gcalcli-${version}";
 
@@ -12,27 +43,21 @@ pythonPackages.buildPythonApplication rec {
     sha256 = "171awccgnmfv4j7m2my9387sjy60g18kzgvscl6pzdid9fn9rrm8";
   };
 
-  propagatedBuildInputs = with pythonPackages; [
-    dateutil
-    gflags
-    google_api_python_client
-    httplib2
-    oauth2client
-    parsedatetime
-    six
-    vobject
-  ]
-  ++ lib.optional (!pythonPackages.isPy3k) futures;
-
-  # there are no tests as of 3.4.0
-  doCheck = false;
+  propagatedBuildInputs = [
+    dateutil gflags httplib2 parsedatetime six vobject
+    # overridden
+    google_api_python_client oauth2client uritemplate
+  ] ++ lib.optional (!isPy3k) futures;
 
   postInstall = lib.optionalString stdenv.isLinux ''
-    substituteInPlace $out/bin/gcalcli \
-      --replace "command = 'notify-send -u critical -a gcalcli %s'" \
-                "command = '${libnotify}/bin/notify-send -i view-calendar-upcoming-events -u critical -a Calendar %s'"
+    substituteInPlace $out/bin/gcalcli --replace \
+      "command = 'notify-send -u critical -a gcalcli %s'" \
+      "command = '${libnotify}/bin/notify-send -i view-calendar-upcoming-events -u critical -a Calendar %s'"
   '';
 
+  # There are no tests as of 3.4.0
+  doCheck = false;
+
   meta = with lib; {
     homepage = https://github.com/insanum/gcalcli;
     description = "CLI for Google Calendar";
diff --git a/pkgs/applications/misc/mwic/default.nix b/pkgs/applications/misc/mwic/default.nix
index 02c18109abc2..67e6ed3fa9ce 100644
--- a/pkgs/applications/misc/mwic/default.nix
+++ b/pkgs/applications/misc/mwic/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, pythonPackages }:
 
 stdenv.mkDerivation rec {
-  version = "0.7.4";
+  version = "0.7.5";
   name = "mwic-${version}";
 
   src = fetchurl {
     url = "https://github.com/jwilk/mwic/releases/download/${version}/${name}.tar.gz";
-    sha256 = "0c0xk7wx4vaamlry6srdixw1q6afmqznvxdzcg1skr0qjypw5i5q";
+    sha256 = "1b4fz9vs0aihg9nj9aj6d2jmykpa9nxi9rvz06v50wwk515plpmc";
   };
 
   makeFlags=["PREFIX=\${out}"];
diff --git a/pkgs/applications/misc/pdf-quench/default.nix b/pkgs/applications/misc/pdf-quench/default.nix
new file mode 100644
index 000000000000..c567a7903b81
--- /dev/null
+++ b/pkgs/applications/misc/pdf-quench/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, pkgs, pythonPackages, wrapGAppsHook}:
+
+pythonPackages.buildPythonApplication rec {
+  name = "pdf-quench-${version}";
+  version = "1.0.5";
+
+  src = fetchFromGitHub {
+    owner = "linuxerwang";
+    repo = "pdf-quench";
+    rev = "b72b3970b371026f9a7ebe6003581e8a63af98f6";
+    sha256 = "1rp9rlwr6rarcsxygv5x2c5psgwl6r69k0lsgribgyyla9cf2m7n";
+  };
+
+  nativeBuildInputs = [ wrapGAppsHook ];
+  buildInputs = with pkgs; [
+    gtk3
+    gobjectIntrospection
+    goocanvas2
+    poppler_gi
+  ];
+  propagatedBuildInputs = with pythonPackages; [ pygobject3 pypdf2 ];
+
+  format = "other";
+  doCheck = false;
+
+  installPhase = ''
+    install -D -T -m 755 src/pdf_quench.py $out/bin/pdf-quench
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/linuxerwang/pdf-quench;
+    description = "A visual tool for cropping pdf files";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ flokli ];
+  };
+}
diff --git a/pkgs/applications/misc/qpdfview/default.nix b/pkgs/applications/misc/qpdfview/default.nix
index e3e7ff950b0c..f836ce5b8085 100644
--- a/pkgs/applications/misc/qpdfview/default.nix
+++ b/pkgs/applications/misc/qpdfview/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, qt4, pkgconfig, poppler_qt4, djvulibre, libspectre, cups
+{stdenv, fetchurl, qmake, qtbase, qtsvg, pkgconfig, poppler_qt5, djvulibre, libspectre, cups
 , file, ghostscript
 }:
 let
@@ -10,9 +10,9 @@ let
     url="https://launchpad.net/qpdfview/trunk/${version}/+download/qpdfview-${version}.tar.gz";
     sha256 = "0zysjhr58nnmx7ba01q3zvgidkgcqxjdj4ld3gx5fc7wzvl1dm7s";
   };
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ qmake pkgconfig ];
   buildInputs = [
-    qt4 poppler_qt4 djvulibre libspectre cups file ghostscript
+    qtbase qtsvg poppler_qt5 djvulibre libspectre cups file ghostscript
   ];
 in
 stdenv.mkDerivation {
@@ -21,13 +21,12 @@ stdenv.mkDerivation {
   src = fetchurl {
     inherit (s) url sha256;
   };
-  configurePhase = ''
-    qmake *.pro
-    for i in *.pro; do 
-      qmake "$i" -o "Makefile.$(basename "$i" .pro)"
-    done
-    sed -e "s@/usr/@$out/@g" -i Makefile*
+
+  # TODO: revert this once placeholder is supported
+  preConfigure = ''
+    qmakeFlags="$qmakeFlags *.pro TARGET_INSTALL_PATH=$out/bin PLUGIN_INSTALL_PATH=$out/lib/qpdfview DATA_INSTALL_PATH=$out/share/qpdfview MANUAL_INSTALL_PATH=$out/share/man/man1 ICON_INSTALL_PATH=$out/share/icons/hicolor/scalable/apps LAUNCHER_INSTALL_PATH=$out/share/applications APPDATA_INSTALL_PATH=$out/share/appdata"
   '';
+
   meta = {
     inherit (s) version;
     description = "A tabbed document viewer";
diff --git a/pkgs/applications/misc/vit/default.nix b/pkgs/applications/misc/vit/default.nix
index 37d7aeb88e61..40a399247e90 100644
--- a/pkgs/applications/misc/vit/default.nix
+++ b/pkgs/applications/misc/vit/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Visual Interactive Taskwarrior";
     maintainers = with pkgs.lib.maintainers; [ ];
-    platforms = pkgs.lib.platforms.linux;
+    platforms = pkgs.lib.platforms.all;
     license = pkgs.lib.licenses.gpl3;
   };
 }
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index b591d5d7ba0c..6403f5441f36 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -160,8 +160,9 @@ let
         sha256 = "0dc4cmd05qjqyihrd4qb34kz0jlapjgah8bzgnvxf9m4791w062z";
       })
     ] ++ optional enableWideVine ./patches/widevine.patch
-      ++ optionals (stdenv.isAarch64 && versionRange "65" "66") [
+      ++ optionals (stdenv.isAarch64 && versionRange "65" "67") [
         ./patches/skia_buildfix.patch
+        ./patches/neon_buildfix.patch
     ];
 
     postPatch = ''
diff --git a/pkgs/applications/networking/browsers/chromium/patches/neon_buildfix.patch b/pkgs/applications/networking/browsers/chromium/patches/neon_buildfix.patch
new file mode 100644
index 000000000000..b44487ca634c
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/patches/neon_buildfix.patch
@@ -0,0 +1,21 @@
+diff --git a/skia/ext/convolver_neon.cc b/skia/ext/convolver_neon.cc
+index 26b91b9..cae6bc2 100644
+--- a/skia/ext/convolver_neon.cc
++++ b/skia/ext/convolver_neon.cc
+
+@@ -23,7 +23,7 @@
+     remainder[2] += coeff * pixels_left[i * 4 + 2];
+     remainder[3] += coeff * pixels_left[i * 4 + 3];
+   }
+-  return {remainder[0], remainder[1], remainder[2], remainder[3]};
++  return vld1q_s32(remainder);
+ }
+ 
+ // Convolves horizontally along a single row. The row data is given in
+@@ -336,4 +336,4 @@
+   }
+ }
+ 
+-}  // namespace skia
+\ No newline at end of file
++}  // namespace skia
diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
index 8a8abb42f55e..a2094305db55 100644
--- a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
+++ b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
@@ -340,7 +340,7 @@ stdenv.mkDerivation rec {
       \
       TMPDIR="\''${TMPDIR:-/tmp}" \
       HOME="\$HOME" \
-      XAUTHORITY="\$XAUTHORITY" \
+      XAUTHORITY="\''${XAUTHORITY:-}" \
       DISPLAY="\$DISPLAY" \
       DBUS_SESSION_BUS_ADDRESS="\$DBUS_SESSION_BUS_ADDRESS" \
       \
diff --git a/pkgs/applications/networking/instant-messengers/bitlbee/default.nix b/pkgs/applications/networking/instant-messengers/bitlbee/default.nix
index fa1c64ba0ad7..fa3c66e67b61 100644
--- a/pkgs/applications/networking/instant-messengers/bitlbee/default.nix
+++ b/pkgs/applications/networking/instant-messengers/bitlbee/default.nix
@@ -50,6 +50,6 @@ stdenv.mkDerivation rec {
     license = licenses.gpl2Plus;
 
     maintainers = with maintainers; [ wkennington pSub ];
-    platforms = platforms.gnu;  # arbitrary choice
+    platforms = platforms.gnu ++ platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/qtox/default.nix b/pkgs/applications/networking/instant-messengers/qtox/default.nix
index bbad5a681807..f7a56d47dbfa 100644
--- a/pkgs/applications/networking/instant-messengers/qtox/default.nix
+++ b/pkgs/applications/networking/instant-messengers/qtox/default.nix
@@ -1,19 +1,23 @@
-{ mkDerivation, lib, fetchFromGitHub, cmake, pkgconfig,
-  libtoxcore,
-  libpthreadstubs, libXdmcp, libXScrnSaver,
-  qtbase, qtsvg, qttools, qttranslations,
-  ffmpeg, filter-audio, libexif, libsodium, libopus,
-  libvpx, openal, pcre, qrencode, sqlcipher }:
-
-mkDerivation rec {
+{ stdenv, mkDerivation, lib, fetchFromGitHub, cmake, pkgconfig
+, libtoxcore
+, libpthreadstubs, libXdmcp, libXScrnSaver
+, qtbase, qtsvg, qttools, qttranslations
+, ffmpeg, filter-audio, libexif, libsodium, libopus
+, libvpx, openal, pcre, qrencode, sqlcipher
+, AVFoundation ? null }:
+
+let
+  version = "1.15.0";
+  rev = "v${version}";
+
+in mkDerivation rec {
   name = "qtox-${version}";
-  version = "1.13.0";
 
   src = fetchFromGitHub {
     owner  = "qTox";
     repo   = "qTox";
-    rev    = "v${version}";
-    sha256 = "08x71p23d0sp0w11k8z3wf3k56iclmdq9x652n8ggidgyrdi9f6y";
+    sha256 = "1garwnlmg452b0bwx36rsh08s15q3zylb26l01iiwg4l9vcaldh9";
+    inherit rev;
   };
 
   buildInputs = [
@@ -22,17 +26,18 @@ mkDerivation rec {
     qtbase qtsvg qttranslations
     ffmpeg filter-audio libexif libopus libsodium
     libvpx openal pcre qrencode sqlcipher
-  ];
+  ] ++ lib.optionals stdenv.isDarwin [ AVFoundation] ;
 
   nativeBuildInputs = [ cmake pkgconfig qttools ];
 
   enableParallelBuilding = true;
 
   cmakeFlags = [
-    "-DGIT_DESCRIBE=${version}"
+    "-DGIT_DESCRIBE=${rev}"
     "-DENABLE_STATUSNOTIFIER=False"
     "-DENABLE_GTK_SYSTRAY=False"
     "-DENABLE_APPINDICATOR=False"
+    "-DTIMESTAMP=1"
   ];
 
   meta = with lib; {
diff --git a/pkgs/applications/networking/instant-messengers/quaternion/default.nix b/pkgs/applications/networking/instant-messengers/quaternion/default.nix
index 768ab24c2f39..6c716cc3e1c0 100644
--- a/pkgs/applications/networking/instant-messengers/quaternion/default.nix
+++ b/pkgs/applications/networking/instant-messengers/quaternion/default.nix
@@ -2,24 +2,21 @@
 
 stdenv.mkDerivation rec {
   name = "quaternion-${version}";
-  version = "0.0.5";
-
-  # libqmatrixclient doesn't support dynamic linking as of 0.2 so we simply pull in the source
+  version = "0.0.9";
 
   src = fetchFromGitHub {
     owner  = "QMatrixClient";
     repo   = "Quaternion";
     rev    = "v${version}";
-    sha256 = "14xmaq446aggqhpcilahrw2mr5gf2mlr1xzyp7r6amrnmnqsyxrd";
+    sha256 = "0zdpll953a7biwnklhgmgg3k2vz7j58lc1nmfkmvsfcj1fmdf408";
   };
 
   buildInputs = [ qtbase qtquickcontrols libqmatrixclient ];
 
   nativeBuildInputs = [ cmake ];
 
-  enableParallelBuilding = true;
-
-  # take the source from libqmatrixclient
+  # libqmatrixclient is now compiled as a dynamic library but quarternion cannot use it yet
+  # https://github.com/QMatrixClient/Quaternion/issues/239
   postPatch = ''
     rm -rf lib
     ln -s ${libqmatrixclient.src} lib
diff --git a/pkgs/applications/networking/instant-messengers/ratox/default.nix b/pkgs/applications/networking/instant-messengers/ratox/default.nix
index 5d004db60e3a..add337d3f085 100644
--- a/pkgs/applications/networking/instant-messengers/ratox/default.nix
+++ b/pkgs/applications/networking/instant-messengers/ratox/default.nix
@@ -5,22 +5,24 @@ with stdenv.lib;
 
 let
   configFile = optionalString (conf!=null) (builtins.toFile "config.h" conf);
-in
 
-stdenv.mkDerivation rec {
-  name = "ratox-0.4";
+in stdenv.mkDerivation rec {
+  name = "ratox-0.4.20180303";
 
   src = fetchgit {
     url = "git://git.2f30.org/ratox.git";
-    rev = "0db821b7bd566f6cfdc0cc5a7bbcc3e5e92adb4c";
-    sha256 = "0wmf8hydbcq4bkpsld9vnqw4zfzf3f04vhgwy17nd4p5p389fbl5";
+    rev = "269f7f97fb374a8f9c0b82195c21de15b81ddbbb";
+    sha256 = "0bpn37h8jvsqd66fkba8ky42nydc8acawa5x31yxqlxc8mc66k74";
   };
 
-  patches = [ ./ldlibs.patch ];
-
   buildInputs = [ libtoxcore ];
 
-  preConfigure = optionalString (conf!=null) "cp ${configFile} config.def.h";
+  preConfigure = ''
+    substituteInPlace config.mk \
+      --replace '-lsodium -lopus -lvpx ' ""
+
+    ${optionalString (conf!=null) "cp ${configFile} config.def.h"}
+  '';
 
   makeFlags = [ "PREFIX=$(out)" ];
 
diff --git a/pkgs/applications/networking/instant-messengers/ratox/ldlibs.patch b/pkgs/applications/networking/instant-messengers/ratox/ldlibs.patch
deleted file mode 100644
index 1406e7143107..000000000000
--- a/pkgs/applications/networking/instant-messengers/ratox/ldlibs.patch
+++ /dev/null
@@ -1,5 +0,0 @@
---- a/config.mk
-+++ b/config.mk
-@@ -13 +13 @@ LDFLAGS  = -L/usr/local/lib
--LDLIBS   = -ltoxcore -ltoxav -ltoxencryptsave -lsodium -lopus -lvpx -lm -lpthread
-+LDLIBS   = -ltoxcore -ltoxav -ltoxencryptsave -lm -lpthread
diff --git a/pkgs/applications/networking/instant-messengers/riot/riot-web.nix b/pkgs/applications/networking/instant-messengers/riot/riot-web.nix
index 0d3342e66687..ce558130a6ce 100644
--- a/pkgs/applications/networking/instant-messengers/riot/riot-web.nix
+++ b/pkgs/applications/networking/instant-messengers/riot/riot-web.nix
@@ -3,11 +3,11 @@
 let configFile = writeText "riot-config.json" conf; in
 stdenv.mkDerivation rec {
   name= "riot-web-${version}";
-  version = "0.14.0";
+  version = "0.14.1";
 
   src = fetchurl {
     url = "https://github.com/vector-im/riot-web/releases/download/v${version}/riot-v${version}.tar.gz";
-    sha256 = "0san8d3dghjkqqv0ypampgl7837mxk9w64ci6fzy1k5d5dmdgvsi";
+    sha256 = "08paca7wc135hspkv97bgh2a29hbg8vxv0mrp68mgwscpyrl6vnf";
   };
 
   installPhase = ''
diff --git a/pkgs/applications/networking/instant-messengers/telepathy/gabble/default.nix b/pkgs/applications/networking/instant-messengers/telepathy/gabble/default.nix
index 2d880bef753e..4fa4967c898e 100644
--- a/pkgs/applications/networking/instant-messengers/telepathy/gabble/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telepathy/gabble/default.nix
@@ -22,6 +22,6 @@ stdenv.mkDerivation rec {
     homepage = https://telepathy.freedesktop.org/components/telepathy-gabble/;
     description = "Jabber/XMPP connection manager for the Telepathy framework";
     license = licenses.lgpl21Plus;
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/telepathy/haze/default.nix b/pkgs/applications/networking/instant-messengers/telepathy/haze/default.nix
index a1669183bb3b..89be42781a4c 100644
--- a/pkgs/applications/networking/instant-messengers/telepathy/haze/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telepathy/haze/default.nix
@@ -24,6 +24,6 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A Telepathy connection manager based on libpurple";
-    platforms = stdenv.lib.platforms.gnu; # Random choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux; # Random choice
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/telepathy/idle/default.nix b/pkgs/applications/networking/instant-messengers/telepathy/idle/default.nix
index 7894554eee4f..4607961cdf08 100644
--- a/pkgs/applications/networking/instant-messengers/telepathy/idle/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telepathy/idle/default.nix
@@ -21,6 +21,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "IRC connection manager for the Telepathy framework";
     license = stdenv.lib.licenses.lgpl21;
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix b/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix
index 111970ab7112..f1b3c55d14c3 100644
--- a/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix
@@ -31,6 +31,6 @@ stdenv.mkDerivation rec {
     homepage = https://telepathy.freedesktop.org/components/telepathy-logger/;
     license = licenses.lgpl21;
     maintainers = with maintainers; [ jtojnar ];
-    platforms = platforms.gnu; # Arbitrary choice
+    platforms = platforms.gnu ++ platforms.linux; # Arbitrary choice
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/telepathy/salut/default.nix b/pkgs/applications/networking/instant-messengers/telepathy/salut/default.nix
index e060eaabf281..17cd20c09cbd 100644
--- a/pkgs/applications/networking/instant-messengers/telepathy/salut/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telepathy/salut/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "Link-local XMPP connection manager for Telepathy";
-    platforms = platforms.gnu; # Random choice
+    platforms = platforms.gnu ++ platforms.linux; # Random choice
     maintainers = [ maintainers.lethalman ];
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/toxic/default.nix b/pkgs/applications/networking/instant-messengers/toxic/default.nix
index 4934a7374058..8a45e988c07d 100644
--- a/pkgs/applications/networking/instant-messengers/toxic/default.nix
+++ b/pkgs/applications/networking/instant-messengers/toxic/default.nix
@@ -4,13 +4,13 @@
 
 stdenv.mkDerivation rec {
   name = "toxic-${version}";
-  version = "0.7.2";
+  version = "0.8.2";
 
   src = fetchFromGitHub {
     owner  = "Tox";
     repo   = "toxic";
     rev    = "v${version}";
-    sha256 = "1kws6bx5va1wc0k6pqihrla91vicxk4zqghvxiylgfbjr1jnkvwc";
+    sha256 = "0fwmk945nip98m3md58y3ibjmzfq25hns3xf0bmbc6fjpww8d5p5";
   };
 
   makeFlags = [ "PREFIX=$(out)"];
diff --git a/pkgs/applications/networking/instant-messengers/utox/default.nix b/pkgs/applications/networking/instant-messengers/utox/default.nix
index 9c208dd52a83..e139904fee53 100644
--- a/pkgs/applications/networking/instant-messengers/utox/default.nix
+++ b/pkgs/applications/networking/instant-messengers/utox/default.nix
@@ -1,16 +1,18 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, libtoxcore, filter-audio, dbus, libvpx, libX11, openal, freetype, libv4l
-, libXrender, fontconfig, libXext, libXft, utillinux, git, libsodium, libopus, check }:
+{ stdenv, lib, fetchFromGitHub, check, cmake, pkgconfig
+, libtoxcore, filter-audio, dbus, libvpx, libX11, openal, freetype, libv4l
+, libXrender, fontconfig, libXext, libXft, utillinux, libsodium, libopus }:
 
 stdenv.mkDerivation rec {
   name = "utox-${version}";
 
-  version = "0.16.1";
+  version = "0.17.0";
 
   src = fetchFromGitHub {
     owner  = "uTox";
     repo   = "uTox";
     rev    = "v${version}";
-    sha256 = "0ak10925v67yaga2pw9yzp0xkb5j1181srfjdyqpd29v8mi9j828";
+    sha256 = "12wbq883il7ikldayh8hm0cjfrkp45vn05xx9s1jbfz6gmkidyar";
+    fetchSubmodules = true;
   };
 
   buildInputs = [
@@ -20,16 +22,20 @@ stdenv.mkDerivation rec {
   ];
 
   nativeBuildInputs = [
-    cmake git pkgconfig check
+    check cmake pkgconfig
   ];
 
   cmakeFlags = [
-    "-DENABLE_UPDATER=OFF"
-  ] ++ stdenv.lib.optional (!doCheck) "-DENABLE_TESTS=OFF";
+    "-DENABLE_AUTOUPDATE=OFF"
+  ] ++ lib.optional (doCheck) "-DENABLE_TESTS=ON";
 
-  doCheck = true;
+  doCheck = stdenv.isLinux;
 
-  checkTarget = "test";
+  checkPhase = ''
+    runHook preCheck
+    ctest -VV
+    runHook postCheck
+  '';
 
   meta = with stdenv.lib; {
     description = "Lightweight Tox client";
diff --git a/pkgs/applications/networking/instant-messengers/wire-desktop/default.nix b/pkgs/applications/networking/instant-messengers/wire-desktop/default.nix
index 9e946152c192..f0123024fe2f 100644
--- a/pkgs/applications/networking/instant-messengers/wire-desktop/default.nix
+++ b/pkgs/applications/networking/instant-messengers/wire-desktop/default.nix
@@ -61,7 +61,7 @@ in
     };
 
     desktopItem = makeDesktopItem {
-      name = "Wire";
+      name = "wire-desktop";
       exec = "wire-desktop %U";
       icon = "wire-desktop";
       comment = "Secure messenger for everyone";
diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix
index d89219cce5f3..13add2690db3 100644
--- a/pkgs/applications/networking/mailreaders/notmuch/default.nix
+++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix
@@ -12,7 +12,7 @@
 with stdenv.lib;
 
 stdenv.mkDerivation rec {
-  version = "0.26.1";
+  version = "0.26.2";
   name = "notmuch-${version}";
 
   passthru = {
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "http://notmuchmail.org/releases/${name}.tar.gz";
-    sha256 = "0dx8nhdmkaqabxcgxfa757m99fi395y76h9ynx8539yh9m7y9xyk";
+    sha256 = "0fqf6wwvqlccq9qdnd0mky7fx0kbkczd28blf045s0vsvdjii70h";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/applications/networking/p2p/gnunet/default.nix b/pkgs/applications/networking/p2p/gnunet/default.nix
index d18342177243..e15c3588c298 100644
--- a/pkgs/applications/networking/p2p/gnunet/default.nix
+++ b/pkgs/applications/networking/p2p/gnunet/default.nix
@@ -73,6 +73,6 @@ stdenv.mkDerivation rec {
     license = licenses.gpl2Plus;
 
     maintainers = with maintainers; [ viric vrthra ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/applications/networking/p2p/gnunet/git.nix b/pkgs/applications/networking/p2p/gnunet/git.nix
new file mode 100644
index 000000000000..9763c0ee97fa
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/git.nix
@@ -0,0 +1,92 @@
+{ stdenv, fetchgit, libextractor, libmicrohttpd, libgcrypt
+, zlib, gmp, curl, libtool, adns, sqlite, pkgconfig
+, libxml2, ncurses, gettext, libunistring, libidn
+, makeWrapper, autoconf, automake, texinfo, which
+, withVerbose ? false }:
+
+let
+  rev = 	"ce2864cfaa27e55096b480bf35db5f8cee2a5e7e";
+in
+stdenv.mkDerivation rec {
+  name = "gnunet-git-${rev}";
+
+  src = fetchgit {
+    url =  https://gnunet.org/git/gnunet.git;
+    inherit rev;
+    sha256 = "0gbw920m9v4b3425c0d1h7drgl2m1fni1bwjn4fwqnyz7kdqzsgl";
+  };
+
+  buildInputs = [
+    libextractor libmicrohttpd libgcrypt gmp curl libtool
+    zlib adns sqlite libxml2 ncurses libidn
+    pkgconfig gettext libunistring makeWrapper
+    autoconf automake texinfo which
+  ];
+
+  configureFlags = stdenv.lib.optional withVerbose "--enable-logging=verbose ";
+
+  preConfigure = ''
+    # Brute force: since nix-worker chroots don't provide
+    # /etc/{resolv.conf,hosts}, replace all references to `localhost'
+    # by their IPv4 equivalent.
+    for i in $(find . \( -name \*.c -or -name \*.conf \) \
+                    -exec grep -l '\<localhost\>' {} \;)
+    do
+      echo "$i: substituting \`127.0.0.1' to \`localhost'..."
+      sed -i "$i" -e's/\<localhost\>/127.0.0.1/g'
+    done
+
+    # Make sure the tests don't rely on `/tmp', for the sake of chroot
+    # builds.
+    for i in $(find . \( -iname \*test\*.c -or -name \*.conf \) \
+                    -exec grep -l /tmp {} \;)
+    do
+      echo "$i: replacing references to \`/tmp' by \`$TMPDIR'..."
+      substituteInPlace "$i" --replace "/tmp" "$TMPDIR"
+    done
+
+    # Ensure NSS installation works fine
+    configureFlags="$configureFlags --with-nssdir=$out/lib"
+
+    sh contrib/pogen.sh
+    sh bootstrap
+  '';
+
+  doCheck = false;
+
+  /* FIXME: Tests must be run this way, but there are still a couple of
+     failures.
+
+  postInstall =
+    '' export GNUNET_PREFIX="$out"
+       export PATH="$out/bin:$PATH"
+       make -k check
+    '';
+  */
+
+  meta = {
+    description = "GNUnet, GNU's decentralized anonymous and censorship-resistant P2P framework";
+
+    longDescription = ''
+      GNUnet is a framework for secure peer-to-peer networking that
+      does not use any centralized or otherwise trusted services.  A
+      first service implemented on top of the networking layer
+      allows anonymous censorship-resistant file-sharing.  Anonymity
+      is provided by making messages originating from a peer
+      indistinguishable from messages that the peer is routing.  All
+      peers act as routers and use link-encrypted connections with
+      stable bandwidth utilization to communicate with each other.
+      GNUnet uses a simple, excess-based economic model to allocate
+      resources.  Peers in GNUnet monitor each others behavior with
+      respect to resource usage; peers that contribute to the
+      network are rewarded with better service.
+    '';
+
+    homepage = https://gnunet.org/;
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ viric ];
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/applications/networking/p2p/gnunet/svn.nix b/pkgs/applications/networking/p2p/gnunet/svn.nix
index 8c8d95169c87..688bb11acd03 100644
--- a/pkgs/applications/networking/p2p/gnunet/svn.nix
+++ b/pkgs/applications/networking/p2p/gnunet/svn.nix
@@ -88,6 +88,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
 
     maintainers = with stdenv.lib.maintainers; [ viric ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/networking/sync/rclone/default.nix b/pkgs/applications/networking/sync/rclone/default.nix
index aa2a971b15f6..405ff2fde735 100644
--- a/pkgs/applications/networking/sync/rclone/default.nix
+++ b/pkgs/applications/networking/sync/rclone/default.nix
@@ -2,7 +2,7 @@
 
 buildGoPackage rec {
   name = "rclone-${version}";
-  version = "1.40";
+  version = "1.41";
 
   goPackagePath = "github.com/ncw/rclone";
 
@@ -10,7 +10,7 @@ buildGoPackage rec {
     owner = "ncw";
     repo = "rclone";
     rev = "v${version}";
-    sha256 = "01q9g5g4va1s91xzvxpq8lj9jcrbl66cik383cpxwmcv04qcqgw9";
+    sha256 = "0kvqzrj7kbr9mhg023lkvk320qhkf4widcv6yph1cx701935brhr";
   };
 
   outputs = [ "bin" "out" "man" ];
diff --git a/pkgs/applications/office/gnucash/2.6.nix b/pkgs/applications/office/gnucash/2.6.nix
index c768f4c7fa34..4d85374ee9a6 100644
--- a/pkgs/applications/office/gnucash/2.6.nix
+++ b/pkgs/applications/office/gnucash/2.6.nix
@@ -113,6 +113,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.gnucash.org/;
 
     maintainers = [ stdenv.lib.maintainers.peti stdenv.lib.maintainers.domenkozar ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/office/gnucash/default.nix b/pkgs/applications/office/gnucash/default.nix
index d17cd2a7ab75..252c6d878d0c 100644
--- a/pkgs/applications/office/gnucash/default.nix
+++ b/pkgs/applications/office/gnucash/default.nix
@@ -80,6 +80,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.gnucash.org/;
 
     maintainers = [ stdenv.lib.maintainers.peti stdenv.lib.maintainers.domenkozar ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/science/machine-learning/torch/torch-distro.nix b/pkgs/applications/science/machine-learning/torch/torch-distro.nix
index a4247eac627b..d8ce1d2c6280 100644
--- a/pkgs/applications/science/machine-learning/torch/torch-distro.nix
+++ b/pkgs/applications/science/machine-learning/torch/torch-distro.nix
@@ -9,7 +9,7 @@ let
     homepage = http://torch.ch;
     license = stdenv.lib.licenses.bsd3;
     maintainers = with stdenv.lib.maintainers; [ smironov ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 
   distro_src = src;
diff --git a/pkgs/applications/science/misc/megam/default.nix b/pkgs/applications/science/misc/megam/default.nix
index a0ee505dc97f..8cd119c7b7b0 100644
--- a/pkgs/applications/science/misc/megam/default.nix
+++ b/pkgs/applications/science/misc/megam/default.nix
@@ -41,6 +41,6 @@ stdenv.mkDerivation rec {
     license = "non-commercial";
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/applications/science/misc/tulip/default.nix b/pkgs/applications/science/misc/tulip/default.nix
index 8560d900a4fa..7db2e6a12c20 100644
--- a/pkgs/applications/science/misc/tulip/default.nix
+++ b/pkgs/applications/science/misc/tulip/default.nix
@@ -33,6 +33,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl3Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/applications/video/makemkv/default.nix b/pkgs/applications/video/makemkv/default.nix
index a4b08e1ce47c..acc9c88d2ffe 100644
--- a/pkgs/applications/video/makemkv/default.nix
+++ b/pkgs/applications/video/makemkv/default.nix
@@ -1,26 +1,26 @@
 { stdenv, fetchurl
-, openssl, qt4, libGLU_combined, zlib, pkgconfig, libav
+, openssl, qt5, libGLU_combined, zlib, pkgconfig, libav
 }:
 
 stdenv.mkDerivation rec {
   name = "makemkv-${ver}";
-  ver = "1.10.8";
+  ver = "1.12.2";
   builder = ./builder.sh;
 
   src_bin = fetchurl {
     url = "http://www.makemkv.com/download/makemkv-bin-${ver}.tar.gz";
-    sha256 = "b7861aa7b03203f50d2ce3130f805c4b0406d13aec597648050349fa8b084b29";
+    sha256 = "0ylybq0776am5yy064b55q0jja1q1p9dscwmn7f1p3igzv15rypj";
   };
 
   src_oss = fetchurl {
     url = "http://www.makemkv.com/download/makemkv-oss-${ver}.tar.gz";
-    sha256 = "d17cfd916a9bdda35b1065bce86a48a987caf9ffb4d6861609458f9f312603c7";
+    sha256 = "063rgb88zbh4zwysyhjn4awykcnc90qgsx6d8ggm27wy849306v1";
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [openssl qt4 libGLU_combined zlib libav];
+  buildInputs = [openssl qt5.qtbase libGLU_combined zlib libav];
 
-  libPath = stdenv.lib.makeLibraryPath [stdenv.cc.cc openssl libGLU_combined qt4 zlib ]
+  libPath = stdenv.lib.makeLibraryPath [stdenv.cc.cc openssl libGLU_combined qt5.qtbase zlib ]
           + ":" + stdenv.cc.cc + "/lib64";
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/video/qstopmotion/default.nix b/pkgs/applications/video/qstopmotion/default.nix
index 412cc1ad2728..2454044bb48e 100644
--- a/pkgs/applications/video/qstopmotion/default.nix
+++ b/pkgs/applications/video/qstopmotion/default.nix
@@ -31,6 +31,6 @@ stdenv.mkDerivation rec {
 
     license = stdenv.lib.licenses.gpl2Plus;
     maintainers = [ maintainers.leenaars ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix
index 9839aadc9c1f..dd68eb19380f 100644
--- a/pkgs/applications/virtualization/qemu/default.nix
+++ b/pkgs/applications/virtualization/qemu/default.nix
@@ -21,8 +21,8 @@
 
 with stdenv.lib;
 let
-  version = "2.11.1";
-  sha256 = "1jrcff0szyjxc3vywyiclwdzk0xgq4cxvjbvmcfyjcpdrq9j5pyr";
+  version = "2.12.0";
+  sha256 = "17377xxbmwbrnh895a108z944pqi39hzrbw4jzgj8pcipi3s3x69";
   audio = optionalString (hasSuffix "linux" stdenv.system) "alsa,"
     + optionalString pulseSupport "pa,"
     + optionalString sdlSupport "sdl,";
@@ -69,11 +69,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "ga" ];
 
-  patches = [ ./no-etc-install.patch ./statfs-flags.patch (fetchpatch {
-    name = "glibc-2.27-memfd.patch";
-    url = "https://git.qemu.org/?p=qemu.git;a=patch;h=75e5b70e6b5dcc4f2219992d7cffa462aa406af0";
-    sha256 = "0gaz93kb33qc0jx6iphvny0yrd17i8zhcl3a9ky5ylc2idz0wiwa";
-  }) ]
+  patches = [ ./no-etc-install.patch ]
     ++ optional nixosTestRunner ./force-uid0-on-9p.patch
     ++ optional pulseSupport ./fix-hda-recording.patch
     ++ optionals stdenv.hostPlatform.isMusl [
@@ -99,6 +95,8 @@ stdenv.mkDerivation rec {
 
   preConfigure = ''
     unset CPP # intereferes with dependency calculation
+  '' + optionalString stdenv.hostPlatform.isMusl ''
+    NIX_CFLAGS_COMPILE+=" -D_LINUX_SYSINFO_H"
   '';
 
   configureFlags =
diff --git a/pkgs/applications/virtualization/qemu/riscv.nix b/pkgs/applications/virtualization/qemu/riscv.nix
deleted file mode 100644
index 2159ad4b4dc9..000000000000
--- a/pkgs/applications/virtualization/qemu/riscv.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ qemu, fetchFromGitHub, lib }: let
-  src = fetchFromGitHub {
-    owner  = "riscv";
-    repo   = "riscv-qemu";
-    rev    = "f733c7b5f86147216e14aff90c03ccdd76056bef";
-    sha256 = "1ppr9qqwi7qqh8m6dgk1hrzg8zri240il27l67vfayd8ijagb9zq";
-    fetchSubmodules = true;
-  };
-  version = "2.11.92";
-  revCount = "60378";
-  shortRev = builtins.substring 0 9 src.rev;
-  targets = [ "riscv32-linux-user" "riscv32-softmmu"
-              "riscv64-linux-user" "riscv64-softmmu"
-            ];
-in lib.overrideDerivation qemu (orig: {
-  name = "${(builtins.parseDrvName qemu.name).name}-${version}pre${revCount}_${shortRev}";
-  inherit src;
-# <<<<<<< HEAD
-#   # https://github.com/riscv/riscv-qemu/pull/109
-#   patches = [ ./no-etc-install.patch ./statfs-flags.patch ./riscv-initrd.patch ];
-# =======
-  # The pulseaudio and statfs patches are in 2.12.0+, which this is based on
-  patches = [
-    ./force-uid0-on-9p.patch
-    ./no-etc-install.patch
-  ];
-
-  configureFlags = orig.configureFlags ++ [ "--target-list=${lib.concatStringsSep "," targets}" ];
-  postInstall = null;
-})
diff --git a/pkgs/applications/virtualization/qemu/statfs-flags.patch b/pkgs/applications/virtualization/qemu/statfs-flags.patch
deleted file mode 100644
index 52a470a2869a..000000000000
--- a/pkgs/applications/virtualization/qemu/statfs-flags.patch
+++ /dev/null
@@ -1,197 +0,0 @@
-commit 909fe47c7009aa9a75fe9470c5f8d3dd5b50917a
-Author: Shea Levy <shea@shealevy.com>
-Date:   Sun Feb 18 13:50:11 2018 -0500
-
-    linux-user: Support f_flags in statfs when available.
-    
-    Signed-off-by: Shea Levy <shea@shealevy.com>
-
-diff --git a/configure b/configure
-index 913e14839d..52fe2bf941 100755
---- a/configure
-+++ b/configure
-@@ -5303,6 +5303,22 @@ if compile_prog "" "" ; then
-     have_utmpx=yes
- fi
- 
-+##########################################
-+# Check for newer fields of struct statfs on Linux
-+
-+if test "$linux_user" = "yes"; then
-+  cat > $TMPC <<EOF
-+#include <sys/vfs.h>
-+
-+int main(void) {
-+  struct statfs fs;
-+  fs.f_flags = 0;
-+}
-+EOF
-+  if compile_object ; then
-+      have_statfs_flags=yes
-+  fi
-+fi
- ##########################################
- # checks for sanitizers
- 
-@@ -6518,6 +6534,10 @@ if test "$have_utmpx" = "yes" ; then
-   echo "HAVE_UTMPX=y" >> $config_host_mak
- fi
- 
-+if test "$have_statfs_flags" = "yes" ; then
-+  echo "HAVE_STATFS_FLAGS=y" >> $config_host_mak
-+fi
-+
- if test "$ivshmem" = "yes" ; then
-   echo "CONFIG_IVSHMEM=y" >> $config_host_mak
- fi
-diff --git a/linux-user/syscall.c b/linux-user/syscall.c
-index 82b35a6bdf..77481eca2c 100644
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -9534,6 +9534,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
-             __put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
-             __put_user(stfs.f_namelen, &target_stfs->f_namelen);
-             __put_user(stfs.f_frsize, &target_stfs->f_frsize);
-+#ifdef HAVE_STATFS_FLAGS
-+            __put_user(stfs.f_flags, &target_stfs->f_flags);
-+#endif
-             memset(target_stfs->f_spare, 0, sizeof(target_stfs->f_spare));
-             unlock_user_struct(target_stfs, arg2, 1);
-         }
-diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
-index a35c52a60a..64aa49d3c5 100644
---- a/linux-user/syscall_defs.h
-+++ b/linux-user/syscall_defs.h
-@@ -362,7 +362,14 @@ struct kernel_statfs {
- 	int f_ffree;
-         kernel_fsid_t f_fsid;
- 	int f_namelen;
-+#ifdef HAVE_STATFS_FLAGS
-+	int f_frsize;
-+	int f_flags;
-+	int f_spare[4];
-+#else
- 	int f_spare[6];
-+#endif
-+
- };
- 
- struct target_dirent {
-@@ -2223,7 +2230,12 @@ struct target_statfs {
- 	/* Linux specials */
- 	target_fsid_t		f_fsid;
- 	int32_t			f_namelen;
-+#ifdef HAVE_STATFS_FLAGS
-+	int32_t			f_flags;
-+	int32_t			f_spare[5];
-+#else
- 	int32_t			f_spare[6];
-+#endif
- };
- #else
- struct target_statfs {
-@@ -2239,7 +2251,12 @@ struct target_statfs {
- 	/* Linux specials */
- 	target_fsid_t		f_fsid;
- 	abi_long		f_namelen;
-+#ifdef HAVE_STATFS_FLAGS
-+	abi_long		f_flags;
-+	abi_long		f_spare[5];
-+#else
- 	abi_long		f_spare[6];
-+#endif
- };
- #endif
- 
-@@ -2255,7 +2272,12 @@ struct target_statfs64 {
- 	uint64_t	f_bavail;
- 	target_fsid_t	f_fsid;
- 	uint32_t	f_namelen;
-+#ifdef HAVE_STATFS_FLAGS
-+	uint32_t	f_flags;
-+	uint32_t	f_spare[5];
-+#else
- 	uint32_t	f_spare[6];
-+#endif
- };
- #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
-        defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
-@@ -2271,7 +2293,12 @@ struct target_statfs {
- 	target_fsid_t f_fsid;
- 	abi_long f_namelen;
- 	abi_long f_frsize;
-+#ifdef HAVE_STATFS_FLAGS
-+	abi_long f_flags;
-+	abi_long f_spare[4];
-+#else
- 	abi_long f_spare[5];
-+#endif
- };
- 
- struct target_statfs64 {
-@@ -2285,7 +2312,12 @@ struct target_statfs64 {
- 	target_fsid_t f_fsid;
- 	abi_long f_namelen;
- 	abi_long f_frsize;
-+#ifdef HAVE_STATFS_FLAGS
-+	abi_long f_flags;
-+	abi_long f_spare[4];
-+#else
- 	abi_long f_spare[5];
-+#endif
- };
- #elif defined(TARGET_S390X)
- struct target_statfs {
-@@ -2299,7 +2331,13 @@ struct target_statfs {
-     kernel_fsid_t f_fsid;
-     int32_t  f_namelen;
-     int32_t  f_frsize;
-+#ifdef HAVE_STATFS_FLAGS
-+    int32_t  f_flags;
-+    int32_t  f_spare[4];
-+#else
-     int32_t  f_spare[5];
-+#endif
-+
- };
- 
- struct target_statfs64 {
-@@ -2313,7 +2351,12 @@ struct target_statfs64 {
-     kernel_fsid_t f_fsid;
-     int32_t  f_namelen;
-     int32_t  f_frsize;
-+#ifdef HAVE_STATFS_FLAGS
-+    int32_t  f_flags;
-+    int32_t  f_spare[4];
-+#else
-     int32_t  f_spare[5];
-+#endif
- };
- #else
- struct target_statfs {
-@@ -2327,7 +2370,12 @@ struct target_statfs {
- 	target_fsid_t f_fsid;
- 	uint32_t f_namelen;
- 	uint32_t f_frsize;
-+#ifdef HAVE_STATFS_FLAGS
-+	uint32_t f_flags;
-+	uint32_t f_spare[4];
-+#else
- 	uint32_t f_spare[5];
-+#endif
- };
- 
- struct target_statfs64 {
-@@ -2341,7 +2389,12 @@ struct target_statfs64 {
- 	target_fsid_t f_fsid;
-         uint32_t f_namelen;
- 	uint32_t f_frsize;
-+#ifdef HAVE_STATFS_FLAGS
-+	uint32_t f_flags;
-+	uint32_t f_spare[4];
-+#else
- 	uint32_t f_spare[5];
-+#endif
- };
- #endif
- 
diff --git a/pkgs/desktops/gnome-3/core/folks/default.nix b/pkgs/desktops/gnome-3/core/folks/default.nix
index 776f76642222..beb40209bc8c 100644
--- a/pkgs/desktops/gnome-3/core/folks/default.nix
+++ b/pkgs/desktops/gnome-3/core/folks/default.nix
@@ -45,6 +45,6 @@ in stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.lgpl2Plus;
 
     maintainers = gnome3.maintainers;
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/development/compilers/gprolog/default.nix b/pkgs/development/compilers/gprolog/default.nix
index 0e3eb88f537c..b12b055342ca 100644
--- a/pkgs/development/compilers/gprolog/default.nix
+++ b/pkgs/development/compilers/gprolog/default.nix
@@ -63,6 +63,6 @@ stdenv.mkDerivation rec {
     '';
 
     maintainers = [ stdenv.lib.maintainers.peti ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/development/compilers/mit-scheme/default.nix b/pkgs/development/compilers/mit-scheme/default.nix
index 4670f39eac18..f254e91e5c65 100644
--- a/pkgs/development/compilers/mit-scheme/default.nix
+++ b/pkgs/development/compilers/mit-scheme/default.nix
@@ -87,6 +87,6 @@ stdenv.mkDerivation {
 
     # Build fails on Cygwin and Darwin:
     # <http://article.gmane.org/gmane.lisp.scheme.mit-scheme.devel/489>.
-    platforms = platforms.gnu ++ platforms.freebsd;
+    platforms = platforms.gnu ++ platforms.linux ++ platforms.freebsd;
   };
 }
diff --git a/pkgs/development/guile-modules/guile-lib/default.nix b/pkgs/development/guile-modules/guile-lib/default.nix
index 95741e07600a..35eb4667bd6b 100644
--- a/pkgs/development/guile-modules/guile-lib/default.nix
+++ b/pkgs/development/guile-modules/guile-lib/default.nix
@@ -40,6 +40,6 @@ in stdenv.mkDerivation {
     homepage = "http://www.nongnu.org/guile-lib/";
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ vyp ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/development/guile-modules/guile-ncurses/default.nix b/pkgs/development/guile-modules/guile-ncurses/default.nix
index 152a34883045..8f6018582670 100644
--- a/pkgs/development/guile-modules/guile-ncurses/default.nix
+++ b/pkgs/development/guile-modules/guile-ncurses/default.nix
@@ -39,6 +39,6 @@ in stdenv.mkDerivation {
     homepage = "https://www.gnu.org/software/guile-ncurses/";
     license = licenses.lgpl3Plus;
     maintainers = with maintainers; [ vyp ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/audio/rtaudio/default.nix b/pkgs/development/libraries/audio/rtaudio/default.nix
index 326572996b48..1df696c0ec64 100644
--- a/pkgs/development/libraries/audio/rtaudio/default.nix
+++ b/pkgs/development/libraries/audio/rtaudio/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2,  alsaLib, rtmidi }:
 
 stdenv.mkDerivation rec {
-  version = "4.1.2";
+  version = "5.0.0";
   name = "rtaudio-${version}";
 
   src = fetchFromGitHub {
     owner = "thestk";
     repo = "rtaudio";
     rev = "${version}";
-    sha256 = "09j84l9l3q0g238z5k89rm8hgk0i1ir8917an7amq474nwjp80pq";
+    sha256 = "0jkqnhc2pq31nmq4daxhmqdjgv2qi4ib27hwms2r5zhnmvvzlr67";
   };
 
   buildInputs = [ autoconf automake libtool libjack2 alsaLib rtmidi ];
diff --git a/pkgs/development/libraries/cddlib/default.nix b/pkgs/development/libraries/cddlib/default.nix
index 818eb6db8c69..ee56b50e1da5 100644
--- a/pkgs/development/libraries/cddlib/default.nix
+++ b/pkgs/development/libraries/cddlib/default.nix
@@ -1,17 +1,49 @@
-{stdenv, fetchurl, gmp}:
+{ stdenv
+, fetchurl
+, fetchpatch
+, gmp
+, autoreconfHook
+}:
+
 stdenv.mkDerivation rec {
   name = "cddlib-${version}";
-  fileVersion = "094h";
-  version = "0.94h";
-  src = fetchurl {
+  version = "0.94i";
+  src = let
+    fileVersion = stdenv.lib.replaceStrings ["."] [""] version;
+  in fetchurl {
+    # Might switch to github in the future, see
+    # https://trac.sagemath.org/ticket/21952#comment:20
     urls = [
       "http://archive.ubuntu.com/ubuntu/pool/universe/c/cddlib/cddlib_${fileVersion}.orig.tar.gz"
       "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-${fileVersion}.tar.gz"
     ];
-    name = "";
-    sha256 = "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy";
+    sha256 = "00zdgiqb91vx6gd2103h3ijij0llspsxc6zz3iw2bll39fvkl4xq";
   };
   buildInputs = [gmp];
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+  # compute reduced H and V representation of polytope
+  # this patch is included by most distributions (Debian, Conda, ArchLinux, SageMath)
+  # proposed upstream (no answer yet): https://github.com/cddlib/cddlib/pull/3
+  both_reps_c = (fetchurl {
+    name = "cdd_both_reps.c";
+    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-libs/cddlib/files/cdd_both_reps.c?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d";
+    sha256 = "0r9yc5bgiz8i72c6vsn2y2mjk5581iw94gji9v7lg16kzzgrk9x0";
+  });
+  preAutoreconf = ''
+    # Required by sage.geometry.polyhedron
+    cp ${both_reps_c} src/cdd_both_reps.c
+    cp ${both_reps_c} src-gmp/cdd_both_reps.c
+  '';
+  patches = [
+    # add the cdd_both_reps binary
+    (fetchpatch {
+      name = "add-cdd_both_reps-binary.patch";
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-libs/cddlib/files/cddlib-094h-add-cdd_both_reps-binary.patch?id=78e3a61a68c916450aa4e5ceecd20041583af901";
+      sha256 = "162ni2fr7dpbdkz0b5nizxq7qr5k1i1d75g0smiylpzfb0hb761a";
+    })
+  ];
   meta = {
     inherit version;
     description = ''An implementation of the Double Description Method for generating all vertices of a convex polyhedron'';
diff --git a/pkgs/development/libraries/clutter-gst/default.nix b/pkgs/development/libraries/clutter-gst/default.nix
index 962ca9ff9b53..a06691d5c715 100644
--- a/pkgs/development/libraries/clutter-gst/default.nix
+++ b/pkgs/development/libraries/clutter-gst/default.nix
@@ -30,6 +30,6 @@ in stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.lgpl2Plus;
 
     maintainers = with stdenv.lib.maintainers; [ lethalman ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/development/libraries/clutter-gtk/default.nix b/pkgs/development/libraries/clutter-gtk/default.nix
index 71789b45a283..22f205cdcec0 100644
--- a/pkgs/development/libraries/clutter-gtk/default.nix
+++ b/pkgs/development/libraries/clutter-gtk/default.nix
@@ -27,6 +27,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.clutter-project.org/;
     license = stdenv.lib.licenses.lgpl2Plus;
     maintainers = with stdenv.lib.maintainers; [ lethalman ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index 6bfa6bdc2fb9..069b78f6bcac 100644
--- a/pkgs/development/libraries/gdk-pixbuf/default.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -52,6 +52,9 @@ stdenv.mkDerivation rec {
       packageName = pname;
       attrPath = "gdk_pixbuf";
     };
+
+    # gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc
+    moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/gegl/4.0.nix b/pkgs/development/libraries/gegl/4.0.nix
new file mode 100644
index 000000000000..a8e50945c3fd
--- /dev/null
+++ b/pkgs/development/libraries/gegl/4.0.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, glib, babl, libpng, cairo, libjpeg, which
+, librsvg, pango, gtk, bzip2, json-glib, intltool, autoreconfHook, libraw
+, libwebp, gnome3, libintl }:
+
+let
+  version = "0.4.0";
+in stdenv.mkDerivation rec {
+  name = "gegl-${version}";
+
+  src = fetchurl {
+    url = "http://download.gimp.org/pub/gegl/${stdenv.lib.versions.majorMinor version}/${name}.tar.bz2";
+    sha256 = "1ighk4z8nlqrzyj8w97s140hzj59564l3xv6fpzbr97m1zx2nkfh";
+  };
+
+  # needs fonts otherwise, don't know how to pass them
+  configureFlags = [ "--disable-docs" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  buildInputs = [
+    libpng cairo libjpeg librsvg pango gtk bzip2
+    libraw libwebp gnome3.gexiv2
+  ];
+
+  propagatedBuildInputs = [ glib json-glib babl ]; # for gegl-4.0.pc
+
+  nativeBuildInputs = [ pkgconfig intltool which autoreconfHook libintl ];
+
+  meta = with stdenv.lib; {
+    description = "Graph-based image processing framework";
+    homepage = http://www.gegl.org;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/goocanvas/2.x.nix b/pkgs/development/libraries/goocanvas/2.x.nix
index 026f58079f6d..ef36a9c076fb 100644
--- a/pkgs/development/libraries/goocanvas/2.x.nix
+++ b/pkgs/development/libraries/goocanvas/2.x.nix
@@ -13,11 +13,13 @@ in stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig gettext gtk-doc python2 ];
-  buildInputs = [ gtk3 cairo glib ];
+  buildInputs = [ gtk3 cairo glib gobjectIntrospection ];
 
   configureFlags = [
     "--disable-python"
   ];
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "$(dev)/share/gir-1.0";
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "$(out)/lib/girepository-1.0";
 
   meta = with stdenv.lib; {
     description = "Canvas widget for GTK+ based on the the Cairo 2D library";
diff --git a/pkgs/development/libraries/gperftools/default.nix b/pkgs/development/libraries/gperftools/default.nix
index 5c863cf26cbe..de71704cff85 100644
--- a/pkgs/development/libraries/gperftools/default.nix
+++ b/pkgs/development/libraries/gperftools/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, libunwind }:
 
 stdenv.mkDerivation rec {
-  name = "gperftools-2.6.1";
+  name = "gperftools-2.6.3";
 
   src = fetchurl {
     url = "https://github.com/gperftools/gperftools/releases/download/${name}/${name}.tar.gz";
-    sha256 = "10cxd6s5pkm2d934gh47hrn9xcrw4qlc9yr7s99z4a508bmngd1q";
+    sha256 = "17zfivp6n00rlqbrx6q6h71y2f815nvlzysff1ihgk4mxpv2yjri";
   };
 
   buildInputs = stdenv.lib.optional stdenv.isLinux libunwind;
@@ -16,7 +16,9 @@ stdenv.mkDerivation rec {
     substituteInPlace libtool --replace stdc++ c++
   '';
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optional stdenv.isDarwin "-D_XOPEN_SOURCE";
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.isDarwin [
+    "-D_XOPEN_SOURCE" "-Wno-aligned-allocation-unavailable"
+  ];
 
   # some packages want to link to the static tcmalloc_minimal
   # to drop the runtime dependency on gperftools
diff --git a/pkgs/development/libraries/ldb/default.nix b/pkgs/development/libraries/ldb/default.nix
index 4f2785675f08..c178f2f76a4d 100644
--- a/pkgs/development/libraries/ldb/default.nix
+++ b/pkgs/development/libraries/ldb/default.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, python, pkgconfig, readline, tdb, talloc, tevent
-, popt, libxslt, docbook_xsl, docbook_xml_dtd_42
+, popt, libxslt, docbook_xsl, docbook_xml_dtd_42, cmocka
 }:
 
 stdenv.mkDerivation rec {
-  name = "ldb-1.1.27";
+  name = "ldb-1.1.31";
 
   src = fetchurl {
     url = "mirror://samba/ldb/${name}.tar.gz";
-    sha256 = "1b1mkl5p8swb67s9aswavhzswlib34hpgsv66zgns009paf2df6d";
+    sha256 = "04d53e2ab5b35688f5ed7a4471f5b273da121016e1af0630b36a36506afaeb46"                                                                                                                                                             ;
   };
 
   outputs = [ "out" "dev" ];
@@ -16,6 +16,7 @@ stdenv.mkDerivation rec {
   buildInputs = [
     python readline tdb talloc tevent popt
     libxslt docbook_xsl docbook_xml_dtd_42
+    cmocka
   ];
 
   preConfigure = ''
diff --git a/pkgs/development/libraries/libcanberra/default.nix b/pkgs/development/libraries/libcanberra/default.nix
index 1b2cf4084f93..54f2273c2fcf 100644
--- a/pkgs/development/libraries/libcanberra/default.nix
+++ b/pkgs/development/libraries/libcanberra/default.nix
@@ -43,6 +43,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.lgpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/development/libraries/libchamplain/default.nix b/pkgs/development/libraries/libchamplain/default.nix
index 74e5bbc952ae..418e9cf0b573 100644
--- a/pkgs/development/libraries/libchamplain/default.nix
+++ b/pkgs/development/libraries/libchamplain/default.nix
@@ -38,6 +38,6 @@ stdenv.mkDerivation rec {
     '';
 
      maintainers = gnome3.maintainers;
-     platforms = platforms.gnu;  # arbitrary choice
+     platforms = platforms.gnu ++ platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/development/libraries/libchop/default.nix b/pkgs/development/libraries/libchop/default.nix
index 1be3a74fbff5..5790672d8e51 100644
--- a/pkgs/development/libraries/libchop/default.nix
+++ b/pkgs/development/libraries/libchop/default.nix
@@ -50,6 +50,6 @@ stdenv.mkDerivation rec {
     homepage = http://nongnu.org/libchop/;
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ viric ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libgpod/default.nix b/pkgs/development/libraries/libgpod/default.nix
index 60400712e30e..fbe421e9974e 100644
--- a/pkgs/development/libraries/libgpod/default.nix
+++ b/pkgs/development/libraries/libgpod/default.nix
@@ -32,7 +32,7 @@ in stdenv.mkDerivation rec {
     homepage = http://gtkpod.sourceforge.net/;
     description = "Library used by gtkpod to access the contents of an ipod";
     license = "LGPL";
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libqmatrixclient/default.nix b/pkgs/development/libraries/libqmatrixclient/default.nix
index f537013d2fec..7d8ec42700c5 100644
--- a/pkgs/development/libraries/libqmatrixclient/default.nix
+++ b/pkgs/development/libraries/libqmatrixclient/default.nix
@@ -1,40 +1,26 @@
 { stdenv, fetchFromGitHub, cmake
 , qtbase }:
 
-# This doesn't actually do anything really yet as it doesn't support dynamic building
-# When it does, quaternion and tensor should use it
-
 stdenv.mkDerivation rec {
   name = "libqmatrixclient-${version}";
-  version = "0.2";
+  version = "0.2.1";
 
   src = fetchFromGitHub {
     owner  = "QMatrixClient";
     repo   = "libqmatrixclient";
-    rev    = "v${version}-q0.0.5";
-    sha256 = "1m53yxsqjxv2jq0h1xipwsgaj5rca4fk4cl3azgvmf19l9yn00ck";
+    rev    = "v${version}";
+    sha256 = "0sv5hhdsffq7092n6hggfz9a78qn3jfmbvw2flmc4ippzz563akv";
   };
 
   buildInputs = [ qtbase ];
 
   nativeBuildInputs = [ cmake ];
 
-  enableParallelBuilding = true;
-
-  installPhase = ''
-    runHook preInstall
-
-    install -Dm644 -t $out/lib *.a
-
-    runHook postInstall
-  '';
-
   meta = with stdenv.lib; {
     description= "A Qt5 library to write cross-platfrom clients for Matrix";
     homepage = https://matrix.org/docs/projects/sdk/libqmatrixclient.html;
     license = licenses.lgpl21;
     platforms = platforms.linux;
     maintainers = with maintainers; [ peterhoeg ];
-    hydraPlatforms = [ ];
   };
 }
diff --git a/pkgs/development/libraries/libressl/default.nix b/pkgs/development/libraries/libressl/default.nix
index ae03ef7ecb97..51162979e630 100644
--- a/pkgs/development/libraries/libressl/default.nix
+++ b/pkgs/development/libraries/libressl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, lib }:
 
 let
 
@@ -11,13 +11,20 @@ let
       inherit sha256;
     };
 
+    configureFlags = [ "--enable-nc" ];
+
     enableParallelBuilding = true;
 
-    outputs = [ "bin" "dev" "out" "man" ];
+    outputs = [ "bin" "dev" "out" "man" "nc" ];
+
+    postFixup = ''
+      moveToOutput "bin/nc" "$nc"
+      moveToOutput "share/man/man1/nc.1${lib.optionalString (dontGzipMan==null) ".gz"}" "$nc"
+    '';
 
     dontGzipMan = if stdenv.isDarwin then true else null; # not sure what's wrong
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       description = "Free TLS/SSL implementation";
       homepage    = "http://www.libressl.org";
       platforms   = platforms.all;
diff --git a/pkgs/development/libraries/libtoxcore/default.nix b/pkgs/development/libraries/libtoxcore/default.nix
index 9af8718dc5fe..42d2fe11f7b3 100644
--- a/pkgs/development/libraries/libtoxcore/default.nix
+++ b/pkgs/development/libraries/libtoxcore/default.nix
@@ -1,46 +1,51 @@
 { stdenv, fetchFromGitHub, cmake, libsodium, ncurses, libopus, libmsgpack
 , libvpx, check, libconfig, pkgconfig }:
 
-stdenv.mkDerivation rec {
-  name = "libtoxcore-${version}";
-  version = "0.1.11";
-
-  src = fetchFromGitHub {
-    owner  = "TokTok";
-    repo   = "c-toxcore";
-    rev    = "v${version}";
-    sha256 = "1fya5gfiwlpk6fxhalv95n945ymvp2iidiyksrjw1xw95fzsp1ij";
+let
+  generic = { version, sha256 }:
+  stdenv.mkDerivation rec {
+    name = "libtoxcore-${version}";
+
+    src = fetchFromGitHub {
+      owner  = "TokTok";
+      repo   = "c-toxcore";
+      rev    = "v${version}";
+      inherit sha256;
+    };
+
+    cmakeFlags = [
+      "-DBUILD_NTOX=ON"
+      "-DDHT_BOOTSTRAP=ON"
+      "-DBOOTSTRAP_DAEMON=ON"
+    ];
+
+    buildInputs = [
+      libsodium libmsgpack ncurses libconfig
+    ] ++ stdenv.lib.optionals (!stdenv.isAarch32) [
+      libopus libvpx
+    ];
+
+    nativeBuildInputs = [ cmake pkgconfig ];
+
+    enableParallelBuilding = true;
+
+    meta = with stdenv.lib; {
+      description = "P2P FOSS instant messaging application aimed to replace Skype";
+      homepage = https://tox.chat;
+      license = licenses.gpl3Plus;
+      maintainers = with maintainers; [ peterhoeg ];
+      platforms = platforms.all;
+    };
   };
 
-  cmakeFlags = [
-    "-DBUILD_NTOX=ON"
-    "-DDHT_BOOTSTRAP=ON"
-    "-DBOOTSTRAP_DAEMON=ON"
-  ];
-
-  buildInputs = [
-    libsodium libmsgpack ncurses libconfig
-  ] ++ stdenv.lib.optionals (!stdenv.isAarch32) [
-    libopus
-    libvpx
-  ];
-
-  nativeBuildInputs = [ cmake pkgconfig ];
-
-  enableParallelBuilding = true;
-
-  checkInputs = [ check ];
-
-  checkPhase = "ctest";
-
-  # for some reason the tests are not running - it says "No tests found!!"
-  doCheck = true;
+in rec {
+  libtoxcore_0_1 = generic {
+    version = "0.1.11";
+    sha256 = "1fya5gfiwlpk6fxhalv95n945ymvp2iidiyksrjw1xw95fzsp1ij";
+  };
 
-  meta = with stdenv.lib; {
-    description = "P2P FOSS instant messaging application aimed to replace Skype";
-    homepage = https://tox.chat;
-    license = licenses.gpl3Plus;
-    maintainers = with maintainers; [ peterhoeg ];
-    platforms = platforms.all;
+  libtoxcore_0_2 = generic {
+    version = "0.2.2";
+    sha256 = "1463grbbv009pj2g6dbnyk4lr871vw41962m63v21mmp6dkrr7r5";
   };
 }
diff --git a/pkgs/development/libraries/libxmi/default.nix b/pkgs/development/libraries/libxmi/default.nix
index 46d38b16ccf1..81c5b5e2891b 100644
--- a/pkgs/development/libraries/libxmi/default.nix
+++ b/pkgs/development/libraries/libxmi/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
     description = "Library for rasterizing 2-D vector graphics";
     homepage = http://www.gnu.org/software/libxmi/;
     license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/mypaint-brushes/default.nix b/pkgs/development/libraries/mypaint-brushes/default.nix
new file mode 100644
index 000000000000..140dbcc937b5
--- /dev/null
+++ b/pkgs/development/libraries/mypaint-brushes/default.nix
@@ -0,0 +1,35 @@
+{stdenv, fetchpatch, autoconf, automake, fetchFromGitHub, pkgconfig}:
+
+let
+  pname = "mypaint-brushes";
+  version = "1.3.0";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "Jehan";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1iz89z6v2mp8j1lrf942k561s8311i3s34ap36wh4rybb2lq15m0";
+  };
+
+  nativeBuildInputs = [ autoconf automake pkgconfig ];
+
+  patches = [
+    # build with automake 1.16
+    (fetchpatch {
+      url = https://github.com/Jehan/mypaint-brushes/commit/1e9109dde3bffd416ed351c3f30ecd6ffd0ca2cd.patch;
+      sha256 = "0mi8rwbirl0ib22f2hz7kdlgi4hw8s3ab29b003dsshdyzn5iha9";
+    })
+  ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    homepage = http://mypaint.org/;
+    description = "Brushes used by MyPaint and other software using libmypaint.";
+    license = licenses.cc0;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/tokyo-tyrant/default.nix b/pkgs/development/libraries/tokyo-tyrant/default.nix
index ccd619e8bc18..7bf08a3560ae 100644
--- a/pkgs/development/libraries/tokyo-tyrant/default.nix
+++ b/pkgs/development/libraries/tokyo-tyrant/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
 
     license = stdenv.lib.licenses.lgpl21Plus;
 
-    platforms = stdenv.lib.platforms.gnu;         # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;         # arbitrary choice
     maintainers = [ ];
   };
 }
diff --git a/pkgs/development/libraries/vcdimager/default.nix b/pkgs/development/libraries/vcdimager/default.nix
index 48ad33424f60..77956be3b12e 100644
--- a/pkgs/development/libraries/vcdimager/default.nix
+++ b/pkgs/development/libraries/vcdimager/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = http://www.gnu.org/software/vcdimager/;
     description = "Full-featured mastering suite for authoring, disassembling and analyzing Video CDs and Super Video CDs";
-    platforms = platforms.gnu; # random choice
+    platforms = platforms.gnu ++ platforms.linux; # random choice
     license = licenses.gpl2;
   };
 }
diff --git a/pkgs/development/python-modules/hdbscan/default.nix b/pkgs/development/python-modules/hdbscan/default.nix
new file mode 100644
index 000000000000..3d57ff371666
--- /dev/null
+++ b/pkgs/development/python-modules/hdbscan/default.nix
@@ -0,0 +1,30 @@
+{ lib
+, buildPythonPackage
+, cython
+, numpy
+, nose
+, scipy
+, scikitlearn
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+  pname = "hdbscan";
+  version = "0.8.12";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0yxi34frg2jwyvjl942qy4gq5pbx8dq4pf4p28d1xah8njchfqir";
+  };
+
+  checkInputs = [ nose ];
+
+  propagatedBuildInputs = [ cython numpy scipy scikitlearn ];
+
+  meta = with lib; {
+    description = "Hierarchical Density-Based Spatial Clustering of Applications with Noise, a clustering algorithm with a scikit-learn compatible API";
+    homepage =  http://github.com/scikit-learn-contrib/hdbscan;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ ixxie ];
+  };
+}
diff --git a/pkgs/development/python-modules/patsy/default.nix b/pkgs/development/python-modules/patsy/default.nix
new file mode 100644
index 000000000000..9efa3126ce3b
--- /dev/null
+++ b/pkgs/development/python-modules/patsy/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, fetchPypi
+, buildPythonPackage
+, nose
+, six
+, numpy
+, scipy # optional, allows spline-related features (see patsy's docs)
+, parameterized
+}:
+
+buildPythonPackage rec {
+  pname = "patsy";
+  version = "0.5.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0fw888zd2s7f5zxm9f98ss93qhwv0sqnbdy21ipj33ccqgakhpz0";
+  };
+
+  checkInputs = [ nose parameterized ];
+  checkPhase = "nosetests -v";
+
+  propagatedBuildInputs = [
+    six
+    numpy
+    scipy
+  ];
+
+  meta = {
+    description = "A Python package for describing statistical models";
+    homepage = https://github.com/pydata/patsy;
+    license = lib.licenses.bsd2;
+    maintainers = with lib.maintainers; [ ilya-kolpakov ];
+  };
+}
+
diff --git a/pkgs/development/python-modules/pymc3/default.nix b/pkgs/development/python-modules/pymc3/default.nix
new file mode 100644
index 000000000000..308958abb6d0
--- /dev/null
+++ b/pkgs/development/python-modules/pymc3/default.nix
@@ -0,0 +1,64 @@
+{ lib
+, fetchPypi
+, buildPythonPackage
+, pythonOlder
+, Theano
+, pandas
+, patsy
+, joblib
+, tqdm
+, six
+, h5py
+, pytest
+, nose
+, parameterized
+, matplotlib
+}:
+
+buildPythonPackage rec {
+  pname = "pymc3";
+  version = "3.2";
+  disabled = pythonOlder "3.5";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0hpzhkpv7sbwkcva7x914yvzcf1d1a952ynbcx6mvlgv5lqghc39";
+  };
+
+  # No need for coverage stats in Nix builds
+  postPatch = ''
+    substituteInPlace setup.py --replace ", 'pytest-cov'" ""
+  '';
+
+  propagatedBuildInputs = [
+    Theano
+    pandas
+    patsy
+    joblib
+    tqdm
+    six
+    h5py
+  ];
+
+  checkInputs = [
+    pytest
+    nose
+    parameterized
+  ];
+
+  # The test suite is computationally intensive and test failures are not
+  # indicative for package usability hence tests are disabled by default.
+  doCheck = false;
+
+  # For some reason tests are run as a part of the *install* phase if enabled.
+  # Theano writes compiled code to ~/.theano hence we set $HOME.
+  preInstall = "export HOME=$(mktemp -d)";
+  postInstall = "rm -rf $HOME";
+
+  meta = {
+    description = "Bayesian estimation, particularly using Markov chain Monte Carlo (MCMC)";
+    homepage = http://github.com/pymc-devs/pymc3;
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ ilya-kolpakov ];
+  };
+}
diff --git a/pkgs/development/tools/analysis/flow/default.nix b/pkgs/development/tools/analysis/flow/default.nix
index 042b338b2b14..31bc1848d580 100644
--- a/pkgs/development/tools/analysis/flow/default.nix
+++ b/pkgs/development/tools/analysis/flow/default.nix
@@ -4,14 +4,14 @@
 with lib;
 
 stdenv.mkDerivation rec {
-  version = "0.70.0";
+  version = "0.71.0";
   name = "flow-${version}";
 
   src = fetchFromGitHub {
     owner = "facebook";
     repo = "flow";
     rev = "v${version}";
-    sha256 = "1pydmfs7xxrqjdnidp2nagwpk2d0vf5nx3m821plld3vbyh22b76";
+    sha256 = "1z9qf3kahaincy3i3ynqx7gr1sf470ym8h690a0kc7ah5fwsyr5w";
   };
 
   installPhase = ''
diff --git a/pkgs/development/tools/gllvm/default.nix b/pkgs/development/tools/gllvm/default.nix
index 58ee7699b459..da8f90cd9406 100644
--- a/pkgs/development/tools/gllvm/default.nix
+++ b/pkgs/development/tools/gllvm/default.nix
@@ -2,15 +2,15 @@
 
 buildGoPackage rec {
   name = "gllvm-${version}";
-  version = "2018-02-09";
+  version = "2018-04-28"; # ~= 1.0.2, but no release tags yet
 
   goPackagePath = "github.com/SRI-CSL/gllvm";
 
   src = fetchFromGitHub {
     owner = "SRI-CSL";
     repo = "gllvm";
-    rev = "ef83222afd22452dd1277329df227a326db9f84f";
-    sha256 = "068mc8q7jmpjzh6pr0ygvv39mh4k7vz0dmiacxf3pdsigy3d1y1a";
+    rev = "7755cdabb9bd2c5115059c13dce986e4e38f624e";
+    sha256 = "0a7mzmshyl4m216cxnar0pzjq98n2678x0czqfxgfdga55xp5frl";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/tools/misc/complexity/default.nix b/pkgs/development/tools/misc/complexity/default.nix
index 60a0370e86e2..41bfa520e62c 100644
--- a/pkgs/development/tools/misc/complexity/default.nix
+++ b/pkgs/development/tools/misc/complexity/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
     homepage = http://www.gnu.org/software/complexity/;
 
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/games/instead/default.nix b/pkgs/games/instead/default.nix
index 343b2948d5ea..697791d38577 100644
--- a/pkgs/games/instead/default.nix
+++ b/pkgs/games/instead/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, SDL, SDL_ttf, SDL_image, SDL_mixer, pkgconfig, lua, zlib, unzip }:
 
 let
-  version = "3.2.0";
+  version = "3.2.1";
 
   # I took several games at random from http://instead.syscall.ru/games/
   games = [
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://sourceforge/project/instead/instead/${version}/instead_${version}.tar.gz";
-    sha256 = "0l57qdngxv9nbfj4ixr4fyanlazmdib2kr1nzv3g578308xzjv6a";
+    sha256 = "1lnsawbrdhdixbdhm49hc4c9vz2l3fvrpbxyk1mia2hf4pdmc594";
   };
 
   NIX_LDFLAGS = "-llua -lgcc_s";
diff --git a/pkgs/games/openmw/default.nix b/pkgs/games/openmw/default.nix
index f64bbe4c1255..8080c9596388 100644
--- a/pkgs/games/openmw/default.nix
+++ b/pkgs/games/openmw/default.nix
@@ -18,7 +18,7 @@ in stdenv.mkDerivation rec {
     owner = "OpenMW";
     repo = "openmw";
     rev = name;
-    sha256 = "0lj8v81hk807dy0wcdhfp0iyn4l5yag53hx1a6xm44gh2dpyil43";
+    sha256 = "1nybxwp77qswjayf0g9xayp4x1xxq799681rhjlggch127r07ifi";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/games/tuxpaint/default.nix b/pkgs/games/tuxpaint/default.nix
new file mode 100644
index 000000000000..ddf0782b210d
--- /dev/null
+++ b/pkgs/games/tuxpaint/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, SDL, SDL_image, SDL_ttf, SDL_mixer, libpng,
+  cairo, librsvg, gettext, libpaper, fribidi, pkgconfig, gperf }:
+
+stdenv.mkDerivation rec {
+  version = "0.9.22";
+  name = "tuxpaint-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/tuxpaint/${version}/${name}.tar.gz";
+    sha256 = "1qrbrdck9yxpcg3si6jb9i11w8lw9h4hqad0pfaxgyiniqpr7gca";
+  };
+
+  nativeBuildInputs = [ SDL SDL_image SDL_ttf SDL_mixer libpng cairo
+    librsvg gettext libpaper fribidi pkgconfig gperf ];
+  hardeningDisable = [ "format" ];
+  makeFlags = [ "GPERF=${gperf}/bin/gperf"
+                "PREFIX=$$out"
+                "COMPLETIONDIR=$$out/share/bash-completion/completions"
+              ];
+
+  patches = [ ./tuxpaint-completion.diff ];
+  postPatch = ''
+    grep -Zlr include.*SDL . | xargs -0 sed -i -e 's,"SDL,"SDL/SDL,'
+  '';
+
+  # stamps
+  stamps = fetchurl {
+    url = "mirror://sourceforge/project/tuxpaint/tuxpaint-stamps/2014-08-23/tuxpaint-stamps-2014.08.23.tar.gz";
+    sha256 = "0rhlwrjz44wp269v3rid4p8pi0i615pzifm1ym6va64gn1bms06q";
+  };
+
+  postInstall = ''
+    tar xzf $stamps
+    cd tuxpaint-stamps-2014.08.23
+    make install-all PREFIX=$out
+    rm -rf $out/share/tuxpaint/stamps/military
+  '';
+
+  meta = {
+    description = "Open Source Drawing Software for Children";
+    homepage = http://www.tuxpaint.org/;
+    license = stdenv.lib.licenses.gpl3;
+    maintainers = with stdenv.lib.maintainers; [ woffs ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/games/tuxpaint/tuxpaint-completion.diff b/pkgs/games/tuxpaint/tuxpaint-completion.diff
new file mode 100644
index 000000000000..0824b2becf49
--- /dev/null
+++ b/pkgs/games/tuxpaint/tuxpaint-completion.diff
@@ -0,0 +1,16 @@
+--- tuxpaint-0.9.22/src/tuxpaint-completion.bash~	1970-01-01 01:00:01.000000000 +0100
++++ tuxpaint-0.9.22/src/tuxpaint-completion.bash	2018-03-06 10:54:03.437560921 +0100
+@@ -8,7 +8,6 @@
+ # FIXME: See http://www.debian-administration.org/articles/316 for an intro
+ # to how we should be doing this... -bjk 2009.09.09
+ 
+-have tuxpaint &&
+ _tuxpaint()
+ {
+         local cur
+@@ -96,4 +95,4 @@
+         fi
+ 
+ }
+-[ "${have:-}" ] && complete -F _tuxpaint $filenames tuxpaint
++complete -F _tuxpaint $filenames tuxpaint
diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix
index b18ae7762df2..91be6cf743a4 100644
--- a/pkgs/misc/drivers/hplip/default.nix
+++ b/pkgs/misc/drivers/hplip/default.nix
@@ -11,16 +11,16 @@
 let
 
   name = "hplip-${version}";
-  version = "3.17.11";
+  version = "3.18.3";
 
   src = fetchurl {
     url = "mirror://sourceforge/hplip/${name}.tar.gz";
-    sha256 = "0xda7x7xxjvzn1l0adlvbwcw21crq1r3r79bkf94q3m5i6abx49g";
+    sha256 = "0x5xs86v18w46rxz5whc15bl4fb7p4km6xqjpwzclp83nl7rl01y";
   };
 
   plugin = fetchurl {
     url = "https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
-    sha256 = "0vqhwqc33vxncdhbzdchbgrcrxvkwnp7rc2hkswwn9da112s0c9w";
+    sha256 = "11nc3cifhd2h2c7p0dr2jjzrg3fd5j43ih1wy0m186l6wcgdjssw";
   };
 
   hplipState = substituteAll {
diff --git a/pkgs/os-specific/bsd/default.nix b/pkgs/os-specific/bsd/default.nix
index a8301ea2a8fc..a75c132b55a2 100644
--- a/pkgs/os-specific/bsd/default.nix
+++ b/pkgs/os-specific/bsd/default.nix
@@ -2,7 +2,4 @@
 
 rec {
   netbsd = recurseIntoAttrs (callPackages ./netbsd {});
-  openbsd = recurseIntoAttrs (callPackages ./openbsd {
-    inherit (netbsd) compat netBSDDerivation libcurses;
-  });
 }
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index 42633232c71a..ecd09eaff807 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -11,22 +11,15 @@ let
 
   netBSDDerivation = attrs: stdenv.mkDerivation ((rec {
     name = "${attrs.pname or (baseNameOf attrs.path)}-netbsd-${attrs.version}";
-    src = fetchNetBSD attrs.path attrs.version attrs.sha256;
+    src = attrs.src or fetchNetBSD attrs.path attrs.version attrs.sha256;
 
     extraPaths = [ ];
 
-    nativeBuildInputs = [ makeMinimal mandoc groff install yacc flex ];
+    nativeBuildInputs = [ makeMinimal mandoc groff install stat
+                          yacc flex tsort lorder ];
     buildInputs = [ compat ];
     installFlags = [ "includes" ];
 
-    # These should be coverd in nbcompat, but are missing, sadly
-    NIX_CFLAGS_COMPILE = [
-      "-D__noinline="
-      "-D__warn_references(a,b)="
-      "-D__strong_alias(a,b)="
-      "-D__va_list=va_list"
-    ];
-
     # Definitions passed to share/mk/*.mk. Should be pretty simple -
     # eventually maybe move it to a configure script.
     DESTDIR = "$(out)";
@@ -45,8 +38,12 @@ let
     LIBUTIL="";
     LIBSSL = "";
     LIBCRYPTO = "";
+    LIBCRYPT = "";
     LIBCURSES = "";
+    LIBTERMINFO = "";
+    LIBM = "";
     "LIBDO.terminfo" = "_external";
+    "LIBDO.curses" = "_external";
     _GCC_CRTBEGIN = "";
     _GCC_CRTBEGINS = "";
     _GCC_CRTEND = "";
@@ -71,11 +68,10 @@ let
 
     HOST_SH = "${bash}/bin/sh";
 
-    # not using bsd binutils
     SHLIB_WARNTEXTREL = "no";
     SHLIB_MKMAP = "no";
-    OBJCOPY = "true";
     PRESERVE = "-p";
+    OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
 
     MACHINE_ARCH = hostPlatform.parsed.cpu.name;
     MACHINE_CPU = hostPlatform.parsed.cpu.name;
@@ -84,9 +80,8 @@ let
     # but without they end up using gcc on Darwin stdenv
     preConfigure = ''
       export HAVE_${if stdenv.cc.isGNU then "GCC" else "LLVM"}=${lib.head (lib.splitString "." (lib.getVersion stdenv.cc.cc))}
-    '' + lib.optionalString (!builtins.hasAttr "nativeBuildInputs" attrs) ''
-      # hack until #38657 is fixed
-      export PATH=${install}/bin:$PATH
+      # Parallel building. Needs the space.
+      export makeFlags+=" -j $NIX_BUILD_CORES"
     '';
 
     postUnpack = ''
@@ -109,12 +104,14 @@ let
       fi
     '';
 
-    # need to create directories for xinstall to work
+    # Need to create directories for xinstall to work. Unused ones
+    # will be removed in the postInstall.
     preInstall = ''
       mkdir -p $out$BINDIR $out$LIBDIR $out$INFODIR \
                $out$DOCDIR $out$LOCALEDIR
       for i in 1 2 3 4 5 6 7 8 9; do
-        mkdir -p $out$MANDIR/man$i $out$MANDIR/html$i $out$DOCDIR/reference/ref$i
+        mkdir -p $out$MANDIR/man$i $out$MANDIR/html$i \
+                 $out$DOCDIR/reference/ref$i
       done
       mkdir -p $out/usr/include
     '';
@@ -125,7 +122,6 @@ let
         cd $out/usr
         find . -type d -exec mkdir -p $out/\{} \;
         find . -type f -exec mv \{} $out/\{} \;
-        find . -type d -delete
       fi
 
       find $out -type d -empty -delete
@@ -146,8 +142,6 @@ let
 
     buildInputs = [];
     nativeBuildInputs = [];
-    NIX_CFLAGS_COMPILE = "";
-    NIX_LDFLAGS = "";
 
     patchPhase = ''
       patchShebangs configure
@@ -173,8 +167,6 @@ let
     # override defaults to prevent infinite recursion
     nativeBuildInputs = [ makeMinimal ];
     buildInputs = [ zlib ];
-    NIX_CFLAGS_COMPILE = "";
-    NIX_LDFLAGS = "";
 
     # temporarily use gnuinstall for bootstrapping
     # bsdinstall will be built later
@@ -195,7 +187,22 @@ let
       install -D $NETBSDSRCDIR/sys/sys/rmd160.h $out/include/rmd160.h
       install -D $NETBSDSRCDIR/sys/sys/sha1.h $out/include/sha1.h
       install -D $NETBSDSRCDIR/sys/sys/sha2.h $out/include/sha2.h
+      install -D $NETBSDSRCDIR/sys/sys/queue.h $out/include/sys/queue.h
       install -D $NETBSDSRCDIR/include/vis.h $out/include/vis.h
+      install -D $NETBSDSRCDIR/include/db.h $out/include/db.h
+      install -D $NETBSDSRCDIR/include/netconfig.h $out/include/netconfig.h
+      install -D $NETBSDSRCDIR/include/rpc/types.h $out/include/rpc/types.h
+      install -D $NETBSDSRCDIR/include/utmpx.h $out/include/utmpx.h
+      install -D $NETBSDSRCDIR/include/tzfile.h $out/include/tzfile.h
+
+      # Remove lingering /usr references
+      if [ -d $out/usr ]; then
+        cd $out/usr
+        find . -type d -exec mkdir -p $out/\{} \;
+        find . -type f -exec mv \{} $out/\{} \;
+      fi
+
+      find $out -type d -empty -delete
     '';
     extraPaths = [ libc.src libutil.src
       (fetchNetBSD "include" "7.1.2" "1vc58xrhrp202biiv1chhlh0jwnjr7k3qq91pm46k6v5j95j0qwp")
@@ -209,9 +216,57 @@ let
     version = "7.1.2";
     sha256 = "0nzhyh714m19h61m45gzc5dszkbafp5iaphbp5mza6w020fzf2y8";
     extraPaths = [ mtree.src make.src ];
-    nativeBuildInputs = [ makeMinimal mandoc groff compat ];
+    nativeBuildInputs = [ makeMinimal mandoc groff ];
+    buildInputs = [ compat fts ];
     RENAME = "-D";
   };
+
+  fts = netBSDDerivation {
+    pname = "fts";
+    path = "include/fts.h";
+    sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
+    version = "7.1.2";
+    nativeBuildInputs = [ ];
+    propagatedBuildInputs = [ compat ];
+    extraPaths = [
+      (fetchNetBSD "lib/libc/gen/fts.c" "7.1.2" "1yfd2liypj6xky2h0mgxi5lgpflmkkg4zf3ii3apz5cf8jq9gmn9")
+      (fetchNetBSD "lib/libc/include/namespace.h" "7.1.2" "0kwd4v8y0mfjhmwplsk52pvzbcpvpp2qy2g8c0jmfraam63q6q1y")
+      (fetchNetBSD "lib/libc/gen/fts.3" "7.1.2" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
+    ];
+    buildPhase = ''
+      cc  -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \
+          -o lib/libc/gen/fts.o
+      ar -rsc libfts.a lib/libc/gen/fts.o
+    '';
+    installPhase = ''
+      install -D lib/libc/gen/fts.3 $out/share/man/man3/fts.3
+      install -D include/fts.h $out/include/fts.h
+      install -D lib/libc/include/namespace.h $out/include/namespace.h
+      install -D libfts.a $out/lib/libfts.a
+    '';
+    setupHook = ./fts-setup-hook.sh;
+  };
+
+  stat = netBSDDerivation {
+    path = "usr.bin/stat";
+    version = "7.1.2";
+    sha256 = "0z4r96id2r4cfy443rw2s1n52n186xm0lqvs8s3qjf4314z7r7yh";
+    nativeBuildInputs = [ makeMinimal mandoc groff install ];
+  };
+
+  tsort = netBSDDerivation {
+    path = "usr.bin/tsort";
+    version = "7.1.2";
+    sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
+    nativeBuildInputs = [ makeMinimal mandoc groff install ];
+  };
+
+  lorder = netBSDDerivation {
+    path = "usr.bin/lorder";
+    version = "7.1.2";
+    sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
+    nativeBuildInputs = [ makeMinimal mandoc groff install ];
+  };
   # END BOOTSTRAPPING
 
   libutil = netBSDDerivation {
@@ -238,7 +293,7 @@ let
     version = "7.1.2";
     patchPhase = ''
       # make needs this to pick up our sys make files
-      NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
+      export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
 
       # can't set owner or group in Nix build
       # maybe there is a better way to trick it?
@@ -251,6 +306,9 @@ let
         --replace '-o ''${DEBUGOWN} -g ''${DEBUGGRP}' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.doc.mk \
         --replace '-o ''${DOCOWN} -g ''${DOCGRP}' ""
+      substituteInPlace $NETBSDSRCDIR/share/mk/bsd.links.mk \
+        --replace '-o ''${LINKSOWN_''${.ALLSRC:T}:U''${LINKSOWN}}' "" \
+        --replace '-g ''${LINKSGRP_''${.ALLSRC:T}:U''${LINKSGRP}}' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.man.mk \
         --replace '-o ''${MANOWN} -g ''${MANGRP}' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.files.mk \
@@ -261,13 +319,10 @@ let
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
         --replace '-o ''${DEBUGOWN} -g ''${DEBUGGRP}' "" \
         --replace '-o ''${LIBOWN} -g ''${LIBGRP}' ""
-
-      substituteInPlace $NETBSDSRCDIR/share/mk/Makefile \
-        --replace /usr/share/mk /share/mk
+    '' + lib.optionalString stdenv.isDarwin ''
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \
         --replace '-Wl,--fatal-warnings' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
-        --replace ' ''${_ARFL} ''${.TARGET} `NM=''${NM} ''${LORDER} ''${.ALLSRC:M*o} | ''${TSORT}`' ' ''${_ARFL} ''${.TARGET} ''${.ALLSRC:M*o}' \
         --replace '-Wl,-soname,''${_LIB}.so.''${SHLIB_SOVERSION}' "" \
         --replace '-Wl,--whole-archive' "" \
         --replace '-Wl,--no-whole-archive' ""
@@ -286,8 +341,21 @@ let
     sha256 = "1dhsyfvcm67kf5zdbg5dmx5y8fimnbll6qxwp3gjfmbxqigmc52m";
   };
 
+  who = netBSDDerivation {
+    path = "usr.bin/who";
+    version = "7.1.2";
+    sha256 = "17ffwww957m3qw0b6fkgjpp12pd5ydg2hs9dxkkw0qpv11j00d88";
+    patchPhase = ''
+      substituteInPlace $NETBSDSRCDIR/usr.bin/who/utmpentry.c \
+        --replace "strncpy(e->name, up->ut_name, sizeof(up->ut_name))" "strncpy(e->name, up->ut_user, sizeof(up->ut_user))" \
+        --replace "utmptime = st.st_mtimespec" "utmptime = st.st_mtim" \
+        --replace "timespeccmp(&st.st_mtimespec, &utmptime, >)" "st.st_mtim.tv_sec == utmptime.tv_sec ? st.st_mtim.tv_nsec > utmptime.tv_nsec : st.st_mtim.tv_sec > utmptime.tv_sec" \
+        --replace "timespecclear(&utmptime)" "utmptime.tv_sec = utmptime.tv_nsec = 0"
+    '';
+  };
+
 in rec {
-  inherit compat libc libutil install make mtree netBSDDerivation;
+  inherit compat install netBSDDerivation fts;
 
   getent = netBSDDerivation {
     path = "usr.bin/getent";
@@ -302,65 +370,103 @@ in rec {
     version = "7.1.2";
   };
 
-  fts = netBSDDerivation {
-    pname = "fts";
-    path = "include/fts.h";
-    sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
-    version = "7.1.2";
-    nativeBuildInputs = [ ];
-    extraPaths = [
-      (fetchNetBSD "lib/libc/gen/fts.c" "7.1.2" "1yfd2liypj6xky2h0mgxi5lgpflmkkg4zf3ii3apz5cf8jq9gmn9")
-      (fetchNetBSD "lib/libc/include/namespace.h" "7.1.2" "0kwd4v8y0mfjhmwplsk52pvzbcpvpp2qy2g8c0jmfraam63q6q1y")
-      (fetchNetBSD "lib/libc/gen/fts.3" "7.1.2" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
-    ];
-    buildPhase = ''
-      cc  -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \
-          -o lib/libc/gen/fts.o
-      ar -rsc libfts.a lib/libc/gen/fts.o
-    '';
-    installPhase = ''
-      install -D lib/libc/gen/fts.3 $out/share/man/man3/fts.3
-      install -D include/fts.h $out/include/fts.h
-      install -D lib/libc/include/namespace.h $out/include/namespace.h
-      install -D libfts.a $out/lib/libfts.a
-    '';
-    setupHook = ./fts-setup-hook.sh;
-  };
-
   games = netBSDDerivation {
     path = "games";
     sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqzy1";
     version = "7.1.2";
     patchPhase = ''
       sed -i '1i #include <time.h>' adventure/save.c
-    '';
-  };
 
-  who = netBSDDerivation {
-    path = "usr.bin/who";
-    version = "7.1.2";
-    sha256 = "17ffwww957m3qw0b6fkgjpp12pd5ydg2hs9dxkkw0qpv11j00d88";
+      # Disable some games that don't build. They should be possible
+      # to build but need to look at how to implement stuff in
+      # Linux. macOS is missing gettime. TODO try to get these
+      # working.
+      disableGame() {
+        substituteInPlace Makefile --replace $1 ""
+      }
+
+      disableGame atc
+      disableGame boggle
+      disableGame dm
+      disableGame fortune
+      disableGame hunt
+      disableGame larn
+      disableGame phantasia
+      disableGame rogue
+      disableGame sail
+      disableGame trek
+      disableGame dab
+      ${lib.optionalString stdenv.isDarwin "disableGame adventure"}
+      ${lib.optionalString stdenv.isDarwin "disableGame factor"}
+      ${lib.optionalString stdenv.isDarwin "disableGame gomoku"}
+      ${lib.optionalString stdenv.isDarwin "disableGame mille"}
+
+      substituteInPlace Makefile.inc \
+        --replace 2555 555 \
+        --replace 2550 550
+    '';
+    NIX_CFLAGS_COMPILE = [
+      "-D__noinline="
+      "-D__scanflike(a,b)="
+      "-D__va_list=va_list"
+      "-DOXTABS=XTABS"
+      "-DRANDOM_MAX=RAND_MAX"
+      "-DINFTIM=-1"
+      (if hostPlatform.isMusl then "-include sys/ttydefaults.h -include sys/file.h" else "")
+    ];
+    postBuild = ''
+      mkdir -p $out/usr/games $out/usr/share/games/ching \
+               $out/usr/share/games/quiz.db \
+               $out/usr/libexec/ching $out/var/games/hackdir
+      touch $out/var/games/hackdir/perm
+    '';
+    preFixup = ''
+      mkdir -p $out/bin
+      mv $out/games/* $out/bin
+      rmdir $out/games
+    '';
+    buildInputs = [ compat libcurses libterminfo libressl ];
+    extraPaths = [
+      (fetchNetBSD "share/dict" "7.1.2" "0nickhsjwgnr2h9nvwflvgfz93kqms5hzdnpyq02crpj35w98bh4")
+      who.src
+    ];
   };
 
-  finger = netBSDDerivation {
-    path = "usr.bin/finger";
-    sha256 = "0jl672z50f2yf7ikp682b3xrarm6bnrrx9vi94xnp2fav8m8zfyi";
-    version = "7.1.2";
-    extraPaths = [ who.src ];
-  };
+  # finger = netBSDDerivation {
+  #   path = "usr.bin/finger";
+  #   sha256 = "0jl672z50f2yf7ikp682b3xrarm6bnrrx9vi94xnp2fav8m8zfyi";
+  #   version = "7.1.2";
+  #   extraPaths = [ who.src ];
+  #   NIX_CFLAGS_COMPILE = [
+  #     "-DSUPPORT_UTMP"
+  #     "-USUPPORT_UTMPX"
+  #   ];
+  #   patchPhase = ''
+  #     ${who.patchPhase}
+  #   '';
+  # };
 
   fingerd = netBSDDerivation {
-    path = "usr.bin/fingerd";
-    sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqz00";
+    path = "libexec/fingerd";
+    sha256 = "1hhdq70hrxxkjnjfmjm3w8w9g9xq2ngxaxk0chy4vm7chg9nfpmp";
     version = "7.1.2";
   };
 
   libedit = netBSDDerivation {
     path = "lib/libedit";
-    buildInputs = [ compat libterminfo ];
+    buildInputs = [ libterminfo libcurses ];
+    propagatedBuildInputs = [ compat ];
+    postBuild = "mkdir -p $out/usr/include/readline";
     patchPhase = ''
       sed -i '1i #undef bool_t' el.h
+      substituteInPlace config.h \
+        --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
     '';
+    NIX_CFLAGS_COMPILE = [
+      "-D__noinline="
+      "-D__scanflike(a,b)="
+      "-D__va_list=va_list"
+    ];
     version = "7.1.2";
     sha256 = "0qvr52j4qih10m7fa8nddn1psyjy9l0pa4ix02acyssjvgbz2kca";
   };
@@ -370,6 +476,7 @@ in rec {
     version = "7.1.2";
     sha256 = "06plg0bjqgbb0aghpb9qlk8wkp1l2izdlr64vbr5laqyw8jg84zq";
     buildInputs = [ compat tic nbperf ];
+    MKPIC = if stdenv.isDarwin then "no" else "yes";
     extraPaths = [
       (fetchNetBSD "share/terminfo" "7.1.2" "1z5vzq8cw24j05r6df4vd6r57cvdbv7vbm4h962kplp14xrbg2h3")
     ];
@@ -379,8 +486,22 @@ in rec {
     path = "lib/libcurses";
     version = "7.1.2";
     sha256 = "04djah9dadzw74nswn0xydkxn900kav8xdvxlxdl50nbrynxg9yf";
-    buildInputs = [ compat libterminfo ];
+    buildInputs = [ libterminfo ];
+    NIX_CFLAGS_COMPILE = [
+      "-D__scanflike(a,b)="
+      "-D__va_list=va_list"
+      "-D__warn_references(a,b)="
+    ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)=";
+    propagatedBuildInputs = [ compat ];
     MKDOC = "no"; # missing vfontedpr
+    MKPIC = if stdenv.isDarwin then "no" else "yes";
+    patchPhase = lib.optionalString (!stdenv.isDarwin) ''
+      substituteInPlace printw.c \
+        --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \
+        --replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));'
+      substituteInPlace scanw.c \
+        --replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));'
+    '';
   };
 
   nbperf = netBSDDerivation {
diff --git a/pkgs/os-specific/bsd/openbsd/default.nix b/pkgs/os-specific/bsd/openbsd/default.nix
deleted file mode 100644
index 9ccc0adaa2df..000000000000
--- a/pkgs/os-specific/bsd/openbsd/default.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ fetchcvs, netBSDDerivation, compat, libcurses, libressl }:
-
-let
-  fetchOpenBSD = path: version: sha256: fetchcvs {
-    cvsRoot = "anoncvs@anoncvs.ca.openbsd.org:/cvs";
-    module = "src/${path}";
-    inherit sha256;
-    tag = "OPENBSD_${builtins.replaceStrings ["."] ["_"] version}";
-  };
-
-  # OpenBSD is a fork of NetBSD
-  # We can build it with minimal changes
-  openBSDDerivation = attrs: netBSDDerivation (attrs // {
-    name = "${attrs.pname or (baseNameOf attrs.path)}-openbsd-${attrs.version}";
-    src = fetchOpenBSD attrs.path attrs.version attrs.sha256;
-  });
-
-in {
-
-  mg = openBSDDerivation {
-    path = "usr.bin/mg";
-    version = "6.3";
-    sha256 = "0n3hwa81c2mcjwbmidrbvi1l25jh8hy939kqrigbv78jixpynffc";
-    buildInputs = [ compat libcurses ];
-    patchPhase = ''
-      NIX_CFLAGS_COMPILE+=" -I$BSDSRCDIR/sys"
-    '';
-    extraPaths = [
-      (fetchOpenBSD "sys/sys/tree.h" "6.3" "0rimh41wn9wz5m510zk9i27z3s450qqgq2k5xn8kp3885hygbcj9")
-      (fetchOpenBSD "sys/sys/_null.h" "6.3" "0l2rgg9ai4ivfl07zmbqli19vnm3lj7qkxpikqplmzrfp36qpzgr")
-    ];
-  };
-
-  nc = openBSDDerivation {
-    path = "usr.bin/nc";
-    version = "6.3";
-    sha256 = "0fmnh6ccxab0qvhmgspyd3wra1ps2516i0j6hwkvna2lcny20xvr";
-    patches = [ ./nc.patch ];
-    buildInputs = [ compat libressl ];
-  };
-
-}
diff --git a/pkgs/os-specific/bsd/openbsd/nc.patch b/pkgs/os-specific/bsd/openbsd/nc.patch
deleted file mode 100644
index de6fb2d04c41..000000000000
--- a/pkgs/os-specific/bsd/openbsd/nc.patch
+++ /dev/null
@@ -1,421 +0,0 @@
---- a/nc.1
-+++ b/nc.1
-@@ -204,9 +204,6 @@ Proxy authentication is only supported f
- Specifies the source port
- .Nm
- should use, subject to privilege restrictions and availability.
--It is an error to use this option in conjunction with the
--.Fl l
--option.
- .It Fl R Ar CAfile
- Specifies the filename from which the root CA bundle for certificate
- verification is loaded, in PEM format.
-@@ -258,6 +255,7 @@ For IPv4 TOS value
- may be one of
- .Ar critical ,
- .Ar inetcontrol ,
-+.Ar lowcost ,
- .Ar lowdelay ,
- .Ar netcontrol ,
- .Ar throughput ,
---- a/netcat.c
-+++ b/netcat.c
-@@ -32,6 +32,8 @@
-  * *Hobbit* <hobbit@avian.org>.
-  */
- 
-+#define _GNU_SOURCE
-+
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <sys/uio.h>
-@@ -41,6 +43,49 @@
- #include <netinet/tcp.h>
- #include <netinet/ip.h>
- #include <arpa/telnet.h>
-+#ifdef __linux__
-+# include <linux/in6.h>
-+#endif
-+
-+#ifndef IPTOS_LOWDELAY
-+# define IPTOS_LOWDELAY 0x10
-+# define IPTOS_THROUGHPUT 0x08
-+# define IPTOS_RELIABILITY 0x04
-+# define IPTOS_LOWCOST 0x02
-+# define IPTOS_MINCOST IPTOS_LOWCOST
-+#endif /* IPTOS_LOWDELAY */
-+
-+# ifndef IPTOS_DSCP_AF11
-+# define	IPTOS_DSCP_AF11		0x28
-+# define	IPTOS_DSCP_AF12		0x30
-+# define	IPTOS_DSCP_AF13		0x38
-+# define	IPTOS_DSCP_AF21		0x48
-+# define	IPTOS_DSCP_AF22		0x50
-+# define	IPTOS_DSCP_AF23		0x58
-+# define	IPTOS_DSCP_AF31		0x68
-+# define	IPTOS_DSCP_AF32		0x70
-+# define	IPTOS_DSCP_AF33		0x78
-+# define	IPTOS_DSCP_AF41		0x88
-+# define	IPTOS_DSCP_AF42		0x90
-+# define	IPTOS_DSCP_AF43		0x98
-+# define	IPTOS_DSCP_EF		0xb8
-+#endif /* IPTOS_DSCP_AF11 */
-+
-+#ifndef IPTOS_DSCP_CS0
-+# define	IPTOS_DSCP_CS0		0x00
-+# define	IPTOS_DSCP_CS1		0x20
-+# define	IPTOS_DSCP_CS2		0x40
-+# define	IPTOS_DSCP_CS3		0x60
-+# define	IPTOS_DSCP_CS4		0x80
-+# define	IPTOS_DSCP_CS5		0xa0
-+# define	IPTOS_DSCP_CS6		0xc0
-+# define	IPTOS_DSCP_CS7		0xe0
-+#endif /* IPTOS_DSCP_CS0 */
-+
-+#ifndef IPTOS_DSCP_EF
-+# define	IPTOS_DSCP_EF		0xb8
-+#endif /* IPTOS_DSCP_EF */
-+
- 
- #include <err.h>
- #include <errno.h>
-@@ -268,10 +315,14 @@ main(int argc, char *argv[])
- 			uflag = 1;
- 			break;
- 		case 'V':
-+# if defined(RT_TABLEID_MAX)
- 			rtableid = (int)strtonum(optarg, 0,
- 			    RT_TABLEID_MAX, &errstr);
- 			if (errstr)
- 				errx(1, "rtable %s: %s", errstr, optarg);
-+# else
-+			errx(1, "no alternate routing table support available");
-+# endif
- 			break;
- 		case 'v':
- 			vflag = 1;
-@@ -320,7 +371,11 @@ main(int argc, char *argv[])
- 			oflag = optarg;
- 			break;
- 		case 'S':
-+# if defined(TCP_MD5SIG)
- 			Sflag = 1;
-+# else
-+			errx(1, "no TCP MD5 signature support available");
-+# endif
- 			break;
- 		case 'T':
- 			errstr = NULL;
-@@ -345,35 +400,23 @@ main(int argc, char *argv[])
- 	argc -= optind;
- 	argv += optind;
- 
-+# if defined(RT_TABLEID_MAX)
- 	if (rtableid >= 0)
- 		if (setrtable(rtableid) == -1)
- 			err(1, "setrtable");
--
--	if (family == AF_UNIX) {
--		if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
--			err(1, "pledge");
--	} else if (Fflag && Pflag) {
--		if (pledge("stdio inet dns sendfd tty", NULL) == -1)
--			err(1, "pledge");
--	} else if (Fflag) { 
--		if (pledge("stdio inet dns sendfd", NULL) == -1)
--			err(1, "pledge");
--	} else if (Pflag && usetls) {
--		if (pledge("stdio rpath inet dns tty", NULL) == -1)
--			err(1, "pledge");
--	} else if (Pflag) {
--		if (pledge("stdio inet dns tty", NULL) == -1)
--			err(1, "pledge");
--	} else if (usetls) {
--		if (pledge("stdio rpath inet dns", NULL) == -1)
--			err(1, "pledge");
--	} else if (pledge("stdio inet dns", NULL) == -1)
--		err(1, "pledge");
-+# endif
- 
- 	/* Cruft to make sure options are clean, and used properly. */
- 	if (argv[0] && !argv[1] && family == AF_UNIX) {
- 		host = argv[0];
- 		uport = NULL;
-+	} else if (!argv[0] && lflag) {
-+		if (sflag)
-+			errx(1, "cannot use -s and -l");
-+		if (pflag)
-+			errx(1, "cannot use -p and -l");
-+		if (zflag)
-+			errx(1, "cannot use -z and -l");
- 	} else if (argv[0] && !argv[1]) {
- 		if (!lflag)
- 			usage(1);
-@@ -385,12 +428,6 @@ main(int argc, char *argv[])
- 	} else
- 		usage(1);
- 
--	if (lflag && sflag)
--		errx(1, "cannot use -s and -l");
--	if (lflag && pflag)
--		errx(1, "cannot use -p and -l");
--	if (lflag && zflag)
--		errx(1, "cannot use -z and -l");
- 	if (!lflag && kflag)
- 		errx(1, "must use -l with -k");
- 	if (uflag && usetls)
-@@ -425,8 +462,8 @@ main(int argc, char *argv[])
- 		} else {
- 			strlcpy(unix_dg_tmp_socket_buf, "/tmp/nc.XXXXXXXXXX",
- 			    UNIX_DG_TMP_SOCKET_SIZE);
--			if (mktemp(unix_dg_tmp_socket_buf) == NULL)
--				err(1, "mktemp");
-+			if (mkstemp(unix_dg_tmp_socket_buf) == -1)
-+				err(1, "mkstemp");
- 			unix_dg_tmp_socket = unix_dg_tmp_socket_buf;
- 		}
- 	}
-@@ -901,8 +938,10 @@ remote_connect(const char *host, const c
- 		if (sflag || pflag) {
- 			struct addrinfo ahints, *ares;
- 
-+# if defined (SO_BINDANY)
- 			/* try SO_BINDANY, but don't insist */
- 			setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
-+# endif
- 			memset(&ahints, 0, sizeof(struct addrinfo));
- 			ahints.ai_family = res->ai_family;
- 			ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
-@@ -994,9 +1033,15 @@ local_listen(char *host, char *port, str
- 		    res->ai_protocol)) < 0)
- 			continue;
- 
-+		ret = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
-+		if (ret == -1)
-+			err(1, NULL);
-+
-+# if defined(SO_REUSEPORT)
- 		ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
- 		if (ret == -1)
- 			err(1, NULL);
-+# endif
- 
- 		set_common_sockopts(s, res->ai_family);
- 
-@@ -1452,11 +1497,13 @@ set_common_sockopts(int s, int af)
- {
- 	int x = 1;
- 
-+# if defined(TCP_MD5SIG)
- 	if (Sflag) {
- 		if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
- 			&x, sizeof(x)) == -1)
- 			err(1, NULL);
- 	}
-+# endif
- 	if (Dflag) {
- 		if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
- 			&x, sizeof(x)) == -1)
-@@ -1467,9 +1514,14 @@ set_common_sockopts(int s, int af)
- 		    IP_TOS, &Tflag, sizeof(Tflag)) == -1)
- 			err(1, "set IP ToS");
- 
-+#if defined(IPV6_TCLASS)
- 		else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
- 		    IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1)
- 			err(1, "set IPv6 traffic class");
-+#else
-+		else if (af == AF_INET6)
-+			errx(1, "can't set IPv6 traffic class (unavailable)");
-+#endif
- 	}
- 	if (Iflag) {
- 		if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
-@@ -1487,19 +1539,34 @@ set_common_sockopts(int s, int af)
- 		    IP_TTL, &ttl, sizeof(ttl)))
- 			err(1, "set IP TTL");
- 
-+#if defined(IPV6_UNICAST_HOPS)
- 		else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
- 		    IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)))
- 			err(1, "set IPv6 unicast hops");
-+#else
-+		else if (af == AF_INET6)
-+			errx(1, "can't set IPv6 unicast hops (unavailable)");
-+#endif
- 	}
- 
- 	if (minttl != -1) {
-+#if defined(IP_MINTTL)
- 		if (af == AF_INET && setsockopt(s, IPPROTO_IP,
- 		    IP_MINTTL, &minttl, sizeof(minttl)))
- 			err(1, "set IP min TTL");
-+#else
-+		if (af == AF_INET)
-+			errx(1, "can't set IP min TTL (unavailable)");
-+#endif
- 
-+#if defined(IPV6_MINHOPCOUNT)
- 		else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
- 		    IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)))
- 			err(1, "set IPv6 min hop count");
-+#else
-+		else if (af == AF_INET6)
-+			errx(1, "can't set IPv6 min hop count (unavailable)");
-+#endif
- 	}
- }
- 
-@@ -1534,6 +1601,7 @@ process_tos_opt(char *s, int *val)
- 		{ "cs7",		IPTOS_DSCP_CS7 },
- 		{ "ef",			IPTOS_DSCP_EF },
- 		{ "inetcontrol",	IPTOS_PREC_INTERNETCONTROL },
-+		{ "lowcost",		IPTOS_LOWCOST },
- 		{ "lowdelay",		IPTOS_LOWDELAY },
- 		{ "netcontrol",		IPTOS_PREC_NETCONTROL },
- 		{ "reliability",	IPTOS_RELIABILITY },
-@@ -1741,7 +1812,7 @@ help(void)
- 	\t-Z		Peer certificate file\n\
- 	\t-z		Zero-I/O mode [used for scanning]\n\
- 	Port numbers can be individual or ranges: lo-hi [inclusive]\n");
--	exit(1);
-+	exit(0);
- }
- 
- void
---- a/socks.c
-+++ b/socks.c
-@@ -219,11 +219,11 @@ socks_connect(const char *host, const ch
- 		buf[2] = SOCKS_NOAUTH;
- 		cnt = atomicio(vwrite, proxyfd, buf, 3);
- 		if (cnt != 3)
--			err(1, "write failed (%zu/3)", cnt);
-+			err(1, "write failed (%zu/3)", (size_t)cnt);
- 
- 		cnt = atomicio(read, proxyfd, buf, 2);
- 		if (cnt != 2)
--			err(1, "read failed (%zu/3)", cnt);
-+			err(1, "read failed (%zu/3)", (size_t)cnt);
- 
- 		if (buf[1] == SOCKS_NOMETHOD)
- 			errx(1, "authentication method negotiation failed");
-@@ -272,11 +272,11 @@ socks_connect(const char *host, const ch
- 
- 		cnt = atomicio(vwrite, proxyfd, buf, wlen);
- 		if (cnt != wlen)
--			err(1, "write failed (%zu/%zu)", cnt, wlen);
-+			err(1, "write failed (%zu/%zu)", (size_t)cnt, (size_t)wlen);
- 
- 		cnt = atomicio(read, proxyfd, buf, 4);
- 		if (cnt != 4)
--			err(1, "read failed (%zu/4)", cnt);
-+			err(1, "read failed (%zu/4)", (size_t)cnt);
- 		if (buf[1] != 0) {
- 			errx(1, "connection failed, SOCKSv5 error: %s",
- 			    socks5_strerror(buf[1]));
-@@ -285,12 +285,12 @@ socks_connect(const char *host, const ch
- 		case SOCKS_IPV4:
- 			cnt = atomicio(read, proxyfd, buf + 4, 6);
- 			if (cnt != 6)
--				err(1, "read failed (%zu/6)", cnt);
-+				err(1, "read failed (%zu/6)", (size_t)cnt);
- 			break;
- 		case SOCKS_IPV6:
- 			cnt = atomicio(read, proxyfd, buf + 4, 18);
- 			if (cnt != 18)
--				err(1, "read failed (%zu/18)", cnt);
-+				err(1, "read failed (%zu/18)", (size_t)cnt);
- 			break;
- 		default:
- 			errx(1, "connection failed, unsupported address type");
-@@ -310,11 +310,11 @@ socks_connect(const char *host, const ch
- 
- 		cnt = atomicio(vwrite, proxyfd, buf, wlen);
- 		if (cnt != wlen)
--			err(1, "write failed (%zu/%zu)", cnt, wlen);
-+			err(1, "write failed (%zu/%zu)", (size_t)cnt, (size_t)wlen);
- 
- 		cnt = atomicio(read, proxyfd, buf, 8);
- 		if (cnt != 8)
--			err(1, "read failed (%zu/8)", cnt);
-+			err(1, "read failed (%zu/8)", (size_t)cnt);
- 		if (buf[1] != 90) {
- 			errx(1, "connection failed, SOCKSv4 error: %s",
- 			    socks4_strerror(buf[1]));
-@@ -328,39 +328,39 @@ socks_connect(const char *host, const ch
- 
- 		/* Try to be sane about numeric IPv6 addresses */
- 		if (strchr(host, ':') != NULL) {
--			r = snprintf(buf, sizeof(buf),
-+			r = snprintf((char*)buf, sizeof(buf),
- 			    "CONNECT [%s]:%d HTTP/1.0\r\n",
- 			    host, ntohs(serverport));
- 		} else {
--			r = snprintf(buf, sizeof(buf),
-+			r = snprintf((char*)buf, sizeof(buf),
- 			    "CONNECT %s:%d HTTP/1.0\r\n",
- 			    host, ntohs(serverport));
- 		}
- 		if (r == -1 || (size_t)r >= sizeof(buf))
- 			errx(1, "hostname too long");
--		r = strlen(buf);
-+		r = strlen((char*)buf);
- 
- 		cnt = atomicio(vwrite, proxyfd, buf, r);
- 		if (cnt != r)
--			err(1, "write failed (%zu/%d)", cnt, r);
-+			err(1, "write failed (%zu/%d)", (size_t)cnt, (int)r);
- 
- 		if (authretry > 1) {
- 			char resp[1024];
- 
- 			proxypass = getproxypass(proxyuser, proxyhost);
--			r = snprintf(buf, sizeof(buf), "%s:%s",
-+			r = snprintf((char*)buf, sizeof(buf), "%s:%s",
- 			    proxyuser, proxypass);
- 			if (r == -1 || (size_t)r >= sizeof(buf) ||
--			    b64_ntop(buf, strlen(buf), resp,
-+			    b64_ntop(buf, strlen((char*)buf), resp,
- 			    sizeof(resp)) == -1)
- 				errx(1, "Proxy username/password too long");
--			r = snprintf(buf, sizeof(buf), "Proxy-Authorization: "
-+			r = snprintf((char*)buf, sizeof(buf), "Proxy-Authorization: "
- 			    "Basic %s\r\n", resp);
- 			if (r == -1 || (size_t)r >= sizeof(buf))
- 				errx(1, "Proxy auth response too long");
--			r = strlen(buf);
-+			r = strlen((char*)buf);
- 			if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r)
--				err(1, "write failed (%zu/%d)", cnt, r);
-+				err(1, "write failed (%zu/%d)", (size_t)cnt, r);
- 		}
- 
- 		/* Terminate headers */
-@@ -368,22 +368,22 @@ socks_connect(const char *host, const ch
- 			err(1, "write failed (%zu/2)", cnt);
- 
- 		/* Read status reply */
--		proxy_read_line(proxyfd, buf, sizeof(buf));
-+		proxy_read_line(proxyfd, (char*)buf, sizeof(buf));
- 		if (proxyuser != NULL &&
--		    strncmp(buf, "HTTP/1.0 407 ", 12) == 0) {
-+		    strncmp((char*)buf, "HTTP/1.0 407 ", 12) == 0) {
- 			if (authretry > 1) {
- 				fprintf(stderr, "Proxy authentication "
- 				    "failed\n");
- 			}
- 			close(proxyfd);
- 			goto again;
--		} else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 &&
--		    strncmp(buf, "HTTP/1.1 200 ", 12) != 0)
-+		} else if (strncmp((char*)buf, "HTTP/1.0 200 ", 12) != 0 &&
-+		    strncmp((char*)buf, "HTTP/1.1 200 ", 12) != 0)
- 			errx(1, "Proxy error: \"%s\"", buf);
- 
- 		/* Headers continue until we hit an empty line */
- 		for (r = 0; r < HTTP_MAXHDRS; r++) {
--			proxy_read_line(proxyfd, buf, sizeof(buf));
-+			proxy_read_line(proxyfd, (char*)buf, sizeof(buf));
- 			if (*buf == '\0')
- 				break;
- 		}
\ No newline at end of file
diff --git a/pkgs/os-specific/darwin/darling/default.nix b/pkgs/os-specific/darwin/darling/default.nix
index b9d806cded23..c1e29843147c 100644
--- a/pkgs/os-specific/darwin/darling/default.nix
+++ b/pkgs/os-specific/darwin/darling/default.nix
@@ -1,14 +1,19 @@
-{stdenv, lib, fetchFromGitHub, cmake, bison, flex}:
+{stdenv, lib, fetchzip, cmake, bison, flex}:
 
 stdenv.mkDerivation rec {
   pname = "darling";
   name = pname;
 
-  src = fetchFromGitHub {
-    repo = pname;
-    owner = "darlinghq";
-    rev = "d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b";
-    sha256 = "1sdl0ysa3yfdvkq0x7vkdl64g7mcfy3qx70saf1d8rnhycbxjgjg";
+  src = fetchzip {
+    url = "https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz";
+    sha256 = "11b51fw47nl505h63bgx5kqiyhf3glhp1q6jkpb6nqfislnzzkrf";
+    postFetch = ''
+      # Get rid of case conflict
+      mkdir $out
+      cd $out
+      tar -xzf $downloadedFile --strip-components=1
+      rm -r $out/src/libm
+    '';
   };
 
   # only packaging sandbox for now
diff --git a/pkgs/os-specific/gnu/mig/default.nix b/pkgs/os-specific/gnu/mig/default.nix
index 34426b45d55e..2855f5b4240f 100644
--- a/pkgs/os-specific/gnu/mig/default.nix
+++ b/pkgs/os-specific/gnu/mig/default.nix
@@ -46,7 +46,7 @@ stdenv.mkDerivation {
 
     homepage = http://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html;
 
-    # platforms = stdenv.lib.platforms.gnu;  # really GNU/Hurd
+    # platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # really GNU/Hurd
     maintainers = [ stdenv.lib.maintainers.ludo ];
   };
 }
diff --git a/pkgs/os-specific/linux/kernel/hardened-config.nix b/pkgs/os-specific/linux/kernel/hardened-config.nix
index 3a82c00c5010..a00ba9ab7b8e 100644
--- a/pkgs/os-specific/linux/kernel/hardened-config.nix
+++ b/pkgs/os-specific/linux/kernel/hardened-config.nix
@@ -78,6 +78,9 @@ ${optionalString (versionAtLeast version "4.13") ''
 
 # Perform usercopy bounds checking.
 HARDENED_USERCOPY y
+${optionalString (versionAtLeast version "4.16") ''
+  HARDENED_USERCOPY_FALLBACK n
+''}
 
 # Randomize allocator freelists.
 SLAB_FREELIST_RANDOM y
diff --git a/pkgs/os-specific/linux/kernel/linux-4.14.nix b/pkgs/os-specific/linux/kernel/linux-4.14.nix
index d9aef3a21930..177a5c878f65 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.14.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.14.nix
@@ -3,13 +3,13 @@
 with stdenv.lib;
 
 buildLinux (args // rec {
-  version = "4.14.37";
+  version = "4.14.38";
 
   # branchVersion needs to be x.y
   extraMeta.branch = concatStrings (intersperse "." (take 2 (splitString "." version)));
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "14lfj2vfxw36k8cbmzs280w4h81yz5xhlhq5550kww906vnyg5w1";
+    sha256 = "00ibrl633d4cqnn4i0z7kj1ddj1243dh7ap783bwlicw9hkddwzg";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-4.16.nix b/pkgs/os-specific/linux/kernel/linux-4.16.nix
index 3da2cda30e22..46bdcff66a10 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.16.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.16.nix
@@ -3,7 +3,7 @@
 with stdenv.lib;
 
 buildLinux (args // rec {
-  version = "4.16.5";
+  version = "4.16.6";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = concatStrings (intersperse "." (take 3 (splitString "." "${version}.0")));
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0f1a8ggjb2jxc8n3hvypc81xbwylwkqi0mnynd9q316ay152zb1r";
+    sha256 = "0jwa2r3gpn4ahy38730b7g4xzavfqwxxwgyfhpn5ssvzsc4934gs";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-4.4.nix b/pkgs/os-specific/linux/kernel/linux-4.4.nix
index fe8633ed0da7..ccc8b4ba2dc2 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.4.nix
@@ -1,11 +1,11 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.4.129";
+  version = "4.4.130";
   extraMeta.branch = "4.4";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0aviyky8f73l6jpi1d4by947rj78d5vckxkyf9aj73bavaxc8rd1";
+    sha256 = "1rad8fa25hzifpxqxsc7wzhcssbbv32rc03nvljygvlxcn8dz6xj";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-4.9.nix b/pkgs/os-specific/linux/kernel/linux-4.9.nix
index 63fe3db3b577..cc4609676d4e 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.9.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.9.nix
@@ -1,11 +1,11 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.9.96";
+  version = "4.9.97";
   extraMeta.branch = "4.9";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0zw7x86c8qa2kzkwlxlhqzsnddyp1ncw4ja660bqnzqrnmp5jvw2";
+    sha256 = "08vg8lm03s04cpyicq1jj342c25x3039nnxvcvwr80j18w4biwf4";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-testing.nix b/pkgs/os-specific/linux/kernel/linux-testing.nix
index 6370f82235a7..d02ab4157191 100644
--- a/pkgs/os-specific/linux/kernel/linux-testing.nix
+++ b/pkgs/os-specific/linux/kernel/linux-testing.nix
@@ -1,13 +1,13 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, libelf, utillinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.17-rc2";
-  modDirVersion = "4.17.0-rc2";
+  version = "4.17-rc3";
+  modDirVersion = "4.17.0-rc3";
   extraMeta.branch = "4.17";
 
   src = fetchurl {
     url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
-    sha256 = "1z4kl25x8m498wicbzhx21kvksp63ab8l2s0nfxf7fwj7dd13cld";
+    sha256 = "1divgjzmpl98b5j416vhkq53li0y9v5vvdwbgwpr2xznspzbkygq";
   };
 
   # Should the testing kernels ever be built on Hydra?
diff --git a/pkgs/os-specific/linux/pam_u2f/default.nix b/pkgs/os-specific/linux/pam_u2f/default.nix
index 0f0b6ebb37a6..5cc235c3104a 100644
--- a/pkgs/os-specific/linux/pam_u2f/default.nix
+++ b/pkgs/os-specific/linux/pam_u2f/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name    = "pam_u2f-${version}";
-  version = "1.0.5";
+  version = "1.0.6";
 
   src     = fetchurl {
     url = "https://developers.yubico.com/pam-u2f/Releases/${name}.tar.gz";
-    sha256 = "0bbwy9k3002anhkv67zwck3dry7blqnnp291dc4qsjrca0blw217";
+    sha256 = "0fpdb49596zywnbx1cfcx1k83rbs1ylhi1cnn25pq9d3b92hj50h";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/os-specific/linux/wireguard/default.nix b/pkgs/os-specific/linux/wireguard/default.nix
index b88646424be5..6e3e444240ac 100644
--- a/pkgs/os-specific/linux/wireguard/default.nix
+++ b/pkgs/os-specific/linux/wireguard/default.nix
@@ -6,11 +6,11 @@ assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "3.10";
 let
   name = "wireguard-${version}";
 
-  version = "0.0.20180413";
+  version = "0.0.20180420";
 
   src = fetchurl {
     url    = "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${version}.tar.xz";
-    sha256 = "0lbjx62ihc8prqfhvmi0v1xq1q3ayzj5rfy2p5149nr9qx3z37j1";
+    sha256 = "05nsn5pkzvkfsc8z0mm4fdb1znklpmb00v608j8gxlz8z6nd535m";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/servers/http/myserver/default.nix b/pkgs/servers/http/myserver/default.nix
index 3e1c94e79b4b..fa3b57a0b22e 100644
--- a/pkgs/servers/http/myserver/default.nix
+++ b/pkgs/servers/http/myserver/default.nix
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     license = lib.licenses.gpl3Plus;
 
     # libevent fails to build on Cygwin and Guile has troubles on Darwin.
-    platforms = lib.platforms.gnu;
+    platforms = lib.platforms.gnu ++ lib.platforms.linux;
 
     broken = true; # needs patch for gets()
   };
diff --git a/pkgs/servers/monitoring/uchiwa/bower-packages.nix b/pkgs/servers/monitoring/uchiwa/bower-packages.nix
index 618c3a33cd7c..f18ea3875516 100644
--- a/pkgs/servers/monitoring/uchiwa/bower-packages.nix
+++ b/pkgs/servers/monitoring/uchiwa/bower-packages.nix
@@ -1,15 +1,15 @@
 # Generated by bower2nix v3.2.0 (https://github.com/rvl/bower2nix)
 { fetchbower, buildEnv }:
 buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
-  (fetchbower "uchiwa-web" "1.1.2" "1.1.2" "174flmnqjm0avpvi71ii5cvas2wkgz42is38r7n4zyrhagzlj66k")
-  (fetchbower "angular" "1.6.8" "~1.6.3" "07bwbahxaz5myjj7sqv7k211avs23a9j7msl373h1qvp05fblajf")
+  (fetchbower "uchiwa-web" "1.2.0" "1.2.0" "0733ha6bahzg9qlvhz75agi8hwwqdk99hfx9j8dhpdf1v5xkj2fz")
+  (fetchbower "angular" "1.6.10" "~1.6.3" "0ag8xddsgxx5yka4wjq4ala4y6z3x2g1vc3x7a1n291fzz26p7ws")
   (fetchbower "angular-bootstrap" "2.2.0" "~2.2.0" "11r2nlwp6xrim2y6lnrr8v064mx3bmlxchqpg1i803v9zxz3q53d")
-  (fetchbower "angular-cookies" "1.6.8" "~1.6.3" "0p3skdg2pmzgwm9a0gyl1vhq4lcwyrymmii7lxlrmypjhwm83il6")
+  (fetchbower "angular-cookies" "1.6.10" "~1.6.3" "0bjgmz5jnw06dfxhq9sajj62fk0b3v4j9p7nb45x8bl8rzkf25pn")
   (fetchbower "angular-gravatar" "0.4.2" "~0.4.2" "14jrzvjwx64awh9z95054manp8qd57fvinqhmakipz5x12i7qrwi")
   (fetchbower "angular-moment" "1.0.1" "~1.0.1" "0zkn52s9l15d6b5zfx52g5jpib23rpb637m0p1hzc429w5bbl0rj")
-  (fetchbower "angular-resource" "1.6.8" "~1.6.3" "0pnv12c61i8giwj0fmzf38f3x6ckf24g6izrak9y7zy28nlb3y5q")
-  (fetchbower "angular-route" "1.6.8" "~1.6.3" "0k8sy5dkn589w8ykn65fhrcrfi7wkn7gagwwl5j5zgzj4m91wlar")
-  (fetchbower "angular-sanitize" "1.6.8" "~1.6.3" "0q7hy5iyjlf745yisphwa5b8rvkhc43zwwmiwfkqcdcbf3w6564l")
+  (fetchbower "angular-resource" "1.6.10" "~1.6.3" "1gplq8kd49qakk7ardg5xr5amwvspaz9n71kf8x49xfllda61rm0")
+  (fetchbower "angular-route" "1.6.10" "~1.6.3" "0vwbn7i45yvsn8c469nj141ahrn7iw85j7hy3vvhh2r373j94mai")
+  (fetchbower "angular-sanitize" "1.6.10" "~1.6.3" "066gsdl19s27w00wafg2skf5abdsdrlzhkcagkk1ma39dyqyl4i3")
   (fetchbower "angular-toastr" "1.6.0" "1.6.0" "1szigf1m28bgpfyg8hbm5rffr5zi7wr9n73nc1fqhk0yqh7gzysh")
   (fetchbower "angular-tools/ng-jsoneditor" "ea138469f157d8f2b54ec5b8dcf4b08a55b61459" "ea138469f157d8f2b54ec5b8dcf4b08a55b61459" "1j3vysr01niabc9fxcpixhcq1lyx2fr4q4wpmxhmiqki431h9hq8")
   (fetchbower "angular-ua-parser" "0.0.2" "0.0.2" "0gb0vmwksnydlm6hklfq1n4ak2967wcmnx3cx9cgiv7v7vk3w2m9")
diff --git a/pkgs/servers/monitoring/uchiwa/src.nix b/pkgs/servers/monitoring/uchiwa/src.nix
index 3e0ead7b495b..0cf6815fbe5d 100644
--- a/pkgs/servers/monitoring/uchiwa/src.nix
+++ b/pkgs/servers/monitoring/uchiwa/src.nix
@@ -1,4 +1,4 @@
 {
-    version = "1.1.2-1";
-    sha256  = "0fmzpjwmv7fkl0ihy2gzcgfd384k3wnifg42gzap770d6kl6yj1c";
+    version = "1.2.0-1";
+    sha256  = "1gj9cr0gkiivxdlq7ha6gxq9s8s26j79crijkrlrsqpg59jz063p";
 }
diff --git a/pkgs/servers/nextcloud/default.nix b/pkgs/servers/nextcloud/default.nix
index e6baf9e64d8b..7513d3c71d2b 100644
--- a/pkgs/servers/nextcloud/default.nix
+++ b/pkgs/servers/nextcloud/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name= "nextcloud-${version}";
-  version = "13.0.1";
+  version = "13.0.2";
 
   src = fetchurl {
     url = "https://download.nextcloud.com/server/releases/${name}.tar.bz2";
-    sha256 = "048x3x6d11m75ghxjcjzm8amjm6ljirv6djbl53awwp9f5532hsp";
+    sha256 = "0zf4z4cn4wwsybxirvzyk7l6xjw9gkc60lzm8jqz9aak3a5gk5kk";
   };
 
   installPhase = ''
diff --git a/pkgs/servers/pies/default.nix b/pkgs/servers/pies/default.nix
index c472f767d525..73af60e55c42 100644
--- a/pkgs/servers/pies/default.nix
+++ b/pkgs/servers/pies/default.nix
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
 
     homepage = http://www.gnu.org/software/pies/;
 
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/tools/X11/xnee/default.nix b/pkgs/tools/X11/xnee/default.nix
index 63abc31e0076..b31a512e84ab 100644
--- a/pkgs/tools/X11/xnee/default.nix
+++ b/pkgs/tools/X11/xnee/default.nix
@@ -50,6 +50,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.gnu.org/software/xnee/;
 
     maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/tools/admin/awscli/default.nix b/pkgs/tools/admin/awscli/default.nix
index 23908a8b66f9..4e7e2d402e90 100644
--- a/pkgs/tools/admin/awscli/default.nix
+++ b/pkgs/tools/admin/awscli/default.nix
@@ -19,11 +19,11 @@ let
 
 in py.pkgs.buildPythonApplication rec {
   pname = "awscli";
-  version = "1.14.50";
+  version = "1.15.10";
 
   src = py.pkgs.fetchPypi {
     inherit pname version;
-    sha256 = "1yiwj7cl9r1k9226mdq6pcmrs044k7p3d133lzgv9rb1dgp4053c";
+    sha256 = "0nwpanbfx5h0bad8wwvvbhpjf9r6n885bbv2w8mw7vijdgclkq8x";
   };
 
   # No tests included
@@ -42,6 +42,12 @@ in py.pkgs.buildPythonApplication rec {
     less
   ];
 
+  postPatch = ''
+    for i in {py,cfg}; do
+      substituteInPlace setup.$i --replace "botocore==1.10.10" "botocore>=1.10.9,<=1.11"
+    done
+  '';
+
   postInstall = ''
     mkdir -p $out/etc/bash_completion.d
     echo "complete -C $out/bin/aws_completer aws" > $out/etc/bash_completion.d/awscli
diff --git a/pkgs/tools/admin/dehydrated/default.nix b/pkgs/tools/admin/dehydrated/default.nix
index d4211328b959..38b70d1b5d07 100644
--- a/pkgs/tools/admin/dehydrated/default.nix
+++ b/pkgs/tools/admin/dehydrated/default.nix
@@ -1,7 +1,7 @@
 { stdenv, bash, coreutils, curl, diffutils, gawk, gnugrep, gnused, openssl, makeWrapper, fetchFromGitHub }:
 let
   pkgName = "dehydrated";
-  version = "0.6.1";
+  version = "0.6.2";
 in
 stdenv.mkDerivation rec {
   name = pkgName + "-" + version;
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     owner = "lukas2511";
     repo = "dehydrated";
     rev = "v${version}";
-    sha256 = "0390fnycl3l4yqacwvaf7dp08rx2vvs27s06q7b478qzrn59flz4";
+    sha256 = "19d4kam0dl6l9wfd0v54w4d085jdgi1ljksnqpjj67d6sm23f2l4";
   };
 
   buildInputs = [ makeWrapper ];
diff --git a/pkgs/tools/filesystems/mtools/default.nix b/pkgs/tools/filesystems/mtools/default.nix
index ff311b9fae2f..e7a9963f6501 100644
--- a/pkgs/tools/filesystems/mtools/default.nix
+++ b/pkgs/tools/filesystems/mtools/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = http://www.gnu.org/software/mtools/;
     description = "Utilities to access MS-DOS disks";
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.darwin;
+    platforms = stdenv.lib.platforms.unix;
     maintainers = [ ];
   };
 }
diff --git a/pkgs/tools/graphics/asymptote/default.nix b/pkgs/tools/graphics/asymptote/default.nix
index 7337cd227a2e..01ddd6ba7fc5 100644
--- a/pkgs/tools/graphics/asymptote/default.nix
+++ b/pkgs/tools/graphics/asymptote/default.nix
@@ -51,7 +51,9 @@ stdenv.mkDerivation {
     rmdir $out/share/info/asymptote
     rm $out/share/info/dir
 
-    rm -rf "$out"/share/texmf
+    rm -rfv "$out"/share/texmf
+    mkdir -pv "$out"/share/emacs/site-lisp/${s.name}
+    mv -v "$out"/share/asymptote/*.el "$out"/share/emacs/site-lisp/${s.name}
   '';
 
   enableParallelBuilding = true;
diff --git a/pkgs/tools/graphics/gmic/default.nix b/pkgs/tools/graphics/gmic/default.nix
index a8c491b049ff..008f9af36852 100644
--- a/pkgs/tools/graphics/gmic/default.nix
+++ b/pkgs/tools/graphics/gmic/default.nix
@@ -1,36 +1,45 @@
-{ stdenv, fetchurl, fftw, zlib, libjpeg, libtiff, libpng, pkgconfig }:
+{ stdenv, fetchurl, fetchFromGitHub, cmake, ninja, pkgconfig
+, opencv, openexr, graphicsmagick, fftw, zlib, libjpeg, libtiff, libpng
+, withGimpPlugin ? true, gimp ? null}:
 
-stdenv.mkDerivation rec {
+assert withGimpPlugin -> gimp != null;
+
+let
+  version = "2.2.2";
+
+  # CMakeLists.txt is missing from the tarball and Makefile is terrible
+  CMakeLists = fetchurl {
+    url = "https://github.com/dtschump/gmic/raw/v.${version}/CMakeLists.txt";
+    sha256 = "0lv5jrg98cpbk13fl4xm7l4sk1axfz054q570bpi741w815d7cpg";
+  };
+in stdenv.mkDerivation rec {
   name = "gmic-${version}";
-  version = "2.2.1";
+
+  outputs = [ "out" "lib" "dev" "man" ] ++ stdenv.lib.optional withGimpPlugin "gimpPlugin";
 
   src = fetchurl {
     url = "http://gmic.eu/files/source/gmic_${version}.tar.gz";
-    sha256 = "0iac1zaix2zv1dfp45ca0wk9pj6k02gf8l1vmg820z8jd12pa19w";
+    sha256 = "0zqfj2ym5nn3ff93xh2wf9ayxqlznabbdi00xw4lm7vw3iwkzqnc";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ cmake ninja pkgconfig ];
 
-  buildInputs = [ fftw zlib libjpeg libtiff libpng ];
+  buildInputs = [
+    fftw zlib libjpeg libtiff libpng opencv openexr graphicsmagick
+  ] ++ stdenv.lib.optionals withGimpPlugin [ gimp gimp.gtk ];
 
-  sourceRoot = "${name}/src";
+  cmakeFlags = [
+    "-DBUILD_LIB_STATIC=OFF"
+    "-DBUILD_PLUGIN=${if withGimpPlugin then "ON" else "OFF"}"
+    "-DENABLE_DYNAMIC_LINKING=ON"
+  ];
 
-  preBuild = ''
-    buildFlagsArray=( \
-      CURL_CFLAGS= CURL_LIBS= \
-      OPENEXR_CFLAGS= OPENEXR_LIBS= \
-      OPENCV_CFLAGS= OPENCV_LIBS= \
-      X11_CFLAGS="-Dcimg_display=0" X11_LIBS= \
-      cli \
-    )
+  postPatch = ''
+    cp ${CMakeLists} CMakeLists.txt
   '';
 
-  installPhase = ''
-    mkdir -p $out/bin
-    mkdir -p $out/share/man/man1
-
-    cp -v gmic $out/bin/
-    cp -v ../man/gmic.1.gz $out/share/man/man1/
+  preConfigure = stdenv.lib.optionalString withGimpPlugin ''
+    cmakeFlags="$cmakeFlags -DPLUGIN_INSTALL_PREFIX=$gimpPlugin/${gimp.targetPluginDir}"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/graphics/logstalgia/default.nix b/pkgs/tools/graphics/logstalgia/default.nix
index 0fa991638457..be4cf0f493b6 100644
--- a/pkgs/tools/graphics/logstalgia/default.nix
+++ b/pkgs/tools/graphics/logstalgia/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
       a Miscellaneous section.
     '';
 
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
     maintainers = with maintainers; [ pSub ];
   };
 }
diff --git a/pkgs/tools/misc/grc/default.nix b/pkgs/tools/misc/grc/default.nix
index c554c13bb4ab..451828b0f47b 100644
--- a/pkgs/tools/misc/grc/default.nix
+++ b/pkgs/tools/misc/grc/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name    = "grc-${version}";
-  version = "1.11.1";
+  version = "1.11.3";
 
   src = fetchFromGitHub {
     owner  = "garabik";
     repo   = "grc";
     rev    = "v${version}";
-    sha256 = "10h65qmv2cymixzfsckfcn6f01xsjzfq1x303rv01nibniwbq5z9";
+    sha256 = "0b3wx9zr7l642hizk93ysbdss7rfymn22b2ykj4kpkf1agjkbv35";
   };
 
   buildInputs = with python3Packages; [ wrapPython makeWrapper ];
diff --git a/pkgs/tools/misc/grub/pvgrub_image/default.nix b/pkgs/tools/misc/grub/pvgrub_image/default.nix
index ee6e5065f40b..df5e3f15e95a 100644
--- a/pkgs/tools/misc/grub/pvgrub_image/default.nix
+++ b/pkgs/tools/misc/grub/pvgrub_image/default.nix
@@ -37,6 +37,6 @@ stdenv.mkDerivation rec {
          Xen guests
       '';
 
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 })
diff --git a/pkgs/tools/misc/grub/trusted.nix b/pkgs/tools/misc/grub/trusted.nix
index e57c98bf51b0..2bf7e3dcf43b 100644
--- a/pkgs/tools/misc/grub/trusted.nix
+++ b/pkgs/tools/misc/grub/trusted.nix
@@ -98,6 +98,6 @@ stdenv.mkDerivation rec {
     description = "GRUB 2.0 extended with TCG (TPM) support for integrity measured boot process (trusted boot)";
     homepage = https://github.com/Sirrix-AG/TrustedGRUB2;
     license = licenses.gpl3Plus;
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/tools/misc/picocom/default.nix b/pkgs/tools/misc/picocom/default.nix
index 57be275d32af..bb66b97039da 100644
--- a/pkgs/tools/misc/picocom/default.nix
+++ b/pkgs/tools/misc/picocom/default.nix
@@ -26,6 +26,6 @@ stdenv.mkDerivation rec {
     description = "Minimal dumb-terminal emulation program";
     homepage = https://github.com/npat-efault/picocom/;
     license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
   };
 }
diff --git a/pkgs/tools/misc/sweep-visualizer/default.nix b/pkgs/tools/misc/sweep-visualizer/default.nix
index c1f3fbea8e5c..cbf849494b75 100644
--- a/pkgs/tools/misc/sweep-visualizer/default.nix
+++ b/pkgs/tools/misc/sweep-visualizer/default.nix
@@ -24,10 +24,9 @@
     buildPhase = ":";
 
     installPhase = ''
-      mkdir -p $out/lib $out/bin $out/share/sweep-visualizer
+      mkdir -p $out/bin $out/share/sweep-visualizer
       mv usr/share/* $out/share
       mv opt/Sweep\ Visualizer\ BETA/* $out/share/sweep-visualizer/
-      mv $out/share/sweep-visualizer/*.so $out/lib/
       ln -s $out/share/sweep-visualizer/sweep_visualizer $out/bin/sweep_visualizer
     '';
 
@@ -40,12 +39,12 @@
       ];
       runtimeLibs = lib.makeLibraryPath [ libudev0-shim ];
     in ''
-      for lib in $out/lib/*.so; do
-        patchelf --set-rpath "$out/lib:${libPath}" $lib
+      for lib in $out/share/sweep-visualizer/*.so; do
+        patchelf --set-rpath "$out/share/sweep-visualizer:${libPath}" $lib
       done
       patchelf \
         --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-        --set-rpath "$out/lib:${libPath}" \
+        --set-rpath "$out/share/sweep-visualizer:${libPath}" \
         $out/share/sweep-visualizer/sweep_visualizer
       wrapProgram "$out/bin/sweep_visualizer" --prefix LD_LIBRARY_PATH : ${runtimeLibs}
     '';
diff --git a/pkgs/tools/misc/tealdeer/default.nix b/pkgs/tools/misc/tealdeer/default.nix
new file mode 100644
index 000000000000..fe0aa6cc3089
--- /dev/null
+++ b/pkgs/tools/misc/tealdeer/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, rustPlatform, fetchFromGitHub, pkgconfig, openssl, cacert, curl }:
+
+rustPlatform.buildRustPackage rec {
+  name = "tealdeer-${version}";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "dbrgn";
+    repo = "tealdeer";
+    rev = "v${version}";
+    sha256 = "0mkcja9agkbj2i93hx01r77w66ca805v4wvivcnrqmzid001717v";
+  };
+
+  cargoSha256 = "1qrvic7b6g3f3gjzx7x97ipp7ppa79c0aawn0lsav0c9xxzl44jq";
+
+  buildInputs = [ openssl cacert curl ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  
+  NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
+
+  # disable tests for now since one needs network
+  # what is unavailable in sandbox build
+  # and i can't disable just this one
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "An implementation of tldr in Rust";
+    homepage = "https://github.com/dbrgn/tealdeer";
+    maintainers = with maintainers; [ davidak ];
+    license = with licenses; [ asl20 mit ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/tools/misc/urjtag/default.nix b/pkgs/tools/misc/urjtag/default.nix
index 99cd407a9ae4..25687a3dbe1e 100644
--- a/pkgs/tools/misc/urjtag/default.nix
+++ b/pkgs/tools/misc/urjtag/default.nix
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     description = "Enhanced, modern tool for communicating over JTAG with flash chips, CPUs,and many more";
     homepage = http://urjtag.org/;
     license = with stdenv.lib.licenses; [ gpl2Plus lgpl21Plus ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
     maintainers = with stdenv.lib.maintainers; [ lowfatcomputing ];
   };
 }
diff --git a/pkgs/tools/networking/connect/default.nix b/pkgs/tools/networking/connect/default.nix
index 387987c588ad..f7a0c00fb481 100644
--- a/pkgs/tools/networking/connect/default.nix
+++ b/pkgs/tools/networking/connect/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
       '';
     homepage = https://bitbucket.org/gotoh/connect/wiki/Home;
     license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
     maintainers = with stdenv.lib.maintainers; [ jcumming ];
   };
 }
diff --git a/pkgs/tools/networking/inetutils/default.nix b/pkgs/tools/networking/inetutils/default.nix
index c5ecb5eb6dad..04045615a9b4 100644
--- a/pkgs/tools/networking/inetutils/default.nix
+++ b/pkgs/tools/networking/inetutils/default.nix
@@ -48,6 +48,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl3Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/networking/mailutils/default.nix b/pkgs/tools/networking/mailutils/default.nix
index 26bfd27bf9a6..4df7f80fff6c 100644
--- a/pkgs/tools/networking/mailutils/default.nix
+++ b/pkgs/tools/networking/mailutils/default.nix
@@ -116,6 +116,6 @@ in stdenv.mkDerivation rec {
     homepage = http://www.gnu.org/software/mailutils/;
 
     # Some of the dependencies fail to build on {cyg,dar}win.
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/tools/networking/miniupnpd/default.nix b/pkgs/tools/networking/miniupnpd/default.nix
index 129db56dc554..99e12084ccb5 100644
--- a/pkgs/tools/networking/miniupnpd/default.nix
+++ b/pkgs/tools/networking/miniupnpd/default.nix
@@ -3,11 +3,11 @@
 assert stdenv.isLinux;
 
 stdenv.mkDerivation rec {
-  name = "miniupnpd-2.0.20180410";
+  name = "miniupnpd-2.0.20180422";
 
   src = fetchurl {
     url = "http://miniupnp.free.fr/files/download.php?file=${name}.tar.gz";
-    sha256 = "1w4crmsmrygagh0v9phx8aicbyh6nypfjh2fdmknijngvx05biaq";
+    sha256 = "03g9r519p127sj6rl2x535022bwj8vzvdwp4385v7vnjrd4dswzy";
     name = "${name}.tar.gz";
   };
 
diff --git a/pkgs/tools/networking/netcat-openbsd/default.nix b/pkgs/tools/networking/netcat-openbsd/default.nix
deleted file mode 100644
index 1a79e17c6598..000000000000
--- a/pkgs/tools/networking/netcat-openbsd/default.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-{stdenv, fetchurl, fetchpatch, pkgconfig, libbsd}:
-
-stdenv.mkDerivation rec {
-  version = "1.190";
-  deb-version = "${version}-1";
-  name = "netcat-openbsd-${version}";
-
-  srcs = [
-    (fetchurl {
-      url = "mirror://debian/pool/main/n/netcat-openbsd/netcat-openbsd_${version}.orig.tar.gz";
-      sha256 = "0dp571m42zc7wvb9bf4hz5a08rcc5fknf0gdp98yq19c754c9k38";
-    })
-    (fetchurl {
-      url = "mirror://debian/pool/main/n/netcat-openbsd/netcat-openbsd_${deb-version}.debian.tar.xz";
-      sha256 = "0plgrri85sghzn499jzd9d3h7w61ksqj0amkwmcah8dmfkp7jrgv";
-    })
-  ];
-
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ libbsd ];
-
-  sourceRoot = name;
-
-  prePatch = ''
-    for i in $(cat ../debian/patches/series); do
-      patch -p1 < "../debian/patches/$i"
-    done
-  '';
-
-  patches = stdenv.lib.optional stdenv.hostPlatform.isMusl [
-    (fetchpatch {
-      url = "https://gitweb.gentoo.org/proj/musl.git/plain/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-b64_ntop.patch?id=4a5864922232c7df550c21f2a7b77fe6f8ffc6d6";
-      sha256 = "1cgqb6fxas5yiwf26hq57v627hhmcskl5j6rx30090ha2ksjqyvr";
-    })
-  ];
-
-  installPhase = ''
-    runHook preInstall
-    install -Dm0755 nc $out/bin/nc
-    install -Dm0644 nc.1 $out/share/man/man1/nc.1
-    runHook postInstall
-  '';
-
-  meta = with stdenv.lib; {
-    homepage = https://packages.debian.org/netcat-openbsd;
-    description = "TCP/IP swiss army knife, OpenBSD variant";
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ willibutz ];
-  };
-
-}
diff --git a/pkgs/tools/networking/netcat-gnu/default.nix b/pkgs/tools/networking/netcat/default.nix
index 47ec804e5d48..47ec804e5d48 100644
--- a/pkgs/tools/networking/netcat-gnu/default.nix
+++ b/pkgs/tools/networking/netcat/default.nix
diff --git a/pkgs/tools/networking/nss-mdns/default.nix b/pkgs/tools/networking/nss-mdns/default.nix
index b3d4ec95e061..9f83949e8de0 100644
--- a/pkgs/tools/networking/nss-mdns/default.nix
+++ b/pkgs/tools/networking/nss-mdns/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv }:
+{ fetchurl, stdenv, fetchpatch }:
 
 stdenv.mkDerivation rec {
   name = "nss-mdns-0.10";
@@ -20,6 +20,16 @@ stdenv.mkDerivation rec {
       "--localstatedir=/var"
     ];
 
+  patches = stdenv.lib.optional stdenv.hostPlatform.isMusl
+    (
+      fetchpatch
+      {
+        url = "https://raw.githubusercontent.com/openembedded/openembedded-core/94f780e889f194b67a48587ac68b3200288bee10/meta/recipes-connectivity/libnss-mdns/libnss-mdns/0001-check-for-nss.h.patch";
+        sha256 = "1l1kjbdw8z31br4vib3l5b85jy7kxin760a2f24lww8v6lqdpgds";
+      }
+    );
+
+
   meta = {
     description = "The mDNS Name Service Switch (NSS) plug-in";
     longDescription = ''
@@ -34,7 +44,7 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.lgpl2Plus;
 
     # Supports both the GNU and FreeBSD NSS.
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.freebsd;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux ++ stdenv.lib.platforms.freebsd;
 
     maintainers = [ ];
   };
diff --git a/pkgs/tools/networking/p2p/amule/default.nix b/pkgs/tools/networking/p2p/amule/default.nix
index c278cc989357..ac440fc6d338 100644
--- a/pkgs/tools/networking/p2p/amule/default.nix
+++ b/pkgs/tools/networking/p2p/amule/default.nix
@@ -65,7 +65,7 @@ mkDerivation rec {
 
     license = stdenv.lib.licenses.gpl2Plus;
 
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
     maintainers = [ stdenv.lib.maintainers.phreedom ];
   };
 }
diff --git a/pkgs/tools/networking/p2p/seeks/default.nix b/pkgs/tools/networking/p2p/seeks/default.nix
index f11c0a63b07e..2a89e419b2e4 100644
--- a/pkgs/tools/networking/p2p/seeks/default.nix
+++ b/pkgs/tools/networking/p2p/seeks/default.nix
@@ -63,7 +63,7 @@ stdenv.mkDerivation {
     maintainers = [
       stdenv.lib.maintainers.matejc
     ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
     broken = true; # 2018-04-11
   };
 }
diff --git a/pkgs/tools/networking/p2p/tahoe-lafs/default.nix b/pkgs/tools/networking/p2p/tahoe-lafs/default.nix
index 8c0c4a6c5664..c682100b4384 100644
--- a/pkgs/tools/networking/p2p/tahoe-lafs/default.nix
+++ b/pkgs/tools/networking/p2p/tahoe-lafs/default.nix
@@ -89,6 +89,6 @@ pythonPackages.buildPythonApplication rec {
     homepage = http://tahoe-lafs.org/;
     license = [ lib.licenses.gpl2Plus /* or */ "TGPPLv1+" ];
     maintainers = with lib.maintainers; [ MostAwesomeDude ];
-    platforms = lib.platforms.gnu;  # arbitrary choice
+    platforms = lib.platforms.gnu ++ lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/networking/strongswan/default.nix b/pkgs/tools/networking/strongswan/default.nix
index 042f8bea3d62..eb466745ef84 100644
--- a/pkgs/tools/networking/strongswan/default.nix
+++ b/pkgs/tools/networking/strongswan/default.nix
@@ -3,11 +3,15 @@
 , gmp, python, iptables, ldns, unbound, openssl, pcsclite
 , openresolv
 , systemd, pam
-
-, enableTNC            ? false, curl, trousers, sqlite, libxml2
+, curl
+, enableTNC            ? false, trousers, sqlite, libxml2
 , enableNetworkManager ? false, networkmanager
 }:
 
+# Note on curl support: If curl is built with gnutls as its backend, the
+# strongswan curl plugin may break.
+# See https://wiki.strongswan.org/projects/strongswan/wiki/Curl for more info.
+
 with stdenv.lib;
 
 stdenv.mkDerivation rec {
@@ -23,8 +27,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig autoreconfHook ];
   buildInputs =
-    [ gmp python iptables ldns unbound openssl pcsclite ]
-    ++ optionals enableTNC [ curl trousers sqlite libxml2 ]
+    [ curl gmp python iptables ldns unbound openssl pcsclite ]
+    ++ optionals enableTNC [ trousers sqlite libxml2 ]
     ++ optionals stdenv.isLinux [ systemd.dev pam ]
     ++ optionals enableNetworkManager [ networkmanager ];
 
@@ -61,12 +65,12 @@ stdenv.mkDerivation rec {
       "--enable-eap-mschapv2" "--enable-eap-radius" "--enable-xauth-eap" "--enable-ext-auth"
       "--enable-forecast" "--enable-connmark" "--enable-acert"
       "--enable-pkcs11" "--enable-eap-sim-pcsc" "--enable-dnscert" "--enable-unbound"
-      "--enable-af-alg" "--enable-xauth-pam" "--enable-chapoly" ]
+      "--enable-af-alg" "--enable-xauth-pam" "--enable-chapoly"
+      "--enable-curl" ]
     ++ optionals stdenv.isx86_64 [ "--enable-aesni" "--enable-rdrand" ]
     ++ optional (stdenv.system == "i686-linux") "--enable-padlock"
     ++ optionals enableTNC [
          "--disable-gmp" "--disable-aes" "--disable-md5" "--disable-sha1" "--disable-sha2" "--disable-fips-prf"
-         "--enable-curl"
          "--enable-eap-tnc" "--enable-eap-ttls" "--enable-eap-dynamic" "--enable-tnccs-20"
          "--enable-tnc-imc" "--enable-imc-os" "--enable-imc-attestation"
          "--enable-tnc-imv" "--enable-imv-attestation"
diff --git a/pkgs/tools/networking/telnet/default.nix b/pkgs/tools/networking/telnet/default.nix
index 3a5117653c83..c38f3c46fa46 100644
--- a/pkgs/tools/networking/telnet/default.nix
+++ b/pkgs/tools/networking/telnet/default.nix
@@ -17,6 +17,6 @@ stdenv.mkDerivation {
     description = "A client and daemon for the Telnet protocol";
     homepage = ftp://ftp.suse.com/pub/people/kukuk/ipv6/;
     license = "BSD";
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/networking/toxvpn/default.nix b/pkgs/tools/networking/toxvpn/default.nix
index c7fa1c7a2719..ccb9f3bc0d6b 100644
--- a/pkgs/tools/networking/toxvpn/default.nix
+++ b/pkgs/tools/networking/toxvpn/default.nix
@@ -1,25 +1,22 @@
 { stdenv, fetchFromGitHub, cmake, nlohmann_json,
-libtoxcore, libsodium, systemd, libcap, zeromq }:
+  libtoxcore, libsodium, libcap, zeromq,
+  systemd ? null }:
 
 with stdenv.lib;
 
-let
-  systemdOrNull = if stdenv.system == "x86_64-darwin" then null else systemd;
-  if_systemd = optional (systemdOrNull != null);
-in stdenv.mkDerivation rec {
-  name = "toxvpn-${version}";
-  version = "2017-06-25";
+stdenv.mkDerivation rec {
+  name = "toxvpn-2018-04-17";
 
   src = fetchFromGitHub {
     owner  = "cleverca22";
     repo   = "toxvpn";
-    rev    = "7bd6f169d69c511affa8c9672e8f794e4e205a44";
-    sha256 = "1km8hkrxmrnca1b49vbw5kyldayaln5plvz78vhf8325r6c5san0";
+    rev    = "dc766f98888f500ea51f002f59007eac3f3a0a06";
+    sha256 = "19br3fmrdm45fvymj9kvwikkn8m657yd5fkhx6grv35ckrj83mxz";
   };
 
   buildInputs = [ libtoxcore nlohmann_json libsodium zeromq ]
-    ++ if_systemd systemd
-    ++ optional (stdenv.system != "x86_64-darwin") libcap;
+    ++ optionals stdenv.isLinux [ libcap systemd ];
+
   nativeBuildInputs = [ cmake ];
 
   cmakeFlags = optional stdenv.isLinux [ "-DSYSTEMD=1" ];
diff --git a/pkgs/tools/security/gnupg/1.nix b/pkgs/tools/security/gnupg/1.nix
index fa4555dcafb9..9a147caa7e21 100644
--- a/pkgs/tools/security/gnupg/1.nix
+++ b/pkgs/tools/security/gnupg/1.nix
@@ -27,6 +27,6 @@ stdenv.mkDerivation rec {
       other applications.  A wealth of frontend applications and libraries are
       available.
     '';
-    platforms = platforms.gnu; # arbitrary choice
+    platforms = platforms.gnu ++ platforms.linux; # arbitrary choice
   };
 }
diff --git a/pkgs/tools/security/monkeysphere/default.nix b/pkgs/tools/security/monkeysphere/default.nix
index f0d3a870676c..d1266ca495ed 100644
--- a/pkgs/tools/security/monkeysphere/default.nix
+++ b/pkgs/tools/security/monkeysphere/default.nix
@@ -24,6 +24,11 @@ stdenv.mkDerivation rec {
         CryptOpenSSLRSA
         CryptOpenSSLBignum
       ]}"
+    wrapProgram $out/bin/monkeysphere --prefix PERL5LIB :\
+      "${with perlPackages; stdenv.lib.makePerlPath [
+        CryptOpenSSLRSA
+        CryptOpenSSLBignum
+      ]}"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/security/notary/default.nix b/pkgs/tools/security/notary/default.nix
index 4a42c9162e1b..071bfdaea005 100644
--- a/pkgs/tools/security/notary/default.nix
+++ b/pkgs/tools/security/notary/default.nix
@@ -1,32 +1,42 @@
-{ stdenv, fetchFromGitHub, buildGoPackage, git, libtool }:
+{ stdenv, fetchFromGitHub, buildGoPackage, libtool }:
 
 buildGoPackage rec {
   name = "notary-${version}";
-  version = "0.6.0";
-  gitcommit = "34f53ad";
+  version = "0.6.1";
+  gitcommit = "d6e1431f";
 
   src = fetchFromGitHub {
     owner = "theupdateframework";
     repo = "notary";
     rev = "v${version}";
-    sha256 = "0lg7ab2agkk3rnladcvpdzk8cnf3m49qfm4sanh7yjvlvlv1wm4a";
+    sha256 = "1ak9dk6vjny5069hp3w36dbjawcnaq82l3i2qvf7mn7zfglbsnf9";
   };
 
-  buildInputs = [ libtool ];
-
-  goPackagePath = "github.com/theupdateframework/notary";
+  patches = [ ./no-git-usage.patch ];
 
+  buildInputs = [ libtool ];
   buildPhase = ''
+    runHook preBuild
     cd go/src/github.com/theupdateframework/notary
-    make GITCOMMIT=${gitcommit} GITUNTRACKEDCHANGES= client
+    make client GITCOMMIT=${gitcommit}
+    runHook postBuild
   '';
 
+  goPackagePath = "github.com/theupdateframework/notary";
+
   installPhase = ''
+    runHook preInstall
     install -D bin/notary $bin/bin/notary
+    runHook postInstall
+  '';
+
+  doCheck = true;
+  checkPhase = ''
+    make test PKGS=github.com/theupdateframework/notary/cmd/notary
   '';
 
   meta = with stdenv.lib; {
-    description = " Notary is a project that allows anyone to have trust over arbitrary collections of data";
+    description = "Notary is a project that allows anyone to have trust over arbitrary collections of data";
     longDescription = ''
       The Notary project comprises a server and a client for running and
       interacting with trusted collections. See the service architecture
@@ -49,7 +59,7 @@ buildGoPackage rec {
     '';
     license = licenses.asl20;
     homepage = https://github.com/theupdateframework/notary;
-    maintainers = with maintainers; [ vdemeester ];
-    platforms = with platforms; unix;
+    maintainers = with maintainers; [ vdemeester ma27 ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/tools/security/notary/no-git-usage.patch b/pkgs/tools/security/notary/no-git-usage.patch
new file mode 100644
index 000000000000..363eefe36921
--- /dev/null
+++ b/pkgs/tools/security/notary/no-git-usage.patch
@@ -0,0 +1,15 @@
+diff --git a/Makefile b/Makefile
+index ab794165..0cbd047f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -5,8 +5,8 @@ PREFIX?=$(shell pwd)
+ # Add to compile time flags
+ NOTARY_PKG := github.com/theupdateframework/notary
+ NOTARY_VERSION := $(shell cat NOTARY_VERSION)
+-GITCOMMIT := $(shell git rev-parse --short HEAD)
+-GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
++GITCOMMIT ?= $(shell git rev-parse --short HEAD)
++GITUNTRACKEDCHANGES :=
+ ifneq ($(GITUNTRACKEDCHANGES),)
+ GITCOMMIT := $(GITCOMMIT)-dirty
+ endif
diff --git a/pkgs/tools/security/pcsc-scm-scl011/default.nix b/pkgs/tools/security/pcsc-scm-scl011/default.nix
index 88b5c147f303..1418a4ead580 100644
--- a/pkgs/tools/security/pcsc-scm-scl011/default.nix
+++ b/pkgs/tools/security/pcsc-scm-scl011/default.nix
@@ -17,10 +17,9 @@ stdenv.mkDerivation rec {
   buildInputs = [ unzip ];
 
   unpackPhase = ''
-    echo ${stdenv.system}
     unzip $src
     tar xf "Linux Driver Ver${version}/sclgeneric_${version}_linux_${arch}bit.tar.gz"
-    cd sclgeneric_${version}_linux_${arch}bit; export sourceRoot=`pwd`
+    export sourceRoot=$(readlink -e sclgeneric_${version}_linux_${arch}bit)
   '';
 
   # Add support for SCL011 nPA (subsidized model for German eID)
diff --git a/pkgs/tools/security/pius/default.nix b/pkgs/tools/security/pius/default.nix
index eb05c3748078..f9dced33ed46 100644
--- a/pkgs/tools/security/pius/default.nix
+++ b/pkgs/tools/security/pius/default.nix
@@ -32,7 +32,7 @@ pythonPackages.buildPythonApplication {
 
     license = stdenv.lib.licenses.gpl2;
 
-    platforms = stdenv.lib.platforms.gnu;
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;
     maintainers = with stdenv.lib.maintainers; [ fuuzetsu kierdavis ];
   };
 }
diff --git a/pkgs/tools/system/freeipmi/default.nix b/pkgs/tools/system/freeipmi/default.nix
index fd70dce4edf3..6996d66abe0c 100644
--- a/pkgs/tools/system/freeipmi/default.nix
+++ b/pkgs/tools/system/freeipmi/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl3Plus;
 
     maintainers = with stdenv.lib.maintainers; [ raskin ];
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
 
     updateWalker = true;
     inherit version;
diff --git a/pkgs/tools/system/osquery/default.nix b/pkgs/tools/system/osquery/default.nix
index 2a719efd79b3..a0aaa846bc73 100644
--- a/pkgs/tools/system/osquery/default.nix
+++ b/pkgs/tools/system/osquery/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   # this is what `osquery --help` will show as the version.
   OSQUERY_BUILD_VERSION = version;
-  OSQUERY_PLATFORM = "nixos;${builtins.readFile "${toString path}/.version"}";
+  OSQUERY_PLATFORM = "nixos;${stdenv.lib.version}";
 
   src = fetchFromGitHub {
     owner = "facebook";
diff --git a/pkgs/tools/system/psstop/default.nix b/pkgs/tools/system/psstop/default.nix
new file mode 100644
index 000000000000..178e08938fea
--- /dev/null
+++ b/pkgs/tools/system/psstop/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, glib }:
+
+stdenv.mkDerivation rec {
+  name = "psstop-${version}";
+  version = "1.3";
+
+  src = fetchFromGitHub {
+    owner = "clearlinux";
+    repo = "psstop";
+    rev = "v${version}";
+    sha256 = "03ir3jjpzm7q8n1qc5jr99hqarr9r529w1zb6f7q4wak2vfj7w9h";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [ glib ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/clearlinux/psstop;
+    description = "Show processes' memory usage by looking into pss"; # upstream summary
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/pkgs/tools/text/highlight/default.nix b/pkgs/tools/text/highlight/default.nix
index 1fcfdd85e7ae..c2fe3fcd5761 100644
--- a/pkgs/tools/text/highlight/default.nix
+++ b/pkgs/tools/text/highlight/default.nix
@@ -4,13 +4,13 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "highlight-${version}";
-  version = "3.42";
+  version = "3.43";
 
   src = fetchFromGitHub {
     owner = "andre-simon";
     repo = "highlight";
-    rev = "${version}";
-    sha256 = "1fxx827igzqjn5rri57b8980hnd3ixz3j7smfxwi1ivfhlfznzgr";
+    rev = "v${version}";
+    sha256 = "126nsf4cjxflg2kiv72qf1xl5fsilk0jqcncs6qqgm72cpjfmlsy";
   };
 
   nativeBuildInputs = [ pkgconfig ] ++ optional stdenv.isDarwin  gcc ;
diff --git a/pkgs/tools/text/namazu/default.nix b/pkgs/tools/text/namazu/default.nix
index 21548de5efbd..67a26cb41aa0 100644
--- a/pkgs/tools/text/namazu/default.nix
+++ b/pkgs/tools/text/namazu/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
     homepage = http://namazu.org/;
 
-    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
     maintainers = [ ];
     broken = true; # File-MMagic is not compatible with our Perl version
   };
diff --git a/pkgs/tools/text/numdiff/default.nix b/pkgs/tools/text/numdiff/default.nix
index 96c91def9ac7..4741fecb90c1 100644
--- a/pkgs/tools/text/numdiff/default.nix
+++ b/pkgs/tools/text/numdiff/default.nix
@@ -18,6 +18,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.nongnu.org/numdiff/;
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ ndowens ];
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/tools/text/xml/html-xml-utils/default.nix b/pkgs/tools/text/xml/html-xml-utils/default.nix
index 987d192bafcd..f681ae62aeaa 100644
--- a/pkgs/tools/text/xml/html-xml-utils/default.nix
+++ b/pkgs/tools/text/xml/html-xml-utils/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "html-xml-utils-${version}";
-  version = "7.6";
+  version = "7.7";
 
   src = fetchurl {
     url = "http://www.w3.org/Tools/HTML-XML-utils/${name}.tar.gz";
-    sha256 = "0l97ps089byy62838wf2jwvvc465iw29z9r5kwmwcq7f3bn11y3m";
+    sha256 = "1vwqp5q276j8di9zql3kygf31z2frp2c59yjqlrvvwcvccvkcdwr";
   };
 
   buildInputs = [curl libiconv];
diff --git a/pkgs/tools/text/xml/xmlformat/default.nix b/pkgs/tools/text/xml/xmlformat/default.nix
new file mode 100644
index 000000000000..5982aa3828ef
--- /dev/null
+++ b/pkgs/tools/text/xml/xmlformat/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, perl }:
+stdenv.mkDerivation rec {
+  name = "xmlformat-${version}";
+  version = "1.04";
+
+  src = fetchurl {
+    url = "http://www.kitebird.com/software/xmlformat/xmlformat-${version}.tar.gz";
+    sha256 = "1vwgzn4ha0az7dx0cyc6dx5nywwrx9gxhyh08mvdcq27wjbh79vi";
+  };
+
+  buildInputs = [ perl ];
+  buildPhase = ''
+    patchShebangs ./xmlformat.pl
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp ./xmlformat.pl $out/bin/xmlformat
+    cp ./LICENSE $out/
+  '';
+
+  meta = {
+    description = "a configurable formatter (or 'pretty-printer') for XML documents";
+    homepage = "http://www.kitebird.com/software/xmlformat/";
+    license = stdenv.lib.licenses.bsd3;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/tools/video/dvgrab/default.nix b/pkgs/tools/video/dvgrab/default.nix
index cec4fc1ce8bf..752a6f314325 100644
--- a/pkgs/tools/video/dvgrab/default.nix
+++ b/pkgs/tools/video/dvgrab/default.nix
@@ -34,6 +34,6 @@ stdenv.mkDerivation rec {
     homepage = http://kinodv.org/;
 
     license = licenses.gpl2Plus;
-    platforms = platforms.gnu;
+    platforms = platforms.gnu ++ platforms.linux;
   };
 }
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index 4b4dd2bf915d..334905b79f2b 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -138,6 +138,7 @@ mapAliases (rec {
   mupen64plus1_5 = mupen64plus; # added 2016-02-12
   mysqlWorkbench = mysql-workbench; # added 2017-01-19
   ncat = nmap;  # added 2016-01-26
+  netcat-openbsd = libressl.nc; # added 2018-04-25
   networkmanager_fortisslvpn = networkmanager-fortisslvpn; # added 2018-02-25
   networkmanager_iodine = networkmanager-iodine; # added 2018-02-25
   networkmanager_l2tp = networkmanager-l2tp; # added 2018-02-25
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3ba524aa722a..b20cf36a05fb 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1358,6 +1358,8 @@ with pkgs;
 
   ps_mem = callPackage ../tools/system/ps_mem { };
 
+  psstop = callPackage ../tools/system/psstop { };
+
   parallel-rust = callPackage ../tools/misc/parallel-rust { };
 
   socklog = callPackage ../tools/system/socklog { };
@@ -2105,6 +2107,8 @@ with pkgs;
 
   mcrcon = callPackage ../tools/networking/mcrcon {};
 
+  tealdeer = callPackage ../tools/misc/tealdeer/default.nix { };
+
   uudeview = callPackage ../tools/misc/uudeview { };
 
   uutils-coreutils = callPackage ../tools/misc/uutils-coreutils {
@@ -3879,9 +3883,7 @@ with pkgs;
 
   netcat = netcat-openbsd;
 
-  netcat-gnu = callPackage ../tools/networking/netcat-gnu { };
-
-  netcat-openbsd = callPackage ../tools/networking/netcat-openbsd { };
+  netcat-gnu = callPackage ../tools/networking/netcat { };
 
   nethogs = callPackage ../tools/networking/nethogs { };
 
@@ -4286,6 +4288,8 @@ with pkgs;
 
   pdfmod = callPackage ../applications/misc/pdfmod { };
 
+  pdf-quench = callPackage ../applications/misc/pdf-quench { };
+
   jbig2enc = callPackage ../tools/graphics/jbig2enc { };
 
   pdfread = callPackage ../tools/graphics/pdfread {
@@ -5220,7 +5224,7 @@ with pkgs;
 
   torsocks = callPackage ../tools/security/tor/torsocks.nix { };
 
-  toxvpn = callPackage ../tools/networking/toxvpn { };
+  toxvpn = callPackage ../tools/networking/toxvpn { libtoxcore = libtoxcore_0_1; };
 
   tpmmanager = callPackage ../applications/misc/tpmmanager { };
 
@@ -5732,6 +5736,8 @@ with pkgs;
 
   xml2 = callPackage ../tools/text/xml/xml2 { };
 
+  xmlformat = callPackage ../tools/text/xml/xmlformat { };
+
   xmlroff = callPackage ../tools/typesetting/xmlroff { };
 
   xmloscopy = callPackage ../tools/text/xml/xmloscopy { };
@@ -8949,6 +8955,10 @@ with pkgs;
     gtk = self.gtk2;
   };
 
+  gegl_0_4 = callPackage ../development/libraries/gegl/4.0.nix {
+    gtk = self.gtk2;
+  };
+
   geoclue = callPackage ../development/libraries/geoclue {};
 
   geoclue2 = callPackage ../development/libraries/geoclue/2.0.nix {};
@@ -10358,9 +10368,12 @@ with pkgs;
 
   libtorrentRasterbar = callPackage ../development/libraries/libtorrent-rasterbar { };
 
+  # this is still the new version of the old API
   libtoxcore-new = callPackage ../development/libraries/libtoxcore/new-api.nix { };
 
-  libtoxcore = callPackage ../development/libraries/libtoxcore { };
+  inherit (callPackages ../development/libraries/libtoxcore {})
+    libtoxcore_0_1 libtoxcore_0_2;
+  libtoxcore = libtoxcore_0_2;
 
   libtap = callPackage ../development/libraries/libtap { };
 
@@ -15908,16 +15921,14 @@ with pkgs;
 
   ghq = gitAndTools.ghq;
 
-  gimp_2_8 = callPackage ../applications/graphics/gimp/2.8.nix {
-    webkit = null;
+  gimp = callPackage ../applications/graphics/gimp {
+    gegl = gegl_0_4;
     lcms = lcms2;
+    inherit (gnome3) gexiv2;
     inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
   };
 
-  gimp = gimp_2_8;
-
   gimp-with-plugins = callPackage ../applications/graphics/gimp/wrapper.nix {
-    gimp = gimp_2_8;
     plugins = null; # All packaged plugins enabled, if not explicit plugin list supplied
   };
 
@@ -16026,6 +16037,8 @@ with pkgs;
 
   gnunet = callPackage ../applications/networking/p2p/gnunet { };
 
+  gnunet_git = lowPrio (callPackage ../applications/networking/p2p/gnunet/git.nix { });
+
   gnunet_svn = lowPrio (callPackage ../applications/networking/p2p/gnunet/svn.nix { });
 
   gocr = callPackage ../applications/graphics/gocr { };
@@ -17080,6 +17093,8 @@ with pkgs;
 
   mypaint = callPackage ../applications/graphics/mypaint { };
 
+  mypaint-brushes = callPackage ../development/libraries/mypaint-brushes { };
+
   mythtv = libsForQt5.callPackage ../applications/video/mythtv { };
 
   micro = callPackage ../applications/editors/micro { };
@@ -17424,8 +17439,6 @@ with pkgs;
     inherit (darwin.stubs) rez setfile;
   };
 
-  qemu-riscv = lowPrio (callPackage ../applications/virtualization/qemu/riscv.nix {});
-
   qgis = callPackage ../applications/gis/qgis {
     inherit (darwin.apple_sdk.frameworks) IOKit ApplicationServices;
   };
@@ -17465,7 +17478,7 @@ with pkgs;
 
   qtbitcointrader = callPackage ../applications/misc/qtbitcointrader { };
 
-  qtox = libsForQt5.callPackage ../applications/networking/instant-messengers/qtox { ffmpeg = ffmpeg_2; };
+  qtox = libsForQt5.callPackage ../applications/networking/instant-messengers/qtox { };
 
   qtpass = libsForQt5.callPackage ../applications/misc/qtpass { };
 
@@ -18222,7 +18235,7 @@ with pkgs;
 
   vimNox = lowPrio (vim_configurable.override { source = "vim-nox"; });
 
-  qpdfview = callPackage ../applications/misc/qpdfview {};
+  qpdfview = libsForQt5.callPackage ../applications/misc/qpdfview {};
 
   qtile = callPackage ../applications/window-managers/qtile {
     inherit (xorg) libxcb;
@@ -19453,6 +19466,8 @@ with pkgs;
 
   tremulous = callPackage ../games/tremulous { };
 
+  tuxpaint = callPackage ../games/tuxpaint { };
+
   speed_dreams = callPackage ../games/speed-dreams {
     # Torcs wants to make shared libraries linked with plib libraries (it provides static).
     # i686 is the only platform I know than can do that linking without plib built with -fPIC
@@ -20634,7 +20649,7 @@ with pkgs;
 
   hplip_3_16_11 = callPackage ../misc/drivers/hplip/3.16.11.nix { };
 
-  hplipWithPlugin_3_16_11 = hplip.override { withPlugin = true; };
+  hplipWithPlugin_3_16_11 = hplip_3_16_11.override { withPlugin = true; };
 
   hyperfine = callPackage ../tools/misc/hyperfine { };
 
@@ -21383,5 +21398,5 @@ with pkgs;
                       mount wall hostname more sysctl;
 
   inherit (recurseIntoAttrs (callPackages ../os-specific/bsd { }))
-          netbsd openbsd;
+          netbsd;
 }
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index f24d6ff955bd..6635721ee958 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -6342,6 +6342,8 @@ in {
     propagatedBuildInputs = with self; [ requests webob ];
   };
 
+  hdbscan = callPackage ../development/python-modules/hdbscan { };
+
   hmmlearn = callPackage ../development/python-modules/hmmlearn { };
 
   hcs_utils = callPackage ../development/python-modules/hcs_utils { };
@@ -8244,6 +8246,8 @@ in {
 
   pygraphviz = callPackage ../development/python-modules/pygraphviz { };
 
+  pymc3 = callPackage ../development/python-modules/pymc3 { };
+
   pympler = buildPythonPackage rec {
     pname = "Pympler";
     version = "0.4.3";
@@ -9673,24 +9677,7 @@ in {
     };
   };
 
-  patsy = buildPythonPackage rec {
-    name = "patsy-${version}";
-    version = "0.3.0";
-
-    src = pkgs.fetchurl{
-      url = "mirror://pypi/p/patsy/${name}.zip";
-      sha256 = "a55dd4ca09af4b9608b81f30322beb450510964c022708ab50e83a065ccf15f0";
-    };
-
-    buildInputs = with self; [ nose ];
-    propagatedBuildInputs = with self; [six numpy];
-
-    meta = {
-      description = "A Python package for describing statistical models";
-      homepage = "https://github.com/pydata/patsy";
-      license = licenses.bsd2;
-    };
-  };
+  patsy = callPackage ../development/python-modules/patsy { };
 
   paste = buildPythonPackage rec {
     name = "paste-${version}";