about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/audio/aumix/default.nix6
-rw-r--r--pkgs/applications/editors/emacs-modes/melpa-generated.nix10
-rw-r--r--pkgs/applications/editors/emacs-modes/melpa-packages.nix3
-rw-r--r--pkgs/applications/editors/emacs-modes/melpa-stable-generated.nix10
-rw-r--r--pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix3
-rw-r--r--pkgs/applications/networking/browsers/chromium/default.nix4
-rw-r--r--pkgs/applications/networking/p2p/qbittorrent/default.nix4
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix6
-rw-r--r--pkgs/applications/virtualization/containerd/default.nix42
-rw-r--r--pkgs/applications/virtualization/docker/default.nix66
-rw-r--r--pkgs/applications/virtualization/openstack/nova.nix3
-rw-r--r--pkgs/applications/virtualization/runc/default.nix62
-rw-r--r--pkgs/applications/virtualization/virtualbox/default.nix76
-rw-r--r--pkgs/applications/virtualization/virtualbox/guest-additions/default.nix2
-rw-r--r--pkgs/applications/virtualization/virtualbox/libressl.patch47
-rw-r--r--pkgs/applications/virtualization/virtualbox/qtx11extras.patch31
-rwxr-xr-xpkgs/applications/virtualization/virtualbox/update.py83
-rw-r--r--pkgs/applications/virtualization/virtualbox/upstream-info.json8
18 files changed, 374 insertions, 92 deletions
diff --git a/pkgs/applications/audio/aumix/default.nix b/pkgs/applications/audio/aumix/default.nix
index f5f0711ecac1d..db5f081c4ed49 100644
--- a/pkgs/applications/audio/aumix/default.nix
+++ b/pkgs/applications/audio/aumix/default.nix
@@ -1,9 +1,9 @@
 {stdenv, fetchurl, gettext, ncurses
 , gtkGUI ? false
 , pkgconfig ? null
-, gtk ? null}:
+, gtk2 ? null}:
 
-assert gtkGUI -> pkgconfig != null && gtk != null;
+assert gtkGUI -> pkgconfig != null && gtk2 != null;
 
 stdenv.mkDerivation rec {
   name = "aumix-2.9.1";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ gettext ncurses ]
-    ++ (if gtkGUI then [pkgconfig gtk] else []);
+    ++ (if gtkGUI then [pkgconfig gtk2] else []);
 
   meta = {
     description = "Audio mixer for X and the console";
diff --git a/pkgs/applications/editors/emacs-modes/melpa-generated.nix b/pkgs/applications/editors/emacs-modes/melpa-generated.nix
index dea17a86b9090..d5cbea302878a 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-generated.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-generated.nix
@@ -34414,22 +34414,22 @@
           license = lib.licenses.free;
         };
       }) {};
-    jade = callPackage ({ company, emacs, fetchFromGitHub, fetchurl, js2-mode, lib, map, melpaBuild, seq, websocket }:
+    jade = callPackage ({ company, emacs, fetchFromGitHub, fetchurl, js2-mode, lib, melpaBuild, seq, websocket }:
     melpaBuild {
         pname = "jade";
-        version = "20160808.129";
+        version = "20160913.816";
         src = fetchFromGitHub {
           owner = "NicolasPetton";
           repo = "jade";
-          rev = "e5204d18a9a9563af2ba5d5f985d6161a906d7d9";
-          sha256 = "0l0q4c98jil0scr4spc3z3rgy4xy4w85zrsas1z8w142arvpiw70";
+          rev = "5d9c5cc88a4601700adba558aab2818591fcf02c";
+          sha256 = "1jfwns1jk0ixpxcf2rk49mr008bnnzq8g591vyd31lb5n10kwyc2";
         };
         recipeFile = fetchurl {
           url = "https://raw.githubusercontent.com/milkypostman/melpa/b989c1bd83f20225314b6e903c5e1df972551c19/recipes/jade";
           sha256 = "04w7pgn0dkppi6l15rkz8b1bcpw1dsgvvijy81a6i4nkigxxlv4y";
           name = "jade";
         };
-        packageRequires = [ company emacs js2-mode map seq websocket ];
+        packageRequires = [ company emacs js2-mode seq websocket ];
         meta = {
           homepage = "https://melpa.org/#/jade";
           license = lib.licenses.free;
diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index eaddf4ed61ec0..6081c96006ad8 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -98,9 +98,6 @@ self:
       # upstream issue: missing file header
       initsplit = markBroken super.initsplit;
 
-      # upstream issue: missing dependency
-      jade = null;
-
       # upstream issue: missing file header
       jsfmt = markBroken super.jsfmt;
 
diff --git a/pkgs/applications/editors/emacs-modes/melpa-stable-generated.nix b/pkgs/applications/editors/emacs-modes/melpa-stable-generated.nix
index 993b9b4e50e5b..5667e54fb4e1e 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-stable-generated.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-stable-generated.nix
@@ -16683,22 +16683,22 @@
           license = lib.licenses.free;
         };
       }) {};
-    jade = callPackage ({ company, emacs, fetchFromGitHub, fetchurl, js2-mode, lib, map, melpaBuild, seq, websocket }:
+    jade = callPackage ({ company, emacs, fetchFromGitHub, fetchurl, js2-mode, lib, melpaBuild, seq, websocket }:
     melpaBuild {
         pname = "jade";
-        version = "0.17";
+        version = "0.19";
         src = fetchFromGitHub {
           owner = "NicolasPetton";
           repo = "jade";
-          rev = "11769bf8419202819a25047f57dd9aa0c98f5ebb";
-          sha256 = "09zfvcirz7hcp255yhsf7d04vrc078kk69qhwy1j31ar0rb4fy1b";
+          rev = "94f53bbd8aa8719b3d83ce038f68e74695b86ed4";
+          sha256 = "0c40pg9f9w90fb1gwpl4z5wxhi0ng8j2fr6kf60yhbwg65x92w2k";
         };
         recipeFile = fetchurl {
           url = "https://raw.githubusercontent.com/milkypostman/melpa/b989c1bd83f20225314b6e903c5e1df972551c19/recipes/jade";
           sha256 = "04w7pgn0dkppi6l15rkz8b1bcpw1dsgvvijy81a6i4nkigxxlv4y";
           name = "jade";
         };
-        packageRequires = [ company emacs js2-mode map seq websocket ];
+        packageRequires = [ company emacs js2-mode seq websocket ];
         meta = {
           homepage = "https://melpa.org/#/jade";
           license = lib.licenses.free;
diff --git a/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix
index 7cf85d3cdab28..03121edada0a1 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix
@@ -91,9 +91,6 @@ self:
       # upstream issue: missing file header
       initsplit = markBroken super.initsplit;
 
-      # upstream issue: missing dependency
-      jade = null;
-
       # upstream issue: missing file header
       jsfmt = markBroken super.jsfmt;
 
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index 973669f87cdcc..7402a8bae29b4 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -5,7 +5,7 @@
 , enableSELinux ? false
 , enableNaCl ? false
 , enableHotwording ? false
-, gnomeSupport ? false
+, gnomeSupport ? false, gnome ? null
 , gnomeKeyringSupport ? false
 , proprietaryCodecs ? true
 , enablePepperFlash ? false
@@ -22,7 +22,7 @@ let
     upstream-info = (callPackage ./update.nix {}).getChannel channel;
 
     mkChromiumDerivation = callPackage ./common.nix {
-      inherit enableSELinux enableNaCl enableHotwording gnomeSupport
+      inherit enableSELinux enableNaCl enableHotwording gnomeSupport gnome
               gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport
               hiDPISupport;
     };
diff --git a/pkgs/applications/networking/p2p/qbittorrent/default.nix b/pkgs/applications/networking/p2p/qbittorrent/default.nix
index f3c94e8577f8f..620b8601d7dc4 100644
--- a/pkgs/applications/networking/p2p/qbittorrent/default.nix
+++ b/pkgs/applications/networking/p2p/qbittorrent/default.nix
@@ -10,11 +10,11 @@ assert guiSupport -> (dbus_libs != null);
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "qbittorrent-${version}";
-  version = "3.3.5";
+  version = "3.3.7";
 
   src = fetchurl {
     url = "mirror://sourceforge/qbittorrent/${name}.tar.xz";
-    sha256 = "1nh4lr4kbgh6rrsjax2a4lg82vn1ld0rnqjpp7sb6vpz8ikavk9q";
+    sha256 = "0h2ccqmjnm0x0qjvd0vz5hk7dy9qbqhiqvxywqjhip7sj1585p3j";
   };
 
   nativeBuildInputs = [ pkgconfig which ];
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index bbd08f0057796..99df01afa6a4c 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, perl, flex, bison, libpcap, libnl, c-ares
 , gnutls, libgcrypt, geoip, openssl, lua5, makeDesktopItem, python, libcap, glib
 , zlib
-, withGtk ? false, gtk ? null, pango ? null, cairo ? null, gdk_pixbuf ? null
+, withGtk ? false, gtk2 ? null, pango ? null, cairo ? null, gdk_pixbuf ? null
 , withQt ? false, qt4 ? null
 }:
 
-assert withGtk -> !withQt && gtk != null;
+assert withGtk -> !withQt && gtk2 != null;
 assert withQt -> !withGtk && qt4 != null;
 
 with stdenv.lib;
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
     bison flex perl pkgconfig libpcap lua5 openssl libgcrypt gnutls
     geoip libnl c-ares python libcap glib zlib
   ] ++ optional withQt qt4
-    ++ (optionals withGtk [gtk pango cairo gdk_pixbuf]);
+    ++ (optionals withGtk [gtk2 pango cairo gdk_pixbuf]);
 
   patches = [ ./wireshark-lookup-dumpcap-in-path.patch ];
 
diff --git a/pkgs/applications/virtualization/containerd/default.nix b/pkgs/applications/virtualization/containerd/default.nix
new file mode 100644
index 0000000000000..6de68ee32f3a5
--- /dev/null
+++ b/pkgs/applications/virtualization/containerd/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, lib, fetchFromGitHub
+, go, libapparmor, apparmor-parser, libseccomp }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "containerd-${version}";
+  version = "0.2.3";
+
+  src = fetchFromGitHub {
+    owner = "docker";
+    repo = "containerd";
+    rev = "v${version}";
+    sha256 = "0hlvbd5n4v337ywkc8mnbhp9m8lg8612krv45262n87c2ijyx09s";
+  };
+
+  buildInputs = [ go ];
+
+  preBuild = ''
+    ln -s $(pwd) vendor/src/github.com/docker/containerd
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp bin/* $out/bin
+  '';
+
+  preFixup = ''
+    # remove references to go compiler
+    while read file; do
+      sed -ri "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
+    done < <(find $out/bin -type f 2>/dev/null)
+  '';
+
+  meta = {
+    homepage = https://containerd.tools/;
+    description = "A daemon to control runC";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ offline ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix
index 3d69de9c15bad..801b93a02de1f 100644
--- a/pkgs/applications/virtualization/docker/default.nix
+++ b/pkgs/applications/virtualization/docker/default.nix
@@ -1,32 +1,34 @@
-{ stdenv, fetchFromGitHub, makeWrapper
-, go, sqlite, iproute, bridge-utils, devicemapper
-, btrfs-progs, iptables, e2fsprogs, xz, utillinux
-, systemd, pkgconfig
+{ stdenv, lib, fetchFromGitHub, makeWrapper, pkgconfig, go-md2man
+, go, containerd, runc
+, sqlite, iproute, bridge-utils, devicemapper, systemd
+, btrfs-progs, iptables, e2fsprogs, xz, utillinux, xfsprogs
+, procps
 }:
 
 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   name = "docker-${version}";
-  version = "1.10.3";
+  version = "1.12.1";
 
   src = fetchFromGitHub {
     owner = "docker";
     repo = "docker";
     rev = "v${version}";
-    sha256 = "0bmrafi0p3fm681y165ps97jki0a8ihl9f0bmpvi22nmc1v0sv6l";
+    sha256 = "079786dyydjfc8vb6djxh140pc7v16fjl5x2h2q420qc3mrfz5zd";
   };
 
   buildInputs = [
-    makeWrapper go sqlite iproute bridge-utils devicemapper btrfs-progs
-    iptables e2fsprogs systemd pkgconfig stdenv.glibc stdenv.glibc.static
+    makeWrapper pkgconfig go-md2man go
+    sqlite devicemapper btrfs-progs systemd
   ];
 
   dontStrip = true;
 
-  DOCKER_BUILDTAGS = [ "journald" ]
+  DOCKER_BUILDTAGS = []
+    ++ optional (systemd != null) [ "journald" ]
     ++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
     ++ optional (devicemapper == null) "exclude_graphdriver_devicemapper";
 
@@ -39,15 +41,27 @@ stdenv.mkDerivation rec {
   buildPhase = ''
     patchShebangs .
     export AUTO_GOPATH=1
-    export DOCKER_GITCOMMIT="20f81dde"
+    export DOCKER_GITCOMMIT="23cf638"
     ./hack/make.sh dynbinary
   '';
 
+  outputs = ["out" "man"];
+
+  extraPath = makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ];
+
   installPhase = ''
-    install -Dm755 ./bundles/${version}/dynbinary/docker-${version} $out/libexec/docker/docker
-    install -Dm755 ./bundles/${version}/dynbinary/dockerinit-${version} $out/libexec/docker/dockerinit
+    install -Dm755 ./bundles/${version}/dynbinary-client/docker-${version} $out/libexec/docker/docker
+    install -Dm755 ./bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
+    install -Dm755 ./bundles/${version}/dynbinary-daemon/docker-proxy-${version} $out/libexec/docker/docker-proxy
     makeWrapper $out/libexec/docker/docker $out/bin/docker \
-      --prefix PATH : "${stdenv.lib.makeBinPath [ iproute iptables e2fsprogs xz utillinux ]}"
+      --prefix PATH : "$out/libexec/docker:$extraPath"
+    makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
+      --prefix PATH : "$out/libexec/docker:$extraPath"
+
+    # docker uses containerd now
+    ln -s ${containerd}/bin/containerd $out/libexec/docker/docker-containerd
+    ln -s ${containerd}/bin/containerd-shim $out/libexec/docker/docker-containerd-shim
+    ln -s ${runc}/bin/runc $out/libexec/docker/docker-runc
 
     # systemd
     install -Dm644 ./contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
@@ -56,9 +70,31 @@ stdenv.mkDerivation rec {
     install -Dm644 ./contrib/completion/bash/docker $out/share/bash-completion/completions/docker
     install -Dm644 ./contrib/completion/fish/docker.fish $out/share/fish/vendor_completions.d/docker.fish
     install -Dm644 ./contrib/completion/zsh/_docker $out/share/zsh/site-functions/_docker
+
+    # Include contributed man pages
+    man/md2man-all.sh -q
+    manRoot="$man/share/man"
+    mkdir -p "$manRoot"
+    for manDir in man/man?; do
+      manBase="$(basename "$manDir")" # "man1"
+      for manFile in "$manDir"/*; do
+        manName="$(basename "$manFile")" # "docker-build.1"
+        mkdir -p "$manRoot/$manBase"
+        gzip -c "$manFile" > "$manRoot/$manBase/$manName.gz"
+      done
+    done
+  '';
+
+  preFixup = ''
+    # remove references to go compiler, gcc and glibc
+    while read file; do
+      sed -ri "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
+      sed -ri "s,${stdenv.cc.cc},$(echo "${stdenv.cc.cc}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
+      sed -ri "s,${stdenv.glibc.dev},$(echo "${stdenv.glibc.dev}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
+    done < <(find $out -type f 2>/dev/null)
   '';
 
-  meta = with stdenv.lib; {
+  meta = {
     homepage = http://www.docker.com/;
     description = "An open source project to pack, ship and run any application as a lightweight container";
     license = licenses.asl20;
diff --git a/pkgs/applications/virtualization/openstack/nova.nix b/pkgs/applications/virtualization/openstack/nova.nix
index 618eb76669230..a4e0779d3f916 100644
--- a/pkgs/applications/virtualization/openstack/nova.nix
+++ b/pkgs/applications/virtualization/openstack/nova.nix
@@ -15,6 +15,9 @@ pythonPackages.buildPythonApplication rec {
   # otherwise migrate.cfg is not installed
   patchPhase = ''
     echo "graft nova" >> MANIFEST.in
+
+    # remove transient error test, see http://hydra.nixos.org/build/40203534
+    rm nova/tests/unit/compute/test_{shelve,compute_utils}.py
   '';
 
   # https://github.com/openstack/nova/blob/stable/liberty/requirements.txt
diff --git a/pkgs/applications/virtualization/runc/default.nix b/pkgs/applications/virtualization/runc/default.nix
new file mode 100644
index 0000000000000..d66865573648f
--- /dev/null
+++ b/pkgs/applications/virtualization/runc/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, lib, fetchFromGitHub, go-md2man
+, go, pkgconfig, libapparmor, apparmor-parser, libseccomp }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  name = "runc-${version}";
+  version = "2016-06-15";
+
+  src = fetchFromGitHub {
+    owner = "opencontainers";
+    repo = "runc";
+    rev = "cc29e3dded8e27ba8f65738f40d251c885030a28";
+    sha256 = "18fwb3kq10zhhx184yn3j396gpbppy3y4ypb8m2b2pdms39s6pyx";
+  };
+
+  outputs = [ "out" "man" ];
+
+  hardeningDisable = ["fortify"];
+
+  buildInputs = [ go-md2man go pkgconfig libseccomp libapparmor apparmor-parser ];
+
+  makeFlags = ''BUILDTAGS+=seccomp BUILDTAGS+=apparmor'';
+
+  preBuild = ''
+    patchShebangs .
+    substituteInPlace libcontainer/apparmor/apparmor.go \
+      --replace /sbin/apparmor_parser ${apparmor-parser}/bin/apparmor_parser
+  '';
+
+  installPhase = ''
+    install -Dm755 runc $out/bin/runc
+
+    # Include contributed man pages
+    man/md2man-all.sh -q
+    manRoot="$man/share/man"
+    mkdir -p "$manRoot"
+    for manDir in man/man?; do
+      manBase="$(basename "$manDir")" # "man1"
+      for manFile in "$manDir"/*; do
+        manName="$(basename "$manFile")" # "docker-build.1"
+        mkdir -p "$manRoot/$manBase"
+        gzip -c "$manFile" > "$manRoot/$manBase/$manName.gz"
+      done
+    done
+  '';
+
+  preFixup = ''
+    # remove references to go compiler
+    while read file; do
+      sed -ri "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
+    done < <(find $out/bin -type f 2>/dev/null)
+  '';
+
+  meta = {
+    homepage = https://runc.io/;
+    description = "A CLI tool for spawning and running containers according to the OCI specification";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ offline ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 8bcf122132e3b..baf18c3f66f42 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchurl, lib, iasl, dev86, pam, libxslt, libxml2, libX11, xproto, libXext
-, libXcursor, libXmu, qt4, libIDL, SDL, libcap, zlib, libpng, glib, kernel, lvm2
-, libXrandr
+, libXcursor, libXmu, qt5, libIDL, SDL, libcap, zlib, libpng, glib, lvm2
+, libXrandr, libXinerama
 , which, alsaLib, curl, libvpx, gawk, nettools, dbus
-, xorriso, makeself, perl, pkgconfig, nukeReferences
+, xorriso, makeself, perl, pkgconfig
 , javaBindings ? false, jdk ? null
 , pythonBindings ? false, python ? null
 , enableExtensionPack ? false, requireFile ? null, patchelf ? null, fakeroot ? null
@@ -16,37 +16,12 @@ with stdenv.lib;
 let
   buildType = "release";
 
-  # When changing this, update ./guest-additions and the extpack
-  # revision/hash as well. See
-  # http://download.virtualbox.org/virtualbox/${version}/SHA256SUMS
-  # for hashes.
-  version = "5.0.26";
-
-  forEachModule = action: ''
-    for mod in \
-      out/linux.*/${buildType}/bin/src/vboxdrv \
-      out/linux.*/${buildType}/bin/src/vboxpci \
-      out/linux.*/${buildType}/bin/src/vboxnetadp \
-      out/linux.*/${buildType}/bin/src/vboxnetflt
-    do
-      if [ "x$(basename "$mod")" != xvboxdrv -a ! -e "$mod/Module.symvers" ]
-      then
-        cp -v out/linux.*/${buildType}/bin/src/vboxdrv/Module.symvers \
-          "$mod/Module.symvers"
-      fi
-      INSTALL_MOD_PATH="$out" INSTALL_MOD_DIR=misc \
-      make -j $NIX_BUILD_CORES -C "$MODULES_BUILD_DIR" DEPMOD=/do_not_use_depmod \
-        "M=\$(PWD)/$mod" BUILD_TYPE="${buildType}" ${action}
-    done
-  '';
+  inherit (importJSON ./upstream-info.json) version extpackRev extpack main;
 
   # See https://github.com/NixOS/nixpkgs/issues/672 for details
-  extpackRevision = "108824";
   extensionPack = requireFile rec {
-    name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${extpackRevision}.vbox-extpack";
-    # IMPORTANT: Hash must be base16 encoded because it's used as an input to
-    # VBoxExtPackHelperApp!
-    sha256 = "2f2302c7ba3d00a1258fe8e7767a6eb08dccdc3c31f6e3eeb74063c2c268b104";
+    name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${extpackRev}.vbox-extpack";
+    sha256 = extpack;
     message = ''
       In order to use the extension pack, you need to comply with the VirtualBox Personal Use
       and Evaluation License (PUEL) available at:
@@ -61,35 +36,36 @@ let
   };
 
 in stdenv.mkDerivation {
-  name = "virtualbox-${version}-${kernel.version}";
+  name = "virtualbox-${version}";
 
   src = fetchurl {
     url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2";
-    sha256 = "78dec1369d2c8feefea3c682d95e76c0e99414c56626388035cf4061d4dad62e";
+    sha256 = main;
   };
 
+  outputs = [ "out" "modsrc" ];
+
   buildInputs =
     [ iasl dev86 libxslt libxml2 xproto libX11 libXext libXcursor libIDL
       libcap glib lvm2 python alsaLib curl libvpx pam xorriso makeself perl
-      pkgconfig which libXmu nukeReferences ]
+      pkgconfig which libXmu libpng ]
     ++ optional javaBindings jdk
     ++ optional pythonBindings python
     ++ optional pulseSupport libpulseaudio
-    ++ optionals (headless) [ libXrandr libpng ]
-    ++ optionals (!headless) [ qt4 SDL ];
+    ++ optionals (headless) [ libXrandr ]
+    ++ optionals (!headless) [ qt5.qtbase qt5.qtx11extras libXinerama SDL ];
 
   hardeningDisable = [ "fortify" "pic" "stackprotector" ];
 
   prePatch = ''
     set -x
-    MODULES_BUILD_DIR=`echo ${kernel.dev}/lib/modules/*/build`
-    sed -e 's@/lib/modules/`uname -r`/build@'$MODULES_BUILD_DIR@ \
-        -e 's@MKISOFS --version@MKISOFS -version@' \
+    sed -e 's@MKISOFS --version@MKISOFS -version@' \
         -e 's@PYTHONDIR=.*@PYTHONDIR=${if pythonBindings then python else ""}@' \
-        -i configure
+        ${optionalString (!headless) ''
+        -e 's@TOOLQT5BIN=.*@TOOLQT5BIN="${getDev qt5.qtbase}/bin"@' \
+        ''} -i configure
     ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2
     ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2
-    find . -type f -iname '*makefile*' -exec sed -i -e 's/depmod -a/:/g' {} +
     sed -i -e '
       s@"libdbus-1\.so\.3"@"${dbus.lib}/lib/libdbus-1.so.3"@g
       s@"libasound\.so\.2"@"${alsaLib.out}/lib/libasound.so.2"@g
@@ -103,11 +79,12 @@ in stdenv.mkDerivation {
     set +x
   '';
 
-  patches = optional enableHardening ./hardened.patch;
+  patches = optional enableHardening ./hardened.patch
+    ++ [ ./libressl.patch ./qtx11extras.patch ];
 
   postPatch = ''
     sed -i -e 's|/sbin/ifconfig|${nettools}/bin/ifconfig|' \
-      src/apps/adpctl/VBoxNetAdpCtl.cpp
+      src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp
   '';
 
   # first line: ugly hack, and it isn't yet clear why it's a problem
@@ -131,11 +108,15 @@ in stdenv.mkDerivation {
     ${optionalString javaBindings ''
     VBOX_JAVA_HOME                 := ${jdk}
     ''}
+    ${optionalString (!headless) ''
+    PATH_QT5_X11_EXTRAS_LIB        := ${getLib qt5.qtx11extras}/lib
+    PATH_QT5_X11_EXTRAS_INC        := ${getDev qt5.qtx11extras}/include
+    TOOL_QT5_LRC                   := ${getDev qt5.qttools}/bin/lrelease
+    ''}
     LOCAL_CONFIG
 
     ./configure \
       ${optionalString headless "--build-headless"} \
-      ${optionalString (!headless) "--with-qt4-dir=${qt4}"} \
       ${optionalString (!javaBindings) "--disable-java"} \
       ${optionalString (!pythonBindings) "--disable-python"} \
       ${optionalString (!pulseSupport) "--disable-pulse"} \
@@ -153,7 +134,6 @@ in stdenv.mkDerivation {
   buildPhase = ''
     source env.sh
     kmk -j $NIX_BUILD_CORES BUILD_TYPE="${buildType}"
-    ${forEachModule "modules"}
   '';
 
   installPhase = ''
@@ -165,9 +145,6 @@ in stdenv.mkDerivation {
     find out/linux.*/${buildType}/bin -mindepth 1 -maxdepth 1 \
       -name src -o -exec cp -avt "$libexec" {} +
 
-    # Install kernel modules
-    ${forEachModule "modules_install"}
-
     # Create wrapper script
     mkdir -p $out/bin
     for file in VirtualBox VBoxManage VBoxSDL VBoxBalloonCtrl VBoxBFE VBoxHeadless; do
@@ -199,8 +176,7 @@ in stdenv.mkDerivation {
       done
     ''}
 
-    # Get rid of a reference to linux.dev.
-    nuke-refs $out/lib/modules/*/misc/*.ko
+    cp -rv out/linux.*/${buildType}/bin/src "$modsrc"
   '';
 
   passthru = { inherit version; /* for guest additions */ };
diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
index 56e0251979251..c32a34fbc1275 100644
--- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso";
-    sha256 = "7458ee5a7121a7d243fd6a7528ba427945d9120c5efc7cd75b3951fb01f09c59";
+    sha256 = (lib.importJSON ../upstream-info.json).guest;
   };
 
   KERN_DIR = "${kernel.dev}/lib/modules/*/build";
diff --git a/pkgs/applications/virtualization/virtualbox/libressl.patch b/pkgs/applications/virtualization/virtualbox/libressl.patch
new file mode 100644
index 0000000000000..db9b7e7a59d95
--- /dev/null
+++ b/pkgs/applications/virtualization/virtualbox/libressl.patch
@@ -0,0 +1,47 @@
+diff --git a/src/VBox/Runtime/common/crypto/digest-builtin.cpp b/src/VBox/Runtime/common/crypto/digest-builtin.cpp
+index 66b4304..1aaceff 100644
+--- a/src/VBox/Runtime/common/crypto/digest-builtin.cpp
++++ b/src/VBox/Runtime/common/crypto/digest-builtin.cpp
+@@ -561,7 +561,7 @@ static PCRTCRDIGESTDESC const g_apDigestOps[] =
+  * OpenSSL EVP.
+  */
+ 
+-# if OPENSSL_VERSION_NUMBER >= 0x10100000
++# if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
+ /** @impl_interface_method{RTCRDIGESTDESC::pfnNew} */
+ static DECLCALLBACK(void*) rtCrDigestOsslEvp_New(void)
+ {
+@@ -597,7 +597,7 @@ static DECLCALLBACK(int) rtCrDigestOsslEvp_Init(void *pvState, void *pvOpaque, b
+     if (fReInit)
+     {
+         pEvpType = EVP_MD_CTX_md(pThis);
+-# if OPENSSL_VERSION_NUMBER >= 0x10100000
++# if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
+         EVP_MD_CTX_reset(pThis);
+ # else
+         EVP_MD_CTX_cleanup(pThis);
+@@ -616,7 +616,7 @@ static DECLCALLBACK(int) rtCrDigestOsslEvp_Init(void *pvState, void *pvOpaque, b
+ static DECLCALLBACK(void) rtCrDigestOsslEvp_Delete(void *pvState)
+ {
+     EVP_MD_CTX *pThis = (EVP_MD_CTX *)pvState;
+-# if OPENSSL_VERSION_NUMBER >= 0x10100000
++# if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
+     EVP_MD_CTX_reset(pThis);
+ # else
+     EVP_MD_CTX_cleanup(pThis);
+@@ -661,13 +661,13 @@ static RTCRDIGESTDESC const g_rtCrDigestOpenSslDesc =
+     NULL,
+     RTDIGESTTYPE_UNKNOWN,
+     EVP_MAX_MD_SIZE,
+-# if OPENSSL_VERSION_NUMBER >= 0x10100000
++# if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
+     0,
+ # else
+     sizeof(EVP_MD_CTX),
+ # endif
+     0,
+-# if OPENSSL_VERSION_NUMBER >= 0x10100000
++# if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
+     rtCrDigestOsslEvp_New,
+     rtCrDigestOsslEvp_Free,
+ # else
diff --git a/pkgs/applications/virtualization/virtualbox/qtx11extras.patch b/pkgs/applications/virtualization/virtualbox/qtx11extras.patch
new file mode 100644
index 0000000000000..f5decc211c75a
--- /dev/null
+++ b/pkgs/applications/virtualization/virtualbox/qtx11extras.patch
@@ -0,0 +1,31 @@
+diff --git a/kBuild/units/qt5.kmk b/kBuild/units/qt5.kmk
+index 71b96a3..73391f0 100644
+--- a/kBuild/units/qt5.kmk
++++ b/kBuild/units/qt5.kmk
+@@ -994,9 +994,10 @@ else
+    $(eval $(target)_LIBS   += $(PATH_SDK_QT5_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
+   endif
+  else
+-  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) )
++  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) \
++                              $(PATH_QT5_X11_EXTRAS_LIB)/lib$(qt_prefix)Qt5X11Extras$(qt_infix)$(SUFF_DLL))
+  endif
+- $(eval $(target)_INCS     += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) )
++ $(eval $(target)_INCS     += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) $(PATH_QT5_X11_EXTRAS_INC)/QtX11Extras )
+ endif
+ $(eval $(target)_DEFS      += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
+ 
+diff --git a/src/VBox/Frontends/VirtualBox/Makefile.kmk b/src/VBox/Frontends/VirtualBox/Makefile.kmk
+index 38db6b0..7dd446b 100644
+--- a/src/VBox/Frontends/VirtualBox/Makefile.kmk
++++ b/src/VBox/Frontends/VirtualBox/Makefile.kmk
+@@ -912,9 +912,6 @@ VirtualBox_QT_MODULES = Core Gui
+ ifdef VBOX_WITH_QTGUI_V5
+  # Qt5 requires additional modules:
+  VirtualBox_QT_MODULES += Widgets PrintSupport
+- VirtualBox_QT_MODULES.linux   += X11Extras
+- VirtualBox_QT_MODULES.solaris += X11Extras
+- VirtualBox_QT_MODULES.freebsd += X11Extras
+  VirtualBox_QT_MODULES.darwin  += MacExtras
+  VirtualBox_QT_MODULES.win     += WinExtras
+ endif # VBOX_WITH_QTGUI_V5
diff --git a/pkgs/applications/virtualization/virtualbox/update.py b/pkgs/applications/virtualization/virtualbox/update.py
new file mode 100755
index 0000000000000..ff1b2e2fffb75
--- /dev/null
+++ b/pkgs/applications/virtualization/virtualbox/update.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python3
+import os
+import re
+import json
+import urllib.request
+
+from distutils.version import LooseVersion
+
+UPSTREAM_INFO_FILE = os.path.join(
+    os.path.dirname(os.path.abspath(__file__)),
+    "upstream-info.json"
+)
+
+
+def fetch_latest_version():
+    url = "http://download.virtualbox.org/virtualbox/LATEST.TXT"
+    return urllib.request.urlopen(url).read().strip().decode()
+
+
+def load_upstream_info():
+    try:
+        with open(UPSTREAM_INFO_FILE, 'r') as fp:
+            return json.load(fp)
+    except FileNotFoundError:
+        return {'version': "0"}
+
+
+def save_upstream_info(contents):
+    remark = "Generated using update.py from the same directory."
+    contents['__NOTE'] = remark
+    data = json.dumps(contents, indent=2, sort_keys=True)
+    with open(UPSTREAM_INFO_FILE, 'w') as fp:
+        fp.write(data + "\n")
+
+
+def fetch_file_table(version):
+    url = "http://download.virtualbox.org/virtualbox/{}/SHA256SUMS"
+    url = url.format(version)
+    result = {}
+    for line in urllib.request.urlopen(url):
+        sha, name = line.rstrip().split()
+        result[name.lstrip(b'*').decode()] = sha.decode()
+    return result
+
+
+def update_to_version(version):
+    extpack_start = 'Oracle_VM_VirtualBox_Extension_Pack-'
+    version_re = version.replace('.', '\\.')
+    attribute_map = {
+        'extpack': r'^' + extpack_start + r'[^-]+-[^.]+.vbox-extpack$',
+        'extpackRev': r'^' + extpack_start + r'[^-]+-([^.]+).vbox-extpack$',
+        'main': r'^VirtualBox-' + version_re + r'.tar.bz2$',
+        'guest': r'^VBoxGuestAdditions_' + version_re + r'.iso$',
+    }
+    table = fetch_file_table(version)
+    new_attrs = {'version': version}
+    for attr, searchexpr in attribute_map.items():
+        result = [re.search(searchexpr, key) for key in table.keys()]
+        filtered = filter(lambda m: m is not None, result)
+        found = [m.groups()[0] if len(m.groups()) > 0 else table[m.group(0)]
+                 for m in filtered if m is not None]
+
+        if len(found) == 0:
+            msg = "No package found for attribute {}".format(attr)
+            raise AssertionError(msg)
+        elif len(found) != 1:
+            msg = "More than one package found for attribute {}: ".format(attr)
+            msg += ', '.join(found)
+            raise AssertionError(msg)
+        else:
+            new_attrs[attr] = found[0]
+    return new_attrs
+
+
+info = load_upstream_info()
+latest = fetch_latest_version()
+if LooseVersion(info['version']) < LooseVersion(latest):
+    print("Updating to version {}...".format(latest), end="", flush=True)
+    new_attrs = update_to_version(latest)
+    save_upstream_info(new_attrs)
+    print(" done.")
+else:
+    print("Version {} is already the latest one.".format(info['version']))
diff --git a/pkgs/applications/virtualization/virtualbox/upstream-info.json b/pkgs/applications/virtualization/virtualbox/upstream-info.json
new file mode 100644
index 0000000000000..3a386004a3fd0
--- /dev/null
+++ b/pkgs/applications/virtualization/virtualbox/upstream-info.json
@@ -0,0 +1,8 @@
+{
+  "__NOTE": "Generated using update.py from the same directory.",
+  "extpack": "607ac3636bd49a738d5c48159b39261369b5487f71fb10afa2ecf869627a12de",
+  "extpackRev": "110634",
+  "guest": "cbcf9b9b1000e09911b3d20e1efe529aef8a945cf130f6abffc14a39522cc1ed",
+  "main": "2e0112b0d85841587b8f212e6ba8f6c35b31e1cce6b6999497dc917cd37e6911",
+  "version": "5.1.6"
+}