about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2016-07-29 16:33:02 -0500
committerThomas Tuegel <ttuegel@gmail.com>2016-07-29 17:46:13 -0500
commit839a543d41f9e88d59b2b59c2d87e4ebb235f7a2 (patch)
tree2a4385546162d2af933f1247258a78956b12ac76
parent06536879e7189100c6b4043787e1703a0220dc4b (diff)
downloadnixlib-839a543d41f9e88d59b2b59c2d87e4ebb235f7a2.tar
nixlib-839a543d41f9e88d59b2b59c2d87e4ebb235f7a2.tar.gz
nixlib-839a543d41f9e88d59b2b59c2d87e4ebb235f7a2.tar.bz2
nixlib-839a543d41f9e88d59b2b59c2d87e4ebb235f7a2.tar.lz
nixlib-839a543d41f9e88d59b2b59c2d87e4ebb235f7a2.tar.xz
nixlib-839a543d41f9e88d59b2b59c2d87e4ebb235f7a2.tar.zst
nixlib-839a543d41f9e88d59b2b59c2d87e4ebb235f7a2.zip
qt57: init at 5.7.0
-rwxr-xr-xmaintainers/scripts/generate-qt.sh5
-rw-r--r--pkgs/development/libraries/qt-5/5.7/default.nix119
-rw-r--r--pkgs/development/libraries/qt-5/5.7/make-qt-wrapper.sh36
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qmake-hook.sh42
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths.patch321
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/compose-search-path.patch16
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/decrypt-ssl-traffic.patch13
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/default.nix247
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-dbus.patch13
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gl.patch17
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gtkstyle.patch50
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-libXcursor.patch17
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-openssl.patch26
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-resolv.patch26
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/libressl.patch33
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/mkspecs-libgl.patch15
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/nix-profiles-library-paths.patch22
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/series10
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/setup-hook.sh171
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/tzdir.patch40
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/xdg-config-dirs.patch41
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtconnectivity.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtdeclarative/default.nix8
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtdeclarative/nix-profiles-import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtdeclarative/series1
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtdoc.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtgraphicaleffects.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtimageformats.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtlocation.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix12
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtquickcontrols.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtscript/0001-glib-2.32.patch25
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtscript/default.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtsensors.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtserialport/0001-dlopen-serialport-udev.patch28
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtserialport/default.nix12
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtsvg.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qttools.nix10
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qttranslations.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtwebchannel.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtwebengine.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtwebsockets.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtx11extras.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtxmlpatterns.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/qt-5/5.7/srcs.nix301
-rw-r--r--pkgs/top-level/all-packages.nix4
47 files changed, 1794 insertions, 1 deletions
diff --git a/maintainers/scripts/generate-qt.sh b/maintainers/scripts/generate-qt.sh
index 61691520696f..a4d79c1aac58 100755
--- a/maintainers/scripts/generate-qt.sh
+++ b/maintainers/scripts/generate-qt.sh
@@ -1,3 +1,6 @@
 #!/bin/sh
 
-./fetch-kde-qt.sh http://download.qt.io/official_releases/qt/5.6/5.6.1/submodules/ -A '*.tar.xz'
+./maintainers/scripts/fetch-kde-qt.sh \
+    http://download.qt.io/official_releases/qt/5.7/5.7.0/submodules/ \
+    -A '*.tar.xz' \
+    >pkgs/development/libraries/qt-5/5.7/srcs.nix
diff --git a/pkgs/development/libraries/qt-5/5.7/default.nix b/pkgs/development/libraries/qt-5/5.7/default.nix
new file mode 100644
index 000000000000..90bd6b0726ee
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/default.nix
@@ -0,0 +1,119 @@
+/*
+
+# Updates
+
+Before a major version update, make a copy of this directory. (We like to
+keep the old version around for a short time after major updates.) Add a
+top-level attribute to `top-level/all-packages.nix`.
+
+1. Update the URL in `maintainers/scripts/generate-qt.sh`.
+2. From the top of the Nixpkgs tree, run
+   `./maintainers/scripts/generate-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
+3. Check that the new packages build correctly.
+4. Commit the changes and open a pull request.
+
+*/
+
+{ pkgs
+
+# options
+, developerBuild ? false
+, decryptSslTraffic ? false
+}:
+
+let inherit (pkgs) makeSetupHook makeWrapper stdenv; in
+
+with stdenv.lib;
+
+let
+
+  mirror = "http://download.qt.io";
+  srcs = import ./srcs.nix { inherit (pkgs) fetchurl; inherit mirror; };
+
+  qtSubmodule = args:
+    let
+      inherit (args) name;
+      version = args.version or srcs."${name}".version;
+      src = args.src or srcs."${name}".src;
+      inherit (pkgs.stdenv) mkDerivation;
+    in mkDerivation (args // {
+      name = "${name}-${version}";
+      inherit src;
+
+      propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
+      nativeBuildInputs =
+        (args.nativeBuildInputs or [])
+        ++ [ pkgs.perl self.qmakeHook ];
+
+      NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
+
+      outputs = args.outputs or [ "dev" "out" ];
+      setOutputFlags = args.setOutputFlags or false;
+
+      setupHook = ./setup-hook.sh;
+
+      enableParallelBuilding = args.enableParallelBuilding or true;
+
+      meta = self.qtbase.meta // (args.meta or {});
+    });
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtSubmodule srcs; };
+    in {
+
+      qtbase = callPackage ./qtbase {
+        inherit (srcs.qtbase) src version;
+        mesa = pkgs.mesa_noglu;
+        harfbuzz = pkgs.harfbuzz-icu;
+        cups = if stdenv.isLinux then pkgs.cups else null;
+        # GNOME dependencies are not used unless gtkStyle == true
+        bison = pkgs.bison2; # error: too few arguments to function 'int yylex(...
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      qtconnectivity = callPackage ./qtconnectivity.nix {};
+      qtdeclarative = callPackage ./qtdeclarative {};
+      qtdoc = callPackage ./qtdoc.nix {};
+      qtgraphicaleffects = callPackage ./qtgraphicaleffects.nix {};
+      qtimageformats = callPackage ./qtimageformats.nix {};
+      qtlocation = callPackage ./qtlocation.nix {};
+      qtmultimedia = callPackage ./qtmultimedia.nix {
+        inherit (pkgs.gst_all_1) gstreamer gst-plugins-base;
+      };
+      qtquickcontrols = callPackage ./qtquickcontrols.nix {};
+      qtscript = callPackage ./qtscript {};
+      qtsensors = callPackage ./qtsensors.nix {};
+      qtserialport = callPackage ./qtserialport {};
+      qtsvg = callPackage ./qtsvg.nix {};
+      qttools = callPackage ./qttools.nix {};
+      qttranslations = callPackage ./qttranslations.nix {};
+      qtwebchannel = callPackage ./qtwebchannel.nix {};
+      qtwebengine = callPackage ./qtwebengine.nix {};
+      qtwebsockets = callPackage ./qtwebsockets.nix {};
+      qtx11extras = callPackage ./qtx11extras.nix {};
+      qtxmlpatterns = callPackage ./qtxmlpatterns.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-${qtbase.version}" [
+        qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtscript
+        qtsensors qtserialport qtsvg qttools qttranslations qtwebsockets
+        qtx11extras qtxmlpatterns
+      ];
+
+      makeQtWrapper =
+        makeSetupHook
+        { deps = [ makeWrapper ]; }
+        ./make-qt-wrapper.sh;
+
+      qmakeHook =
+        makeSetupHook
+        { deps = [ self.qtbase ]; }
+        ./qmake-hook.sh;
+
+    };
+
+   self = makeScope pkgs.newScope addPackages;
+
+in self
diff --git a/pkgs/development/libraries/qt-5/5.7/make-qt-wrapper.sh b/pkgs/development/libraries/qt-5/5.7/make-qt-wrapper.sh
new file mode 100644
index 000000000000..b0d0bec9e3f6
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/make-qt-wrapper.sh
@@ -0,0 +1,36 @@
+wrapQtProgram() {
+    local prog="$1"
+    shift
+    wrapProgram "$prog" \
+        --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
+        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
+        --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
+        --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
+        --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
+        "$@"
+}
+
+makeQtWrapper() {
+    local old="$1"
+    local new="$2"
+    shift
+    shift
+    makeWrapper "$old" "$new" \
+        --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
+        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
+        --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
+        --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
+        --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
+        "$@"
+}
+
+_makeQtWrapperSetup() {
+    # cannot use addToSearchPath because these directories may not exist yet
+    export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
+    export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
+    export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
+    export RUNTIME_XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}${!outputBin}/share"
+    export RUNTIME_XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS${XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
+}
+
+prePhases+=(_makeQtWrapperSetup)
diff --git a/pkgs/development/libraries/qt-5/5.7/qmake-hook.sh b/pkgs/development/libraries/qt-5/5.7/qmake-hook.sh
new file mode 100644
index 000000000000..696b4ea8dad3
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qmake-hook.sh
@@ -0,0 +1,42 @@
+qmakeConfigurePhase() {
+    runHook preConfigure
+
+    qmake PREFIX=$out $qmakeFlags
+
+    runHook postConfigure
+}
+
+if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
+    configurePhase=qmakeConfigurePhase
+fi
+
+_qtModuleMultioutDevsPre() {
+    # We cannot simply set these paths in configureFlags because libQtCore retains
+    # references to the paths it was built with.
+    moveToOutput "bin" "${!outputDev}"
+    moveToOutput "include" "${!outputDev}"
+
+    # The destination directory must exist or moveToOutput will do nothing
+    mkdir -p "${!outputDev}/share"
+    moveToOutput "share/doc" "${!outputDev}"
+}
+
+_qtModuleMultioutDevsPost() {
+    # Move libtool archives and qmake project files to $dev/lib
+    if [ "z${!outputLib}" != "z${!outputDev}" ]; then
+        pushd "${!outputLib}"
+        if [ -d "lib" ]; then
+            find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \
+                while read -r -d $'\0' file; do
+                    mkdir -p "${!outputDev}/$(dirname "$file")"
+                    mv "${!outputLib}/$file" "${!outputDev}/$file"
+                done
+        fi
+        popd
+    fi
+}
+
+if [ -n "$NIX_QT_SUBMODULE" ]; then
+    preFixupHooks+=(_qtModuleMultioutDevsPre)
+    postFixupHooks+=(_qtModuleMultioutDevsPost)
+fi
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths.patch
new file mode 100644
index 000000000000..6e2de0b3022a
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths.patch
@@ -0,0 +1,321 @@
+Index: qtbase-opensource-src-5.7.0/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ qtbase-opensource-src-5.7.0/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0)
+ endif()
+ !!ENDIF
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
+@@ -59,7 +35,10 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"@NIX_DEV@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    endif()
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+@@ -74,45 +53,18 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+         \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+     )
+ 
+-!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+-    set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+-    _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+-    if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+-        set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+-        \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
+-        )
+-    endif()
+-!!ENDIF
+ endmacro()
+ !!ENDIF
+ 
+ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ 
+ !!IF !no_module_headers
+-!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+-    )
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
++    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"@NIX_DEV@/$$CMAKE_INCLUDE_DIR\" \"@NIX_DEV@/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"@NIX_DEV@/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
++        \"@NIX_DEV@/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -128,7 +80,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
++
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -253,28 +205,19 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+ 
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_DEBUG_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -282,36 +225,23 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ 
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-    _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE
+     _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+ 
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -329,7 +259,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        set(imported_location \"@NIX_OUT@/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+ !!ELSE
+         set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.0/src/gui/Qt5GuiConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/gui/Qt5GuiConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.0/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+ 
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"@NIX_DEV@/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_propert
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"@NIX_DEV@/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.0/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.0/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+     add_executable(Qt5::uic IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.0/src/corelib/Qt5CoreConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.0/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
+     add_executable(Qt5::qmake IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
+     add_executable(Qt5::moc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
+     add_executable(Qt5::rcc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -133,7 +133,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -147,7 +147,7 @@ if (NOT TARGET Qt5::WinMain)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.0/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ qtbase-opensource-src-5.7.0/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.0/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ qtbase-opensource-src-5.7.0/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.0/src/dbus/Qt5DBusConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.0/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/compose-search-path.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/compose-search-path.patch
new file mode 100644
index 000000000000..a0e344a7bc68
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/compose-search-path.patch
@@ -0,0 +1,16 @@
+Index: qtbase-opensource-src-5.7.0/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
++++ qtbase-opensource-src-5.7.0/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+@@ -257,10 +257,7 @@ void TableGenerator::initPossibleLocatio
+     // the QTCOMPOSE environment variable
+     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
+         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
+-    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
++    m_possibleLocations.append(QStringLiteral("${libX11}/share/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
+ }
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/decrypt-ssl-traffic.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/decrypt-ssl-traffic.patch
new file mode 100644
index 000000000000..495db07cfbb5
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/decrypt-ssl-traffic.patch
@@ -0,0 +1,13 @@
+Index: qtbase-opensource-src-5.5.1/src/network/ssl/qsslsocket_openssl.cpp
+===================================================================
+--- qtbase-opensource-src-5.5.1.orig/src/network/ssl/qsslsocket_openssl.cpp
++++ qtbase-opensource-src-5.5.1/src/network/ssl/qsslsocket_openssl.cpp
+@@ -48,7 +48,7 @@
+ ****************************************************************************/
+ 
+ //#define QSSLSOCKET_DEBUG
+-//#define QT_DECRYPT_SSL_TRAFFIC
++#define QT_DECRYPT_SSL_TRAFFIC
+ 
+ #include "qssl_p.h"
+ #include "qsslsocket_openssl_p.h"
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
new file mode 100644
index 000000000000..94ddb21f3b60
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
@@ -0,0 +1,247 @@
+{
+  stdenv, lib, copyPathsToStore,
+  src, version,
+
+  coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python,
+  ruby,
+
+  dbus, fontconfig, freetype, glib, gtk3, harfbuzz, icu, libX11, libXcomposite,
+  libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng, libtiff,
+  libxcb, libxkbcommon, libxml2, libxslt, openssl, pcre16, sqlite, udev,
+  xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilrenderutil, xcbutilwm, xlibs,
+  zlib,
+
+  # optional dependencies
+  cups ? null, mysql ? null, postgresql ? null,
+
+  # options
+  mesaSupported, mesa,
+  buildExamples ? false,
+  buildTests ? false,
+  developerBuild ? false,
+  decryptSslTraffic ? false
+}:
+
+let
+  system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64;
+in
+
+stdenv.mkDerivation {
+
+  name = "qtbase-${version}";
+  inherit src version;
+
+  outputs = [ "dev" "out" ];
+
+  patches =
+    copyPathsToStore (lib.readPathsFromFile ./. ./series)
+    ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch
+    ++ lib.optional mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
+
+  postPatch =
+    ''
+      substituteInPlace configure --replace /bin/pwd pwd
+      substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
+      sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
+
+      sed -i 's/PATHS.*NO_DEFAULT_PATH//' "src/corelib/Qt5Config.cmake.in"
+      sed -i 's/PATHS.*NO_DEFAULT_PATH//' "src/corelib/Qt5CoreMacros.cmake"
+      sed -i 's/NO_DEFAULT_PATH//' "src/gui/Qt5GuiConfigExtras.cmake.in"
+      sed -i 's/PATHS.*NO_DEFAULT_PATH//' "mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in"
+
+      substituteInPlace src/network/kernel/qdnslookup_unix.cpp \
+        --replace "@glibc@" "${stdenv.cc.libc.out}"
+      substituteInPlace src/network/kernel/qhostinfo_unix.cpp \
+        --replace "@glibc@" "${stdenv.cc.libc.out}"
+
+      substituteInPlace src/plugins/platforms/xcb/qxcbcursor.cpp \
+        --replace "@libXcursor@" "${libXcursor.out}"
+
+      substituteInPlace src/network/ssl/qsslsocket_openssl_symbols.cpp \
+        --replace "@openssl@" "${openssl.out}"
+
+      substituteInPlace src/dbus/qdbus_symbols.cpp \
+        --replace "@dbus_libs@" "${dbus.lib}"
+
+      substituteInPlace \
+        src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp \
+        --replace "@libX11@" "${libX11.out}"
+    ''
+    + lib.optionalString mesaSupported ''
+      substituteInPlace \
+        src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp \
+        --replace "@mesa_lib@" "${mesa.out}"
+      substituteInPlace mkspecs/common/linux.conf \
+        --replace "@mesa_lib@" "${mesa.out}" \
+        --replace "@mesa_inc@" "${mesa.dev or mesa}"
+    '';
+
+
+  setOutputFlags = false;
+  preConfigure = ''
+    export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
+    export MAKEFLAGS=-j$NIX_BUILD_CORES
+
+    configureFlags+="\
+        -plugindir $out/lib/qt5/plugins \
+        -importdir $out/lib/qt5/imports \
+        -qmldir $out/lib/qt5/qml \
+        -docdir $out/share/doc/qt5"
+  '';
+
+  prefixKey = "-prefix ";
+
+  # -no-eglfs, -no-directfb, -no-linuxfb and -no-kms because of the current minimalist mesa
+  # TODO Remove obsolete and useless flags once the build will be totally mastered
+  configureFlags = ''
+    -verbose
+    -confirm-license
+    -opensource
+
+    -release
+    -shared
+    ${lib.optionalString developerBuild "-developer-build"}
+    -largefile
+    -accessibility
+    -rpath
+    -optimized-qmake
+    -strip
+    -reduce-relocations
+    -system-proxies
+    -pkg-config
+
+    -gui
+    -widgets
+    -opengl desktop
+    -qml-debug
+    -nis
+    -iconv
+    -icu
+    -pch
+    -glib
+    -xcb
+    -qpa xcb
+    -${lib.optionalString (cups == null) "no-"}cups
+
+    -no-eglfs
+    -no-directfb
+    -no-linuxfb
+    -no-kms
+
+    ${lib.optionalString (!system-x86_64) "-no-sse2"}
+    -no-sse3
+    -no-ssse3
+    -no-sse4.1
+    -no-sse4.2
+    -no-avx
+    -no-avx2
+    -no-mips_dsp
+    -no-mips_dspr2
+
+    -system-zlib
+    -system-libpng
+    -system-libjpeg
+    -system-harfbuzz
+    -system-xcb
+    -system-xkbcommon
+    -system-pcre
+    -openssl-linked
+    -dbus-linked
+    -libinput
+    -gtk
+
+    -system-sqlite
+    -${if mysql != null then "plugin" else "no"}-sql-mysql
+    -${if postgresql != null then "plugin" else "no"}-sql-psql
+
+    -make libs
+    -make tools
+    -${lib.optionalString (buildExamples == false) "no"}make examples
+    -${lib.optionalString (buildTests == false) "no"}make tests
+    -v
+  '';
+
+  # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
+  # if dependency paths contain the string "pq", which can occur in the hash.
+  # To prevent these failures, we need to override PostgreSQL detection.
+  PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";
+
+  propagatedBuildInputs = [
+    dbus glib libxml2 libxslt openssl pcre16 sqlite udev zlib
+
+    # Image formats
+    libjpeg libpng libtiff
+
+    # Text rendering
+    fontconfig freetype harfbuzz icu
+
+    # X11 libs
+    libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
+    xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
+  ]
+  ++ lib.optional mesaSupported mesa;
+
+  buildInputs =
+    [ gtk3 libinput ]
+    ++ lib.optional developerBuild gdb
+    ++ lib.optional (cups != null) cups
+    ++ lib.optional (mysql != null) mysql.lib
+    ++ lib.optional (postgresql != null) postgresql;
+
+  nativeBuildInputs =
+    [ bison flex gperf lndir patchelf perl pkgconfig python ruby ];
+
+  # freetype-2.5.4 changed signedness of some struct fields
+  NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare";
+
+  postInstall = ''
+    find "$out" -name "*.cmake" | while read file; do
+        substituteInPlace "$file" \
+            --subst-var-by NIX_OUT "$out" \
+            --subst-var-by NIX_DEV "$dev"
+    done
+  '';
+
+  preFixup = ''
+    # We cannot simply set these paths in configureFlags because libQtCore retains
+    # references to the paths it was built with.
+    moveToOutput "bin" "$dev"
+    moveToOutput "include" "$dev"
+    moveToOutput "mkspecs" "$dev"
+
+    # The destination directory must exist or moveToOutput will do nothing
+    mkdir -p "$dev/share"
+    moveToOutput "share/doc" "$dev"
+  '';
+
+  postFixup =
+    ''
+      # Don't retain build-time dependencies like gdb and ruby.
+      sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $dev/mkspecs/qconfig.pri
+
+      # Move libtool archives and qmake projects
+      if [ "z''${!outputLib}" != "z''${!outputDev}" ]; then
+          pushd "''${!outputLib}"
+          find lib -name '*.a' -o -name '*.la' -o -name '*.prl' | \
+              while read -r file; do
+                  mkdir -p "''${!outputDev}/$(dirname "$file")"
+                  mv "''${!outputLib}/$file" "''${!outputDev}/$file"
+              done
+          popd
+      fi
+    '';
+
+  inherit lndir;
+  setupHook = ./setup-hook.sh;
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    homepage = http://www.qt.io;
+    description = "A cross-platform application framework for C++";
+    license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
+    maintainers = with maintainers; [ bbenoist qknight ttuegel ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-dbus.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-dbus.patch
new file mode 100644
index 000000000000..10b0b6701ddc
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-dbus.patch
@@ -0,0 +1,13 @@
+Index: qtbase-opensource-src-5.7.0/src/dbus/qdbus_symbols.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/dbus/qdbus_symbols.cpp
++++ qtbase-opensource-src-5.7.0/src/dbus/qdbus_symbols.cpp
+@@ -97,7 +97,7 @@ bool qdbus_loadLibDBus()
+ #ifdef Q_OS_WIN
+         QLatin1String("dbus-1"),
+ #endif
+-        QLatin1String("libdbus-1")
++        QLatin1String("@dbus_libs@/lib/libdbus-1")
+     };
+ 
+     lib->unload();
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gl.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gl.patch
new file mode 100644
index 000000000000..ea3073ced50a
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gl.patch
@@ -0,0 +1,17 @@
+Index: qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+===================================================================
+--- qtbase-opensource-src-5.5.1.orig/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
++++ qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+@@ -563,7 +563,12 @@ void (*QGLXContext::getProcAddress(const
+             {
+                 extern const QString qt_gl_library_name();
+ //                QLibrary lib(qt_gl_library_name());
++                // Check system library paths first
+                 QLibrary lib(QLatin1String("GL"));
++                if (!lib.load()) {
++                    // Fallback to Mesa driver
++                    lib.setFileName(QLatin1String("@mesa_lib@/lib/libGL"));
++                }
+                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
+             }
+         }
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gtkstyle.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gtkstyle.patch
new file mode 100644
index 000000000000..755b0965cf5f
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-gtkstyle.patch
@@ -0,0 +1,50 @@
+Index: qtbase-opensource-src-5.5.1/src/widgets/styles/qgtk2painter.cpp
+===================================================================
+--- qtbase-opensource-src-5.5.1.orig/src/widgets/styles/qgtk2painter.cpp
++++ qtbase-opensource-src-5.5.1/src/widgets/styles/qgtk2painter.cpp
+@@ -96,7 +96,7 @@ static void initGtk()
+     static bool initialized = false;
+     if (!initialized) {
+         // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
+-        QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
++        QLibrary libgtk(QLS("@gtk@/lib/libgtk-x11-2.0"), 0, 0);
+ 
+         QGtk2PainterPrivate::gdk_pixmap_new = (Ptr_gdk_pixmap_new)libgtk.resolve("gdk_pixmap_new");
+         QGtk2PainterPrivate::gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)libgtk.resolve("gdk_pixbuf_get_from_drawable");
+Index: qtbase-opensource-src-5.5.1/src/widgets/styles/qgtkstyle_p.cpp
+===================================================================
+--- qtbase-opensource-src-5.5.1.orig/src/widgets/styles/qgtkstyle_p.cpp
++++ qtbase-opensource-src-5.5.1/src/widgets/styles/qgtkstyle_p.cpp
+@@ -327,7 +327,7 @@ void QGtkStylePrivate::gtkWidgetSetFocus
+ void QGtkStylePrivate::resolveGtk() const
+ {
+     // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
+-    QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
++    QLibrary libgtk(QLS("@gtk@/lib/libgtk-x11-2.0"), 0, 0);
+ 
+     gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
+     gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new");
+@@ -425,8 +425,8 @@ void QGtkStylePrivate::resolveGtk() cons
+     pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family");
+     pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style");
+ 
+-    gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync");
+-    gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init");
++    gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("@libgnomeui@/lib/libgnomeui-2"), 0, "gnome_icon_lookup_sync");
++    gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("@gnome_vfs@/lib/libgnomevfs-2"), 0, "gnome_vfs_init");
+ }
+ 
+ /* \internal
+@@ -594,9 +594,9 @@ void QGtkStylePrivate::cleanupGtkWidgets
+ static bool resolveGConf()
+ {
+     if (!QGtkStylePrivate::gconf_client_get_default) {
+-        QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default");
+-        QGtkStylePrivate::gconf_client_get_string =  (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string");
+-        QGtkStylePrivate::gconf_client_get_bool =  (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool");
++        QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_default");
++        QGtkStylePrivate::gconf_client_get_string =  (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_string");
++        QGtkStylePrivate::gconf_client_get_bool =  (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_bool");
+     }
+     return (QGtkStylePrivate::gconf_client_get_default !=0);
+ }
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-libXcursor.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-libXcursor.patch
new file mode 100644
index 000000000000..02b7efb73d22
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-libXcursor.patch
@@ -0,0 +1,17 @@
+Index: qtbase-opensource-src-5.7.0/src/plugins/platforms/xcb/qxcbcursor.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ qtbase-opensource-src-5.7.0/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -309,10 +309,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *c
+ #if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+     static bool function_ptrs_not_initialized = true;
+     if (function_ptrs_not_initialized) {
+-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
++        QLibrary xcursorLib(QLatin1String("@libXcursor@/lib/libXcursor"), 1);
+         bool xcursorFound = xcursorLib.load();
+         if (!xcursorFound) { // try without the version number
+-            xcursorLib.setFileName(QLatin1String("Xcursor"));
++            xcursorLib.setFileName(QLatin1String("@libXcursor@/lib/Xcursor"));
+             xcursorFound = xcursorLib.load();
+         }
+         if (xcursorFound) {
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-openssl.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-openssl.patch
new file mode 100644
index 000000000000..9891bfeac5bf
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-openssl.patch
@@ -0,0 +1,26 @@
+Index: qtbase-opensource-src-5.7.0/src/network/ssl/qsslsocket_openssl_symbols.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/network/ssl/qsslsocket_openssl_symbols.cpp
++++ qtbase-opensource-src-5.7.0/src/network/ssl/qsslsocket_openssl_symbols.cpp
+@@ -658,8 +658,8 @@ static QPair<QLibrary*, QLibrary*> loadO
+ #endif
+ #if defined(SHLIB_VERSION_NUMBER) && !defined(Q_OS_QNX) // on QNX, the libs are always libssl.so and libcrypto.so
+     // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
+-    libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER));
+-    libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER));
++    libssl->setFileNameAndVersion(QLatin1String("@openssl@/lib/libssl"), QLatin1String(SHLIB_VERSION_NUMBER));
++    libcrypto->setFileNameAndVersion(QLatin1String("@openssl@/lib/libcrypto"), QLatin1String(SHLIB_VERSION_NUMBER));
+     if (libcrypto->load() && libssl->load()) {
+         // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
+         return pair;
+@@ -676,8 +676,8 @@ static QPair<QLibrary*, QLibrary*> loadO
+     //  OS X's /usr/lib/libssl.dylib, /usr/lib/libcrypto.dylib will be picked up in the third
+     //    attempt, _after_ <bundle>/Contents/Frameworks has been searched.
+     //  iOS does not ship a system libssl.dylib, libcrypto.dylib in the first place.
+-    libssl->setFileNameAndVersion(QLatin1String("ssl"), -1);
+-    libcrypto->setFileNameAndVersion(QLatin1String("crypto"), -1);
++    libssl->setFileNameAndVersion(QLatin1String("@openssl@/lib/libssl"), -1);
++    libcrypto->setFileNameAndVersion(QLatin1String("@openssl@/lib/libcrypto"), -1);
+     if (libcrypto->load() && libssl->load()) {
+         // libssl.so.0 and libcrypto.so.0 found
+         return pair;
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-resolv.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-resolv.patch
new file mode 100644
index 000000000000..98a3610f5fbd
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/dlopen-resolv.patch
@@ -0,0 +1,26 @@
+Index: qtbase-opensource-src-5.7.0/src/network/kernel/qdnslookup_unix.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/network/kernel/qdnslookup_unix.cpp
++++ qtbase-opensource-src-5.7.0/src/network/kernel/qdnslookup_unix.cpp
+@@ -85,7 +85,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String("@glibc@/lib/resolv"));
+         if (!lib.load())
+             return false;
+     }
+Index: qtbase-opensource-src-5.7.0/src/network/kernel/qhostinfo_unix.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/network/kernel/qhostinfo_unix.cpp
++++ qtbase-opensource-src-5.7.0/src/network/kernel/qhostinfo_unix.cpp
+@@ -100,7 +100,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String("@glibc@/lib/libresolv"));
+         if (!lib.load())
+             return false;
+     }
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/libressl.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/libressl.patch
new file mode 100644
index 000000000000..4390db977a71
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/libressl.patch
@@ -0,0 +1,33 @@
+From 81494e67eccba04fc3fe554d76a9ca6fe7f2250e Mon Sep 17 00:00:00 2001
+From: hasufell <hasufell@gentoo.org>
+Date: Sat, 10 Oct 2015 01:15:01 +0200
+Subject: [PATCH] Fix compilation with libressl
+
+By additionally checking for defined(SSL_CTRL_SET_CURVES), which
+is defined in openssl, but not in libressl.
+---
+ src/network/ssl/qsslcontext_openssl.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: qtbase-opensource-src-5.7.0/src/network/ssl/qsslcontext_openssl.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/network/ssl/qsslcontext_openssl.cpp
++++ qtbase-opensource-src-5.7.0/src/network/ssl/qsslcontext_openssl.cpp
+@@ -347,7 +347,7 @@ init_context:
+ 
+     const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
+     if (!qcurves.isEmpty()) {
+-#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         // Set the curves to be used
+         if (q_SSLeay() >= 0x10002000L) {
+             // SSL_CTX_ctrl wants a non-const pointer as last argument,
+@@ -360,7 +360,7 @@ init_context:
+                 sslContext->errorCode = QSslError::UnspecifiedError;
+             }
+         } else
+-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         {
+             // specific curves requested, but not possible to set -> error
+             sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2"));
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/mkspecs-libgl.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/mkspecs-libgl.patch
new file mode 100644
index 000000000000..fda3d3e36533
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/mkspecs-libgl.patch
@@ -0,0 +1,15 @@
+Index: qtbase-opensource-src-5.5.1/mkspecs/common/linux.conf
+===================================================================
+--- qtbase-opensource-src-5.5.1.orig/mkspecs/common/linux.conf
++++ qtbase-opensource-src-5.5.1/mkspecs/common/linux.conf
+@@ -12,8 +12,8 @@ QMAKE_INCDIR            =
+ QMAKE_LIBDIR            =
+ QMAKE_INCDIR_X11        =
+ QMAKE_LIBDIR_X11        =
+-QMAKE_INCDIR_OPENGL     =
+-QMAKE_LIBDIR_OPENGL     =
++QMAKE_INCDIR_OPENGL     = @mesa_inc@/include
++QMAKE_LIBDIR_OPENGL     = @mesa_lib@/lib
+ QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
+ QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
+ QMAKE_INCDIR_EGL        =
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/nix-profiles-library-paths.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/nix-profiles-library-paths.patch
new file mode 100644
index 000000000000..ebaf3651a6d0
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/nix-profiles-library-paths.patch
@@ -0,0 +1,22 @@
+Index: qtbase-opensource-src-5.7.0/src/corelib/kernel/qcoreapplication.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/corelib/kernel/qcoreapplication.cpp
++++ qtbase-opensource-src-5.7.0/src/corelib/kernel/qcoreapplication.cpp
+@@ -2487,7 +2487,17 @@ QStringList QCoreApplication::libraryPat
+         QStringList *app_libpaths = new QStringList;
+         coreappdata()->app_libpaths.reset(app_libpaths);
+ 
++        // Add library paths derived from NIX_PROFILES.
++        const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
++        const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
++        for (const QByteArray &profile: profiles) {
++            if (!profile.isEmpty()) {
++                app_libpaths->append(QFile::decodeName(profile) + plugindir);
++            }
++        }
++
+         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
++        qunsetenv("QT_PLUGIN_PATH"); // do not propagate to child processes
+         if (!libPathEnv.isEmpty()) {
+             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
+             for (QStringList::const_iterator it = paths.constBegin(); it != paths.constEnd(); ++it) {
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/series b/pkgs/development/libraries/qt-5/5.7/qtbase/series
new file mode 100644
index 000000000000..44e2d9040807
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/series
@@ -0,0 +1,10 @@
+dlopen-resolv.patch
+tzdir.patch
+dlopen-libXcursor.patch
+dlopen-openssl.patch
+dlopen-dbus.patch
+xdg-config-dirs.patch
+nix-profiles-library-paths.patch
+compose-search-path.patch
+libressl.patch
+cmake-paths.patch
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/setup-hook.sh b/pkgs/development/libraries/qt-5/5.7/qtbase/setup-hook.sh
new file mode 100644
index 000000000000..6d8989281eba
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/setup-hook.sh
@@ -0,0 +1,171 @@
+addToSearchPathOnceWithCustomDelimiter() {
+    local delim="$1"
+    local search="$2"
+    local target="$3"
+    local dirs
+    local exported
+    IFS="$delim" read -a dirs <<< "${!search}"
+    local canonical
+    if canonical=$(readlink -e "$target"); then
+        for dir in ${dirs[@]}; do
+            if [ "z$dir" == "z$canonical" ]; then exported=1; fi
+        done
+        if [ -z $exported ]; then
+            eval "export ${search}=\"${!search}${!search:+$delim}$canonical\""
+        fi
+    fi
+}
+
+addToSearchPathOnce() {
+    addToSearchPathOnceWithCustomDelimiter ':' "$@"
+}
+
+propagateOnce() {
+    addToSearchPathOnceWithCustomDelimiter ' ' "$@"
+}
+
+_qtPropagate() {
+    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+        if [ -d "$1/$dir" ]; then
+            propagateOnce propagatedBuildInputs "$1"
+            break
+        fi
+    done
+    addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
+    addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
+    addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+}
+
+crossEnvHooks+=(_qtPropagate)
+
+_qtPropagateNative() {
+    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+        if [ -d "$1/$dir" ]; then
+            propagateOnce propagatedNativeBuildInputs "$1"
+            break
+        fi
+    done
+    if [ -z "$crossConfig" ]; then
+        addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
+        addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
+        addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    fi
+}
+
+envHooks+=(_qtPropagateNative)
+
+_qtMultioutDevs() {
+    # This is necessary whether the package is a Qt module or not
+    moveToOutput "mkspecs" "${!outputDev}"
+}
+
+preFixupHooks+=(_qtMultioutDevs)
+
+if [[ -z "$NIX_QT_PIC" ]]; then
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC"
+    export NIX_QT_PIC=1
+fi
+
+_qtSetCMakePrefix() {
+    export CMAKE_PREFIX_PATH="$NIX_QT5_TMP${CMAKE_PREFIX_PATH:+:}${CMAKE_PREFIX_PATH}"
+}
+
+_qtRmTmp() {
+    if [ -z "$NIX_QT_SUBMODULE" ]; then
+        rm -fr "$NIX_QT5_TMP"
+    else
+        cat "$NIX_QT5_TMP/nix-support/qt-inputs" | while read file; do
+            if [ ! -d "$NIX_QT5_TMP/$file" ]; then
+                rm -f "$NIX_QT5_TMP/$file"
+            fi
+        done
+
+        cat "$NIX_QT5_TMP/nix-support/qt-inputs" | while read dir; do
+            if [ -d "$NIX_QT5_TMP/$dir" ]; then
+                rmdir --ignore-fail-on-non-empty -p "$NIX_QT5_TMP/$dir"
+            fi
+        done
+
+        rm "$NIX_QT5_TMP/nix-support/qt-inputs"
+    fi
+}
+
+_qtSetQmakePath() {
+    export PATH="$NIX_QT5_TMP/bin${PATH:+:}$PATH"
+}
+
+if [ -z "$NIX_QT5_TMP" ]; then
+    if [ -z "$NIX_QT_SUBMODULE" ]; then
+        NIX_QT5_TMP=$(mktemp -d)
+    else
+        NIX_QT5_TMP=$out
+    fi
+    postInstallHooks+=(_qtRmTmp)
+
+    mkdir -p "$NIX_QT5_TMP/nix-support"
+    for subdir in bin include lib mkspecs share; do
+        mkdir "$NIX_QT5_TMP/$subdir"
+        echo "$subdir/" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
+    done
+
+    postHooks+=(_qtSetCMakePrefix)
+
+    cp "@dev@/bin/qmake" "$NIX_QT5_TMP/bin"
+    echo "bin/qmake" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
+
+    cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
+[Paths]
+Prefix = $NIX_QT5_TMP
+Plugins = lib/qt5/plugins
+Imports = lib/qt5/imports
+Qml2Imports = lib/qt5/qml
+Documentation = share/doc/qt5
+EOF
+    echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
+
+    export QMAKE="$NIX_QT5_TMP/bin/qmake"
+
+    # Set PATH to find qmake first in a preConfigure hook
+    # It must run after all the envHooks!
+    preConfigureHooks+=(_qtSetQmakePath)
+fi
+
+qt5LinkModuleDir() {
+    if [ -d "$1/$2" ]; then
+        @lndir@/bin/lndir -silent "$1/$2" "$NIX_QT5_TMP/$2"
+        find "$1/$2" -printf "$2/%P\n" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
+    fi
+}
+
+NIX_QT5_MODULES="${NIX_QT5_MODULES}${NIX_QT5_MODULES:+:}@out@"
+NIX_QT5_MODULES_DEV="${NIX_QT5_MODULES_DEV}${NIX_QT5_MODULES_DEV:+:}@dev@"
+
+_qtLinkAllModules() {
+    IFS=: read -a modules <<< $NIX_QT5_MODULES
+    for module in ${modules[@]}; do
+        qt5LinkModuleDir "$module" "lib"
+    done
+
+    IFS=: read -a modules <<< $NIX_QT5_MODULES_DEV
+    for module in ${modules[@]}; do
+        qt5LinkModuleDir "$module" "bin"
+        qt5LinkModuleDir "$module" "include"
+        qt5LinkModuleDir "$module" "lib"
+        qt5LinkModuleDir "$module" "mkspecs"
+        qt5LinkModuleDir "$module" "share"
+    done
+}
+
+preConfigureHooks+=(_qtLinkAllModules)
+
+_qtFixCMakePaths() {
+    find "${!outputLib}" -name "*.cmake" | while read file; do
+        substituteInPlace "$file" \
+            --subst-var-by NIX_OUT "${!outputLib}" \
+            --subst-var-by NIX_DEV "${!outputDev}"
+    done
+}
+
+if [ -n "$NIX_QT_SUBMODULE" ]; then
+    postInstallHooks+=(_qtFixCMakePaths)
+fi
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/tzdir.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/tzdir.patch
new file mode 100644
index 000000000000..f4056dd9cc97
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/tzdir.patch
@@ -0,0 +1,40 @@
+Index: qtbase-opensource-src-5.7.0/src/corelib/tools/qtimezoneprivate_tz.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ qtbase-opensource-src-5.7.0/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -68,7 +68,10 @@ typedef QHash<QByteArray, QTzTimeZone> Q
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++    QString path = qgetenv("TZDIR");
++    path += "/zone.tab";
++    if (!QFile::exists(path))
++        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+     if (!QFile::exists(path))
+         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+ 
+@@ -566,12 +569,18 @@ void QTzTimeZonePrivate::init(const QByt
+         if (!tzif.open(QIODevice::ReadOnly))
+             return;
+     } else {
+-        // Open named tz, try modern path first, if fails try legacy path
+-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++        // Try TZDIR first
++        QString zoneinfoDir = qgetenv("TZDIR");
++        zoneinfoDir += "/" + QString::fromLocal8Bit(ianaId);
++        tzif.setFileName(zoneinfoDir);
+         if (!tzif.open(QIODevice::ReadOnly)) {
+-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+-            if (!tzif.open(QIODevice::ReadOnly))
+-                return;
++            // Open named tz, try modern path first, if fails try legacy path
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++            if (!tzif.open(QIODevice::ReadOnly)) {
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly))
++                    return;
++            }
+         }
+     }
+ 
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/xdg-config-dirs.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/xdg-config-dirs.patch
new file mode 100644
index 000000000000..1f2f316c5b26
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/xdg-config-dirs.patch
@@ -0,0 +1,41 @@
+Index: qtbase-opensource-src-5.7.0/src/corelib/io/qsettings.cpp
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/corelib/io/qsettings.cpp
++++ qtbase-opensource-src-5.7.0/src/corelib/io/qsettings.cpp
+@@ -1161,6 +1161,23 @@ QConfFileSettingsPrivate::QConfFileSetti
+         confFiles[F_System | F_Application].reset(QConfFile::fromName(systemPath + appFile, false));
+     confFiles[F_System | F_Organization].reset(QConfFile::fromName(systemPath + orgFile, false));
+ 
++#if !defined(Q_OS_WIN)
++    // Add directories specified in $XDG_CONFIG_DIRS
++    const QString pathEnv = QString::fromLocal8Bit(getenv("XDG_CONFIG_DIRS"));
++    if (!pathEnv.isEmpty()) {
++        const QStringList pathEntries = pathEnv.split(QLatin1Char(':'), QString::SkipEmptyParts);
++        if (!pathEntries.isEmpty()) {
++            int j = 4; // This is the number of confFiles set above -- we need to start adding $XDG_CONFIG_DIRS after those.
++            for (int k = 0; k < pathEntries.size() && j < NumConfFiles - 1; ++k) {
++                const QString& path = pathEntries.at(k);
++                if (!application.isEmpty())
++                    confFiles[j++].reset(QConfFile::fromName(path + QDir::separator() + appFile, false));
++                confFiles[j++].reset(QConfFile::fromName(path + QDir::separator() + orgFile, false));
++            }
++        }
++    }
++#endif
++
+     for (i = 0; i < NumConfFiles; ++i) {
+         if (confFiles[i]) {
+             spec = i;
+Index: qtbase-opensource-src-5.7.0/src/corelib/io/qsettings_p.h
+===================================================================
+--- qtbase-opensource-src-5.7.0.orig/src/corelib/io/qsettings_p.h
++++ qtbase-opensource-src-5.7.0/src/corelib/io/qsettings_p.h
+@@ -246,7 +246,7 @@ public:
+         F_Organization = 0x1,
+         F_User = 0x0,
+         F_System = 0x2,
+-        NumConfFiles = 4
++        NumConfFiles = 40 // HACK: increase NumConfFiles from 4 to 40 in order to accommodate more paths in $XDG_CONFIG_DIRS -- ellis
+     };
+ 
+     QSettings::Format format;
diff --git a/pkgs/development/libraries/qt-5/5.7/qtconnectivity.nix b/pkgs/development/libraries/qt-5/5.7/qtconnectivity.nix
new file mode 100644
index 000000000000..95cd6fea79b4
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtconnectivity.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtconnectivity";
+  qtInputs = [ qtbase qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtdeclarative/default.nix b/pkgs/development/libraries/qt-5/5.7/qtdeclarative/default.nix
new file mode 100644
index 000000000000..328d8aee72bd
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtdeclarative/default.nix
@@ -0,0 +1,8 @@
+{ qtSubmodule, lib, copyPathsToStore, python, qtbase, qtsvg, qtxmlpatterns }:
+
+qtSubmodule {
+  name = "qtdeclarative";
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  qtInputs = [ qtbase qtsvg qtxmlpatterns ];
+  nativeBuildInputs = [ python ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtdeclarative/nix-profiles-import-paths.patch b/pkgs/development/libraries/qt-5/5.7/qtdeclarative/nix-profiles-import-paths.patch
new file mode 100644
index 000000000000..06b244b974ff
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtdeclarative/nix-profiles-import-paths.patch
@@ -0,0 +1,20 @@
+Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
+===================================================================
+--- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
++++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
+@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add library paths derived from NIX_PROFILES.
++    const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
++    const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
++    Q_FOREACH (const QByteArray &profile, profiles) {
++        if (!profile.isEmpty()) {
++            addImportPath(QFile::decodeName(profile) + qmldir);
++        }
++    }
++
+     // env import paths
+     QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
+     if (!envImportPath.isEmpty()) {
diff --git a/pkgs/development/libraries/qt-5/5.7/qtdeclarative/series b/pkgs/development/libraries/qt-5/5.7/qtdeclarative/series
new file mode 100644
index 000000000000..7dbe197c56e0
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtdeclarative/series
@@ -0,0 +1 @@
+nix-profiles-import-paths.patch
diff --git a/pkgs/development/libraries/qt-5/5.7/qtdoc.nix b/pkgs/development/libraries/qt-5/5.7/qtdoc.nix
new file mode 100644
index 000000000000..578ea6ba0b22
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtdoc.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtdoc";
+  qtInputs = [ qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtgraphicaleffects.nix b/pkgs/development/libraries/qt-5/5.7/qtgraphicaleffects.nix
new file mode 100644
index 000000000000..3273f12eb830
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtgraphicaleffects.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtgraphicaleffects";
+  qtInputs = [ qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtimageformats.nix b/pkgs/development/libraries/qt-5/5.7/qtimageformats.nix
new file mode 100644
index 000000000000..03d0fffbe80e
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtimageformats.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase }:
+
+qtSubmodule {
+  name = "qtimageformats";
+  qtInputs = [ qtbase ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtlocation.nix b/pkgs/development/libraries/qt-5/5.7/qtlocation.nix
new file mode 100644
index 000000000000..1e134057c4b4
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtlocation.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase, qtmultimedia }:
+
+qtSubmodule {
+  name = "qtlocation";
+  qtInputs = [ qtbase qtmultimedia ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix b/pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix
new file mode 100644
index 000000000000..7c1cc5da07e3
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix
@@ -0,0 +1,12 @@
+{ qtSubmodule, qtbase, qtdeclarative, pkgconfig
+, alsaLib, gstreamer, gst-plugins-base, libpulseaudio
+}:
+
+qtSubmodule {
+  name = "qtmultimedia";
+  qtInputs = [ qtbase qtdeclarative ];
+  buildInputs = [
+    pkgconfig alsaLib gstreamer gst-plugins-base libpulseaudio
+  ];
+  qmakeFlags = [ "GST_VERSION=1.0" ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtquickcontrols.nix b/pkgs/development/libraries/qt-5/5.7/qtquickcontrols.nix
new file mode 100644
index 000000000000..93a864621b82
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtquickcontrols.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtquickcontrols";
+  qtInputs = [ qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtscript/0001-glib-2.32.patch b/pkgs/development/libraries/qt-5/5.7/qtscript/0001-glib-2.32.patch
new file mode 100644
index 000000000000..887e107b6c1b
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtscript/0001-glib-2.32.patch
@@ -0,0 +1,25 @@
+From abd80356449bb36c8adcc5c9ca1df6b47715d265 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Sun, 23 Aug 2015 09:13:34 -0500
+Subject: [PATCH] glib-2.32
+
+---
+ src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+index 1f6d25e..087c3fb 100644
+--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
+-- 
+2.5.0
+
diff --git a/pkgs/development/libraries/qt-5/5.7/qtscript/default.nix b/pkgs/development/libraries/qt-5/5.7/qtscript/default.nix
new file mode 100644
index 000000000000..127766e2ebd6
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtscript/default.nix
@@ -0,0 +1,7 @@
+{ qtSubmodule, qtbase, qttools }:
+
+qtSubmodule {
+  name = "qtscript";
+  qtInputs = [ qtbase qttools ];
+  patches = [ ./0001-glib-2.32.patch ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtsensors.nix b/pkgs/development/libraries/qt-5/5.7/qtsensors.nix
new file mode 100644
index 000000000000..61e64dc47e4d
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtsensors.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtsensors";
+  qtInputs = [ qtbase qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtserialport/0001-dlopen-serialport-udev.patch b/pkgs/development/libraries/qt-5/5.7/qtserialport/0001-dlopen-serialport-udev.patch
new file mode 100644
index 000000000000..3a813dc80074
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtserialport/0001-dlopen-serialport-udev.patch
@@ -0,0 +1,28 @@
+From d81c2c870b9bea8fb8e6b85baefb06542f568338 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Sun, 23 Aug 2015 09:16:02 -0500
+Subject: [PATCH] dlopen serialport udev
+
+---
+ src/serialport/qtudev_p.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
+index 6f2cabd..81b9849 100644
+--- a/src/serialport/qtudev_p.h
++++ b/src/serialport/qtudev_p.h
+@@ -105,9 +105,9 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
+-        udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++        udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 1);
+         if (!udevLibrary->load()) {
+-            udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++            udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 0);
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
+-- 
+2.5.0
+
diff --git a/pkgs/development/libraries/qt-5/5.7/qtserialport/default.nix b/pkgs/development/libraries/qt-5/5.7/qtserialport/default.nix
new file mode 100644
index 000000000000..32549c95344a
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtserialport/default.nix
@@ -0,0 +1,12 @@
+{ qtSubmodule, qtbase, substituteAll, libudev }:
+
+qtSubmodule {
+  name = "qtserialport";
+  qtInputs = [ qtbase ];
+  patches = [
+    (substituteAll {
+      src = ./0001-dlopen-serialport-udev.patch;
+      libudev = libudev.out;
+    })
+  ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtsvg.nix b/pkgs/development/libraries/qt-5/5.7/qtsvg.nix
new file mode 100644
index 000000000000..b9ccac7cf933
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtsvg.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase }:
+
+qtSubmodule {
+  name = "qtsvg";
+  qtInputs = [ qtbase ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qttools.nix b/pkgs/development/libraries/qt-5/5.7/qttools.nix
new file mode 100644
index 000000000000..4aeaea729a25
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qttools.nix
@@ -0,0 +1,10 @@
+{ qtSubmodule, qtbase, qtdeclarative }:
+
+qtSubmodule {
+  name = "qttools";
+  qtInputs = [ qtbase qtdeclarative ];
+  postFixup = ''
+    moveToOutput "bin/qdbus" "$out"
+    moveToOutput "bin/qtpaths" "$out"
+  '';
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qttranslations.nix b/pkgs/development/libraries/qt-5/5.7/qttranslations.nix
new file mode 100644
index 000000000000..50fc8cf6826a
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qttranslations.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qttools }:
+
+qtSubmodule {
+  name = "qttranslations";
+  qtInputs = [ qttools ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtwebchannel.nix b/pkgs/development/libraries/qt-5/5.7/qtwebchannel.nix
new file mode 100644
index 000000000000..fd7a3c52026e
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtwebchannel.nix
@@ -0,0 +1,7 @@
+{ qtSubmodule, qtbase, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtwebchannel";
+  qtInputs = [ qtbase qtdeclarative ];
+}
+
diff --git a/pkgs/development/libraries/qt-5/5.7/qtwebengine.nix b/pkgs/development/libraries/qt-5/5.7/qtwebengine.nix
new file mode 100644
index 000000000000..a433976dad1f
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtwebengine.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtquickcontrols, qtlocation, qtwebchannel }:
+
+qtSubmodule {
+  name = "qtwebengine";
+  qtInputs = [ qtquickcontrols qtlocation qtwebchannel ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtwebsockets.nix b/pkgs/development/libraries/qt-5/5.7/qtwebsockets.nix
new file mode 100644
index 000000000000..fbdfbbcf0dbe
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtwebsockets.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtwebsockets";
+  qtInputs = [ qtbase qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtx11extras.nix b/pkgs/development/libraries/qt-5/5.7/qtx11extras.nix
new file mode 100644
index 000000000000..a765161e2d7e
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtx11extras.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase }:
+
+qtSubmodule {
+  name = "qtx11extras";
+  qtInputs = [ qtbase ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/qtxmlpatterns.nix b/pkgs/development/libraries/qt-5/5.7/qtxmlpatterns.nix
new file mode 100644
index 000000000000..9a8ddbba2bd2
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtxmlpatterns.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtbase }:
+
+qtSubmodule {
+  name = "qtxmlpatterns";
+  qtInputs = [ qtbase ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/setup-hook.sh b/pkgs/development/libraries/qt-5/5.7/setup-hook.sh
new file mode 100644
index 000000000000..e41433c11386
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/setup-hook.sh
@@ -0,0 +1,2 @@
+NIX_QT5_MODULES="${NIX_QT5_MODULES}${NIX_QT5_MODULES:+:}@out@"
+NIX_QT5_MODULES_DEV="${NIX_QT5_MODULES_DEV}${NIX_QT5_MODULES_DEV:+:}@dev@"
diff --git a/pkgs/development/libraries/qt-5/5.7/srcs.nix b/pkgs/development/libraries/qt-5/5.7/srcs.nix
new file mode 100644
index 000000000000..38334fa77f18
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/srcs.nix
@@ -0,0 +1,301 @@
+# DO NOT EDIT! This file is generated automatically by fetchsrcs.sh
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qt3d-opensource-src-5.7.0.tar.xz";
+      sha256 = "0a9y4fxm4xmdl5hsv4hfvxcw7jmshy0mwd4j1r2ylqdmg4bql958";
+      name = "qt3d-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtactiveqt-opensource-src-5.7.0.tar.xz";
+      sha256 = "149wj6a5i35k750129kz77y4r8q3hpxqzn1c676fcn9wpmfhay4v";
+      name = "qtactiveqt-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtandroidextras-opensource-src-5.7.0.tar.xz";
+      sha256 = "1caimhfyag96v98j1b07pfzjl5inhsyfi9kxzy9nj0pkvpjdgi4g";
+      name = "qtandroidextras-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtbase-opensource-src-5.7.0.tar.xz";
+      sha256 = "0ip6xnizsn269r4s1nq9lkx8cdxkjqr1fidwrj3sa8xb7h96syry";
+      name = "qtbase-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtcanvas3d = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtcanvas3d-opensource-src-5.7.0.tar.xz";
+      sha256 = "15xxwciyiy8rwrwgb7bgcbxdiiaba3l4cxxm7rdiqmhs9kyv6wbq";
+      name = "qtcanvas3d-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtcharts-opensource-src-5.7.0.tar.xz";
+      sha256 = "0hsj5m9in4w9wzyvbs76v7zc67n9ja641ljc5vgfpbn7fmrsij1b";
+      name = "qtcharts-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtconnectivity-opensource-src-5.7.0.tar.xz";
+      sha256 = "00r7lc1w3snfp2qfqmviqzv0cw16zd8m1sfpvxvpl65yqmzcli4q";
+      name = "qtconnectivity-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtdatavis3d-opensource-src-5.7.0.tar.xz";
+      sha256 = "18p82vh5s9bdshmxxkh7r9482i5vaih8nfya9f81l8ff7lw7lpcs";
+      name = "qtdatavis3d-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtdeclarative-opensource-src-5.7.0.tar.xz";
+      sha256 = "1x7rij423g5chlfd2kix54f393vxwjvdfsn1c7sybqmfycwn5pl6";
+      name = "qtdeclarative-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtdeclarative-render2d = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtdeclarative-render2d-opensource-src-5.7.0.tar.xz";
+      sha256 = "1qf893i7z2iyjpqpaxfhji4cgzlmpgh0w3vdqarpn51vcn7jj4q6";
+      name = "qtdeclarative-render2d-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtdoc-opensource-src-5.7.0.tar.xz";
+      sha256 = "0d7c7137jvxlwl91c2hh33l4falmjvkmsy1f7lyi73x6nnqzdz8i";
+      name = "qtdoc-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtgamepad = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtgamepad-opensource-src-5.7.0.tar.xz";
+      sha256 = "0g36nlnnq19p9svl6pvklxybpwig7r7z4hw0d5dwc2id02ygg62q";
+      name = "qtgamepad-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtgraphicaleffects-opensource-src-5.7.0.tar.xz";
+      sha256 = "1rwdjg5mk6xpadmxfq64xfp573zp5lrj9illb9105ra5wff565n8";
+      name = "qtgraphicaleffects-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtimageformats-opensource-src-5.7.0.tar.xz";
+      sha256 = "1rb27x7i2pmvsck6wax2cg31gqpzaakciy45wm5l3lcl86j48czg";
+      name = "qtimageformats-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtlocation-opensource-src-5.7.0.tar.xz";
+      sha256 = "0rd898gndn41jrp78203lxd94ybfv693l0qg0myag4r46ikk69vh";
+      name = "qtlocation-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtmacextras-opensource-src-5.7.0.tar.xz";
+      sha256 = "1p439sqnchrypggaqkfq3rvfk7xmvqgck4nhwv762jk3kgp48ccq";
+      name = "qtmacextras-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtmultimedia-opensource-src-5.7.0.tar.xz";
+      sha256 = "0ndmhiflmyr144nq8drd5njsdi282ixsm4730q5n0ji2v9dp1bh5";
+      name = "qtmultimedia-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtpurchasing-opensource-src-5.7.0.tar.xz";
+      sha256 = "1db44q3d02nhmrh0fd239n2nsm74myac8saa6jqx1pcap4y4llby";
+      name = "qtpurchasing-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtquickcontrols-opensource-src-5.7.0.tar.xz";
+      sha256 = "0cpcrmz9n5b4bgmshmk093lirl9xwqb23inchnai1zqg21vrmqfq";
+      name = "qtquickcontrols-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtquickcontrols2-opensource-src-5.7.0.tar.xz";
+      sha256 = "0i8h933vhvx1bmniqdx0idg6vk82w9byd3dq0bb2phwjg5vv1xb3";
+      name = "qtquickcontrols2-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtscript-opensource-src-5.7.0.tar.xz";
+      sha256 = "0040890p5ilyrmcpndz1hhp08x2ms5gw4lp4n5iax2a957yy2i4w";
+      name = "qtscript-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtscxml = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtscxml-opensource-src-5.7.0.tar.xz";
+      sha256 = "1waidk96vp9510g94fry0sv1vm2lgzgpwybf6c2xybcsdkbi62rp";
+      name = "qtscxml-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtsensors-opensource-src-5.7.0.tar.xz";
+      sha256 = "1gii6wg2xd3bkb86y5hgpmwcpl04xav030zscpl6fhscl9kcqg98";
+      name = "qtsensors-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtserialbus-opensource-src-5.7.0.tar.xz";
+      sha256 = "0f2xq6fm8lmvd88lc3l37kybqp4wqp71kdch14bwz79y7777lhrc";
+      name = "qtserialbus-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtserialport-opensource-src-5.7.0.tar.xz";
+      sha256 = "0rc2l14s59qskp16wqlkizfai32s41qlm7a86r3qahx28gc51qaw";
+      name = "qtserialport-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtsvg-opensource-src-5.7.0.tar.xz";
+      sha256 = "10fqrlqkiq83xhx79g8d2sjy7hjdnp28067z8f4byj7db81rzy51";
+      name = "qtsvg-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qttools-opensource-src-5.7.0.tar.xz";
+      sha256 = "004m9l7bgh7qnncbyl3d5fkggdrqx58ib21xv4hflvvarxrssibg";
+      name = "qttools-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qttranslations-opensource-src-5.7.0.tar.xz";
+      sha256 = "0vasg5ycg5rhj8ljk3aqg1sxfrlz3602n38fr14ip853yqld83ha";
+      name = "qttranslations-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtvirtualkeyboard-opensource-src-5.7.0.tar.xz";
+      sha256 = "0bzzci32f8ji94p2n6n16n838lrykyy3h822gfw77c93ivk3shyz";
+      name = "qtvirtualkeyboard-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtwayland-opensource-src-5.7.0.tar.xz";
+      sha256 = "04dynjcr6gxi3hcqdf688a4hkabi2l17slpcx9k0f3dxygwcgf96";
+      name = "qtwayland-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtwebchannel-opensource-src-5.7.0.tar.xz";
+      sha256 = "05lqfidlh1ahdd1j9y20p2037qbcq51zkdzj2m8fwhn7ghbwvd1s";
+      name = "qtwebchannel-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtwebengine-opensource-src-5.7.0.tar.xz";
+      sha256 = "0pfwsqjh107jqdw1mzzrhn38jxl64d8lljk4586im2ndypzn4mwq";
+      name = "qtwebengine-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtwebsockets-opensource-src-5.7.0.tar.xz";
+      sha256 = "0hwb2l7iwf4wf7l95dli8j3b7h0nffp56skfg1x810kzj0df26vl";
+      name = "qtwebsockets-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtwebview-opensource-src-5.7.0.tar.xz";
+      sha256 = "1i2ikv1ah4g3rc1pivxiw77p0yj79lialqww91fj781g66pky6l0";
+      name = "qtwebview-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtwinextras-opensource-src-5.7.0.tar.xz";
+      sha256 = "1fh7kqfwgwi9pcfg9b6hp2fpgvs938wl96ppqan79apxlhqy5awd";
+      name = "qtwinextras-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtx11extras-opensource-src-5.7.0.tar.xz";
+      sha256 = "1yrkn8pqdbvbqykas3wx1vdfimhjkgx3s5jgdxib9dgmgyx6vjzw";
+      name = "qtx11extras-opensource-src-5.7.0.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.7.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.7/5.7.0/submodules/qtxmlpatterns-opensource-src-5.7.0.tar.xz";
+      sha256 = "02z2qxamslg6sphnaykjcjfpypq4b69pb586s43vw4fplm72m21q";
+      name = "qtxmlpatterns-opensource-src-5.7.0.tar.xz";
+    };
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e6c50d195c5b..aacf3894e3a3 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9113,6 +9113,10 @@ in
     let imported = import ../development/libraries/qt-5/5.6 { inherit pkgs; };
     in recurseIntoAttrs (imported.override (super: qt5LibsFun));
 
+  qt57 =
+    let imported = import ../development/libraries/qt-5/5.7 { inherit pkgs; };
+    in recurseIntoAttrs (imported.override (super: qt5LibsFun));
+
   qt5 = self.qt56;
 
   qt5ct = qt5.callPackage ../tools/misc/qt5ct { };