summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/mp3info/default.nix2
-rw-r--r--pkgs/applications/editors/jetbrains/default.nix6
-rw-r--r--pkgs/applications/editors/tecoc/default.nix2
-rw-r--r--pkgs/applications/graphics/giv/build.patch17
-rw-r--r--pkgs/applications/graphics/giv/default.nix7
-rw-r--r--pkgs/applications/graphics/pqiv/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix8
-rw-r--r--pkgs/applications/networking/gns3/default.nix30
-rw-r--r--pkgs/applications/networking/gns3/gui.nix27
-rw-r--r--pkgs/applications/networking/gns3/server.nix62
-rw-r--r--pkgs/applications/networking/mailreaders/neomutt/default.nix5
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix2
-rw-r--r--pkgs/applications/science/biology/plink-ng/default.nix2
-rw-r--r--pkgs/applications/science/logic/jonprl/default.nix2
-rw-r--r--pkgs/applications/science/math/calc/default.nix4
-rw-r--r--pkgs/applications/science/math/singular/default.nix4
-rw-r--r--pkgs/applications/video/ogmtools/default.nix2
-rw-r--r--pkgs/build-support/docker/default.nix161
-rw-r--r--pkgs/build-support/docker/examples.nix17
-rw-r--r--pkgs/desktops/lxde/core/lxappearance/default.nix2
-rw-r--r--pkgs/desktops/mate/libmatemixer/default.nix2
-rw-r--r--pkgs/desktops/mate/mate-desktop/default.nix2
-rw-r--r--pkgs/development/compilers/openjdk/8.nix28
-rw-r--r--pkgs/development/compilers/openjdk/9.nix262
-rw-r--r--pkgs/development/compilers/openjdk/fix-java-home-jdk9.patch14
-rw-r--r--pkgs/development/compilers/openjdk/read-truststore-from-env-jdk9.patch20
-rw-r--r--pkgs/development/compilers/openjdk/swing-use-gtk-jdk9.patch26
-rw-r--r--pkgs/development/libraries/dirac/default.nix2
-rw-r--r--pkgs/development/libraries/idnkit/default.nix2
-rw-r--r--pkgs/development/libraries/lmdb/default.nix12
-rw-r--r--pkgs/development/libraries/qt-5/qtbase-setup-hook.sh2
-rw-r--r--pkgs/development/libraries/resolv_wrapper/default.nix2
-rw-r--r--pkgs/development/python-modules/blessed/default.nix21
-rw-r--r--pkgs/development/python-modules/cement/default.nix23
-rw-r--r--pkgs/development/qtcreator/default.nix6
-rw-r--r--pkgs/development/tools/textql/default.nix6
-rw-r--r--pkgs/games/trackballs/default.nix35
-rw-r--r--pkgs/misc/tw-rs/default.nix6
-rw-r--r--pkgs/tools/filesystems/sshfs-fuse/default.nix8
-rw-r--r--pkgs/tools/misc/osm2pgsql/default.nix2
-rw-r--r--pkgs/tools/misc/shallot/default.nix2
-rw-r--r--pkgs/tools/misc/snapper/default.nix4
-rw-r--r--pkgs/tools/networking/cjdns/default.nix2
-rw-r--r--pkgs/tools/networking/ferm/default.nix6
-rw-r--r--pkgs/tools/networking/packetdrill/default.nix2
-rw-r--r--pkgs/tools/networking/redsocks/default.nix2
-rw-r--r--pkgs/tools/package-management/nox/default.nix2
-rw-r--r--pkgs/tools/package-management/nox/nox-review-wip.patch11
-rw-r--r--pkgs/tools/security/tor/default.nix2
-rw-r--r--pkgs/tools/security/trousers/default.nix2
-rw-r--r--pkgs/tools/system/gdmap/default.nix2
-rw-r--r--pkgs/tools/text/nawk/default.nix2
-rw-r--r--pkgs/tools/virtualization/awsebcli/default.nix99
-rw-r--r--pkgs/top-level/all-packages.nix36
-rw-r--r--pkgs/top-level/python-packages.nix43
55 files changed, 842 insertions, 220 deletions
diff --git a/pkgs/applications/audio/mp3info/default.nix b/pkgs/applications/audio/mp3info/default.nix
index 5f1d2bfa93d5..1a1ebc56a841 100644
--- a/pkgs/applications/audio/mp3info/default.nix
+++ b/pkgs/applications/audio/mp3info/default.nix
@@ -39,6 +39,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
 
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix
index 06cc189ca406..65721361cd6b 100644
--- a/pkgs/applications/editors/jetbrains/default.nix
+++ b/pkgs/applications/editors/jetbrains/default.nix
@@ -232,15 +232,15 @@ in
 
   datagrip = buildDataGrip rec {
     name = "datagrip-${version}";
-    version = "2017.1.5"; /* updated by script */
+    version = "2017.2.2"; /* updated by script */
     description = "Your Swiss Army Knife for Databases and SQL";
     license = stdenv.lib.licenses.unfree;
     src = fetchurl {
       url = "https://download.jetbrains.com/datagrip/${name}.tar.gz";
-      sha256 = "8847c35761fcf6fc7a1d3f2bed0fa3971fbf28721c144f41d21feb473bb212dc"; /* updated by script */
+      sha256 = "1l8y65fw9g5ckzwpcgigm2qwy8fhpw2hil576rphsnx6qvnh4swn"; /* updated by script */
     };
     wmClass = "jetbrains-datagrip";
-    update-channel = "datagrip_2017_1";
+    update-channel = "datagrip_2017_2";
   };
 
   gogland = buildGogland rec {
diff --git a/pkgs/applications/editors/tecoc/default.nix b/pkgs/applications/editors/tecoc/default.nix
index a3f58012e534..1c5730838ff1 100644
--- a/pkgs/applications/editors/tecoc/default.nix
+++ b/pkgs/applications/editors/tecoc/default.nix
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
  '';
     homepage = https://github.com/blakemcbride/TECOC;
     maintainers = [ maintainers.AndersonTorres ];
-    platforms = platforms.unix;
+    platforms = platforms.linux;
   };
 }
 # TODO: test in other platforms - especially Darwin
diff --git a/pkgs/applications/graphics/giv/build.patch b/pkgs/applications/graphics/giv/build.patch
index ec343c902386..f57689fd3fa9 100644
--- a/pkgs/applications/graphics/giv/build.patch
+++ b/pkgs/applications/graphics/giv/build.patch
@@ -2,16 +2,21 @@ Get the environment propagated to scons forked childs, and correct the dicom plu
 a typedef of size_t that failed at least on x86_64-linux.
 
 diff --git a/SConstruct b/SConstruct
-index 16eccd9..603e931 100644
+index 9e752d6..f93f27f 100644
 --- a/SConstruct
 +++ b/SConstruct
-@@ -7,8 +7,7 @@ else:
-     cppflags = ['-O2']
-     variant = 'Release'
+@@ -9,13 +9,7 @@ else:
+ 
+ commit_id = os.popen('git rev-parse HEAD').read().replace('\n','')
  
 -env = Environment(LIBPATH=[],
--                  CPPFLAGS = cppflags)
+-                  CPPFLAGS = cppflags + ['-Wno-deprecated-declarations',
+-                                         '-Wno-reorder',
+-                                         '-Wno-unused-but-set-variable',
+-                                         '-Wno-unused-function'],
+-                  CXXFLAGS=['-std=c++1y']
+-                  )
 +env = Environment(ENV = os.environ)
  
  env['SBOX'] = False
- 
+ env['COMMITIDSHORT'] = commit_id[0:6]
diff --git a/pkgs/applications/graphics/giv/default.nix b/pkgs/applications/graphics/giv/default.nix
index 6c892f1bfd4e..5c15c98e482b 100644
--- a/pkgs/applications/graphics/giv/default.nix
+++ b/pkgs/applications/graphics/giv/default.nix
@@ -2,13 +2,14 @@
   pcre, cfitsio, perl, gob2, vala_0_23, libtiff, json_glib }:
 
 stdenv.mkDerivation rec {
-  name = "giv-20150811-git";
+  name = "giv-${version}";
+  version = "0.9.26";
 
   src = fetchFromGitHub {
     owner = "dov";
     repo = "giv";
-    rev = "64648bfbbf10ec4a9adfbc939c96c7d1dbdce57a";
-    sha256 = "1sz2n7jbmg3g97bs613xxjpzqbsl5rvpg6v7g3x3ycyd35r8vsfp";
+    rev = "v${version}";
+    sha256 = "1sfm8j3hvqij6z3h8xz724d7hjqqbzljl2a6pp4yjpnnrxksnic2";
   };
 
   hardeningDisable = [ "format" ];
diff --git a/pkgs/applications/graphics/pqiv/default.nix b/pkgs/applications/graphics/pqiv/default.nix
index 7e375367a2d2..202bbb5b13f4 100644
--- a/pkgs/applications/graphics/pqiv/default.nix
+++ b/pkgs/applications/graphics/pqiv/default.nix
@@ -21,6 +21,6 @@ stdenv.mkDerivation (rec {
     homepage = http://www.pberndt.com/Programme/Linux/pqiv;
     license = licenses.gpl3;
     maintainers = [ maintainers.ndowens ];
-    platforms = platforms.unix;
+    platforms = platforms.linux;
   };
 })
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 b91b789a22b9..1e61cabb7a12 100644
--- a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
+++ b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
@@ -44,6 +44,10 @@
 , hicolor_icon_theme
 , shared_mime_info
 
+# Whether to disable multiprocess support to work around crashing tabs
+# TODO: fix the underlying problem instead of this terrible work-around
+, disableContentSandbox ? true
+
 # Extra preferences
 , extraPrefs ? ""
 }:
@@ -210,6 +214,10 @@ stdenv.mkDerivation rec {
     lockPref("extensions.torlauncher.control_port_use_ipc", true);
     lockPref("extensions.torlauncher.socks_port_use_ipc", true);
 
+    // Optionally disable multiprocess support.  We always set this to ensure that
+    // toggling the pref takes effect.
+    lockPref("browser.tabs.remote.autostart.2", ${if disableContentSandbox then "false" else "true"});
+
     ${optionalString (extraPrefs != "") ''
       ${extraPrefs}
     ''}
diff --git a/pkgs/applications/networking/gns3/default.nix b/pkgs/applications/networking/gns3/default.nix
new file mode 100644
index 000000000000..bec700367da8
--- /dev/null
+++ b/pkgs/applications/networking/gns3/default.nix
@@ -0,0 +1,30 @@
+{ callPackage, stdenv }:
+
+let
+  stableVersion = "2.0.3";
+  previewVersion = "2.1.0rc1";
+  addVersion = args:
+    let version = if args.stable then stableVersion else previewVersion;
+        branch = if args.stable then "stable" else "preview";
+    in args // { inherit version branch; };
+  mkGui = args: callPackage (import ./gui.nix (addVersion args)) { };
+  mkServer = args: callPackage (import ./server.nix (addVersion args)) { };
+in {
+  guiStable = mkGui {
+    stable = true;
+    sha256Hash = "10qp6430md8d0h2wamgfaq7pai59mqmcw6sw3i1gvb20m0avvsvb";
+  };
+  guiPreview = mkGui {
+    stable = false;
+    sha256Hash = "0rmvanzc0fjw9giqwnf98yc49cxaz637w8b865dv08lcf1fg9j8l";
+  };
+
+  serverStable = mkServer {
+    stable = true;
+    sha256Hash = "1c7mzj1r2zh90a7vs3s17jakfp9s43b8nnj29rpamqxvl3qhbdy7";
+  };
+  serverPreview = mkServer {
+    stable = false;
+    sha256Hash = "181689fpjxq4hy2lyxk4zciqhgnhj5srvb4xsxdlbf68n89fj2zf";
+  };
+}
diff --git a/pkgs/applications/networking/gns3/gui.nix b/pkgs/applications/networking/gns3/gui.nix
index 284c4f8cee1a..1352774953df 100644
--- a/pkgs/applications/networking/gns3/gui.nix
+++ b/pkgs/applications/networking/gns3/gui.nix
@@ -1,19 +1,22 @@
-{ stdenv, python34Packages, fetchFromGitHub }:
+{ stable, branch, version, sha256Hash }:
 
-# TODO: Python 3.6 was failing
-python34Packages.buildPythonPackage rec {
+{ stdenv, python3Packages, fetchFromGitHub }:
+
+let
+  pythonPackages = python3Packages;
+
+in pythonPackages.buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "gns3-gui";
-  version = "2.0.3";
 
   src = fetchFromGitHub {
     owner = "GNS3";
     repo = pname;
     rev = "v${version}";
-    sha256 = "10qp6430md8d0h2wamgfaq7pai59mqmcw6sw3i1gvb20m0avvsvb";
+    sha256 = sha256Hash;
   };
 
-  propagatedBuildInputs = with python34Packages; [
+  propagatedBuildInputs = with pythonPackages; [
     raven psutil jsonschema # tox for check
     # Runtime dependencies
     sip pyqt5
@@ -22,11 +25,13 @@ python34Packages.buildPythonPackage rec {
   doCheck = false; # Failing
 
   meta = with stdenv.lib; {
-    description = "Graphical Network Simulator";
-    #longDescription = ''
-    #  ...
-    #'';
-    homepage = "https://www.gns3.com/";
+    description = "Graphical Network Simulator 3 GUI (${branch} release)";
+    longDescription = ''
+      Graphical user interface for controlling the GNS3 network simulator. This
+      requires access to a local or remote GNS3 server (it's recommended to
+      download the official GNS3 VM).
+    '';
+    homepage = https://www.gns3.com/;
     license = licenses.gpl3Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ primeos ];
diff --git a/pkgs/applications/networking/gns3/server.nix b/pkgs/applications/networking/gns3/server.nix
index 7d5d9433bf31..9d7bf6f5a3ab 100644
--- a/pkgs/applications/networking/gns3/server.nix
+++ b/pkgs/applications/networking/gns3/server.nix
@@ -1,23 +1,63 @@
-{ stdenv, python3Packages, fetchFromGitHub }:
+{ stable, branch, version, sha256Hash }:
 
-python3Packages.buildPythonPackage rec {
+{ stdenv, python3Packages, fetchFromGitHub, fetchurl }:
+
+let
+  pythonPackages = python3Packages;
+  yarl = if (!stable) then pythonPackages.yarl
+    else (stdenv.lib.overrideDerivation pythonPackages.yarl (oldAttrs:
+      rec {
+        pname = "yarl";
+        version = "0.9.8";
+        name = "${pname}-${version}";
+        src = pythonPackages.fetchPypi {
+          inherit pname version;
+          sha256 = "1v2dsmr7bqp0yx51pwhbxyvzza8m2f88prsnbd926mi6ah38p0d7";
+        };
+      }));
+  aiohttp = if (!stable) then pythonPackages.aiohttp
+    else (stdenv.lib.overrideDerivation pythonPackages.aiohttp (oldAttrs:
+      rec {
+        pname = "aiohttp";
+        version = "1.3.5";
+        name = "${pname}-${version}";
+        src = pythonPackages.fetchPypi {
+          inherit pname version;
+          sha256 = "0hpqdiaifgyfqmxkyzwypwvrnvz5rqzgzylzhihfidc5ldfs856d";
+        };
+        propagatedBuildInputs = [ yarl ]
+          ++ (with pythonPackages; [ async-timeout chardet multidict ]);
+      }));
+  aiohttp-cors = if (!stable) then pythonPackages.aiohttp-cors
+    else (stdenv.lib.overrideDerivation pythonPackages.aiohttp-cors (oldAttrs:
+      rec {
+        pname = "aiohttp-cors";
+        version = "0.5.1";
+        name = "${pname}-${version}";
+        src = pythonPackages.fetchPypi {
+          inherit pname version;
+          sha256 = "0szma27ri25fq4nwwvs36myddggw3jz4pyzmq63yz4xpw0jjdxck";
+        };
+        propagatedBuildInputs = [ aiohttp ];
+      }));
+in pythonPackages.buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "gns3-server";
-  version = "2.1.0rc1";
 
   src = fetchFromGitHub {
     owner = "GNS3";
     repo = pname;
     rev = "v${version}";
-    sha256 = "181689fpjxq4hy2lyxk4zciqhgnhj5srvb4xsxdlbf68n89fj2zf";
+    sha256 = sha256Hash;
   };
 
-  propagatedBuildInputs = with python3Packages; [
-    aiohttp jinja2 psutil zipstream aiohttp-cors raven jsonschema yarl typing
-    prompt_toolkit
-  ];
+  propagatedBuildInputs = [ yarl aiohttp aiohttp-cors ]
+    ++ (with pythonPackages; [
+      jinja2 psutil zipstream raven jsonschema typing
+      prompt_toolkit
+    ]);
 
-  postPatch = ''
+  postPatch = stdenv.lib.optionalString (!stable) ''
     sed -i 's/yarl>=0.11,<0.12/yarl/g' requirements.txt
   '';
 
@@ -28,13 +68,13 @@ python3Packages.buildPythonPackage rec {
     rm $out/bin/gns3loopback # For windows only
   '';
   meta = with stdenv.lib; {
-    description = "Graphical Network Simulator 3 server";
+    description = "Graphical Network Simulator 3 server (${branch} release)";
     longDescription = ''
       The GNS3 server manages emulators such as Dynamips, VirtualBox or
       Qemu/KVM. Clients like the GNS3 GUI control the server using a HTTP REST
       API.
     '';
-    homepage = "https://www.gns3.com/";
+    homepage = https://www.gns3.com/;
     license = licenses.gpl3Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ primeos ];
diff --git a/pkgs/applications/networking/mailreaders/neomutt/default.nix b/pkgs/applications/networking/mailreaders/neomutt/default.nix
index b0246b58e068..e18d95dc1220 100644
--- a/pkgs/applications/networking/mailreaders/neomutt/default.nix
+++ b/pkgs/applications/networking/mailreaders/neomutt/default.nix
@@ -42,6 +42,11 @@ stdenv.mkDerivation rec {
     "ac_cv_path_SENDMAIL=sendmail"
   ];
 
+  # Fix missing libidn in mutt;
+  # this fix is ugly since it links all binaries in mutt against libidn
+  # like pgpring, pgpewrap, ...
+  NIX_LDFLAGS = "-lidn";
+
   configureScript = "./prepare";
 
   enableParallelBuilding = true;
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index a4a3741aeee2..20a0f947f105 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -66,7 +66,7 @@ in stdenv.mkDerivation {
       experts. It runs on UNIX, macOS and Windows.
     '';
 
-    platforms = platforms.unix;
+    platforms = platforms.linux;
     maintainers = with maintainers; [ bjornfor fpletz ];
   };
 }
diff --git a/pkgs/applications/science/biology/plink-ng/default.nix b/pkgs/applications/science/biology/plink-ng/default.nix
index 06fc1ef641be..2efb59f536f6 100644
--- a/pkgs/applications/science/biology/plink-ng/default.nix
+++ b/pkgs/applications/science/biology/plink-ng/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     description = "A comprehensive update to the PLINK association analysis toolset";
     homepage = https://www.cog-genomics.org/plink2;
     license = stdenv.lib.licenses.gpl3;
-    platforms = stdenv.lib.platforms.all;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
 
diff --git a/pkgs/applications/science/logic/jonprl/default.nix b/pkgs/applications/science/logic/jonprl/default.nix
index 12891697a702..982b5fc8b5fb 100644
--- a/pkgs/applications/science/logic/jonprl/default.nix
+++ b/pkgs/applications/science/logic/jonprl/default.nix
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.jonprl.org/;
     license = stdenv.lib.licenses.mit;
     maintainers = with stdenv.lib.maintainers; [ puffnfresh ];
-    platforms = stdenv.lib.platforms.unix;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/science/math/calc/default.nix b/pkgs/applications/science/math/calc/default.nix
index ff8a1ff95844..5787cb3d6b8b 100644
--- a/pkgs/applications/science/math/calc/default.nix
+++ b/pkgs/applications/science/math/calc/default.nix
@@ -12,11 +12,11 @@ in
 stdenv.mkDerivation rec {
 
   name = "calc-${version}";
-  version = "2.12.6.1";
+  version = "2.12.6.3";
 
   src = fetchurl {
     url = "https://github.com/lcn2/calc/releases/download/${version}/${name}.tar.bz2";
-    sha256 = "1vy4jmhmpl3gzgpkpv0kqwjv8hn1cza8cn1g8c69gq3inqvr4fvd";
+    sha256 = "01m20s5zs74zyb23x6zg6i13gc30a2ay2iz1rdbkxram01cblzky";
   };
 
   buildInputs = [ makeWrapper readline ncurses utillinux ];
diff --git a/pkgs/applications/science/math/singular/default.nix b/pkgs/applications/science/math/singular/default.nix
index b098da060e07..8cd9355a0f63 100644
--- a/pkgs/applications/science/math/singular/default.nix
+++ b/pkgs/applications/science/math/singular/default.nix
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoconf bison pkgconfig ];
 
   preConfigure = ''
-    find . -exec sed -e 's@/bin/rm@${coreutils}&@g' -i '{}' ';'
-    find . -exec sed -e 's@/bin/uname@${coreutils}&@g' -i '{}' ';'
+    find . -type f -exec sed -e 's@/bin/rm@${coreutils}&@g' -i '{}' ';'
+    find . -type f -exec sed -e 's@/bin/uname@${coreutils}&@g' -i '{}' ';'
     ${stdenv.lib.optionalString asLibsingular ''NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DLIBSINGULAR"''}
   '';
 
diff --git a/pkgs/applications/video/ogmtools/default.nix b/pkgs/applications/video/ogmtools/default.nix
index 82077e4d3ddd..83e69495b03a 100644
--- a/pkgs/applications/video/ogmtools/default.nix
+++ b/pkgs/applications/video/ogmtools/default.nix
@@ -19,6 +19,6 @@ stdenv.mkDerivation rec {
     '';
     homepage = http://www.bunkus.org/videotools/ogmtools/;
     license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.all;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix
index 8a7b362bd5ed..843d6d6b5ddb 100644
--- a/pkgs/build-support/docker/default.nix
+++ b/pkgs/build-support/docker/default.nix
@@ -10,6 +10,8 @@
   lib,
   pkgs,
   pigz,
+  nixUnstable,
+  perl,
   runCommand,
   rsync,
   shadow,
@@ -27,7 +29,7 @@
 rec {
 
   examples = import ./examples.nix {
-    inherit pkgs buildImage pullImage shadowSetup;
+    inherit pkgs buildImage pullImage shadowSetup buildImageWithNixDb;
   };
 
   pullImage =
@@ -135,7 +137,7 @@ rec {
         };
         inherit fromImage fromImageName fromImageTag;
 
-        buildInputs = [ utillinux e2fsprogs jshon rsync ];
+        buildInputs = [ utillinux e2fsprogs jshon rsync jq ];
       } ''
       rm -rf $out
 
@@ -144,44 +146,29 @@ rec {
       mount /dev/${vmTools.hd} disk
       cd disk
 
+      layers=""
       if [[ -n "$fromImage" ]]; then
         echo "Unpacking base image..."
         mkdir image
         tar -C image -xpf "$fromImage"
-
-        # If the image name isn't set, read it from the image repository json.
-        if [[ -z "$fromImageName" ]]; then
-          fromImageName=$(jshon -k < image/repositories | head -n 1)
-          echo "From-image name wasn't set. Read $fromImageName."
-        fi
-
-        # If the tag isn't set, use the name as an index into the json
-        # and read the first key found.
-        if [[ -z "$fromImageTag" ]]; then
-          fromImageTag=$(jshon -e $fromImageName -k < image/repositories \
-                         | head -n1)
-          echo "From-image tag wasn't set. Read $fromImageTag."
-        fi
-
-        # Use the name and tag to get the parent ID field.
-        parentID=$(jshon -e $fromImageName -e $fromImageTag -u \
-                   < image/repositories)
+        layers=$(jq -r '.[0].Layers | join(" ")' image/manifest.json)
       fi
 
-      # Unpack all of the parent layers into the image.
+      # Unpack all of the layers into the image.
+      # Layer list is ordered starting from the base image
       lowerdir=""
-      while [[ -n "$parentID" ]]; do
-        echo "Unpacking layer $parentID"
-        mkdir -p image/$parentID/layer
-        tar -C image/$parentID/layer -xpf image/$parentID/layer.tar
-        rm image/$parentID/layer.tar
+      for layer in $layers; do
+        echo "Unpacking layer $layer"
+        layerDir=image/$(echo $layer | cut -d':' -f2)"_unpacked"
+        mkdir -p $layerDir
+        tar -C $layerDir -xpf image/$layer
+        chmod a+w image/$layer
+        rm image/$layer
 
-        find image/$parentID/layer -name ".wh.*" -exec bash -c 'name="$(basename {}|sed "s/^.wh.//")"; mknod "$(dirname {})/$name" c 0 0; rm {}' \;
+        find $layerDir -name ".wh.*" -exec bash -c 'name="$(basename {}|sed "s/^.wh.//")"; mknod "$(dirname {})/$name" c 0 0; rm {}' \;
 
         # Get the next lower directory and continue the loop.
-        lowerdir=$lowerdir''${lowerdir:+:}image/$parentID/layer
-        parentID=$(cat image/$parentID/json \
-                  | (jshon -e parent -u 2>/dev/null || true))
+        lowerdir=$lowerdir''${lowerdir:+:}$layerDir
       done
 
       mkdir work
@@ -239,6 +226,19 @@ rec {
       ${text}
     '';
 
+  nixRegistration = contents: runCommand "nix-registration" {
+    buildInputs = [ nixUnstable perl ];
+    # For obtaining the closure of `contents'.
+    exportReferencesGraph =
+      let contentsList = if builtins.isList contents then contents else [ contents ];
+      in map (x: [("closure-" + baseNameOf x) x]) contentsList;
+    }
+    ''
+      mkdir $out
+      printRegistration=1 perl ${pkgs.pathsFromGraph} closure-* > $out/db.dump
+      perl ${pkgs.pathsFromGraph} closure-* > $out/storePaths
+    '';
+
   # Create a "layer" (set of files).
   mkPureLayer = {
     # Name of the layer
@@ -446,26 +446,17 @@ rec {
 
         mkdir image
         touch baseFiles
+        layers=""
         if [[ -n "$fromImage" ]]; then
           echo "Unpacking base image..."
           tar -C image -xpf "$fromImage"
-          # Do not import the base image configuration and manifest
-          chmod a+w image image/*.json
-          rm -f image/*.json
-
-          if [[ -z "$fromImageName" ]]; then
-            fromImageName=$(jshon -k < image/repositories|head -n1)
-          fi
-          if [[ -z "$fromImageTag" ]]; then
-            fromImageTag=$(jshon -e $fromImageName -k \
-                           < image/repositories|head -n1)
-          fi
-          parentID=$(jshon -e $fromImageName -e $fromImageTag -u \
-                     < image/repositories)
-
-          for l in image/*/layer.tar; do
-            ls_tar $l >> baseFiles
+          config=$(jq -r '.[0].Config' image/manifest.json)
+          layers=$(jq -r '.[0].Layers | join(" ")' image/manifest.json)
+          for l in $layers; do
+            ls_tar image/$l >> baseFiles
           done
+          chmod u+w image image/$config
+          rm image/$config
         fi
 
         chmod -R ug+rw image
@@ -492,47 +483,28 @@ rec {
         tar -rpf temp/layer.tar --mtime="@$SOURCE_DATE_EPOCH" \
           --owner=0 --group=0 --no-recursion --files-from newFiles
 
-        echo "Adding meta..."
-
-        # If we have a parentID, add it to the json metadata.
-        if [[ -n "$parentID" ]]; then
-          cat temp/json | jshon -s "$parentID" -i parent > tmpjson
-          mv tmpjson temp/json
-        fi
-
-        # Take the sha256 sum of the generated json and use it as the layer ID.
-        # Compute the size and add it to the json under the 'Size' field.
-        layerID=$(sha256sum temp/json|cut -d ' ' -f 1)
-        size=$(stat --printf="%s" temp/layer.tar)
-        cat temp/json | jshon -s "$layerID" -i id -n $size -i Size > tmpjson
-        mv tmpjson temp/json
-
-        # Use the temp folder we've been working on to create a new image.
-        mv temp image/$layerID
+        gzip temp/layer.tar
+        layerID="sha256:$(sha256sum temp/layer.tar.gz | cut -d ' ' -f 1)"
+        mv temp/layer.tar.gz image/$layerID
 
-        # Create image json and image manifest
+        echo "Generating image configuration and manifest..."
         imageJson=$(cat ${baseJson} | jq ". + {\"rootfs\": {\"diff_ids\": [], \"type\": \"layers\"}}")
         manifestJson=$(jq -n "[{\"RepoTags\":[\"$imageName:$imageTag\"]}]")
-        currentID=$layerID
-        while [[ -n "$currentID" ]]; do
-          layerChecksum=$(sha256sum image/$currentID/layer.tar | cut -d ' ' -f1)
-          imageJson=$(echo "$imageJson" | jq ".history |= [{\"created\": \"${created}\"}] + .")
-          imageJson=$(echo "$imageJson" | jq ".rootfs.diff_ids |= [\"sha256:$layerChecksum\"] + .")
-          manifestJson=$(echo "$manifestJson" | jq ".[0].Layers |= [\"$currentID/layer.tar\"] + .")
 
-          currentID=$(cat image/$currentID/json | (jshon -e parent -u 2>/dev/null || true))
+        # The layer list is ordered starting from the base image
+        layers=$(echo $layers $layerID)
+        for i in $(echo $layers); do
+          imageJson=$(echo "$imageJson" | jq ".history |= [{\"created\": \"${created}\"}] + .")
+          diffId=$(gzip -dc image/$i | sha256sum | cut -d" " -f1)
+          imageJson=$(echo "$imageJson" | jq ".rootfs.diff_ids |= [\"sha256:$diffId\"] + .")
+          manifestJson=$(echo "$manifestJson" | jq ".[0].Layers |= [\"$i\"] + .")
         done
 
         imageJsonChecksum=$(echo "$imageJson" | sha256sum | cut -d ' ' -f1)
-        echo "$imageJson" > "image/$imageJsonChecksum.json"
-        manifestJson=$(echo "$manifestJson" | jq ".[0].Config = \"$imageJsonChecksum.json\"")
+        echo "$imageJson" > "image/sha256:$imageJsonChecksum"
+        manifestJson=$(echo "$manifestJson" | jq ".[0].Config = \"sha256:$imageJsonChecksum\"")
         echo "$manifestJson" > image/manifest.json
 
-        # Store the json under the name image/repositories.
-        jshon -n object \
-          -n object -s "$layerID" -i "$imageTag" \
-          -i "$imageName" > image/repositories
-
         # Make the image read-only.
         chmod -R a-w image
 
@@ -544,4 +516,37 @@ rec {
 
     in
     result;
+
+  # Build an image and populate its nix database with the provided
+  # contents. The main purpose is to be able to use nix commands in
+  # the container.
+  # Be careful since this doesn't work well with multilayer.
+  buildImageWithNixDb = args@{ contents ? null, extraCommands ? "", ... }:
+    buildImage (args // {
+      extraCommands = ''
+        echo "Generating the nix database..."
+        echo "Warning: only the database of the deepest Nix layer is loaded."
+        echo "         If you want to use nix commands in the container, it would"
+        echo "         be better to only have one layer that contains a nix store."
+        # This requires Nix 1.12 or higher
+        export NIX_REMOTE=local?root=$PWD
+        ${nixUnstable}/bin/nix-store --load-db < ${nixRegistration contents}/db.dump
+
+        # We fill the store in order to run the 'verify' command that
+        # generates hash and size of output paths.
+        # Note when Nix 1.12 is be the stable one, the database dump
+        # generated by the exportReferencesGraph function will
+        # contains sha and size. See
+        # https://github.com/NixOS/nix/commit/c2b0d8749f7e77afc1c4b3e8dd36b7ee9720af4a
+        storePaths=$(cat ${nixRegistration contents}/storePaths)
+        echo "Copying everything to /nix/store (will take a while)..."
+        cp -prd $storePaths nix/store/
+        ${nixUnstable}/bin/nix-store --verify --check-contents
+
+        mkdir -p nix/var/nix/gcroots/docker/
+        for i in ${lib.concatStringsSep " " contents}; do
+          ln -s $i nix/var/nix/gcroots/docker/$(basename $i)
+        done;
+      '' + extraCommands;
+    });
 }
diff --git a/pkgs/build-support/docker/examples.nix b/pkgs/build-support/docker/examples.nix
index aead53f6f7d1..1a8b9c7f8ed4 100644
--- a/pkgs/build-support/docker/examples.nix
+++ b/pkgs/build-support/docker/examples.nix
@@ -7,7 +7,7 @@
 #  $ nix-build '<nixpkgs>' -A dockerTools.examples.redis
 #  $ docker load < result
 
-{ pkgs, buildImage, pullImage, shadowSetup }:
+{ pkgs, buildImage, pullImage, shadowSetup, buildImageWithNixDb }:
 
 rec {
   # 1. basic example
@@ -83,7 +83,7 @@ rec {
   };
 
   # 4. example of pulling an image. could be used as a base for other images
-  nix = pullImage {
+  nixFromDockerHub = pullImage {
     imageName = "nixos/nix";
     imageTag = "1.11";
     # this hash will need change if the tag is updated at docker hub
@@ -101,4 +101,17 @@ rec {
       pkgs.nano
     ];
   };
+
+  # 5. nix example to play with the container nix store
+  # docker run -it --rm nix nix-store -qR $(nix-build '<nixpkgs>' -A nix)
+  nix = buildImageWithNixDb {
+    name = "nix";
+    contents = [
+      # nix-store -qR uses the 'more' program which is not included in
+      # the pkgs.nix dependencies. We then have to manually get it
+      # from the 'eject' package:/
+      pkgs.eject
+      pkgs.nix
+    ];
+  };
 }
diff --git a/pkgs/desktops/lxde/core/lxappearance/default.nix b/pkgs/desktops/lxde/core/lxappearance/default.nix
index 8c6eb5965154..aece5fefaecf 100644
--- a/pkgs/desktops/lxde/core/lxappearance/default.nix
+++ b/pkgs/desktops/lxde/core/lxappearance/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     description = "A lightweight program for configuring the theme and fonts of gtk applications";
     homepage = http://lxde.org/;
     maintainers = [ stdenv.lib.maintainers.hinton ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = stdenv.lib.platforms.linux;
     license = stdenv.lib.licenses.gpl2;
   };
 }
diff --git a/pkgs/desktops/mate/libmatemixer/default.nix b/pkgs/desktops/mate/libmatemixer/default.nix
index 614124f8a0c5..20cf71c7554d 100644
--- a/pkgs/desktops/mate/libmatemixer/default.nix
+++ b/pkgs/desktops/mate/libmatemixer/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     description = "Mixer library for MATE";
     homepage = https://github.com/mate-desktop/libmatemixer;
     license = with licenses; [ gpl2 lgpl2 ];
-    platforms = platforms.unix;
+    platforms = platforms.linux;
     maintainers = [ maintainers.romildo ];
   };
 }
diff --git a/pkgs/desktops/mate/mate-desktop/default.nix b/pkgs/desktops/mate/mate-desktop/default.nix
index 8fea89cdcb6b..039c3732d11d 100644
--- a/pkgs/desktops/mate/mate-desktop/default.nix
+++ b/pkgs/desktops/mate/mate-desktop/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     description = "Library with common API for various MATE modules";
     homepage = http://mate-desktop.org;
     license = licenses.gpl2;
-    platforms = platforms.unix;
+    platforms = platforms.linux;
     maintainers = [ maintainers.romildo ];
   };
 }
diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8.nix
index 45054a3577db..fef41d33d080 100644
--- a/pkgs/development/compilers/openjdk/8.nix
+++ b/pkgs/development/compilers/openjdk/8.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, cpio, pkgconfig, file, which, unzip, zip, cups, freetype
+{ stdenv, lib, fetchurl, bash, cpio, pkgconfig, file, which, unzip, zip, cups, freetype
 , alsaLib, bootjdk, cacert, perl, liberation_ttf, fontconfig, zlib, lndir
 , libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama, libXcursor
 , libjpeg, giflib
@@ -75,11 +75,14 @@ let
       gtk2 gnome_vfs GConf glib
     ];
 
+    #move the seven other source dirs under the main jdk8u directory,
+    #with version suffixes removed, as the remainder of the build will expect
     prePatch = ''
-      ls | grep jdk | grep -v '^jdk8u' | awk -F- '{print $1}' | while read p; do
-        mv $p-* $(ls | grep '^jdk8u')/$p
+      mainDir=$(find . -maxdepth 1 -name jdk8u\*);
+      find . -maxdepth 1 -name \*jdk\* -not -name jdk8u\* | awk -F- '{print $1}' | while read p; do
+        mv $p-* $mainDir/$p
       done
-      cd $(ls | grep '^jdk8u')
+      cd $mainDir
     '';
 
     patches = [
@@ -95,7 +98,7 @@ let
 
     preConfigure = ''
       chmod +x configure
-      substituteInPlace configure --replace /bin/bash "$shell"
+      substituteInPlace configure --replace /bin/bash "${bash}/bin/bash"
       substituteInPlace hotspot/make/linux/adlc_updater --replace /bin/sh "$shell"
       substituteInPlace hotspot/make/linux/makefiles/dtrace.make --replace /usr/include/sys/sdt.h "/no-such-path"
     ''
@@ -188,10 +191,11 @@ let
       done
 
       # Generate certificates.
-      pushd $jre/lib/openjdk/jre/lib/security
-      rm cacerts
-      perl ${./generate-cacerts.pl} $jre/lib/openjdk/jre/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
-      popd
+      (
+        cd $jre/lib/openjdk/jre/lib/security
+        rm cacerts
+        perl ${./generate-cacerts.pl} $jre/lib/openjdk/jre/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
+      )
 
       ln -s $out/lib/openjdk/bin $out/bin
       ln -s $jre/lib/openjdk/jre/bin $jre/bin
@@ -221,13 +225,13 @@ let
       # Build the set of output library directories to rpath against
       LIBDIRS=""
       for output in $outputs; do
-        LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':'):$LIBDIRS"
+        LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
       done
 
       # Add the local library paths to remove dependencies on the bootstrap
       for output in $outputs; do
-        OUTPUTDIR="$(eval echo \$$output)"
-        BINLIBS="$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)"
+        OUTPUTDIR=$(eval echo \$$output)
+        BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
         echo "$BINLIBS" | while read i; do
           patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
           patchelf --shrink-rpath "$i" || true
diff --git a/pkgs/development/compilers/openjdk/9.nix b/pkgs/development/compilers/openjdk/9.nix
new file mode 100644
index 000000000000..ce556a32c11d
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/9.nix
@@ -0,0 +1,262 @@
+{ stdenv, lib, fetchurl, bash, cpio, pkgconfig, file, which, unzip, zip, cups, freetype
+, alsaLib, bootjdk, cacert, perl, liberation_ttf, fontconfig, zlib, lndir
+, libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama, libXcursor
+, libjpeg, giflib
+, setJavaClassPath
+, minimal ? false
+#, enableInfinality ? true # font rendering patch
+, enableGnome2 ? true, gtk2, gnome_vfs, glib, GConf
+}:
+
+let
+
+  /**
+   * The JRE libraries are in directories that depend on the CPU.
+   */
+  architecture =
+    if stdenv.system == "i686-linux" then
+      "i386"
+    else if stdenv.system == "x86_64-linux" then
+      "amd64"
+    else
+      throw "openjdk requires i686-linux or x86_64 linux";
+
+  update = "";
+  build = "181";
+  baseurl = "http://hg.openjdk.java.net/jdk9/jdk9";
+  repover = "jdk-9${update}+${build}";
+  paxflags = if stdenv.isi686 then "msp" else "m";
+  jdk9 = fetchurl {
+             url = "${baseurl}/archive/${repover}.tar.gz";
+             sha256 = "0c7jwz4qvl93brs6c2v4dfc2v3lsv6ic0y72lkh04bnxg9343z82";
+          };
+  langtools = fetchurl {
+             url = "${baseurl}/langtools/archive/${repover}.tar.gz";
+             sha256 = "1wa5rjan6lcs8nnxndbwpw6gkx3qbw013s6zisjjczkcaiq044pp";
+          };
+  hotspot = fetchurl {
+             url = "${baseurl}/hotspot/archive/${repover}.tar.gz";
+             sha256 = "00jnj19rim1gxpsxrpr8ifx1glwrbma3qjiy1ya7n5f08fb263hs";
+          };
+  corba = fetchurl {
+             url = "${baseurl}/corba/archive/${repover}.tar.gz";
+             sha256 = "1gvx6dblzj7rb8648iqwdiv36x97ibykgs323dd9044n3vbqihvj";
+          };
+  jdk = fetchurl {
+             url = "${baseurl}/jdk/archive/${repover}.tar.gz";
+             sha256 = "15pwdw6s03rfyw2gx06xg4f70bjl8j19ycssxiigj39h524xc9aw";
+          };
+  jaxws = fetchurl {
+             url = "${baseurl}/jaxws/archive/${repover}.tar.gz";
+             sha256 = "0jz32pjbgr77ybb2v1vwr1n9ljdrc3y0d5lrj072g3is1hmn2wbh";
+          };
+  jaxp = fetchurl {
+             url = "${baseurl}/jaxp/archive/${repover}.tar.gz";
+             sha256 = "1jdxr9hcqx6va56ll5s2x9bx9dnlrs7zyvhjk1zgr5hxg5yfcqzr";
+          };
+  nashorn = fetchurl {
+             url = "${baseurl}/nashorn/archive/${repover}.tar.gz";
+             sha256 = "12lihmw9ga6yhz0h26fvfablcjkkma0k3idjggmap97xha8zgd6n";
+          };
+  openjdk9 = stdenv.mkDerivation {
+    name = "openjdk-9${update}-b${build}";
+
+    srcs = [ jdk9 langtools hotspot corba jdk jaxws jaxp nashorn ];
+    sourceRoot = ".";
+
+    outputs = [ "out" "jre" ];
+
+    nativeBuildInputs = [ pkgconfig ];
+    buildInputs = [
+      cpio file which unzip zip perl bootjdk zlib cups freetype alsaLib
+      libjpeg giflib libX11 libICE libXext libXrender libXtst libXt libXtst
+      libXi libXinerama libXcursor lndir fontconfig
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      gtk2 gnome_vfs GConf glib
+    ];
+
+    #move the seven other source dirs under the main jdk8u directory,
+    #with version suffixes removed, as the remainder of the build will expect
+    prePatch = ''
+      mainDir=$(find . -maxdepth 1 -name jdk9\*);
+      find . -maxdepth 1 -name \*jdk\* -not -name jdk9\* | awk -F- '{print $1}' | while read p; do
+        mv $p-* $mainDir/$p
+      done
+      cd $mainDir
+    '';
+
+    patches = [
+      ./fix-java-home-jdk9.patch
+      ./read-truststore-from-env-jdk9.patch
+      ./currency-date-range-jdk8.patch
+    #] ++ lib.optionals (!minimal && enableInfinality) [
+    #  ./004_add-fontconfig.patch
+    #  ./005_enable-infinality.patch
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      ./swing-use-gtk-jdk9.patch
+    ];
+
+    preConfigure = ''
+      chmod +x configure
+      substituteInPlace configure --replace /bin/bash "${bash}/bin/bash"
+
+      configureFlagsArray=(
+        "--with-boot-jdk=${bootjdk.home}"
+        "--with-update-version=${update}"
+        "--with-build-number=${build}"
+        "--with-milestone=fcs"
+        "--enable-unlimited-crypto"
+        "--disable-debug-symbols"
+        "--disable-freetype-bundling"
+        "--with-zlib=system"
+        "--with-giflib=system"
+        "--with-stdc++lib=dynamic"
+
+        # glibc 2.24 deprecated readdir_r so we need this
+        # See https://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg49006.html
+        "--with-extra-cflags=-Wno-error=deprecated-declarations -Wno-error=format-contains-nul -Wno-error=unused-result"
+    ''
+    + lib.optionalString minimal "\"--enable-headless-only\""
+    + ");"
+    # https://bugzilla.redhat.com/show_bug.cgi?id=1306558
+    # https://github.com/JetBrains/jdk8u/commit/eaa5e0711a43d64874111254d74893fa299d5716
+    + stdenv.lib.optionalString stdenv.cc.isGNU ''
+      NIX_CFLAGS_COMPILE+=" -fno-lifetime-dse -fno-delete-null-pointer-checks -std=gnu++98 -Wno-error"
+    '';
+
+    NIX_LDFLAGS= lib.optionals (!minimal) [
+      "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic"
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      "-lgtk-x11-2.0" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2"
+    ];
+
+    buildFlags = [ "all" ];
+
+    installPhase = ''
+      mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk
+
+      cp -av build/*/images/jdk/* $out/lib/openjdk
+
+      # Remove some broken manpages.
+      rm -rf $out/lib/openjdk/man/ja*
+
+      # Mirror some stuff in top-level.
+      mkdir $out/include $out/share/man
+      ln -s $out/lib/openjdk/include/* $out/include/
+      ln -s $out/lib/openjdk/man/* $out/share/man/
+
+      # jni.h expects jni_md.h to be in the header search path.
+      ln -s $out/include/linux/*_md.h $out/include/
+
+      # Copy the JRE to a separate output and setup fallback fonts
+      cp -av build/*/images/jre $jre/lib/openjdk/
+      mkdir $out/lib/openjdk/jre
+      ${lib.optionalString (!minimal) ''
+        mkdir -p $jre/lib/openjdk/jre/lib/fonts/fallback
+        lndir ${liberation_ttf}/share/fonts/truetype $jre/lib/openjdk/jre/lib/fonts/fallback
+      ''}
+
+      # Remove crap from the installation.
+      rm -rf $out/lib/openjdk/demo
+      ${lib.optionalString minimal ''
+        for d in $out/lib/openjdk/lib $jre/lib/openjdk/jre/lib; do
+          rm ''${d}/{libjsound,libjsoundalsa,libawt*,libfontmanager}.so
+        done
+      ''}
+
+      lndir $jre/lib/openjdk/jre $out/lib/openjdk/jre
+
+      # Make sure cmm/*.pf are not symlinks:
+      # https://youtrack.jetbrains.com/issue/IDEA-147272
+      # in 9, it seems no *.pf files end up in $out ... ?
+      # rm -rf $out/lib/openjdk/jre/lib/cmm
+      # ln -s {$jre,$out}/lib/openjdk/jre/lib/cmm
+
+      # Set PaX markings
+      exes=$(file $out/lib/openjdk/bin/* $jre/lib/openjdk/jre/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//')
+      echo "to mark: *$exes*"
+      for file in $exes; do
+        echo "marking *$file*"
+        paxmark ${paxflags} "$file"
+      done
+
+      # Remove duplicate binaries.
+      for i in $(cd $out/lib/openjdk/bin && echo *); do
+        if [ "$i" = java ]; then continue; fi
+        if cmp -s $out/lib/openjdk/bin/$i $jre/lib/openjdk/jre/bin/$i; then
+          ln -sfn $jre/lib/openjdk/jre/bin/$i $out/lib/openjdk/bin/$i
+        fi
+      done
+
+      # Generate certificates.
+      (
+        cd $jre/lib/openjdk/jre/lib/security
+        rm cacerts
+        perl ${./generate-cacerts.pl} $jre/lib/openjdk/jre/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
+      )
+
+      ln -s $out/lib/openjdk/bin $out/bin
+      ln -s $jre/lib/openjdk/jre/bin $jre/bin
+      ln -s $jre/lib/openjdk/jre $out/jre
+    '';
+
+    # FIXME: this is unnecessary once the multiple-outputs branch is merged.
+    preFixup = ''
+      prefix=$jre stripDirs "$stripDebugList" "''${stripDebugFlags:--S}"
+      patchELF $jre
+      propagatedNativeBuildInputs+=" $jre"
+
+      # Propagate the setJavaClassPath setup hook from the JRE so that
+      # any package that depends on the JRE has $CLASSPATH set up
+      # properly.
+      mkdir -p $jre/nix-support
+      #TODO or printWords?  cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
+      echo -n "${setJavaClassPath}" > $jre/nix-support/propagated-native-build-inputs
+
+      # Set JAVA_HOME automatically.
+      mkdir -p $out/nix-support
+      cat <<EOF > $out/nix-support/setup-hook
+      if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
+      EOF
+    '';
+
+    postFixup = ''
+      # Build the set of output library directories to rpath against
+      LIBDIRS=""
+      for output in $outputs; do
+        LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
+      done
+
+      # Add the local library paths to remove dependencies on the bootstrap
+      for output in $outputs; do
+        OUTPUTDIR=$(eval echo \$$output)
+        BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
+        echo "$BINLIBS" | while read i; do
+          patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
+          patchelf --shrink-rpath "$i" || true
+        done
+      done
+
+      # Test to make sure that we don't depend on the bootstrap
+      for output in $outputs; do
+        if grep -q -r '${bootjdk}' $(eval echo \$$output); then
+          echo "Extraneous references to ${bootjdk} detected"
+          exit 1
+        fi
+      done
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = http://openjdk.java.net/;
+      license = licenses.gpl2;
+      description = "The open-source Java Development Kit";
+      maintainers = with maintainers; [ edwtjo ];
+      platforms = platforms.linux;
+    };
+
+    passthru = {
+      inherit architecture;
+      home = "${openjdk9}/lib/openjdk";
+    };
+  };
+in openjdk9
diff --git a/pkgs/development/compilers/openjdk/fix-java-home-jdk9.patch b/pkgs/development/compilers/openjdk/fix-java-home-jdk9.patch
new file mode 100644
index 000000000000..f9755d58e48f
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/fix-java-home-jdk9.patch
@@ -0,0 +1,14 @@
+--- a/hotspot/src/os/linux/vm/os_linux.cpp	2017-07-04 23:09:02.533972226 -0400
++++ b/hotspot/src/os/linux/vm/os_linux.cpp	2017-07-04 23:07:52.118338845 -0400
+@@ -2318,10 +2318,7 @@
+   assert(ret, "cannot locate libjvm");
+   char *rp = NULL;
+   if (ret && dli_fname[0] != '\0') {
+-    rp = realpath(dli_fname, buf);
+-  }
+-  if (rp == NULL) {
+-    return;
++    snprintf(buf, buflen, "%s", dli_fname);
+   }
+ 
+   if (Arguments::sun_java_launcher_is_altjvm()) {
diff --git a/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk9.patch b/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk9.patch
new file mode 100644
index 000000000000..cb8d59ff8063
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk9.patch
@@ -0,0 +1,20 @@
+--- a/jdk/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java	2017-06-26 21:48:25.000000000 -0400
++++ b/jdk/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java.new	2017-07-05 20:45:57.491295030 -0400
+@@ -71,6 +71,7 @@
+      *
+      * The preference of the default trusted KeyStore is:
+      *    javax.net.ssl.trustStore
++     *    system environment variable JAVAX_NET_SSL_TRUSTSTORE
+      *    jssecacerts
+      *    cacerts
+      */
+@@ -144,6 +145,9 @@
+                     String temporaryName = "";
+                     File temporaryFile = null;
+                     long temporaryTime = 0L;
++                    if (storePropName == null){
++                        storePropName = System.getenv("JAVAX_NET_SSL_TRUSTSTORE");
++                    }
+                     if (!"NONE".equals(storePropName)) {
+                         String[] fileNames =
+                                 new String[] {storePropName, defaultStore};
diff --git a/pkgs/development/compilers/openjdk/swing-use-gtk-jdk9.patch b/pkgs/development/compilers/openjdk/swing-use-gtk-jdk9.patch
new file mode 100644
index 000000000000..07d95ba71b8a
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/swing-use-gtk-jdk9.patch
@@ -0,0 +1,26 @@
+diff -ru3 a/jdk/src/share/classes/javax/swing/UIManager.java b/jdk/src/share/classes/javax/swing/UIManager.java
+--- a/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java	2016-07-26 00:41:37.000000000 +0300
++++ b/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java	2016-10-02 22:46:01.890071761 +0300
+@@ -607,11 +607,9 @@
+         if (osType == OSInfo.OSType.WINDOWS) {
+             return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
+         } else {
+-            String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
+             Toolkit toolkit = Toolkit.getDefaultToolkit();
+-            if ("gnome".equals(desktop) &&
+-                    toolkit instanceof SunToolkit &&
+-                    ((SunToolkit) toolkit).isNativeGTKAvailable()) {
++            if (toolkit instanceof SunToolkit &&
++                    ((SunToolkit) toolkit).isNativeGTKAvailable()) {
+                 // May be set on Linux and Solaris boxs.
+                 return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
+             }
+@@ -1341,7 +1339,7 @@
+             lafName = (String) lafData.remove("defaultlaf");
+         }
+         if (lafName == null) {
+-            lafName = getCrossPlatformLookAndFeelClassName();
++            lafName = getSystemLookAndFeelClassName();
+         }
+         lafName = swingProps.getProperty(defaultLAFKey, lafName);
+ 
diff --git a/pkgs/development/libraries/dirac/default.nix b/pkgs/development/libraries/dirac/default.nix
index 7b42ead14bd8..b64c6c84980a 100644
--- a/pkgs/development/libraries/dirac/default.nix
+++ b/pkgs/development/libraries/dirac/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   meta = with stdenv.lib; {
     homepage = http://sourceforge.net/projects/dirac;
     description = "A general-purpose video codec based on wavelets";
-    platforms = platforms.all;
+    platforms = platforms.linux;
     license = with licenses; [ mpl11 gpl2 lgpl21 ];
     maintainer = maintainers.igsha;
   };
diff --git a/pkgs/development/libraries/idnkit/default.nix b/pkgs/development/libraries/idnkit/default.nix
index fe816ee5267c..4cee28630935 100644
--- a/pkgs/development/libraries/idnkit/default.nix
+++ b/pkgs/development/libraries/idnkit/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     homepage = https://www.nic.ad.jp/ja/idn/idnkit;
     description = "Provides functionalities about i18n domain name processing";
     license = "idnkit-2 license";
-    platforms = platforms.unix;
+    platforms = platforms.linux;
     maintainers = with maintainers; [ wkennington ];
   };
 }
diff --git a/pkgs/development/libraries/lmdb/default.nix b/pkgs/development/libraries/lmdb/default.nix
index 30703fc7e3ed..d96b5ed6d520 100644
--- a/pkgs/development/libraries/lmdb/default.nix
+++ b/pkgs/development/libraries/lmdb/default.nix
@@ -1,7 +1,6 @@
 { stdenv, fetchFromGitHub }:
 
-let optional = stdenv.lib.optional;
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "lmdb-${version}";
   version = "0.9.21";
 
@@ -16,7 +15,8 @@ in stdenv.mkDerivation rec {
 
   outputs = [ "bin" "out" "dev" ];
 
-  makeFlags = [ "prefix=$(out)" "CC=cc" ];
+  makeFlags = [ "prefix=$(out)" "CC=cc" ]
+    ++ stdenv.lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/liblmdb.so";
 
   doCheck = true;
   checkPhase = "make test";
@@ -25,12 +25,6 @@ in stdenv.mkDerivation rec {
     moveToOutput bin "$bin"
     moveToOutput "lib/*.a" REMOVE # until someone needs it
   ''
-
-    # fix bogus library name
-    + stdenv.lib.optionalString stdenv.isDarwin ''
-    mv "$out"/lib/liblmdb.{so,dylib}
-    ''
-
     # add lmdb.pc (dynamic only)
     + ''
     mkdir -p "$dev/lib/pkgconfig"
diff --git a/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
index e7752af43975..e080d99a4aa6 100644
--- a/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
+++ b/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
@@ -123,7 +123,7 @@ if [ -z "$NIX_QT5_TMP" ]; then
 
     mkdir -p "$NIX_QT5_TMP/nix-support"
     for subdir in bin include lib mkspecs share; do
-        mkdir "$NIX_QT5_TMP/$subdir"
+        mkdir -p "$NIX_QT5_TMP/$subdir"
         echo "$subdir/" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
     done
 
diff --git a/pkgs/development/libraries/resolv_wrapper/default.nix b/pkgs/development/libraries/resolv_wrapper/default.nix
index bc39b320c8e5..4ec06d68a329 100644
--- a/pkgs/development/libraries/resolv_wrapper/default.nix
+++ b/pkgs/development/libraries/resolv_wrapper/default.nix
@@ -15,6 +15,6 @@ stdenv.mkDerivation rec {
     homepage = "https://git.samba.org/?p=uid_wrapper.git;a=summary;";
     license = licenses.bsd3;
     maintainers = with maintainers; [ wkennington ];
-    platforms = platforms.all;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/python-modules/blessed/default.nix b/pkgs/development/python-modules/blessed/default.nix
new file mode 100644
index 000000000000..2d1ac11f3b54
--- /dev/null
+++ b/pkgs/development/python-modules/blessed/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, buildPythonPackage, fetchPypi, six, wcwidth }:
+
+buildPythonPackage rec {
+  name = "${pname}-${version}";
+  pname = "blessed";
+  version = "1.14.2";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0fv9f0074kxy1849h0kwwxw12sifpq3bv63pcz900zzjsigi4hi3";
+  };
+
+  propagatedBuildInputs = [ wcwidth six ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/jquast/blessed;
+    description = "A thin, practical wrapper around terminal capabilities in Python.";
+    maintainers = with maintainers; [ eqyiel ];
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/development/python-modules/cement/default.nix b/pkgs/development/python-modules/cement/default.nix
new file mode 100644
index 000000000000..2ed704e34825
--- /dev/null
+++ b/pkgs/development/python-modules/cement/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, buildPythonPackage, fetchPypi }:
+
+buildPythonPackage rec {
+  pname = "cement";
+  name = "${pname}-${version}";
+  version = "2.8.2";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1li2whjzfhbpg6fjb6r1r92fb3967p1xv6hqs3j787865h2ysrc7";
+  };
+
+  # Disable test tests since they depend on a memcached server running on
+  # 127.0.0.1:11211.
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    homepage = http://builtoncement.com/;
+    description = "A CLI Application Framework for Python.";
+    maintainers = with maintainers; [ eqyiel ];
+    license = licenses.bsd3;
+  };
+}
diff --git a/pkgs/development/qtcreator/default.nix b/pkgs/development/qtcreator/default.nix
index a40a34052ca2..51667bef143d 100644
--- a/pkgs/development/qtcreator/default.nix
+++ b/pkgs/development/qtcreator/default.nix
@@ -6,8 +6,8 @@
 with stdenv.lib;
 
 let
-  baseVersion = "4.3";
-  revision = "1";
+  baseVersion = "4.4";
+  revision = "0";
 in
 
 stdenv.mkDerivation rec {
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "http://download.qt-project.org/official_releases/qtcreator/${baseVersion}/${version}/qt-creator-opensource-src-${version}.tar.xz";
-    sha256 = "1bd4wxvp8b5imsmrbnn8rkiln38g74g2545x07pmihc8z51qh2h6";
+    sha256 = "00k2bb2pamqlq0i619wz8chii8yp884qnrjngzzxrdffk05d95wc";
   };
 
   buildInputs = [ qtbase qtscript qtquickcontrols qtdeclarative ];
diff --git a/pkgs/development/tools/textql/default.nix b/pkgs/development/tools/textql/default.nix
index 65c0bb8e41e5..bd1dbb3f90a1 100644
--- a/pkgs/development/tools/textql/default.nix
+++ b/pkgs/development/tools/textql/default.nix
@@ -4,7 +4,7 @@ buildGoPackage rec {
   name = "textql-${version}";
   version = "2.0.3";
   rev = "${version}";
-  
+
   goPackagePath = "github.com/dinedal/textql";
 
   src = fetchFromGitHub {
@@ -16,6 +16,10 @@ buildGoPackage rec {
 
   goDeps = ./deps.nix;
 
+  preFixup = stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -delete_rpath $out/lib $bin/bin/textql
+  '';
+
   meta = with stdenv.lib; {
     description = "Execute SQL against structured text like CSV or TSV";
     homepage = https://github.com/dinedal/textql;
diff --git a/pkgs/games/trackballs/default.nix b/pkgs/games/trackballs/default.nix
index 5606be6a5943..93dd579b4e0c 100644
--- a/pkgs/games/trackballs/default.nix
+++ b/pkgs/games/trackballs/default.nix
@@ -1,35 +1,22 @@
-{ stdenv, fetchurl, SDL, mesa, SDL_ttf, gettext, zlib, SDL_mixer, SDL_image, guile
-, debug ? false }:
+{ stdenv, fetchFromGitHub, cmake, SDL2, SDL2_ttf, gettext, zlib, SDL2_mixer, SDL2_image, guile, mesa }:
 
 with stdenv.lib;
 
 stdenv.mkDerivation rec {
-  name = "trackballs-1.1.4";
-  
-  src = fetchurl {
-    url = mirror://sourceforge/trackballs/trackballs-1.1.4.tar.gz;
-    sha256 = "19ilnif59sxa8xmfisk90wngrd11pj8s86ixzypv8krm4znbm7a5";
+  name = "trackballs-${version}";
+  version = "1.2.3";
+
+  src = fetchFromGitHub {
+    owner = "trackballs";
+    repo = "trackballs";
+    rev = "v${version}";
+    sha256 = "13f28frni7fkalxx4wqvmkzz7ba3d8pic9f9sd2z9wa6gbjs9zrf";
   };
 
-  buildInputs = [ zlib mesa SDL SDL_ttf SDL_mixer SDL_image guile gettext ];
-
-  hardeningDisable = [ "format" ];
-
-  CFLAGS = optionalString debug "-g -O0";
-  CXXFLAGS = CFLAGS;
-  dontStrip = debug;
-  postUnpack = optionalString debug
-    "mkdir -p $out/src; cp -R * $out/src ; cd $out/src";
-
-  NIX_CFLAGS_COMPILE = "-iquote ${SDL.dev}/include/SDL";
-  configureFlags = optionalString debug "--enable-debug";
-
-  patchPhase = ''
-    sed -i -e 's/images icons music/images music/' share/Makefile.in
-  '';
+  buildInputs = [ cmake zlib SDL2 SDL2_ttf SDL2_mixer SDL2_image guile gettext mesa ];
 
   meta = {
-    homepage = http://trackballs.sourceforge.net/;
+    homepage = https://trackballs.github.io/;
     description = "3D Marble Madness clone";
     platforms = stdenv.lib.platforms.linux;
   };
diff --git a/pkgs/misc/tw-rs/default.nix b/pkgs/misc/tw-rs/default.nix
index 6c6963303e98..2459e157a905 100644
--- a/pkgs/misc/tw-rs/default.nix
+++ b/pkgs/misc/tw-rs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, rustPlatform, perl, zlib, openssl }:
+{ stdenv, fetchFromGitHub, rustPlatform, perl, zlib, openssl, curl }:
 
 rustPlatform.buildRustPackage rec {
   name = "tw-rs-${version}";
@@ -10,7 +10,9 @@ rustPlatform.buildRustPackage rec {
     rev = "${version}";
     sha256 = "1s1gk2wcs3792gdzrngksczz3gma5kv02ni2jqrhib8l6z8mg9ia";
     };
-  buildInputs = [ perl zlib openssl ];
+
+  buildInputs = [ perl zlib openssl ]
+    ++ stdenv.lib.optional stdenv.isDarwin curl;
 
   depsSha256 = "1lg1jh6f9w28i94vaj62r859g6raalxmxabvw7av6sqr0hr56p05";
 
diff --git a/pkgs/tools/filesystems/sshfs-fuse/default.nix b/pkgs/tools/filesystems/sshfs-fuse/default.nix
index 62505ac041e6..274be305da84 100644
--- a/pkgs/tools/filesystems/sshfs-fuse/default.nix
+++ b/pkgs/tools/filesystems/sshfs-fuse/default.nix
@@ -3,16 +3,20 @@
 stdenv.mkDerivation rec {
   version = "3.2.0";
   name = "sshfs-fuse-${version}";
-  
+
   src = fetchFromGitHub {
     owner = "libfuse";
     repo = "sshfs";
     rev = "sshfs-${version}";
     sha256 = "09pqdibhcj1p7m6vxkqiprvbcxp9iq2lm1hb6w7p8iarmvp80rlv";
   };
-  
+
   buildInputs = [ pkgconfig glib fuse3 autoreconfHook ];
 
+  NIX_CFLAGS_COMPILE = stdenv.lib.optional
+    (stdenv.system == "i686-linux")
+    "-D_FILE_OFFSET_BITS=64";
+
   postInstall = ''
     mkdir -p $out/sbin
     ln -sf $out/bin/sshfs $out/sbin/mount.sshfs
diff --git a/pkgs/tools/misc/osm2pgsql/default.nix b/pkgs/tools/misc/osm2pgsql/default.nix
index 98489358738c..67e0c2b21d83 100644
--- a/pkgs/tools/misc/osm2pgsql/default.nix
+++ b/pkgs/tools/misc/osm2pgsql/default.nix
@@ -23,6 +23,6 @@ stdenv.mkDerivation rec {
     version = "0.92.1-unstable";
     homepage = https://github.com/openstreetmap/osm2pgsql;
     license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.unix;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/misc/shallot/default.nix b/pkgs/tools/misc/shallot/default.nix
index 279de83e817a..6c757ca224a9 100644
--- a/pkgs/tools/misc/shallot/default.nix
+++ b/pkgs/tools/misc/shallot/default.nix
@@ -27,6 +27,6 @@ in stdenv.mkDerivation {
 
     license = stdenv.lib.licenses.mit;
     homepage = https://github.com/katmagic/Shallot;
-    platforms = stdenv.lib.platforms.unix;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/misc/snapper/default.nix b/pkgs/tools/misc/snapper/default.nix
index 5f482d68dd9a..9895fff3ba8f 100644
--- a/pkgs/tools/misc/snapper/default.nix
+++ b/pkgs/tools/misc/snapper/default.nix
@@ -5,13 +5,13 @@
 
 stdenv.mkDerivation rec {
   name = "snapper-${version}";
-  version = "0.3.3";
+  version = "0.5.0";
 
   src = fetchFromGitHub {
     owner = "openSUSE";
     repo = "snapper";
     rev = "v${version}";
-    sha256 = "12c2ygaanr4gny4ixnly4vpi0kv7snbg3khr3i5zwridhmdzz9hm";
+    sha256 = "14hrv23film4iihyclcvc2r2dgxl8w3as50r81xjjc85iyp6yxkm";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/tools/networking/cjdns/default.nix b/pkgs/tools/networking/cjdns/default.nix
index 12a8a1a184fe..11f65ea82b03 100644
--- a/pkgs/tools/networking/cjdns/default.nix
+++ b/pkgs/tools/networking/cjdns/default.nix
@@ -31,6 +31,6 @@ stdenv.mkDerivation {
     description = "Encrypted networking for regular people";
     license = licenses.gpl3;
     maintainers = with maintainers; [ ehmry ];
-    platforms = platforms.unix;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/tools/networking/ferm/default.nix b/pkgs/tools/networking/ferm/default.nix
index 454605893823..a0b298f3f4ec 100644
--- a/pkgs/tools/networking/ferm/default.nix
+++ b/pkgs/tools/networking/ferm/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, makeWrapper, perl, ebtables, ipset, iptables }:
 
 stdenv.mkDerivation rec {
-  version = "2.3.1";
+  version = "2.4.1";
   name = "ferm-${version}";
 
   src = fetchurl {
-    url = "http://ferm.foo-projects.org/download/2.3/ferm-${version}.tar.gz";
-    sha256 = "1scdnd2jk4787jyr6fxav2598g0x7hjic5b8bj77j8s0hki48m4a";
+    url = "http://ferm.foo-projects.org/download/2.4/ferm-${version}.tar.xz";
+    sha256 = "1fv8wk513yysp4q0i65rl2m0hg2lxwwgk9ppprsca1xcxrdpsvwa";
   };
 
   buildInputs = [ perl ipset ebtables iptables makeWrapper ];
diff --git a/pkgs/tools/networking/packetdrill/default.nix b/pkgs/tools/networking/packetdrill/default.nix
index 75007b5ed681..d770a51dc820 100644
--- a/pkgs/tools/networking/packetdrill/default.nix
+++ b/pkgs/tools/networking/packetdrill/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     description = "Quick, precise tests for entire TCP/UDP/IPv4/IPv6 network stacks";
     homepage = https://github.com/google/packetdrill;
     license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.unix;
+    platforms = stdenv.lib.platforms.linux;
     maintainers = with stdenv.lib.maintainers; [ dmjio cleverca22 ];
   };
 }
diff --git a/pkgs/tools/networking/redsocks/default.nix b/pkgs/tools/networking/redsocks/default.nix
index e9aced067286..981ecdb03550 100644
--- a/pkgs/tools/networking/redsocks/default.nix
+++ b/pkgs/tools/networking/redsocks/default.nix
@@ -28,6 +28,6 @@ stdenv.mkDerivation rec {
     homepage = http://darkk.net.ru/redsocks/;
     license = stdenv.lib.licenses.asl20;
     maintainers = [ ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/package-management/nox/default.nix b/pkgs/tools/package-management/nox/default.nix
index f12af074d412..ed7ec74483f3 100644
--- a/pkgs/tools/package-management/nox/default.nix
+++ b/pkgs/tools/package-management/nox/default.nix
@@ -10,6 +10,8 @@ pythonPackages.buildPythonApplication rec {
     sha256 = "1qcbhdnhdhhv7q6cqdgv0q55ic8fk18526zn2yb12x9r1s0lfp9z";
   };
 
+  patches = [ ./nox-review-wip.patch ];
+
   buildInputs = [ pythonPackages.pbr git ];
 
   propagatedBuildInputs = with pythonPackages; [
diff --git a/pkgs/tools/package-management/nox/nox-review-wip.patch b/pkgs/tools/package-management/nox/nox-review-wip.patch
new file mode 100644
index 000000000000..e82dc7a2c266
--- /dev/null
+++ b/pkgs/tools/package-management/nox/nox-review-wip.patch
@@ -0,0 +1,11 @@
+--- a/nox/review.py	2017-09-23 04:04:37.322484753 +0200
++++ a/nox/review.py	2017-09-23 04:18:31.582692181 +0200
+@@ -84,7 +84,7 @@
+     ctx.obj['dry_run'] = dry_run
+ 
+ 
+-@cli.command(short_help='difference between working tree and a commit')
++@cli.command('wip', short_help='difference between working tree and a commit')
+ @click.option('--against', default='HEAD')
+ @click.pass_context
+ @setup_nixpkgs_config
diff --git a/pkgs/tools/security/tor/default.nix b/pkgs/tools/security/tor/default.nix
index ad94192d14f5..3daf30d2ff0a 100644
--- a/pkgs/tools/security/tor/default.nix
+++ b/pkgs/tools/security/tor/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "geoip" ];
 
+  enableParallelBuilding = true;
+
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libevent openssl zlib ] ++
     stdenv.lib.optionals stdenv.isLinux [ libseccomp systemd libcap ];
diff --git a/pkgs/tools/security/trousers/default.nix b/pkgs/tools/security/trousers/default.nix
index d57aa8c63a92..e49f2f8ed0fb 100644
--- a/pkgs/tools/security/trousers/default.nix
+++ b/pkgs/tools/security/trousers/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     homepage    = http://trousers.sourceforge.net/;
     license     = licenses.cpl10;
     maintainers = [ maintainers.ak ];
-    platforms   = platforms.unix;
+    platforms   = platforms.linux;
   };
 }
 
diff --git a/pkgs/tools/system/gdmap/default.nix b/pkgs/tools/system/gdmap/default.nix
index 1d33e5fb09fe..b03ec34972eb 100644
--- a/pkgs/tools/system/gdmap/default.nix
+++ b/pkgs/tools/system/gdmap/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     homepage = http://gdmap.sourceforge.net;
     description = "Recursive rectangle map of disk usage";
     license = licenses.gpl2;
-    platforms = platforms.all;
+    platforms = platforms.linux;
     maintainers = [ maintainers.bjornfor ];
   };
 }
diff --git a/pkgs/tools/text/nawk/default.nix b/pkgs/tools/text/nawk/default.nix
index d3056735b8d1..a746c4544350 100644
--- a/pkgs/tools/text/nawk/default.nix
+++ b/pkgs/tools/text/nawk/default.nix
@@ -36,6 +36,6 @@ stdenv.mkDerivation rec {
     homepage = https://www.cs.princeton.edu/~bwk/btl.mirror/;
     license = stdenv.lib.licenses.mit;
     maintainers = [ stdenv.lib.maintainers.konimex ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/virtualization/awsebcli/default.nix b/pkgs/tools/virtualization/awsebcli/default.nix
new file mode 100644
index 000000000000..91cb148d8fe8
--- /dev/null
+++ b/pkgs/tools/virtualization/awsebcli/default.nix
@@ -0,0 +1,99 @@
+ { stdenv, python }:
+let
+
+  localPython = python.override {
+    packageOverrides = self: super: rec {
+      colorama = super.colorama.overridePythonAttrs (oldAttrs: rec {
+        version = "0.3.7";
+
+        src = super.fetchPypi {
+          inherit (oldAttrs) pname;
+          inherit version;
+          sha256 = "0avqkn6362v7k2kg3afb35g4sfdvixjgy890clip4q174p9whhz0";
+        };
+      });
+
+      docker = super.docker.overridePythonAttrs (oldAttrs: rec {
+          pname = "docker-py";
+          version = "1.7.2";
+          name = "${pname}-${version}";
+
+          src = super.fetchPypi {
+            inherit pname version;
+            sha256 = "0k6hm3vmqh1d3wr9rryyif5n4rzvcffdlb1k4jvzp7g4996d3ccm";
+          };
+        });
+
+      pathspec = super.pathspec.overridePythonAttrs (oldAttrs: rec {
+        version = "0.5.0";
+
+        src = super.fetchPypi {
+          inherit (oldAttrs) pname;
+          inherit version;
+          sha256 = "07yx1gxj9v1iyyiy5fhq2wsmh4qfbrx158wi7jb0nx6lah80ffma";
+        };
+      });
+
+      requests = super.requests.overridePythonAttrs (oldAttrs: rec {
+        version = "2.9.1";
+
+        src = super.fetchPypi {
+          inherit (oldAttrs) pname;
+          inherit version;
+          sha256 = "0zsqrzlybf25xscgi7ja4s48y2abf9wvjkn47wh984qgs1fq2xy5";
+        };
+      });
+
+      semantic-version = super.semantic-version.overridePythonAttrs (oldAttrs: rec {
+        version = "2.5.0";
+
+        src = super.fetchPypi {
+          inherit (oldAttrs) pname; inherit version;
+          sha256 = "0p5n3d6blgkncxdz00yxqav0cis87fisdkirjm0ljjh7rdfx7aiv";
+        };
+      });
+
+      tabulate = super.tabulate.overridePythonAttrs (oldAttrs: rec {
+        version = "0.7.5";
+
+        src = super.fetchPypi {
+          inherit (oldAttrs) pname;
+          inherit version;
+          sha256 = "03l1r7ddd1a0j2snv1yd0hlnghjad3fg1an1jr8936ksv75slwch";
+        };
+      });
+    };
+  };
+in with localPython.pkgs; buildPythonApplication rec {
+  name = "${pname}-${version}";
+  pname = "awsebcli";
+  version = "3.10.5";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1g53z2flhp3navdf8lw6rgh99akf3k0ng1zkkqswvh66zswkxnwn";
+  };
+
+  checkInputs = [
+    pytest mock nose pathspec colorama requests docutils
+  ];
+
+  doCheck = false;
+
+  propagatedBuildInputs = [
+    blessed botocore cement colorama docker dockerpty docopt pathspec pyyaml
+    requests semantic-version setuptools tabulate termcolor websocket_client
+  ];
+
+  postInstall = ''
+    mkdir -p $out/etc/bash_completion.d
+    mv $out/bin/eb_completion.bash $out/etc/bash_completion.d
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://aws.amazon.com/elasticbeanstalk/;
+    description = "A command line interface for Elastic Beanstalk.";
+    maintainers = with maintainers; [ eqyiel ];
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 49e128595eed..3043c04ec337 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -511,6 +511,8 @@ with pkgs;
 
   awscli = pythonPackages.awscli; # Should be moved out of python-packages.nix
 
+  awsebcli = callPackage ../tools/virtualization/awsebcli {};
+
   awslogs = callPackage ../tools/admin/awslogs { };
 
   aws_shell = python2Packages.aws_shell; # Should be moved out of python-packages.nix
@@ -5828,6 +5830,15 @@ with pkgs;
         inherit (gnome2) GConf gnome_vfs;
       };
 
+  openjdk9 =
+    # if stdenv.isDarwin then
+    #   callPackage ../development/compilers/openjdk-darwin/9.nix { }
+    # else
+      callPackage ../development/compilers/openjdk/9.nix {
+        bootjdk = openjdk8;
+        inherit (gnome2) GConf gnome_vfs;
+      };
+
   openjdk = openjdk8;
 
   jdk7 = openjdk7 // { outputs = [ "out" ]; };
@@ -5845,6 +5856,16 @@ with pkgs;
         (lib.addMetaAttrs { outputsToInstall = [ "jre" ]; }
           ((openjdk8.override { minimal = true; }).jre // { outputs = [ "jre" ]; }));
 
+  jdk9 = openjdk9 // { outputs = [ "out" ]; };
+  jre9 = lib.setName "openjre-${lib.getVersion pkgs.openjdk9.jre}"
+    (lib.addMetaAttrs { outputsToInstall = [ "jre" ]; }
+      (openjdk9.jre // { outputs = [ "jre" ]; }));
+  jre9_headless =
+    if stdenv.isDarwin then jre9 else
+      lib.setName "openjre-${lib.getVersion pkgs.openjdk9.jre}-headless"
+        (lib.addMetaAttrs { outputsToInstall = [ "jre" ]; }
+          ((openjdk9.override { minimal = true; }).jre // { outputs = [ "jre" ]; }));
+
   jdk = jdk8;
   jre = jre8;
   jre_headless = jre8_headless;
@@ -8239,8 +8260,9 @@ with pkgs;
   # A GMP fork
   mpir = callPackage ../development/libraries/mpir {};
 
-  gns3-gui = callPackage ../applications/networking/gns3/gui.nix { };
-  gns3-server = callPackage ../applications/networking/gns3/server.nix { };
+  gns3Packages = callPackage ../applications/networking/gns3 { };
+  gns3-gui = gns3Packages.guiStable;
+  gns3-server = gns3Packages.serverStable;
 
   gobjectIntrospection = callPackage ../development/libraries/gobject-introspection {
     nixStoreDir = config.nix.storeDir or builtins.storeDir;
@@ -17773,10 +17795,7 @@ with pkgs;
 
   tome4 = callPackage ../games/tome4 { };
 
-  trackballs = callPackage ../games/trackballs {
-    debug = false;
-    guile = guile_1_8;
-  };
+  trackballs = callPackage ../games/trackballs { };
 
   tremulous = callPackage ../games/tremulous { };
 
@@ -18548,9 +18567,12 @@ with pkgs;
     inherit (gnome3) gtksourceview;
   };
 
-  singular = callPackage ../applications/science/math/singular {};
+  singular = callPackage ../applications/science/math/singular {
+    stdenv = overrideCC stdenv gcc5;
+  };
   libsingular = callPackage ../applications/science/math/singular {
     asLibsingular = true;
+    stdenv = overrideCC stdenv gcc5;
   };
 
   scilab = callPackage ../applications/science/math/scilab {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 2cd41b23c166..e94da936af31 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1470,6 +1470,8 @@ in {
     };
   };
 
+  blessed = callPackage ../development/python-modules/blessed {};
+
   # Build boost for this specific Python version
   # TODO: use separate output for libboost_python.so
   boost = pkgs.boost.override {inherit python;};
@@ -1558,6 +1560,8 @@ in {
     };
   };
 
+  cement = callPackage ../development/python-modules/cement {};
+
   cgroup-utils = callPackage ../development/python-modules/cgroup-utils {};
     postPatch = ''
       substituteInPlace setup.py --replace "argparse" ""
@@ -2152,13 +2156,15 @@ in {
       sha256 = "1fgg28halsy4g43wjpkbd6l0wqiwyzkd4zjrzbbyzw4dxbsf3xfm";
     };
 
-    propagatedBuildInputs =
-      [ self.dateutil
-        self.requests
-        self.jmespath
-      ];
+    propagatedBuildInputs = with self; [
+      dateutil
+      jmespath
+      docutils
+      ordereddict
+      simplejson
+    ];
 
-    buildInputs = with self; [ docutils mock nose ];
+    checkInputs = with self; [ mock nose ];
 
     checkPhase = ''
       nosetests -v
@@ -4663,7 +4669,10 @@ in {
     };
   };
 
-  dateutil = callPackage ../development/python-modules/dateutil { };
+  # Actual name of package
+  python-dateutil = callPackage ../development/python-modules/dateutil { };
+  # Alias that we should deprecate
+  dateutil = self.python-dateutil;
 
   # Buildbot 0.8.7p1 needs dateutil==1.5
   dateutil_1_5 = buildPythonPackage (rec {
@@ -7516,11 +7525,11 @@ in {
   };
 
   raven = buildPythonPackage rec {
-    name = "raven-6.1.0";
+    name = "raven-6.2.0";
 
     src = pkgs.fetchurl {
       url = "mirror://pypi/r/raven/${name}.tar.gz";
-      sha256 = "1158fsjjl8byzl9nw52jhhdssjl6n7l0hjaxm5hdi69v2zxvzjh2";
+      sha256 = "1jmr9kpajfh6fvxbym6fdybmlr14216y0dkbial7ris9pi1pwhf5";
     };
 
     # way too many dependencies to run tests
@@ -20314,9 +20323,12 @@ in {
   };
 
   semantic-version = buildPythonPackage rec {
-    name = "semantic_version-2.4.2";
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/s/semantic_version/${name}.tar.gz";
+    pname = "semantic_version";
+    version = "2.4.2";
+    name = "${pname}${version}";
+
+    src = self.fetchPypi {
+      inherit pname version;
       sha256 = "7e8b7fa74a3bc9b6e90b15b83b9bc2377c78eaeae3447516425f475d5d6932d2";
     };
 
@@ -21103,10 +21115,11 @@ in {
 
   tabulate = buildPythonPackage rec {
     version = "0.7.7";
-    name = "tabulate-${version}";
+    pname = "tabulate";
+    name = "${pname}-${version}";
 
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/t/tabulate/${name}.tar.gz";
+    src = fetchPypi {
+      inherit pname version;
       sha256 = "83a0b8e17c09f012090a50e1e97ae897300a72b35e0c86c0b53d3bd2ae86d8c6";
     };