about summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-02-18 16:25:27 -0500
committerShea Levy <shea@shealevy.com>2018-02-18 16:27:22 -0500
commit32ce7012f0ec479be27c81ab7ce64dca66a2d9e3 (patch)
tree0b69e0bd2d4aad0f3c37d4ba1ec2d67176e35df8
parentba5563b5bc8ef8514a53e73e58ca5b9fd07fdfdf (diff)
parenta96886863a0616f528b4cfe17faf182cb29d3a03 (diff)
downloadnixlib-32ce7012f0ec479be27c81ab7ce64dca66a2d9e3.tar
nixlib-32ce7012f0ec479be27c81ab7ce64dca66a2d9e3.tar.gz
nixlib-32ce7012f0ec479be27c81ab7ce64dca66a2d9e3.tar.bz2
nixlib-32ce7012f0ec479be27c81ab7ce64dca66a2d9e3.tar.lz
nixlib-32ce7012f0ec479be27c81ab7ce64dca66a2d9e3.tar.xz
nixlib-32ce7012f0ec479be27c81ab7ce64dca66a2d9e3.tar.zst
nixlib-32ce7012f0ec479be27c81ab7ce64dca66a2d9e3.zip
Merge branch 'master' into gcc-7
-rw-r--r--lib/systems/examples.nix8
-rw-r--r--lib/systems/platforms.nix6
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/mail/postfix.nix6
-rw-r--r--nixos/modules/system/boot/binfmt.nix139
-rw-r--r--nixos/tests/home-assistant.nix36
-rw-r--r--pkgs/applications/misc/octoprint/default.nix7
-rw-r--r--pkgs/applications/misc/redshift/default.nix5
-rw-r--r--pkgs/applications/networking/browsers/palemoon/default.nix18
-rw-r--r--pkgs/applications/networking/newsreaders/liferea/default.nix1
-rw-r--r--pkgs/applications/virtualization/qemu/default.nix6
-rw-r--r--pkgs/applications/virtualization/qemu/riscv.nix20
-rw-r--r--pkgs/applications/virtualization/qemu/statfs-flags.patch200
-rw-r--r--pkgs/applications/virtualization/xen/4.8.nix8
-rw-r--r--pkgs/applications/virtualization/xen/packages.nix4
-rw-r--r--pkgs/data/fonts/hack/default.nix11
-rw-r--r--pkgs/development/compilers/sbcl/default.nix4
-rw-r--r--pkgs/development/compilers/swift/default.nix80
-rw-r--r--pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch4
-rw-r--r--pkgs/development/compilers/swift/patches/icu59.patch113
-rw-r--r--pkgs/development/compilers/swift/patches/remove_xlocale.patch54
-rw-r--r--pkgs/development/compilers/swift/patches/sigaltstack.patch11
-rw-r--r--pkgs/development/compilers/swift/patches/sigunused.patch11
-rw-r--r--pkgs/development/libraries/boehm-gc/default.nix4
-rw-r--r--pkgs/development/libraries/boehm-gc/riscv.patch53
-rw-r--r--pkgs/development/libraries/ffmpeg-full/default.nix4
-rw-r--r--pkgs/development/libraries/ffmpeg/3.4.nix4
-rw-r--r--pkgs/development/libraries/geis/default.nix27
-rw-r--r--pkgs/development/libraries/glibc/2.27.nix101
-rw-r--r--pkgs/development/libraries/glibc/common-2.27.nix210
-rw-r--r--pkgs/development/libraries/glibc/dont-use-system-ld-so-cache-2.27.patch46
-rw-r--r--pkgs/development/libraries/glibc/nix-locale-archive-2.27.patch118
-rw-r--r--pkgs/development/libraries/libatomic_ops/default.nix5
-rw-r--r--pkgs/development/libraries/libatomic_ops/riscv.patch40
-rw-r--r--pkgs/development/libraries/libav/default.nix7
-rw-r--r--pkgs/development/libraries/pcre/default.nix3
-rw-r--r--pkgs/development/libraries/qt-5/5.10/default.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.6/default.nix2
-rw-r--r--pkgs/development/libraries/qt-5/5.9/default.nix9
-rw-r--r--pkgs/development/libraries/qt-5/qt-env.nix6
-rw-r--r--pkgs/development/ocaml-modules/lwt_ssl/default.nix24
-rw-r--r--pkgs/development/python-modules/docker/default.nix4
-rw-r--r--pkgs/development/python-modules/micawber/default.nix26
-rw-r--r--pkgs/development/python-modules/moinmoin/default.nix32
-rw-r--r--pkgs/development/python-modules/moinmoin/fix_tests.patch16
-rw-r--r--pkgs/development/python-modules/pymacaroons-pynacl/default.nix24
-rw-r--r--pkgs/development/python-modules/pynacl/default.nix7
-rw-r--r--pkgs/development/python-modules/pynacl/pynacl-no-timeout-and-deadline.patch49
-rw-r--r--pkgs/development/python-modules/yarl/default.nix4
-rw-r--r--pkgs/development/qtcreator/default.nix5
-rw-r--r--pkgs/development/tools/build-managers/gnumake/4.2/default.nix4
-rw-r--r--pkgs/development/tools/build-managers/gnumake/4.2/glibc-2.27.patch24
-rw-r--r--pkgs/os-specific/linux/busybox/sandbox-shell.nix5
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.14.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.15.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.4.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.9.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-copperhead-hardened.nix4
-rw-r--r--pkgs/servers/home-assistant/component-packages.nix2
-rw-r--r--pkgs/servers/home-assistant/default.nix4
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools-cross.nix1
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix4
-rw-r--r--pkgs/tools/networking/arping/default.nix25
-rw-r--r--pkgs/tools/package-management/conda/default.nix71
-rw-r--r--pkgs/tools/package-management/nix/default.nix12
-rw-r--r--pkgs/tools/text/catdocx/default.nix30
-rw-r--r--pkgs/top-level/all-packages.nix25
-rw-r--r--pkgs/top-level/ocaml-packages.nix4
-rw-r--r--pkgs/top-level/python-packages.nix35
69 files changed, 1706 insertions, 150 deletions
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index f5562e28a09d..bd68ee9460e7 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -68,6 +68,14 @@ rec {
   musl64 = { config = "x86_64-unknown-linux-musl"; };
   musl32  = { config = "i686-unknown-linux-musl"; };
 
+  riscv = bits: {
+    config = "riscv${bits}-unknown-linux-gnu";
+    platform = platforms.riscv-multiplatform bits;
+  };
+  riscv64 = riscv "64";
+  riscv32 = riscv "32";
+
+
   #
   # Darwin
   #
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index 58a7afa7679d..3106c05dd5d2 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -541,6 +541,12 @@ rec {
     };
   };
 
+  riscv-multiplatform = bits: {
+    name = "riscv-multiplatform";
+    kernelArch = "riscv";
+    bfdEmulation = "elf${bits}lriscv";
+  };
+
   selectBySystem = system: {
       "i686-linux" = pc32;
       "x86_64-linux" = pc64;
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 35f5e87d7e5e..01bd2960517b 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -694,6 +694,7 @@
   ./services/x11/xserver.nix
   ./system/activation/activation-script.nix
   ./system/activation/top-level.nix
+  ./system/boot/binfmt.nix
   ./system/boot/coredump.nix
   ./system/boot/emergency-mode.nix
   ./system/boot/grow-partition.nix
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix
index 22af7e876af2..5ab331ac067f 100644
--- a/nixos/modules/services/mail/postfix.nix
+++ b/nixos/modules/services/mail/postfix.nix
@@ -414,7 +414,10 @@ in
       postmasterAlias = mkOption {
         type = types.str;
         default = "root";
-        description = "Who should receive postmaster e-mail.";
+        description = "
+          Who should receive postmaster e-mail. Multiple values can be added by
+          separating values with comma.
+        ";
       };
 
       rootAlias = mkOption {
@@ -422,6 +425,7 @@ in
         default = "";
         description = "
           Who should receive root e-mail. Blank for no redirection.
+          Multiple values can be added by separating values with comma.
         ";
       };
 
diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix
new file mode 100644
index 000000000000..15e84dc021e2
--- /dev/null
+++ b/nixos/modules/system/boot/binfmt.nix
@@ -0,0 +1,139 @@
+{ config, lib, ... }:
+let
+  inherit (lib) mkOption types optionalString;
+
+  cfg = config.boot.binfmtMiscRegistrations;
+
+  makeBinfmtLine = name: { recognitionType, offset, magicOrExtension
+                         , mask, preserveArgvZero, openBinary
+                         , matchCredentials, fixBinary, ...
+                         }: let
+    type = if recognitionType == "magic" then "M" else "E";
+    offset' = toString offset;
+    mask' = toString mask;
+    interpreter = "/run/binfmt/${name}";
+    flags = if !(matchCredentials -> openBinary)
+              then throw "boot.binfmtMiscRegistrations.${name}: you can't specify openBinary = false when matchCredentials = true."
+            else optionalString preserveArgvZero "P" +
+                 optionalString (openBinary && !matchCredentials) "O" +
+                 optionalString matchCredentials "C" +
+                 optionalString fixBinary "F";
+  in ":${name}:${type}:${offset'}:${magicOrExtension}:${mask'}:${interpreter}:${flags}";
+
+  binfmtFile = builtins.toFile "binfmt_nixos.conf"
+    (lib.concatStringsSep "\n" (lib.mapAttrsToList makeBinfmtLine cfg));
+
+  activationSnippet = name: { interpreter, ... }:
+    "ln -sf ${interpreter} /run/binfmt/${name}";
+  activationScript = ''
+    mkdir -p -m 0755 /run/binfmt
+    ${lib.concatStringsSep "\n" (lib.mapAttrsToList activationSnippet cfg)}
+  '';
+in {
+  options = {
+    boot.binfmtMiscRegistrations = mkOption {
+      default = {};
+
+      description = ''
+        Extra binary formats to register with the kernel.
+        See https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html for more details.
+      '';
+
+      type = types.attrsOf (types.submodule ({ config, ... }: {
+        options = {
+          recognitionType = mkOption {
+            default = "magic";
+            description = "Whether to recognize executables by magic number or extension.";
+            type = types.enum [ "magic" "extension" ];
+          };
+
+          offset = mkOption {
+            default = null;
+            description = "The byte offset of the magic number used for recognition.";
+            type = types.nullOr types.int;
+          };
+
+          magicOrExtension = mkOption {
+            description = "The magic number or extension to match on.";
+            type = types.str;
+          };
+
+          mask = mkOption {
+            default = null;
+            description =
+              "A mask to be ANDed with the byte sequence of the file before matching";
+            type = types.nullOr types.str;
+          };
+
+          interpreter = mkOption {
+            description = ''
+              The interpreter to invoke to run the program.
+
+              Note that the actual registration will point to
+              /run/binfmt/''${name}, so the kernel interpreter length
+              limit doesn't apply.
+            '';
+            type = types.path;
+          };
+
+          preserveArgvZero = mkOption {
+            default = false;
+            description = ''
+              Whether to pass the original argv[0] to the interpreter.
+
+              See the description of the 'P' flag in the kernel docs
+              for more details;
+            '';
+            type = types.bool;
+          };
+
+          openBinary = mkOption {
+            default = config.matchCredentials;
+            description = ''
+              Whether to pass the binary to the interpreter as an open
+              file descriptor, instead of a path.
+            '';
+            type = types.bool;
+          };
+
+          matchCredentials = mkOption {
+            default = false;
+            description = ''
+              Whether to launch with the credentials and security
+              token of the binary, not the interpreter (e.g. setuid
+              bit).
+
+              See the description of the 'C' flag in the kernel docs
+              for more details.
+
+              Implies/requires openBinary = true.
+            '';
+            type = types.bool;
+          };
+
+          fixBinary = mkOption {
+            default = false;
+            description = ''
+              Whether to open the interpreter file as soon as the
+              registration is loaded, rather than waiting for a
+              relevant file to be invoked.
+
+              See the description of the 'F' flag in the kernel docs
+              for more details.
+            '';
+            type = types.bool;
+          };
+        };
+      }));
+    };
+  };
+
+  config = lib.mkIf (cfg != {}) {
+    environment.etc."binfmt.d/nixos.conf".source = binfmtFile;
+    system.activationScripts.binfmt = activationScript;
+    systemd.additionalUpstreamSystemUnits =
+      [ "proc-sys-fs-binfmt_misc.automount"
+        "proc-sys-fs-binfmt_misc.mount"
+      ];
+  };
+}
diff --git a/nixos/tests/home-assistant.nix b/nixos/tests/home-assistant.nix
index 5d7e0ec65e73..2e45dc78471f 100644
--- a/nixos/tests/home-assistant.nix
+++ b/nixos/tests/home-assistant.nix
@@ -2,17 +2,27 @@ import ./make-test.nix ({ pkgs, ... }:
 
 let
   configDir = "/var/lib/foobar";
+  apiPassword = "secret";
 
 in {
   name = "home-assistant";
+  meta = with pkgs.stdenv.lib; {
+    maintainers = with maintainers; [ dotlambda ];
+  };
 
   nodes = {
     hass =
       { config, pkgs, ... }:
       {
+        environment.systemPackages = with pkgs; [
+          mosquitto
+        ];
         services.home-assistant = {
           inherit configDir;
           enable = true;
+          package = pkgs.home-assistant.override {
+            extraPackages = ps: with ps; [ hbmqtt ];
+          };
           config = {
             homeassistant = {
               name = "Home";
@@ -22,7 +32,16 @@ in {
               elevation = 0;
             };
             frontend = { };
-            http = { };
+            http.api_password = apiPassword;
+            mqtt = { }; # Use hbmqtt as broker
+            binary_sensor = [
+              {
+                platform = "mqtt";
+                state_topic = "home-assistant/test";
+                payload_on = "let_there_be_light";
+                payload_off = "off";
+              }
+            ];
           };
         };
       };
@@ -31,7 +50,7 @@ in {
   testScript = ''
     startAll;
     $hass->waitForUnit("home-assistant.service");
-    
+
     # Since config is specified using a Nix attribute set,
     # configuration.yaml is a link to the Nix store
     $hass->succeed("test -L ${configDir}/configuration.yaml");
@@ -39,8 +58,19 @@ in {
     # Check that Home Assistant's web interface and API can be reached
     $hass->waitForOpenPort(8123);
     $hass->succeed("curl --fail http://localhost:8123/states");
-    $hass->succeed("curl --fail http://localhost:8123/api/ | grep 'API running'");
+    $hass->succeed("curl --fail -H 'x-ha-access: ${apiPassword}' http://localhost:8123/api/ | grep -qF 'API running'");
 
+    # Toggle a binary sensor using MQTT
+    $hass->succeed("curl http://localhost:8123/api/states/binary_sensor.mqtt_binary_sensor -H 'x-ha-access: ${apiPassword}' | grep -qF '\"state\": \"off\"'");
+    $hass->waitUntilSucceeds("mosquitto_pub -V mqttv311 -t home-assistant/test -u homeassistant -P '${apiPassword}' -m let_there_be_light");
+    $hass->succeed("curl http://localhost:8123/api/states/binary_sensor.mqtt_binary_sensor -H 'x-ha-access: ${apiPassword}' | grep -qF '\"state\": \"on\"'");
+
+    # Check that no errors were logged
     $hass->fail("cat ${configDir}/home-assistant.log | grep -qF ERROR");
+
+    # Print log to ease debugging
+    my $log = $hass->succeed("cat ${configDir}/home-assistant.log");
+    print "\n### home-assistant.log ###\n";
+    print "$log\n";
   '';
 })
diff --git a/pkgs/applications/misc/octoprint/default.nix b/pkgs/applications/misc/octoprint/default.nix
index 972fbfb7b072..6587305a770f 100644
--- a/pkgs/applications/misc/octoprint/default.nix
+++ b/pkgs/applications/misc/octoprint/default.nix
@@ -54,14 +54,13 @@ let
 
 in pythonPackages.buildPythonApplication rec {
   name = "OctoPrint-${version}";
-  version = "1.3.5";
-  # 1.3.5, 2017-10-16, 77753ca02602d3a798d6b0a22535e6fd69ff448a
+  version = "1.3.6";
 
   src = fetchFromGitHub {
     owner = "foosel";
     repo = "OctoPrint";
     rev = version;
-    sha256 = "13krv9i6gm4jn4cb327q4qma4xwwashjnc0dia8vlnbjbbvkrni4";
+    sha256 = "0pgpkjw5zjnks5bky51gjaksq8mhrzkl52kpgf799hl35pd08xr3";
   };
 
   # We need old Tornado
@@ -70,7 +69,7 @@ in pythonPackages.buildPythonApplication rec {
     semantic-version flask_principal werkzeug flaskbabel tornado
     psutil pyserial flask_login netaddr markdown sockjs-tornado
     pylru pyyaml sarge feedparser netifaces click websocket_client
-    scandir chainmap future dateutil futures wrapt
+    scandir chainmap future dateutil futures wrapt monotonic emoji
   ];
 
   buildInputs = with pythonPackages; [ nose mock ddt ];
diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix
index 9871c559523c..c0e481ae8788 100644
--- a/pkgs/applications/misc/redshift/default.nix
+++ b/pkgs/applications/misc/redshift/default.nix
@@ -41,7 +41,10 @@ stdenv.mkDerivation rec {
   pythonPath = [ pygobject3 pyxdg ];
 
   preConfigure = "./bootstrap";
-  postFixup = "wrapPythonPrograms";
+  postFixup = ''
+    wrapPythonPrograms
+    rm "$out/share/icons/hicolor/icon-theme.cache"
+  '';
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/applications/networking/browsers/palemoon/default.nix b/pkgs/applications/networking/browsers/palemoon/default.nix
index 006aa88f363c..cd4f95097889 100644
--- a/pkgs/applications/networking/browsers/palemoon/default.nix
+++ b/pkgs/applications/networking/browsers/palemoon/default.nix
@@ -10,14 +10,14 @@
 
 stdenv.mkDerivation rec {
   name = "palemoon-${version}";
-  version = "27.6.2";
+  version = "27.7.2";
 
   src = fetchFromGitHub {
     name   = "palemoon-src";
     owner  = "MoonchildProductions";
     repo   = "Pale-Moon";
     rev    = version + "_Release";
-    sha256 = "0ickxrwl36iyqj3v9qq6hnfl2y652f2ppwi949pfh4f6shm9x0ri";
+    sha256 = "19ki6gp6bhcvhjnclalviiyp93mqsgc22xjl0gm9x5y4sxdb5wlq";
   };
 
   desktopItem = makeDesktopItem {
@@ -101,10 +101,20 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "A web browser";
+    longDescription = ''
+      Pale Moon is an Open Source, Goanna-based web browser focusing on
+      efficiency and customization.
+
+      Pale Moon offers you a browsing experience in a browser completely built
+      from its own, independently developed source that has been forked off from
+      Firefox/Mozilla code a number of years ago, with carefully selected
+      features and optimizations to improve the browser's stability and user
+      experience, while offering full customization and a growing collection of
+      extensions and themes to make the browser truly your own.
+    '';
     homepage    = https://www.palemoon.org/;
     license     = licenses.mpl20;
-    maintainers = with maintainers; [ rnhmjoj ];
+    maintainers = with maintainers; [ rnhmjoj AndersonTorres ];
     platforms   = platforms.linux;
   };
-
 }
diff --git a/pkgs/applications/networking/newsreaders/liferea/default.nix b/pkgs/applications/networking/newsreaders/liferea/default.nix
index 743da7958067..ed6fe17cc7e8 100644
--- a/pkgs/applications/networking/newsreaders/liferea/default.nix
+++ b/pkgs/applications/networking/newsreaders/liferea/default.nix
@@ -28,6 +28,7 @@ in stdenv.mkDerivation rec {
   pythonPath = with python3Packages; [ pygobject3 pycairo ];
 
   preFixup = ''
+    rm "$out/share/icons/hicolor/icon-theme.cache"
     buildPythonPath "$out $pythonPath"
     gappsWrapperArgs+=(--prefix PYTHONPATH : "$program_PYTHONPATH")
   '';
diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix
index 68ab979ecfbe..694026d3bac2 100644
--- a/pkgs/applications/virtualization/qemu/default.nix
+++ b/pkgs/applications/virtualization/qemu/default.nix
@@ -18,8 +18,8 @@
 
 with stdenv.lib;
 let
-  version = "2.11.0";
-  sha256 = "1jvzw6rdhimn583dz6an8xiw07n3ycvxmj3jpv1s312scv3k9w64";
+  version = "2.11.1";
+  sha256 = "1jrcff0szyjxc3vywyiclwdzk0xgq4cxvjbvmcfyjcpdrq9j5pyr";
   audio = optionalString (hasSuffix "linux" stdenv.system) "alsa,"
     + optionalString pulseSupport "pa,"
     + optionalString sdlSupport "sdl,";
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  patches = [ ./no-etc-install.patch ]
+  patches = [ ./no-etc-install.patch ./statfs-flags.patch ]
     ++ optional nixosTestRunner ./force-uid0-on-9p.patch
     ++ optional pulseSupport ./fix-hda-recording.patch;
 
diff --git a/pkgs/applications/virtualization/qemu/riscv.nix b/pkgs/applications/virtualization/qemu/riscv.nix
new file mode 100644
index 000000000000..a900d943dabf
--- /dev/null
+++ b/pkgs/applications/virtualization/qemu/riscv.nix
@@ -0,0 +1,20 @@
+{ qemu, fetchFromGitHub, lib }: let
+  src = fetchFromGitHub {
+    owner = "riscv";
+    repo = "riscv-qemu";
+    rev = "af435b709d4a5de3ec2e59ff4dcd05b0b295a730";
+    sha256 = "1kqcsn8yfdg3zyd991i4v5dxznd1l4a4hjry9304lvsm3sz2wllw";
+    fetchSubmodules = true;
+  };
+  version = "2.11.50";
+  revCount = "58771";
+  shortRev = "af435b709d";
+  targets = [ "riscv32-linux-user" "riscv32-softmmu"
+              "riscv64-linux-user" "riscv64-softmmu"
+            ];
+in lib.overrideDerivation qemu (orig: {
+  name = "${(builtins.parseDrvName qemu.name).name}-${version}pre${revCount}_${shortRev}";
+  inherit src;
+  configureFlags = orig.configureFlags ++ [ "--target-list=${lib.concatStringsSep "," targets}" ];
+  postInstall = null;
+})
diff --git a/pkgs/applications/virtualization/qemu/statfs-flags.patch b/pkgs/applications/virtualization/qemu/statfs-flags.patch
new file mode 100644
index 000000000000..c0f0162aacc9
--- /dev/null
+++ b/pkgs/applications/virtualization/qemu/statfs-flags.patch
@@ -0,0 +1,200 @@
+commit d3282d2512774dc5027c98930a3852b2b6e8407a
+Author: Shea Levy <shea@shealevy.com>
+Date:   Sun Feb 18 13:50:11 2018 -0500
+
+    linux-user: Support f_flags in statfs when available.
+    
+    Signed-off-by: Shea Levy <shea@shealevy.com>
+
+diff --git a/configure b/configure
+index 913e14839d..52fe2bf941 100755
+--- a/configure
++++ b/configure
+@@ -5303,6 +5303,22 @@ if compile_prog "" "" ; then
+     have_utmpx=yes
+ fi
+ 
++##########################################
++# Check for newer fields of struct statfs on Linux
++
++if test "$linux_user" = "yes"; then
++  cat > $TMPC <<EOF
++#include <sys/vfs.h>
++
++int main(void) {
++  struct statfs fs;
++  fs.f_flags = 0;
++}
++EOF
++  if compile_object ; then
++      have_statfs_flags=yes
++  fi
++fi
+ ##########################################
+ # checks for sanitizers
+ 
+@@ -6518,6 +6534,10 @@ if test "$have_utmpx" = "yes" ; then
+   echo "HAVE_UTMPX=y" >> $config_host_mak
+ fi
+ 
++if test "$have_statfs_flags" = "yes" ; then
++  echo "HAVE_STATFS_FLAGS=y" >> $config_host_mak
++fi
++
+ if test "$ivshmem" = "yes" ; then
+   echo "CONFIG_IVSHMEM=y" >> $config_host_mak
+ fi
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 82b35a6bdf..77481eca2c 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -9534,6 +9534,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
+             __put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
+             __put_user(stfs.f_namelen, &target_stfs->f_namelen);
+             __put_user(stfs.f_frsize, &target_stfs->f_frsize);
++#ifdef HAVE_STATFS_FLAGS
++            __put_user(stfs.f_flags, &target_stfs->f_flags);
++#endif
+             memset(target_stfs->f_spare, 0, sizeof(target_stfs->f_spare));
+             unlock_user_struct(target_stfs, arg2, 1);
+         }
+diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
+index a35c52a60a..9f90451caf 100644
+--- a/linux-user/syscall_defs.h
++++ b/linux-user/syscall_defs.h
+@@ -362,7 +362,14 @@ struct kernel_statfs {
+ 	int f_ffree;
+         kernel_fsid_t f_fsid;
+ 	int f_namelen;
++#ifdef HAVE_STATFS_FLAGS
++	int f_frsize;
++	int f_flags;
++	int f_spare[4];
++#else
+ 	int f_spare[6];
++#endif
++
+ };
+ 
+ struct target_dirent {
+@@ -2223,7 +2230,13 @@ struct target_statfs {
+ 	/* Linux specials */
+ 	target_fsid_t		f_fsid;
+ 	int32_t			f_namelen;
++#ifdef HAVE_STATFS_FLAGS
++	int32_t			f_frsize;
++	int32_t			f_flags;
++	int32_t			f_spare[4];
++#else
+ 	int32_t			f_spare[6];
++#endif
+ };
+ #else
+ struct target_statfs {
+@@ -2239,7 +2252,13 @@ struct target_statfs {
+ 	/* Linux specials */
+ 	target_fsid_t		f_fsid;
+ 	abi_long		f_namelen;
++#ifdef HAVE_STATFS_FLAGS
++	abi_long		f_frsize;
++	abi_long		f_flags;
++	abi_long		f_spare[4];
++#else
+ 	abi_long		f_spare[6];
++#endif
+ };
+ #endif
+ 
+@@ -2255,7 +2274,13 @@ struct target_statfs64 {
+ 	uint64_t	f_bavail;
+ 	target_fsid_t	f_fsid;
+ 	uint32_t	f_namelen;
++#ifdef HAVE_STATFS_FLAGS
++	uint32_t	f_frsize;
++	uint32_t	f_flags;
++	uint32_t	f_spare[4];
++#else
+ 	uint32_t	f_spare[6];
++#endif
+ };
+ #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
+        defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
+@@ -2271,7 +2296,12 @@ struct target_statfs {
+ 	target_fsid_t f_fsid;
+ 	abi_long f_namelen;
+ 	abi_long f_frsize;
++#ifdef HAVE_STATFS_FLAGS
++	abi_long f_flags;
++	abi_long f_spare[4];
++#else
+ 	abi_long f_spare[5];
++#endif
+ };
+ 
+ struct target_statfs64 {
+@@ -2285,7 +2315,12 @@ struct target_statfs64 {
+ 	target_fsid_t f_fsid;
+ 	abi_long f_namelen;
+ 	abi_long f_frsize;
++#ifdef HAVE_STATFS_FLAGS
++	abi_long f_flags;
++	abi_long f_spare[4];
++#else
+ 	abi_long f_spare[5];
++#endif
+ };
+ #elif defined(TARGET_S390X)
+ struct target_statfs {
+@@ -2299,7 +2334,13 @@ struct target_statfs {
+     kernel_fsid_t f_fsid;
+     int32_t  f_namelen;
+     int32_t  f_frsize;
++#ifdef HAVE_STATFS_FLAGS
++    int32_t  f_flags;
++    int32_t  f_spare[4];
++#else
+     int32_t  f_spare[5];
++#endif
++
+ };
+ 
+ struct target_statfs64 {
+@@ -2313,7 +2354,12 @@ struct target_statfs64 {
+     kernel_fsid_t f_fsid;
+     int32_t  f_namelen;
+     int32_t  f_frsize;
++#ifdef HAVE_STATFS_FLAGS
++    int32_t  f_flags;
++    int32_t  f_spare[4];
++#else
+     int32_t  f_spare[5];
++#endif
+ };
+ #else
+ struct target_statfs {
+@@ -2327,7 +2373,12 @@ struct target_statfs {
+ 	target_fsid_t f_fsid;
+ 	uint32_t f_namelen;
+ 	uint32_t f_frsize;
++#ifdef HAVE_STATFS_FLAGS
++	uint32_t f_flags;
++	uint32_t f_spare[4];
++#else
+ 	uint32_t f_spare[5];
++#endif
+ };
+ 
+ struct target_statfs64 {
+@@ -2341,7 +2392,12 @@ struct target_statfs64 {
+ 	target_fsid_t f_fsid;
+         uint32_t f_namelen;
+ 	uint32_t f_frsize;
++#ifdef HAVE_STATFS_FLAGS
++	uint32_t f_flags;
++	uint32_t f_spare[4];
++#else
+ 	uint32_t f_spare[5];
++#endif
+ };
+ #endif
+ 
diff --git a/pkgs/applications/virtualization/xen/4.8.nix b/pkgs/applications/virtualization/xen/4.8.nix
index 44a52a1026af..b1fcf36a46c1 100644
--- a/pkgs/applications/virtualization/xen/4.8.nix
+++ b/pkgs/applications/virtualization/xen/4.8.nix
@@ -49,15 +49,9 @@ callPackage (import ./generic.nix (rec {
       src = fetchgit {
         url = https://xenbits.xen.org/git-http/qemu-xen.git;
         rev = "refs/tags/qemu-xen-${version}";
-        sha256 = "1v19pp86kcgwvsbkrdrn4rlaj02i4054avw8k70w1m0rnwgcsdbs";
+        sha256 = "1l4sygd8p0mc13bskr4r1m31qh1kr58h195qn1s52869s58jyhvm";
       };
       buildInputs = qemuDeps;
-      patches = [
-        (xsaPatch {
-          name = "216-qemuu";
-          sha256 = "06w2iw1r5gip2bpbg19cziws965h9in0f6np74cr31f76yy30yxn";
-        })
-      ];
       meta.description = "Xen's fork of upstream Qemu";
     };
   } // optionalAttrs withInternalTraditionalQemu {
diff --git a/pkgs/applications/virtualization/xen/packages.nix b/pkgs/applications/virtualization/xen/packages.nix
index 8f5262acb024..4b5f15c8ff42 100644
--- a/pkgs/applications/virtualization/xen/packages.nix
+++ b/pkgs/applications/virtualization/xen/packages.nix
@@ -58,10 +58,6 @@ rec {
   };
 
   xen_4_8-vanilla = callPackage ./4.8.nix {
-    # At the very least included seabios and etherboot need gcc49,
-    # so we have to build all of it with gcc49.
-    stdenv = overrideCC stdenv gcc49;
-
     meta = {
       description = "vanilla";
       longDescription = ''
diff --git a/pkgs/data/fonts/hack/default.nix b/pkgs/data/fonts/hack/default.nix
index 0edd27dab0e3..eb7943265397 100644
--- a/pkgs/data/fonts/hack/default.nix
+++ b/pkgs/data/fonts/hack/default.nix
@@ -1,20 +1,18 @@
 { stdenv, fetchzip }:
 
 let
-  version = "2.020";
+  version = "3.002";
 in fetchzip rec {
   name = "hack-font-${version}";
 
-  url = let
-    version_ = with stdenv.lib; concatStringsSep "_" (splitString "." version);
-  in "https://github.com/chrissimpkins/Hack/releases/download/v${version}/Hack-v${version_}-ttf.zip";
+  url = "https://github.com/chrissimpkins/Hack/releases/download/v${version}/Hack-v${version}-ttf.zip";
 
   postFetch = ''
     mkdir -p $out/share/fonts
     unzip -j $downloadedFile \*.ttf -d $out/share/fonts/hack
   '';
 
-  sha256 = "0cpsglb9vnhmpsn496aqisfvmq3yxvjnj7c361dspy0fn6z8x60c";
+  sha256 = "11f3hl4nvxq6pvsmwr1c1r5wrxhrp7ixr5bshrz2dmqn7l8bxa63";
 
   meta = with stdenv.lib; {
     description = "A typeface designed for source code";
@@ -25,7 +23,7 @@ in fetchzip rec {
       The face has been re-designed with a larger glyph set, modifications of
       the original glyph shapes, and meticulous attention to metrics.
     '';
-    homepage = http://sourcefoundry.org/hack/;
+    homepage = https://sourcefoundry.org/hack/;
 
     /*
      "The font binaries are released under a license that permits unlimited
@@ -36,6 +34,7 @@ in fetchzip rec {
       the license is available in LICENSE.md" (From the GitHub page)
     */
     license = licenses.free;
+    maintainers = with maintainers; [ dywedir ];
     platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix
index 54610467e7ae..39b84ae6a365 100644
--- a/pkgs/development/compilers/sbcl/default.nix
+++ b/pkgs/development/compilers/sbcl/default.nix
@@ -9,11 +9,11 @@
 
 stdenv.mkDerivation rec {
   name    = "sbcl-${version}";
-  version = "1.4.3";
+  version = "1.4.4";
 
   src = fetchurl {
     url    = "mirror://sourceforge/project/sbcl/sbcl/${version}/${name}-source.tar.bz2";
-    sha256 = "1z8d11k6vc6jhmpwzy0nawj84qdd2jvibrvqmb1nmq3h8w64hlam";
+    sha256 = "1k6v5b8qv7vyxvh8asx6phf2hbapx5pp5p5j47hgnq123fwnh4fa";
   };
 
   patchPhase = ''
diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix
index 937977b0a97d..360f96e12427 100644
--- a/pkgs/development/compilers/swift/default.nix
+++ b/pkgs/development/compilers/swift/default.nix
@@ -12,7 +12,6 @@
 , swig
 , bash
 , libxml2
-, llvm
 , clang
 , python
 , ncurses
@@ -28,13 +27,17 @@
 , git
 , libgit2
 , fetchFromGitHub
+, fetchpatch
 , paxctl
 , findutils
+, makeWrapper
+, gnumake
+, file
 #, systemtap
 }:
 
 let
-  v_major = "3.1.1";
+  v_major = "4.0.3";
   version = "${v_major}-RELEASE";
   version_friendly = "${v_major}";
 
@@ -47,53 +50,53 @@ let
       name = "${repo}-${version}-src";
     };
 
-sources = {
+  sources = {
     # FYI: SourceKit probably would work but currently requires building everything twice
     # For more inforation, see: https://github.com/apple/swift/pull/3594#issuecomment-234169759
     clang = fetch {
       repo = "swift-clang";
-      sha256 = "1gmdgr8jph87nya8cgdl7iwrggbji2sag996m27hkbszw4nxy8sd";
+      sha256 = "0zm624iwiprk3c3nzqf4p1fd9zqic4yi3jv51cw3249ax4x6vy10";
     };
     llvm = fetch {
       repo = "swift-llvm";
-      sha256 = "0nwd7cp6mbj7f6a2rx8123n7ygs8406hsx7hp7ybagww6v75bwzi";
+      sha256 = "11vw6461c0cdvwm1wna1a5709fjj14hzp6br6jg94p4f6jp3yv4d";
     };
     compilerrt = fetch {
       repo = "swift-compiler-rt";
-      sha256 = "1gjcr6g3ffs3nhf4a84iwg4flbd7rqcf9rvvclwyq96msa3mj950";
+      sha256 = "1hj4qaj4c9n2wzg2cvarbyl0n708zd1dlw4zkzq07fjxxqs36nfa";
     };
     cmark = fetch {
       repo = "swift-cmark";
-      sha256 = "0qf2f3zd8lndkfbxbz6vkznzz8rvq5gigijh7pgmfx9fi4zcssqx";
+      sha256 = "1nmxp0fj749sgar682c5nsj7zxxigqwg973baxj2r656a7ybh325";
     };
     lldb = fetch {
       repo = "swift-lldb";
-      sha256 = "17n4whpf3wxw9zaayiq21gk9q3547qxi4rvxld2hybh0k7a1bj5c";
+      sha256 = "0yk5qg85008vcn63vn2jpn5ls9pdhda222p2w1cfkrj27k5k8vqr";
     };
     llbuild = fetch {
       repo = "swift-llbuild";
-      sha256 = "1l3hnb2s01jby91k1ipbc3bhszq14vyx5pzdhf2chld1yhpg420d";
+      sha256 = "0jffw6z1s6ck1i05brw59x6vsg7zrxbz5n2wz72fj29rh3nppc7a";
     };
     pm = fetch {
       repo = "swift-package-manager";
-      sha256 = "1ayy5vk3mjk354pg9bf68wvnaj3jymx23w0qnlw1jxz256ff8fwi";
+      sha256 = "0xj070b8fii7ijfsnyq4fxgv6569vdrg0yippi85h2p1l7s9aagh";
     };
     xctest = fetch {
       repo = "swift-corelibs-xctest";
-      sha256 = "0cj5y7wanllfldag08ci567x12aw793c79afckpbsiaxmwy4xhnm";
+      sha256 = "0l355wq8zfwrpv044xf4smjwbm0bmib360748n8cwls3vkr9l2yv";
     };
     foundation = fetch {
       repo = "swift-corelibs-foundation";
-      sha256 = "1d1ldk7ckqn4mhmdhsx2zrmsd6jfxzgdywn2pki7limk979hcwjc";
+      sha256 = "0s7yc5gsbd96a4bs8c6q24dyfjm4xhcr2nzhl2ics8dmi60j15s4";
     };
     libdispatch = fetch {
       repo = "swift-corelibs-libdispatch";
-      sha256 = "0ckjg41fjak06i532azhryckjq64fkxzsal4svf5v4s8n9mkq2sg";
+      sha256 = "0x8zzq3shhvmhq4sbhaaa0ddiv3nw347pz6ayym6jyzq7j9n15ia";
       fetchSubmodules = true;
     };
     swift = fetch {
       repo = "swift";
-      sha256 = "0879jlv37lmxc1apzi53xn033y72548i86r7fzwr0g52124q5gry";
+      sha256 = "0a1gq0k5701i418f0qi7kywv16q7vh4a4wp0f6fpyv4sjkq27msx";
     };
   };
 
@@ -119,6 +122,9 @@ sources = {
   ];
 
   builder = ''
+    # gcc-6.4.0/include/c++/6.4.0/cstdlib:75:15: fatal error: 'stdlib.h' file not found
+    NIX_CFLAGS_COMPILE="$( echo ${clang.default_cxx_stdlib_compile} ) $NIX_CFLAGS_COMPILE"
+
     $SWIFT_SOURCE_ROOT/swift/utils/build-script \
       --preset=buildbot_linux \
       installable_package=$INSTALLABLE_PACKAGE \
@@ -126,6 +132,20 @@ sources = {
       install_destdir=$SWIFT_INSTALL_DIR \
       extra_cmake_options="${stdenv.lib.concatStringsSep "," cmakeFlags}"'';
 
+  # from llvm/4/llvm.nix
+  sigaltstackPatch = fetchpatch {
+    name = "sigaltstack.patch"; # for glibc-2.26
+    url = https://github.com/llvm-mirror/compiler-rt/commit/8a5e425a68d.diff;
+    sha256 = "0h4y5vl74qaa7dl54b1fcyqalvlpd8zban2d1jxfkxpzyi7m8ifi";
+  };
+
+  # https://bugs.swift.org/browse/SR-6409
+  sigunusedPatch = fetchpatch {
+    name = "sigunused.patch";
+    url = "https://github.com/apple/swift-llbuild/commit/303a89bc6da606c115560921a452686aa0655f5e.diff";
+    sha256 = "04sw7ym1grzggj1v3xrzr2ljxz8rf9rnn9n5fg1xjbwlrdagkc7m";
+  };
+
 in
 stdenv.mkDerivation rec {
   name = "swift-${version_friendly}";
@@ -145,6 +165,8 @@ stdenv.mkDerivation rec {
     rsync
     which
     findutils
+    makeWrapper
+    gnumake
   ] ++ stdenv.lib.optional stdenv.needsPax paxctl;
 
   # TODO: Revisit what's propagated and how
@@ -198,6 +220,14 @@ stdenv.mkDerivation rec {
     # Just patch all the things for now, we can focus this later
     patchShebangs $SWIFT_SOURCE_ROOT
 
+    # TODO eliminate use of env.
+    find -type f -print0 | xargs -0 sed -i \
+      -e 's|/usr/bin/env|${coreutils}/bin/env|g' \
+      -e 's|/usr/bin/make|${gnumake}/bin/make|g' \
+      -e 's|/bin/mkdir|${coreutils}/bin/mkdir|g' \
+      -e 's|/bin/cp|${coreutils}/bin/cp|g' \
+      -e 's|/usr/bin/file|${file}/bin/file|g'
+
     substituteInPlace swift/stdlib/public/Platform/CMakeLists.txt \
       --replace '/usr/include' "${stdenv.cc.libc.dev}/include"
     substituteInPlace swift/utils/build-script-impl \
@@ -209,6 +239,13 @@ stdenv.mkDerivation rec {
     patch -p1 -d swift -i ${./patches/0002-build-presets-linux-allow-custom-install-prefix.patch}
     patch -p1 -d swift -i ${./patches/0003-build-presets-linux-disable-tests.patch}
     patch -p1 -d swift -i ${./patches/0004-build-presets-linux-plumb-extra-cmake-options.patch}
+    # https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
+    patch -p1 -i ${./patches/remove_xlocale.patch}
+    # https://bugs.swift.org/browse/SR-4633
+    patch -p1 -d swift -i ${./patches/icu59.patch}
+
+    # https://bugs.swift.org/browse/SR-5779
+    sed -i -e 's|"-latomic"|"-Wl,-rpath,${clang.cc.gcc.lib}/lib" "-L${clang.cc.gcc.lib}/lib" "-latomic"|' swift/cmake/modules/AddSwift.cmake
 
     substituteInPlace clang/lib/Driver/ToolChains.cpp \
       --replace '  addPathIfExists(D, SysRoot + "/usr/lib", Paths);' \
@@ -217,21 +254,21 @@ stdenv.mkDerivation rec {
 
     # Workaround hardcoded dep on "libcurses" (vs "libncurses"):
     sed -i 's,curses,ncurses,' llbuild/*/*/CMakeLists.txt
-    substituteInPlace llbuild/tests/BuildSystem/Build/basic.llbuild \
-      --replace /usr/bin/env $(type -p env)
 
     # This test fails on one of my machines, not sure why.
     # Disabling for now. 
     rm llbuild/tests/Examples/buildsystem-capi.llbuild
 
-    substituteInPlace swift-corelibs-foundation/lib/script.py \
-      --replace /bin/cp $(type -p cp)
-
     PREFIX=''${out/#\/}
     substituteInPlace swift-corelibs-xctest/build_script.py \
       --replace usr "$PREFIX"
     substituteInPlace swiftpm/Utilities/bootstrap \
       --replace "usr" "$PREFIX"
+  '' + stdenv.lib.optionalString (stdenv ? glibc) ''
+    patch -p1 -d compiler-rt -i ${sigaltstackPatch}
+    patch -p1 -d compiler-rt -i ${./patches/sigaltstack.patch}
+    patch -p1 -d llbuild -i ${sigunusedPatch}
+    patch -p1 -i ${./patches/sigunused.patch}
   '';
 
   doCheck = false;
@@ -251,6 +288,10 @@ stdenv.mkDerivation rec {
     # TODO: Use wrappers to get these on the PATH for swift tools, instead
     ln -s ${clang}/bin/* $out/bin/
     ln -s ${targetPackages.stdenv.cc.bintools}/bin/ar $out/bin/ar
+
+    wrapProgram $out/bin/swift \
+      --suffix C_INCLUDE_PATH : $out/lib/swift/clang/include \
+      --suffix CPLUS_INCLUDE_PATH : $out/lib/swift/clang/include
   '';
 
   # Hack to avoid TMPDIR in RPATHs.
@@ -263,7 +304,6 @@ stdenv.mkDerivation rec {
     license = licenses.asl20;
     # Swift doesn't support 32bit Linux, unknown on other platforms.
     platforms = [ "x86_64-linux" ];
-    broken = true;
   };
 }
 
diff --git a/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch b/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch
index 0e18e8812a84..66723f1cdf39 100644
--- a/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch
+++ b/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch
@@ -11,13 +11,13 @@ diff --git a/utils/build-presets.ini b/utils/build-presets.ini
 index e6b0af3581..1095cbaab7 100644
 --- a/utils/build-presets.ini
 +++ b/utils/build-presets.ini
-@@ -692,7 +692,7 @@ install-lldb
+@@ -708,7 +708,7 @@ install-lldb
  install-llbuild
  install-swiftpm
  install-xctest
 -install-prefix=/usr
 +install-prefix=%(install_prefix)s
- swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license
+ swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
  build-swift-static-stdlib
  build-swift-static-sdk-overlay
 -- 
diff --git a/pkgs/development/compilers/swift/patches/icu59.patch b/pkgs/development/compilers/swift/patches/icu59.patch
new file mode 100644
index 000000000000..26337814cafa
--- /dev/null
+++ b/pkgs/development/compilers/swift/patches/icu59.patch
@@ -0,0 +1,113 @@
+--- a/stdlib/public/stubs/UnicodeNormalization.cpp
++++ b/stdlib/public/stubs/UnicodeNormalization.cpp
+@@ -86,11 +86,8 @@ ASCIICollation() {
+     for (unsigned char c = 0; c < 128; ++c) {
+       UErrorCode ErrorCode = U_ZERO_ERROR;
+       intptr_t NumCollationElts = 0;
+-#if defined(__CYGWIN__) || defined(_MSC_VER)
+       UChar Buffer[1];
+-#else
+-      uint16_t Buffer[1];
+-#endif
++
+       Buffer[0] = c;
+ 
+       UCollationElements *CollationIterator =
+@@ -127,18 +124,9 @@ swift::_swift_stdlib_unicode_compare_utf16_utf16(const uint16_t *LeftString,
+                                                  int32_t LeftLength,
+                                                  const uint16_t *RightString,
+                                                  int32_t RightLength) {
+-#if defined(__CYGWIN__) || defined(_MSC_VER)
+-  // ICU UChar type is platform dependent. In Cygwin, it is defined
+-  // as wchar_t which size is 2. It seems that the underlying binary
+-  // representation is same with swift utf16 representation.
+   return ucol_strcoll(GetRootCollator(),
+     reinterpret_cast<const UChar *>(LeftString), LeftLength,
+     reinterpret_cast<const UChar *>(RightString), RightLength);
+-#else
+-  return ucol_strcoll(GetRootCollator(),
+-    LeftString, LeftLength,
+-    RightString, RightLength);
+-#endif
+ }
+ 
+ /// Compares the strings via the Unicode Collation Algorithm on the root locale.
+@@ -156,12 +144,8 @@ swift::_swift_stdlib_unicode_compare_utf8_utf16(const unsigned char *LeftString,
+   UErrorCode ErrorCode = U_ZERO_ERROR;
+ 
+   uiter_setUTF8(&LeftIterator, reinterpret_cast<const char *>(LeftString), LeftLength);
+-#if defined(__CYGWIN__) || defined(_MSC_VER)
+   uiter_setString(&RightIterator, reinterpret_cast<const UChar *>(RightString),
+                   RightLength);
+-#else
+-  uiter_setString(&RightIterator, RightString, RightLength);
+-#endif
+ 
+   uint32_t Diff = ucol_strcollIter(GetRootCollator(),
+     &LeftIterator, &RightIterator, &ErrorCode);
+@@ -199,14 +183,10 @@ swift::_swift_stdlib_unicode_compare_utf8_utf8(const unsigned char *LeftString,
+ void *swift::_swift_stdlib_unicodeCollationIterator_create(
+     const __swift_uint16_t *Str, __swift_uint32_t Length) {
+   UErrorCode ErrorCode = U_ZERO_ERROR;
+-#if defined(__CYGWIN__) || defined(_MSC_VER)
+   UCollationElements *CollationIterator = ucol_openElements(
+     GetRootCollator(), reinterpret_cast<const UChar *>(Str), Length,
+     &ErrorCode);
+-#else
+-  UCollationElements *CollationIterator = ucol_openElements(
+-    GetRootCollator(), Str, Length, &ErrorCode);
+-#endif
++
+   if (U_FAILURE(ErrorCode)) {
+     swift::crash("_swift_stdlib_unicodeCollationIterator_create: ucol_openElements() failed.");
+   }
+@@ -244,17 +224,12 @@ swift::_swift_stdlib_unicode_strToUpper(uint16_t *Destination,
+                                         const uint16_t *Source,
+                                         int32_t SourceLength) {
+   UErrorCode ErrorCode = U_ZERO_ERROR;
+-#if defined(__CYGWIN__) || defined(_MSC_VER)
+   uint32_t OutputLength = u_strToUpper(reinterpret_cast<UChar *>(Destination),
+                                        DestinationCapacity,
+                                        reinterpret_cast<const UChar *>(Source),
+                                        SourceLength,
+                                        "", &ErrorCode);
+-#else
+-  uint32_t OutputLength = u_strToUpper(Destination, DestinationCapacity,
+-                                       Source, SourceLength,
+-                                       "", &ErrorCode);
+-#endif
++
+   if (U_FAILURE(ErrorCode) && ErrorCode != U_BUFFER_OVERFLOW_ERROR) {
+     swift::crash("u_strToUpper: Unexpected error uppercasing unicode string.");
+   }
+@@ -271,17 +246,12 @@ swift::_swift_stdlib_unicode_strToLower(uint16_t *Destination,
+                                         const uint16_t *Source,
+                                         int32_t SourceLength) {
+   UErrorCode ErrorCode = U_ZERO_ERROR;
+-#if defined(__CYGWIN__) || defined(_MSC_VER)
+   uint32_t OutputLength = u_strToLower(reinterpret_cast<UChar *>(Destination),
+                                        DestinationCapacity,
+                                        reinterpret_cast<const UChar *>(Source),
+                                        SourceLength,
+                                        "", &ErrorCode);
+-#else
+-  uint32_t OutputLength = u_strToLower(Destination, DestinationCapacity,
+-                                       Source, SourceLength,
+-                                       "", &ErrorCode);
+-#endif
++
+   if (U_FAILURE(ErrorCode) && ErrorCode != U_BUFFER_OVERFLOW_ERROR) {
+     swift::crash("u_strToLower: Unexpected error lowercasing unicode string.");
+   }
+@@ -300,9 +300,9 @@
+ 
+ swift::__swift_stdlib_UBreakIterator *swift::__swift_stdlib_ubrk_open(
+     swift::__swift_stdlib_UBreakIteratorType type, const char *locale,
+-    const UChar *text, int32_t textLength, __swift_stdlib_UErrorCode *status) {
++    const __swift_stdlib_UChar * text, __swift_int32_t textLength, __swift_stdlib_UErrorCode *status) {
+   return ptr_cast<swift::__swift_stdlib_UBreakIterator>(
+-      ubrk_open(static_cast<UBreakIteratorType>(type), locale, text, textLength,
++      ubrk_open(static_cast<UBreakIteratorType>(type), locale, reinterpret_cast<const UChar *>(text), textLength,
+                 ptr_cast<UErrorCode>(status)));
+ }
+ 
diff --git a/pkgs/development/compilers/swift/patches/remove_xlocale.patch b/pkgs/development/compilers/swift/patches/remove_xlocale.patch
new file mode 100644
index 000000000000..8ef7e3916962
--- /dev/null
+++ b/pkgs/development/compilers/swift/patches/remove_xlocale.patch
@@ -0,0 +1,54 @@
+--- a/swift/stdlib/public/SDK/os/os_trace_blob.c
++++ b/swift/stdlib/public/SDK/os/os_trace_blob.c
+@@ -14,7 +14,6 @@
+ #include <dispatch/dispatch.h>
+ #include <os/base.h>
+ #include <os/log.h>
+-#include <xlocale.h>
+ #include "os_trace_blob.h"
+ 
+ OS_NOINLINE
+
+--- a/swift/stdlib/public/stubs/Stubs.cpp
++++ b/swift/stdlib/public/stubs/Stubs.cpp
+@@ -61,7 +61,6 @@
+ #define strtof_l swift_strtof_l
+ #define strtold_l swift_strtold_l
+ #else
+-#include <xlocale.h>
+ #endif
+ #include <limits>
+ #include "llvm/ADT/StringExtras.h"
+
+--- a/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringDefaultEncoding.h
++++ b/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringDefaultEncoding.h
+@@ -20,7 +20,6 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <stdio.h>
+-#include <xlocale.h>
+ 
+ CF_EXTERN_C_BEGIN
+ 
+
+--- a/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringEncodings.c
++++ b/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringEncodings.c
+@@ -24,7 +24,6 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <stdio.h>
+-#include <xlocale.h>
+ #include <CoreFoundation/CFStringDefaultEncoding.h>
+ #endif
+ 
+
+--- a/swift-corelibs-foundation/CoreFoundation/Base.subproj/CFInternal.h
++++ b/swift-corelibs-foundation/CoreFoundation/Base.subproj/CFInternal.h
+@@ -95,7 +95,6 @@
+ #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD
+ #if TARGET_OS_CYGWIN
+ #else
+-#include <xlocale.h>
+ #endif
+ #include <unistd.h>
+ #include <sys/time.h>
diff --git a/pkgs/development/compilers/swift/patches/sigaltstack.patch b/pkgs/development/compilers/swift/patches/sigaltstack.patch
new file mode 100644
index 000000000000..c529fa3777b3
--- /dev/null
+++ b/pkgs/development/compilers/swift/patches/sigaltstack.patch
@@ -0,0 +1,11 @@
+--- a/lib/esan/esan_sideline_linux.cpp
++++ b/lib/esan/esan_sideline_linux.cpp
+@@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) {
+ 
+   // Set up a signal handler on an alternate stack for safety.
+   InternalScopedBuffer<char> StackMap(SigAltStackSize);
+-  struct sigaltstack SigAltStack;
++  stack_t SigAltStack;
+   SigAltStack.ss_sp = StackMap.data();
+   SigAltStack.ss_size = SigAltStackSize;
+   SigAltStack.ss_flags = 0;
diff --git a/pkgs/development/compilers/swift/patches/sigunused.patch b/pkgs/development/compilers/swift/patches/sigunused.patch
new file mode 100644
index 000000000000..2701d1a3ae25
--- /dev/null
+++ b/pkgs/development/compilers/swift/patches/sigunused.patch
@@ -0,0 +1,11 @@
+--- a/swiftpm/Sources/Basic/Process.swift
++++ b/swiftpm/Sources/Basic/Process.swift
+@@ -258,7 +258,7 @@ public func launch() throws {
+         // modify, so we have to take care about the set we use.
+         var mostSignals = sigset_t()
+         sigemptyset(&mostSignals)
+-        for i in 1 ..< SIGUNUSED {
++        for i in 1 ..< SIGSYS {
+             if i == SIGKILL || i == SIGSTOP {
+                 continue
+             }
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index c1bcb46bae6e..d4e91deb7449 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -27,7 +27,9 @@ stdenv.mkDerivation rec {
   patches = [ (fetchpatch {
     url = "https://raw.githubusercontent.com/gentoo/musl/85b6a600996bdd71162b357e9ba93d8559342432/dev-libs/boehm-gc/files/boehm-gc-7.6.0-sys_select.patch";
     sha256 = "1gydwlklvci30f5dpp5ccw2p2qpph5y41r55wx9idamjlq66fbb3";
-  }) ];
+  }) ] ++
+    # https://github.com/ivmai/bdwgc/pull/208
+    lib.optional hostPlatform.isRiscV ./riscv.patch;
 
   configureFlags =
     [ "--enable-cplusplus" ]
diff --git a/pkgs/development/libraries/boehm-gc/riscv.patch b/pkgs/development/libraries/boehm-gc/riscv.patch
new file mode 100644
index 000000000000..249137d0a0dc
--- /dev/null
+++ b/pkgs/development/libraries/boehm-gc/riscv.patch
@@ -0,0 +1,53 @@
+diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
+index a8e55dd2..439cc88d 100644
+--- a/include/private/gcconfig.h
++++ b/include/private/gcconfig.h
+@@ -650,6 +650,15 @@
+ #   endif
+ #   define mach_type_known
+ # endif
++# if defined(__riscv) && defined(LINUX)
++#   if __riscv_xlen == 32
++#     define RISCV32
++#     define mach_type_known
++#   elif __riscv_xlen == 64
++#     define RISCV64
++#     define mach_type_known
++#   endif
++# endif
+ 
+ # if defined(SN_TARGET_PSP2)
+ #   define mach_type_known
+@@ -2970,6 +2979,32 @@
+ #   endif
+ # endif
+ 
++# ifdef RISCV32
++#   define CPP_WORDSZ 32
++#   define MACH_TYPE "RISC-V 32"
++#   define ALIGNMENT 4
++#   ifdef LINUX
++#     define OS_TYPE "LINUX"
++      extern int __data_start[];
++#     define DATASTART ((ptr_t)__data_start)
++#     define LINUX_STACKBOTTOM
++#     define DYNAMIC_LOADING
++#   endif
++# endif
++
++# ifdef RISCV64
++#   define CPP_WORDSZ 64
++#   define MACH_TYPE "RISC-V 64"
++#   define ALIGNMENT 8
++#   ifdef LINUX
++#     define OS_TYPE "LINUX"
++      extern int __data_start[];
++#     define DATASTART ((ptr_t)__data_start)
++#     define LINUX_STACKBOTTOM
++#     define DYNAMIC_LOADING
++#   endif
++# endif
++
+ #if defined(__GLIBC__) && !defined(DONT_USE_LIBC_PRIVATES)
+   /* Use glibc's stack-end marker. */
+ # define USE_LIBC_PRIVATES
diff --git a/pkgs/development/libraries/ffmpeg-full/default.nix b/pkgs/development/libraries/ffmpeg-full/default.nix
index 780008c95001..689b13a394dc 100644
--- a/pkgs/development/libraries/ffmpeg-full/default.nix
+++ b/pkgs/development/libraries/ffmpeg-full/default.nix
@@ -231,11 +231,11 @@ assert nvenc -> nvidia-video-sdk != null && nonfreeLicensing;
 
 stdenv.mkDerivation rec {
   name = "ffmpeg-full-${version}";
-  version = "3.4.1";
+  version = "3.4.2";
 
   src = fetchurl {
     url = "https://www.ffmpeg.org/releases/ffmpeg-${version}.tar.xz";
-    sha256 = "1h4iz7q10wj04awr2wvmp60n7b09pfwrgwbbw9sgl7klcf52fxss";
+    sha256 = "0h6prjn1ijkzzhkyj8mazp0wpx7m0n9ycadjxagf9czqirbyk4ib";
   };
 
   prePatch = ''
diff --git a/pkgs/development/libraries/ffmpeg/3.4.nix b/pkgs/development/libraries/ffmpeg/3.4.nix
index f4cda16424c3..98cbfdf43f6c 100644
--- a/pkgs/development/libraries/ffmpeg/3.4.nix
+++ b/pkgs/development/libraries/ffmpeg/3.4.nix
@@ -6,7 +6,7 @@
 
 callPackage ./generic.nix (args // rec {
   version = "${branch}";
-  branch = "3.4.1";
-  sha256 = "0b2aaxx8l7g3pvs4zd3mzig44cc73savrxzfm6w0lnaa2lh3wi7k";
+  branch = "3.4.2";
+  sha256 = "0nkq4451masmzlx3p4vprqwc0sl2iwqxbzjrngmvj29q4azp00zb";
   darwinFrameworks = [ Cocoa CoreMedia ];
 })
diff --git a/pkgs/development/libraries/geis/default.nix b/pkgs/development/libraries/geis/default.nix
index 6e043f5994df..5796425e4385 100644
--- a/pkgs/development/libraries/geis/default.nix
+++ b/pkgs/development/libraries/geis/default.nix
@@ -1,14 +1,20 @@
 { stdenv, fetchurl
 , pkgconfig
-, python3
+, python3Packages
+, wrapGAppsHook
+, atk
 , dbus_libs
 , evemu
 , frame
+, gdk_pixbuf
+, gobjectIntrospection
 , grail
+, gtk3
 , libX11
 , libXext
 , libXi
 , libXtst
+, pango
 , xorgserver
 }:
 
@@ -25,8 +31,23 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-Wno-format -Wno-misleading-indentation -Wno-error";
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ python3 dbus_libs evemu frame grail libX11 libXext libXi libXtst xorgserver ];
+  pythonPath = with python3Packages;
+    [ pygobject3  ];
+
+  nativeBuildInputs = [ pkgconfig wrapGAppsHook python3Packages.wrapPython];
+  buildInputs = [ atk dbus_libs evemu frame gdk_pixbuf gobjectIntrospection grail
+    gtk3 libX11 libXext libXi libXtst pango python3Packages.python xorgserver
+  ];
+
+  patchPhase = ''
+    substituteInPlace python/geis/geis_v2.py --replace \
+      "ctypes.util.find_library(\"geis\")" "'$out/lib/libgeis.so'"
+  '';
+
+  preFixup = ''
+    buildPythonPath "$out $pythonPath"
+    gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH")
+  '';
 
   meta = {
     description = "A library for input gesture recognition";
diff --git a/pkgs/development/libraries/glibc/2.27.nix b/pkgs/development/libraries/glibc/2.27.nix
new file mode 100644
index 000000000000..bb057ae899e7
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.27.nix
@@ -0,0 +1,101 @@
+{ stdenv, callPackage
+, withLinuxHeaders ? true
+, installLocales ? true
+, profilingLibraries ? false
+, withGd ? false
+}:
+
+assert stdenv.cc.isGNU;
+
+callPackage ./common-2.27.nix { inherit stdenv; } {
+    name = "glibc" + stdenv.lib.optionalString withGd "-gd";
+
+    inherit withLinuxHeaders profilingLibraries installLocales withGd;
+
+    NIX_NO_SELF_RPATH = true;
+
+    postConfigure = ''
+      # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
+      # This has to be done *after* `configure' because it builds some
+      # test binaries.
+      export NIX_CFLAGS_LINK=
+      export NIX_LDFLAGS_BEFORE=
+
+      export NIX_DONT_SET_RPATH=1
+      unset CFLAGS
+
+      # Apparently --bindir is not respected.
+      makeFlagsArray+=("bindir=$bin/bin" "sbindir=$bin/sbin" "rootsbindir=$bin/sbin")
+    '';
+
+    # The stackprotector and fortify hardening flags are autodetected by glibc
+    # and enabled by default if supported. Setting it for every gcc invocation
+    # does not work.
+    hardeningDisable = [ "stackprotector" "fortify" ];
+
+    # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
+    # any program we run, because the gcc will have been placed at a new
+    # store path than that determined when built (as a source for the
+    # bootstrap-tools tarball)
+    # Building from a proper gcc staying in the path where it was installed,
+    # libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
+    # any special hack.
+    preInstall = ''
+      if [ -f ${stdenv.cc.cc}/lib/libgcc_s.so.1 ]; then
+          mkdir -p $out/lib
+          cp ${stdenv.cc.cc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
+          # the .so It used to be a symlink, but now it is a script
+          cp -a ${stdenv.cc.cc}/lib/libgcc_s.so $out/lib/libgcc_s.so
+      fi
+    '';
+
+    postInstall = ''
+      if test -n "$installLocales"; then
+          make -j''${NIX_BUILD_CORES:-1} -l''${NIX_BUILD_CORES:-1} localedata/install-locales
+      fi
+
+      test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
+
+      if test -n "$linuxHeaders"; then
+          # Include the Linux kernel headers in Glibc, except the `scsi'
+          # subdirectory, which Glibc provides itself.
+          (cd $dev/include && \
+           ln -sv $(ls -d $linuxHeaders/include/* | grep -v scsi\$) .)
+      fi
+
+      # Fix for NIXOS-54 (ldd not working on x86_64).  Make a symlink
+      # "lib64" to "lib".
+      if test -n "$is64bit"; then
+          ln -s lib $out/lib64
+      fi
+
+      # Get rid of more unnecessary stuff.
+      rm -rf $out/var $bin/bin/sln
+
+      # For some reason these aren't stripped otherwise and retain reference
+      # to bootstrap-tools; on cross-arm this stripping would break objects.
+      if [ -z "$crossConfig" ]; then
+        for i in "$out"/lib/*.a; do
+            [ "$i" = "$out/lib/libm.a" ] || strip -S "$i"
+        done
+      fi
+
+      # Put libraries for static linking in a separate output.  Note
+      # that libc_nonshared.a and libpthread_nonshared.a are required
+      # for dynamically-linked applications.
+      mkdir -p $static/lib
+      mv $out/lib/*.a $static/lib
+      mv $static/lib/lib*_nonshared.a $out/lib
+      # Some of *.a files are linker scripts where moving broke the paths.
+      sed "/^GROUP/s|$out/lib/lib|$static/lib/lib|g" \
+        -i "$static"/lib/*.a
+
+      # Work around a Nix bug: hard links across outputs cause a build failure.
+      cp $bin/bin/getconf $bin/bin/getconf_
+      mv $bin/bin/getconf_ $bin/bin/getconf
+    '';
+
+    separateDebugInfo = true;
+
+    meta.description = "The GNU C Library";
+  }
diff --git a/pkgs/development/libraries/glibc/common-2.27.nix b/pkgs/development/libraries/glibc/common-2.27.nix
new file mode 100644
index 000000000000..6c443ebbb932
--- /dev/null
+++ b/pkgs/development/libraries/glibc/common-2.27.nix
@@ -0,0 +1,210 @@
+/* Build configuration used to build glibc, Info files, and locale
+   information.  */
+
+{ stdenv, lib
+, buildPlatform, hostPlatform
+, buildPackages
+, fetchurl
+, linuxHeaders ? null
+, gd ? null, libpng ? null
+, bison
+}:
+
+{ name
+, withLinuxHeaders ? false
+, profilingLibraries ? false
+, installLocales ? false
+, withGd ? false
+, meta
+, ...
+} @ args:
+
+let
+  version = "2.27";
+  patchSuffix = "";
+  sha256 = "0wpwq7gsm7sd6ysidv0z575ckqdg13cr2njyfgrbgh4f65adwwji";
+  cross = if buildPlatform != hostPlatform then hostPlatform else null;
+in
+
+assert withLinuxHeaders -> linuxHeaders != null;
+assert withGd -> gd != null && libpng != null;
+
+stdenv.mkDerivation ({
+  inherit  installLocales;
+  linuxHeaders = if withLinuxHeaders then linuxHeaders else null;
+
+  # The host/target system.
+  crossConfig = if cross != null then cross.config else null;
+
+  inherit (stdenv) is64bit;
+
+  enableParallelBuilding = true;
+
+  patches =
+    [
+      /* Have rpcgen(1) look for cpp(1) in $PATH.  */
+      ./rpcgen-path.patch
+
+      /* Allow NixOS and Nix to handle the locale-archive. */
+      ./nix-locale-archive-2.27.patch
+
+      /* Don't use /etc/ld.so.cache, for non-NixOS systems.  */
+      ./dont-use-system-ld-so-cache-2.27.patch
+
+      /* Don't use /etc/ld.so.preload, but /etc/ld-nix.so.preload.  */
+      ./dont-use-system-ld-so-preload.patch
+
+      /* The command "getconf CS_PATH" returns the default search path
+         "/bin:/usr/bin", which is inappropriate on NixOS machines. This
+         patch extends the search path by "/run/current-system/sw/bin". */
+      ./fix_path_attribute_in_getconf.patch
+
+      /* Allow running with RHEL 6 -like kernels.  The patch adds an exception
+        for glibc to accept 2.6.32 and to tag the ELFs as 2.6.32-compatible
+        (otherwise the loader would refuse libc).
+        Note that glibc will fully work only on their heavily patched kernels
+        and we lose early mismatch detection on 2.6.32.
+
+        On major glibc updates we should check that the patched kernel supports
+        all the required features.  ATM it's verified up to glibc-2.26-131.
+        # HOWTO: check glibc sources for changes in kernel requirements
+        git log -p glibc-2.25.. sysdeps/unix/sysv/linux/x86_64/kernel-features.h sysdeps/unix/sysv/linux/kernel-features.h
+        # get kernel sources (update the URL)
+        mkdir tmp && cd tmp
+        curl http://vault.centos.org/6.9/os/Source/SPackages/kernel-2.6.32-696.el6.src.rpm | rpm2cpio - | cpio -idmv
+        tar xf linux-*.bz2
+        # check syscall presence, for example
+        less linux-*?/arch/x86/kernel/syscall_table_32.S
+       */
+      ./allow-kernel-2.6.32.patch
+    ]
+    ++ lib.optional stdenv.isx86_64 ./fix-x64-abi.patch;
+
+  postPatch =
+    ''
+      # Needed for glibc to build with the gnumake 3.82
+      # http://comments.gmane.org/gmane.linux.lfs.support/31227
+      sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
+
+      # nscd needs libgcc, and we don't want it dynamically linked
+      # because we don't want it to depend on bootstrap-tools libs.
+      echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
+    '';
+
+  configureFlags =
+    [ "-C"
+      "--enable-add-ons"
+      "--enable-obsolete-nsl"
+      "--enable-obsolete-rpc"
+      "--sysconfdir=/etc"
+      "--enable-stackguard-randomization"
+      (if withLinuxHeaders
+       then "--with-headers=${linuxHeaders}/include"
+       else "--without-headers")
+      (if profilingLibraries
+       then "--enable-profile"
+       else "--disable-profile")
+    ] ++ lib.optionals withLinuxHeaders [
+      "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26
+    ] ++ lib.optionals (cross != null) [
+      (if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp")
+    ] ++ lib.optionals (cross != null) [
+      "--with-__thread"
+    ] ++ lib.optionals (cross == null && stdenv.isArm) [
+      "--host=arm-linux-gnueabi"
+      "--build=arm-linux-gnueabi"
+
+      # To avoid linking with -lgcc_s (dynamic link)
+      # so the glibc does not depend on its compiler store path
+      "libc_cv_as_needed=no"
+    ] ++ lib.optional withGd "--with-gd";
+
+  installFlags = [ "sysconfdir=$(out)/etc" ];
+
+  outputs = [ "out" "bin" "dev" "static" ];
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ bison ];
+  buildInputs = lib.optionals withGd [ gd libpng ];
+
+  # Needed to install share/zoneinfo/zone.tab.  Set to impure /bin/sh to
+  # prevent a retained dependency on the bootstrap tools in the stdenv-linux
+  # bootstrap.
+  BASH_SHELL = "/bin/sh";
+}
+
+// (removeAttrs args [ "withLinuxHeaders" "withGd" ]) //
+
+{
+  name = name + "-${version}${patchSuffix}";
+
+  src = fetchurl {
+    url = "mirror://gnu/glibc/glibc-${version}.tar.xz";
+    inherit sha256;
+  };
+
+  # Remove absolute paths from `configure' & co.; build out-of-tree.
+  preConfigure = ''
+    export PWD_P=$(type -tP pwd)
+    for i in configure io/ftwtest-sh; do
+        # Can't use substituteInPlace here because replace hasn't been
+        # built yet in the bootstrap.
+        sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
+    done
+
+    mkdir ../build
+    cd ../build
+
+    configureScript="`pwd`/../$sourceRoot/configure"
+
+    ${lib.optionalString (stdenv.cc.libc != null)
+      ''makeFlags="$makeFlags BUILD_LDFLAGS=-Wl,-rpath,${stdenv.cc.libc}/lib"''
+    }
+
+
+  '' + lib.optionalString (cross != null) ''
+    sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"
+
+    cat > config.cache << "EOF"
+    libc_cv_forced_unwind=yes
+    libc_cv_c_cleanup=yes
+    libc_cv_gnu89_inline=yes
+    EOF
+  '';
+
+  preBuild = lib.optionalString withGd "unset NIX_DONT_SET_RPATH";
+
+  meta = {
+    homepage = http://www.gnu.org/software/libc/;
+    description = "The GNU C Library";
+
+    longDescription =
+      '' Any Unix-like operating system needs a C library: the library which
+         defines the "system calls" and other basic facilities such as
+         open, malloc, printf, exit...
+
+         The GNU C library is used as the C library in the GNU system and
+         most systems with the Linux kernel.
+      '';
+
+    license = lib.licenses.lgpl2Plus;
+
+    maintainers = [ lib.maintainers.eelco ];
+    platforms = lib.platforms.linux;
+  } // meta;
+
+  passthru = { inherit version; };
+}
+
+// lib.optionalAttrs (cross != null) {
+  preInstall = null; # clobber the native hook
+
+  dontStrip = true;
+
+  separateDebugInfo = false; # this is currently broken for crossDrv
+
+  # To avoid a dependency on the build system 'bash'.
+  preFixup = ''
+    rm -f $bin/bin/{ldd,tzselect,catchsegv,xtrace}
+  '';
+})
diff --git a/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache-2.27.patch b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache-2.27.patch
new file mode 100644
index 000000000000..f84b1049adf8
--- /dev/null
+++ b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache-2.27.patch
@@ -0,0 +1,46 @@
+diff -Naur glibc-2.27-orig/elf/ldconfig.c glibc-2.27/elf/ldconfig.c
+--- glibc-2.27-orig/elf/ldconfig.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/elf/ldconfig.c	2018-02-17 22:43:17.232175182 -0500
+@@ -51,7 +51,7 @@
+ #endif
+ 
+ #ifndef LD_SO_CONF
+-# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
++# define LD_SO_CONF PREFIX "/etc/ld.so.conf"
+ #endif
+ 
+ /* Get libc version number.  */
+diff -Naur glibc-2.27-orig/elf/Makefile glibc-2.27/elf/Makefile
+--- glibc-2.27-orig/elf/Makefile	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/elf/Makefile	2018-02-17 22:44:50.334006750 -0500
+@@ -559,13 +559,13 @@
+ 
+ $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
+ 
+-SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
+-CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
++PREFIX-FLAGS := -D'PREFIX="$(prefix)"'
++CFLAGS-ldconfig.c += $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
+ 		    -D'SLIBDIR="$(slibdir)"'
+ libof-ldconfig = ldconfig
+-CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
+-CFLAGS-cache.c += $(SYSCONF-FLAGS)
+-CFLAGS-rtld.c += $(SYSCONF-FLAGS)
++CFLAGS-dl-cache.c += $(PREFIX-FLAGS)
++CFLAGS-cache.c += $(PREFIX-FLAGS)
++CFLAGS-rtld.c += $(PREFIX-FLAGS)
+ 
+ cpp-srcs-left := $(all-rtld-routines:=.os)
+ lib := rtld
+diff -Naur glibc-2.27-orig/sysdeps/generic/dl-cache.h glibc-2.27/sysdeps/generic/dl-cache.h
+--- glibc-2.27-orig/sysdeps/generic/dl-cache.h	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/sysdeps/generic/dl-cache.h	2018-02-17 22:45:20.471598816 -0500
+@@ -28,7 +28,7 @@
+ #endif
+ 
+ #ifndef LD_SO_CACHE
+-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
++# define LD_SO_CACHE PREFIX "/etc/ld.so.cache"
+ #endif
+ 
+ #ifndef add_system_dir
diff --git a/pkgs/development/libraries/glibc/nix-locale-archive-2.27.patch b/pkgs/development/libraries/glibc/nix-locale-archive-2.27.patch
new file mode 100644
index 000000000000..1b3590db4fdd
--- /dev/null
+++ b/pkgs/development/libraries/glibc/nix-locale-archive-2.27.patch
@@ -0,0 +1,118 @@
+diff -Naur glibc-2.27-orig/locale/loadarchive.c glibc-2.27/locale/loadarchive.c
+--- glibc-2.27-orig/locale/loadarchive.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/loadarchive.c	2018-02-17 22:32:25.680169462 -0500
+@@ -123,6 +123,23 @@
+   return MAX (namehash_end, MAX (string_end, locrectab_end));
+ }
+ 
++static int
++open_locale_archive (void)
++{
++  int fd = -1;
++  char *versioned_path = getenv ("LOCAL_ARCHIVE_2_27");
++  char *path = getenv ("LOCAL_ARCHIVE");
++  if (versioned_path)
++    fd = __open_nocancel (versioned_path, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  if (path && fd < 0)
++    fd = __open_nocancel (path, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  if (fd < 0)
++    fd = __open_nocancel (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  if (fd < 0)
++    fd = __open_nocancel ("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  return fd;
++}
++
+ 
+ /* Find the locale *NAMEP in the locale archive, and return the
+    internalized data structure for its CATEGORY data.  If this locale has
+@@ -202,7 +219,7 @@
+       archmapped = &headmap;
+ 
+       /* The archive has never been opened.  */
+-      fd = __open_nocancel (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++      fd = open_locale_archive ();
+       if (fd < 0)
+ 	/* Cannot open the archive, for whatever reason.  */
+ 	return NULL;
+@@ -397,8 +414,7 @@
+ 	  if (fd == -1)
+ 	    {
+ 	      struct stat64 st;
+-	      fd = __open_nocancel (archfname,
+-				    O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++	      fd = open_locale_archive ();
+ 	      if (fd == -1)
+ 		/* Cannot open the archive, for whatever reason.  */
+ 		return NULL;
+diff -Naur glibc-2.27-orig/locale/programs/locale.c glibc-2.27/locale/programs/locale.c
+--- glibc-2.27-orig/locale/programs/locale.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/programs/locale.c	2018-02-17 22:36:39.726293213 -0500
+@@ -633,6 +633,24 @@
+ 
+ 
+ static int
++open_locale_archive (void)
++{
++  int fd = -1;
++  char *versioned_path = getenv ("LOCAL_ARCHIVE_2_27");
++  char *path = getenv ("LOCAL_ARCHIVE");
++  if (versioned_path)
++    fd = open64 (versioned_path, O_RDONLY);
++  if (path && fd < 0)
++    fd = open64 (path, O_RDONLY);
++  if (fd < 0)
++    fd = open64 (ARCHIVE_NAME, O_RDONLY);
++  if (fd < 0)
++    fd = open64 ("/usr/lib/locale/locale-archive", O_RDONLY);
++  return fd;
++}
++
++
++static int
+ write_archive_locales (void **all_datap, char *linebuf)
+ {
+   struct stat64 st;
+@@ -644,7 +662,7 @@
+   int fd, ret = 0;
+   uint32_t cnt;
+ 
+-  fd = open64 (ARCHIVE_NAME, O_RDONLY);
++  fd = open_locale_archive ();
+   if (fd < 0)
+     return 0;
+ 
+diff -Naur glibc-2.27-orig/locale/programs/locarchive.c glibc-2.27/locale/programs/locarchive.c
+--- glibc-2.27-orig/locale/programs/locarchive.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/programs/locarchive.c	2018-02-17 22:40:51.245293975 -0500
+@@ -117,6 +117,22 @@
+ }
+ 
+ 
++static int
++open_locale_archive (const char * archivefname, int flags)
++{
++  int fd = -1;
++  char *versioned_path = getenv ("LOCAL_ARCHIVE_2_27");
++  char *path = getenv ("LOCAL_ARCHIVE");
++  if (versioned_path)
++    fd = open64 (versioned_path, flags);
++  if (path && fd < 0)
++    fd = open64 (path, flags);
++  if (fd < 0)
++    fd = open64 (archivefname, flags);
++  return fd;
++}
++
++
+ static void
+ create_archive (const char *archivefname, struct locarhandle *ah)
+ {
+@@ -578,7 +594,7 @@
+   while (1)
+     {
+       /* Open the archive.  We must have exclusive write access.  */
+-      fd = open64 (archivefname, readonly ? O_RDONLY : O_RDWR);
++      fd = open_locale_archive (archivefname, readonly ? O_RDONLY : O_RDWR);
+       if (fd == -1)
+ 	{
+ 	  /* Maybe the file does not yet exist? If we are opening
diff --git a/pkgs/development/libraries/libatomic_ops/default.nix b/pkgs/development/libraries/libatomic_ops/default.nix
index 3aae754be405..714e9361440c 100644
--- a/pkgs/development/libraries/libatomic_ops/default.nix
+++ b/pkgs/development/libraries/libatomic_ops/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoconf, automake, libtool }:
+{ stdenv, fetchurl, autoconf, automake, libtool, hostPlatform }:
 
 stdenv.mkDerivation rec {
   name = "libatomic_ops-${version}";
@@ -12,6 +12,9 @@ stdenv.mkDerivation rec {
     sha256 ="1rif2hjscq5mh639nsnjhb90c01gnmy1sbmj6x6hsn1xmpnj95r1";
   };
 
+  # https://github.com/ivmai/libatomic_ops/pull/32
+  patches = if hostPlatform.isRiscV then [ ./riscv.patch ] else null;
+
   nativeBuildInputs = stdenv.lib.optionals stdenv.isCygwin [ autoconf automake libtool ];
 
   preConfigure = stdenv.lib.optionalString stdenv.isCygwin ''
diff --git a/pkgs/development/libraries/libatomic_ops/riscv.patch b/pkgs/development/libraries/libatomic_ops/riscv.patch
new file mode 100644
index 000000000000..27f2408c34c6
--- /dev/null
+++ b/pkgs/development/libraries/libatomic_ops/riscv.patch
@@ -0,0 +1,40 @@
+diff -Naur libatomic_ops-7.6.2-orig/src/atomic_ops/sysdeps/gcc/riscv.h libatomic_ops-7.6.2/src/atomic_ops/sysdeps/gcc/riscv.h
+--- libatomic_ops-7.6.2-orig/src/atomic_ops/sysdeps/gcc/riscv.h	1969-12-31 19:00:00.000000000 -0500
++++ libatomic_ops-7.6.2/src/atomic_ops/sysdeps/gcc/riscv.h	2018-02-18 00:48:53.581721375 -0500
+@@ -0,0 +1 @@
++#include "generic.h"
+diff -Naur libatomic_ops-7.6.2-orig/src/atomic_ops.h libatomic_ops-7.6.2/src/atomic_ops.h
+--- libatomic_ops-7.6.2-orig/src/atomic_ops.h	2017-12-24 03:31:12.000000000 -0500
++++ libatomic_ops-7.6.2/src/atomic_ops.h	2018-02-18 00:48:53.580721359 -0500
+@@ -352,6 +352,9 @@
+ # if defined(__tile__)
+ #   include "atomic_ops/sysdeps/gcc/tile.h"
+ # endif
++# if defined(__riscv)
++#   include "atomic_ops/sysdeps/gcc/riscv.h"
++# endif
+ #endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
+ 
+ #if (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(__GNUC__) \
+diff -Naur libatomic_ops-7.6.2-orig/src/Makefile.am libatomic_ops-7.6.2/src/Makefile.am
+--- libatomic_ops-7.6.2-orig/src/Makefile.am	2017-12-24 03:31:12.000000000 -0500
++++ libatomic_ops-7.6.2/src/Makefile.am	2018-02-18 00:48:53.579721342 -0500
+@@ -92,6 +92,7 @@
+           atomic_ops/sysdeps/gcc/mips.h \
+           atomic_ops/sysdeps/gcc/nios2.h \
+           atomic_ops/sysdeps/gcc/powerpc.h \
++          atomic_ops/sysdeps/gcc/riscv.h \
+           atomic_ops/sysdeps/gcc/s390.h \
+           atomic_ops/sysdeps/gcc/sh.h \
+           atomic_ops/sysdeps/gcc/sparc.h \
+diff -Naur libatomic_ops-7.6.2-orig/src/Makefile.in libatomic_ops-7.6.2/src/Makefile.in
+--- libatomic_ops-7.6.2-orig/src/Makefile.in	2017-12-24 03:32:23.000000000 -0500
++++ libatomic_ops-7.6.2/src/Makefile.in	2018-02-18 00:49:14.005062121 -0500
+@@ -446,6 +446,7 @@
+           atomic_ops/sysdeps/gcc/mips.h \
+           atomic_ops/sysdeps/gcc/nios2.h \
+           atomic_ops/sysdeps/gcc/powerpc.h \
++          atomic_ops/sysdeps/gcc/riscv.h \
+           atomic_ops/sysdeps/gcc/s390.h \
+           atomic_ops/sysdeps/gcc/sh.h \
+           atomic_ops/sysdeps/gcc/sparc.h \
diff --git a/pkgs/development/libraries/libav/default.nix b/pkgs/development/libraries/libav/default.nix
index 6a80a856df3c..a069894f6c8c 100644
--- a/pkgs/development/libraries/libav/default.nix
+++ b/pkgs/development/libraries/libav/default.nix
@@ -28,9 +28,9 @@ let inherit (stdenv.lib) optional optionals hasPrefix; in
 let
   result = {
     # e.g. https://libav.org/releases/libav-11.11.tar.xz.sha1
-    libav_0_8 = libavFun "0.8.20" "0c7a2417c3a01eb74072691bb93ce802ae1be08f";
-    libav_11  = libavFun "11.11"  "d7444fa4f135bdd7347cc962ab4b5228796b0f23";
-    libav_12  = libavFun "12.2"   "3784b15f88076ca0ab8fb6b0377e975b83a5c9f5";
+    libav_0_8 = libavFun "0.8.21" "d858f65128dad0bac1a8c3a51e5cbb27a7c79b3f";
+    libav_11  = libavFun "11.12"  "61d5dcab5fde349834af193a572b12a5fd6a4d42";
+    libav_12  = libavFun "12.3"   "386c18c8b857f23dfcf456ce40370716130211d9";
   };
 
   libavFun = version : sha1 : stdenv.mkDerivation rec {
@@ -125,7 +125,6 @@ let
       license = with licenses; if enableUnfree then unfree #ToDo: redistributable or not?
         else if enableGPL then gpl2Plus else lgpl21Plus;
       platforms = with platforms; linux ++ darwin;
-      maintainers = [ maintainers.vcunat ];
     };
   }; # libavFun
 
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index b34c9ff31f2c..2ea5e923bad0 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -24,8 +24,7 @@ in stdenv.mkDerivation rec {
 
   outputs = [ "bin" "dev" "out" "doc" "man" ];
 
-  configureFlags = [
-    "--enable-jit"
+  configureFlags = optional (!hostPlatform.isRiscV) "--enable-jit" ++ [
     "--enable-unicode-properties"
     "--disable-cpp"
   ]
diff --git a/pkgs/development/libraries/qt-5/5.10/default.nix b/pkgs/development/libraries/qt-5/5.10/default.nix
index cf66e60d5696..eeff34568332 100644
--- a/pkgs/development/libraries/qt-5/5.10/default.nix
+++ b/pkgs/development/libraries/qt-5/5.10/default.nix
@@ -101,10 +101,11 @@ let
       qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
 
       env = callPackage ../qt-env.nix {};
-      full = env "qt-${qtbase.version}" ([
+      full = env "qt-full-${qtbase.version}" ([
         qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
-        qtimageformats qtlocation qtmultimedia qtquickcontrols qtscript
-        qtsensors qtserialport qtsvg qttools qttranslations qtwebsockets
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
         qtx11extras qtxmlpatterns
       ] ++ optional (!stdenv.isDarwin) qtwayland
         ++ optional (stdenv.isDarwin) qtmacextras);
diff --git a/pkgs/development/libraries/qt-5/5.6/default.nix b/pkgs/development/libraries/qt-5/5.6/default.nix
index 1200884a30ce..8793b2bb9f01 100644
--- a/pkgs/development/libraries/qt-5/5.6/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/default.nix
@@ -113,7 +113,7 @@ let
       qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
 
       env = callPackage ../qt-env.nix {};
-      full = env "qt-${qtbase.version}" [
+      full = env "qt-full-${qtbase.version}" [
         qtconnectivity qtdeclarative qtdoc qtgraphicaleffects qtimageformats
         qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtscript
         qtsensors qtserialport qtsvg qttools qttranslations qtwayland
diff --git a/pkgs/development/libraries/qt-5/5.9/default.nix b/pkgs/development/libraries/qt-5/5.9/default.nix
index e0dab3421627..5afcdaa430e5 100644
--- a/pkgs/development/libraries/qt-5/5.9/default.nix
+++ b/pkgs/development/libraries/qt-5/5.9/default.nix
@@ -101,11 +101,12 @@ let
       qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
 
       env = callPackage ../qt-env.nix {};
-      full = env "qt-${qtbase.version}" ([
+      full = env "qt-full-${qtbase.version}" ([
         qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
-        qtimageformats qtlocation qtmultimedia qtquickcontrols qtscript
-        qtsensors qtserialport qtsvg qttools qttranslations qtwebsockets
-        qtx11extras qtxmlpatterns qtvirtualkeyboard
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
+        qtx11extras qtxmlpatterns
       ] ++ optional (!stdenv.isDarwin) qtwayland
         ++ optional (stdenv.isDarwin) qtmacextras);
 
diff --git a/pkgs/development/libraries/qt-5/qt-env.nix b/pkgs/development/libraries/qt-5/qt-env.nix
index 728761689b42..49585f601d14 100644
--- a/pkgs/development/libraries/qt-5/qt-env.nix
+++ b/pkgs/development/libraries/qt-5/qt-env.nix
@@ -13,9 +13,9 @@ buildEnv {
     cat >"$out/bin/qt.conf" <<EOF
     [Paths]
     Prefix = $out
-    Plugins = $qtPluginPrefix
-    Qml2Imports = $qtQmlPrefix
-    Documentation = $qtDocPrefix
+    Plugins = ${qtbase.qtPluginPrefix}
+    Qml2Imports = ${qtbase.qtQmlPrefix}
+    Documentation = ${qtbase.qtDocPrefix}
     EOF
   '';
 }
diff --git a/pkgs/development/ocaml-modules/lwt_ssl/default.nix b/pkgs/development/ocaml-modules/lwt_ssl/default.nix
new file mode 100644
index 000000000000..e53c835a2911
--- /dev/null
+++ b/pkgs/development/ocaml-modules/lwt_ssl/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchzip, ocaml, findlib, jbuilder, ssl, lwt }:
+
+stdenv.mkDerivation rec {
+  version = "1.1.2";
+  name = "ocaml${ocaml.version}-lwt_ssl-${version}";
+
+  src = fetchzip {
+    url = "https://github.com/aantron/lwt_ssl/archive/${version}.tar.gz";
+    sha256 = "1q0an3djqjxv83v3iswi7m81braqx93kcrcwrxwmf6jzhdm4pn15";
+  };
+
+  buildInputs = [ ocaml findlib jbuilder ];
+  propagatedBuildInputs = [ ssl lwt ];
+
+  inherit (jbuilder) installPhase;
+
+  meta = {
+    homepage = "https://github.com/aantron/lwt_ssl";
+    description = "OpenSSL binding with concurrent I/O";
+    license = stdenv.lib.licenses.lgpl21;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
+  };
+}
diff --git a/pkgs/development/python-modules/docker/default.nix b/pkgs/development/python-modules/docker/default.nix
index e0ab354173e3..4ce013ac7976 100644
--- a/pkgs/development/python-modules/docker/default.nix
+++ b/pkgs/development/python-modules/docker/default.nix
@@ -3,13 +3,13 @@
 , ipaddress, backports_ssl_match_hostname, docker_pycreds
 }:
 buildPythonPackage rec {
-  version = "3.0.0";
+  version = "2.7.0";
   pname = "docker";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "mirror://pypi/d/docker/${name}.tar.gz";
-    sha256 = "4a1083656c6ac7615c19094d9b5e052f36e38d0b07e63d7e506c9b5b32c3abe2";
+    sha256 = "144248308e8ea31c4863c6d74e1b55daf97cc190b61d0fe7b7313ab920d6a76c";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/micawber/default.nix b/pkgs/development/python-modules/micawber/default.nix
new file mode 100644
index 000000000000..5e3afe05ea79
--- /dev/null
+++ b/pkgs/development/python-modules/micawber/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, buildPythonPackage, fetchPypi, beautifulsoup4 }:
+
+buildPythonPackage rec {
+  pname = "micawber";
+  version = "0.3.5";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0pnq6j8f144virhri0drgf0058x6qcxfd5yrb0ynbwr8djh326yn";
+  };
+
+  propagatedBuildInputs = [ beautifulsoup4 ];
+
+  meta = with stdenv.lib; {
+    homepage = http://micawber.readthedocs.io/en/latest/;
+    description = "A small library for extracting rich content from urls";
+    license = licenses.mit;
+    longDescription = ''
+      micawber supplies a few methods for retrieving rich metadata
+      about a variety of links, such as links to youtube videos.
+      micawber also provides functions for parsing blocks of text and html
+      and replacing links to videos with rich embedded content.
+    '';
+    maintainers = with maintainers; [ davidak ];
+  };
+}
diff --git a/pkgs/development/python-modules/moinmoin/default.nix b/pkgs/development/python-modules/moinmoin/default.nix
new file mode 100644
index 000000000000..cedd45f2f225
--- /dev/null
+++ b/pkgs/development/python-modules/moinmoin/default.nix
@@ -0,0 +1,32 @@
+{ lib, buildPythonPackage, fetchurl, fetchpatch
+, pytest, werkzeug, pygments
+}:
+
+buildPythonPackage rec {
+  name = "moinmoin-${ver}";
+  ver = "1.9.9";
+
+  src = fetchurl {
+    url = "http://static.moinmo.in/files/moin-${ver}.tar.gz";
+    sha256 = "197ga41qghykmir80ik17f9hjpmixslv3zjgj7bj9qvs1dvdg5s3";
+  };
+
+  patches = [
+    # Recommended to install on their download page.
+    (fetchpatch {
+      url = "https://bitbucket.org/thomaswaldmann/moin-1.9/commits/561b7a9c2bd91b61d26cd8a5f39aa36bf5c6159e/raw";
+      sha256 = "1nscnl9nspnrwyf3n95ig0ihzndryinq9kkghliph6h55cncfc65";
+    })
+    ./fix_tests.patch
+  ];
+
+  checkInputs = [ pytest werkzeug pygments ];
+
+  meta = with lib; {
+    description = "Advanced, easy to use and extensible WikiEngine";
+
+    homepage = "http://moinmo.in/";
+
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/pkgs/development/python-modules/moinmoin/fix_tests.patch b/pkgs/development/python-modules/moinmoin/fix_tests.patch
new file mode 100644
index 000000000000..e9856eeffca6
--- /dev/null
+++ b/pkgs/development/python-modules/moinmoin/fix_tests.patch
@@ -0,0 +1,16 @@
+diff -ru3 moin-1.9.9-old/MoinMoin/conftest.py moin-1.9.9-new/MoinMoin/conftest.py
+--- moin-1.9.9-old/MoinMoin/conftest.py	2016-10-31 23:44:02.000000000 +0300
++++ moin-1.9.9-new/MoinMoin/conftest.py	2018-02-18 12:13:19.551929093 +0300
+@@ -22,10 +22,11 @@
+ 
+ import atexit
+ import sys
++import os
+ 
+ import py
+ 
+-rootdir = py.magic.autopath().dirpath()
++rootdir = os.path.abspath(os.path.dirname(__file__))
+ moindir = rootdir.join("..")
+ sys.path.insert(0, str(moindir))
+ 
diff --git a/pkgs/development/python-modules/pymacaroons-pynacl/default.nix b/pkgs/development/python-modules/pymacaroons-pynacl/default.nix
new file mode 100644
index 000000000000..8bc644252c0f
--- /dev/null
+++ b/pkgs/development/python-modules/pymacaroons-pynacl/default.nix
@@ -0,0 +1,24 @@
+{ lib, buildPythonPackage, fetchFromGitHub, pynacl, six }:
+
+buildPythonPackage rec {
+  pname = "pymacaroons-pynacl";
+  version = "0.9.3";
+
+  src = fetchFromGitHub {
+    owner = "matrix-org";
+    repo = "pymacaroons";
+    rev = "v${version}";
+    sha256 = "0bykjk01zdndp6gjr30x46blsn0cvxa7j0zh5g8raxwaawchjhii";
+  };
+
+  propagatedBuildInputs = [ pynacl six ];
+
+  # Tests require an old version of hypothesis
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Macaroon library for Python";
+    homepage = https://github.com/matrix-org/pymacaroons;
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/development/python-modules/pynacl/default.nix b/pkgs/development/python-modules/pynacl/default.nix
index c23a90c095b6..981427e46f33 100644
--- a/pkgs/development/python-modules/pynacl/default.nix
+++ b/pkgs/development/python-modules/pynacl/default.nix
@@ -11,11 +11,8 @@ buildPythonPackage rec {
     sha256 = "0z9i1z4hjzmp23igyhvg131gikbrr947506lwfb3fayf0agwfv8f";
   };
 
-  #remove deadline from tests, see https://github.com/pyca/pynacl/issues/370
-  preCheck = ''
-    sed -i 's/deadline=1500, //' tests/test_pwhash.py
-    sed -i 's/deadline=1500, //' tests/test_aead.py
-  '';
+  #set timeout to unlimited, remove deadline from tests, see https://github.com/pyca/pynacl/issues/370
+  patches = [ ./pynacl-no-timeout-and-deadline.patch ];
 
   checkInputs = [ pytest coverage hypothesis ];
   propagatedBuildInputs = [ libsodium cffi six ];
diff --git a/pkgs/development/python-modules/pynacl/pynacl-no-timeout-and-deadline.patch b/pkgs/development/python-modules/pynacl/pynacl-no-timeout-and-deadline.patch
new file mode 100644
index 000000000000..5f831df3c48d
--- /dev/null
+++ b/pkgs/development/python-modules/pynacl/pynacl-no-timeout-and-deadline.patch
@@ -0,0 +1,49 @@
+diff --git a/tests/test_pwhash.py b/tests/test_pwhash.py
+index 9634c85..7f20316 100644
+--- a/tests/test_pwhash.py
++++ b/tests/test_pwhash.py
+@@ -20,7 +20,7 @@ import os
+ import sys
+ import unicodedata as ud
+ 
+-from hypothesis import given, settings
++from hypothesis import given, settings, unlimited
+ from hypothesis.strategies import integers, text
+ 
+ import pytest
+@@ -411,7 +411,7 @@ def test_str_verify_argon2_ref_fail(password_hash, password):
+        integers(min_value=1024 * 1024,
+                 max_value=16 * 1024 * 1024)
+        )
+-@settings(deadline=1500, max_examples=20)
++@settings(timeout=unlimited, deadline=None, max_examples=20)
+ def test_argon2i_str_and_verify(password, ops, mem):
+     _psw = password.encode('utf-8')
+     pw_hash = nacl.pwhash.argon2i.str(_psw, opslimit=ops, memlimit=mem)
+@@ -425,7 +425,7 @@ def test_argon2i_str_and_verify(password, ops, mem):
+        integers(min_value=1024 * 1024,
+                 max_value=16 * 1024 * 1024)
+        )
+-@settings(deadline=1500, max_examples=20)
++@settings(timeout=unlimited, deadline=None, max_examples=20)
+ def test_argon2id_str_and_verify(password, ops, mem):
+     _psw = password.encode('utf-8')
+     pw_hash = nacl.pwhash.argon2id.str(_psw, opslimit=ops, memlimit=mem)
+@@ -439,7 +439,7 @@ def test_argon2id_str_and_verify(password, ops, mem):
+        integers(min_value=1024 * 1024,
+                 max_value=16 * 1024 * 1024)
+        )
+-@settings(deadline=1500, max_examples=20)
++@settings(timeout=unlimited, deadline=None, max_examples=20)
+ def test_argon2i_str_and_verify_fail(password, ops, mem):
+     _psw = password.encode('utf-8')
+     pw_hash = nacl.pwhash.argon2i.str(_psw, opslimit=ops, memlimit=mem)
+@@ -448,7 +448,7 @@ def test_argon2i_str_and_verify_fail(password, ops, mem):
+ 
+ 
+ @given(text(alphabet=PASSWD_CHARS, min_size=5, max_size=20))
+-@settings(deadline=1500, max_examples=5)
++@settings(timeout=unlimited, deadline=None, max_examples=5)
+ def test_pwhash_str_and_verify(password):
+     _psw = password.encode('utf-8')
+ 
diff --git a/pkgs/development/python-modules/yarl/default.nix b/pkgs/development/python-modules/yarl/default.nix
index e40aa9d05f9c..1953b1610ceb 100644
--- a/pkgs/development/python-modules/yarl/default.nix
+++ b/pkgs/development/python-modules/yarl/default.nix
@@ -9,11 +9,11 @@
 
 buildPythonPackage rec {
   pname = "yarl";
-  version = "1.1.0";
+  version = "1.1.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "162630v7f98l27h11msk9416lqwm2mpgxh4s636594nlbfs9by3a";
+    sha256 = "a69dd7e262cdb265ac7d5e929d55f2f3d07baaadd158c8f19caebf8dde08dfe8";
   };
 
   checkInputs = [ pytest pytestrunner ];
diff --git a/pkgs/development/qtcreator/default.nix b/pkgs/development/qtcreator/default.nix
index 0b3cf3b53f89..de94b7a8eff3 100644
--- a/pkgs/development/qtcreator/default.nix
+++ b/pkgs/development/qtcreator/default.nix
@@ -31,6 +31,11 @@ stdenv.mkDerivation rec {
 
   installFlags = [ "INSTALL_ROOT=$(out)" ] ++ optional withDocumentation "install_docs";
 
+  preConfigure = ''
+    substituteInPlace src/plugins/plugins.pro \
+      --replace '$$[QT_INSTALL_QML]/QtQuick/Controls' '${qtquickcontrols}/${qtbase.qtQmlPrefix}/QtQuick/Controls'
+  '';
+
   preBuild = optional withDocumentation ''
     ln -s ${getLib qtbase}/$qtDocPrefix $NIX_QT5_TMP/share
   '';
diff --git a/pkgs/development/tools/build-managers/gnumake/4.2/default.nix b/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
index e175205143fc..1094cacb7af3 100644
--- a/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
+++ b/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
@@ -4,6 +4,8 @@ assert guileSupport -> ( pkgconfig != null && guile != null );
 
 let
   version = "4.2.1";
+
+  needGlibcPatch = (stdenv.cc.libc.version or "") == "2.27";
 in
 stdenv.mkDerivation {
   name = "gnumake-${version}";
@@ -20,7 +22,7 @@ stdenv.mkDerivation {
     # included Makefiles, don't look in /usr/include and friends.
     ./impure-dirs.patch
     ./pselect.patch
-  ];
+  ] ++ stdenv.lib.optional needGlibcPatch ./glibc-2.27.patch;
 
   nativeBuildInputs = stdenv.lib.optionals guileSupport [ pkgconfig ];
   buildInputs = stdenv.lib.optionals guileSupport [ guile ];
diff --git a/pkgs/development/tools/build-managers/gnumake/4.2/glibc-2.27.patch b/pkgs/development/tools/build-managers/gnumake/4.2/glibc-2.27.patch
new file mode 100644
index 000000000000..c2639c6cc927
--- /dev/null
+++ b/pkgs/development/tools/build-managers/gnumake/4.2/glibc-2.27.patch
@@ -0,0 +1,24 @@
+From 48c8a116a914a325a0497721f5d8b58d5bba34d4 Mon Sep 17 00:00:00 2001
+From: Paul Smith <psmith@gnu.org>
+Date: Sun, 19 Nov 2017 15:09:16 -0500
+Subject: * configure.ac: Support GLIBC glob interface version 2
+
+---
+ configure.ac | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff -Naur a/configure b/configure
+--- configure	2016-06-10 19:03:21.000000000 -0400
++++ configure	2018-02-18 04:40:32.971371555 -0500
+@@ -11481,10 +11481,9 @@
+ #include <glob.h>
+ #include <fnmatch.h>
+ 
+-#define GLOB_INTERFACE_VERSION 1
+ #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
+ # include <gnu-versions.h>
+-# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
++# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2
+    gnu glob
+ # endif
+ #endif
diff --git a/pkgs/os-specific/linux/busybox/sandbox-shell.nix b/pkgs/os-specific/linux/busybox/sandbox-shell.nix
index 1755bd4f3f74..b94fae7f787b 100644
--- a/pkgs/os-specific/linux/busybox/sandbox-shell.nix
+++ b/pkgs/os-specific/linux/busybox/sandbox-shell.nix
@@ -1,8 +1,9 @@
-{ busybox }:
+{ busybox, hostPlatform }:
 
 # Minimal shell for use as basic /bin/sh in sandbox builds
 busybox.override {
-  useMusl = true;
+  # musl roadmap has RISC-V support projected for 1.1.20
+  useMusl = !hostPlatform.isRiscV;
   enableStatic = true;
   enableMinimal = true;
   extraConfig = ''
diff --git a/pkgs/os-specific/linux/kernel/linux-4.14.nix b/pkgs/os-specific/linux/kernel/linux-4.14.nix
index 96aa426b12ea..b5fd5168cf82 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.14.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.14.nix
@@ -3,13 +3,13 @@
 with stdenv.lib;
 
 buildLinux (args // rec {
-  version = "4.14.19";
+  version = "4.14.20";
 
   # branchVersion needs to be x.y
   extraMeta.branch = concatStrings (intersperse "." (take 2 (splitString "." version)));
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0gj7mq0dnb914mm4rari9z2cxbybskv1587606aq6f9nv1qp3kn5";
+    sha256 = "14njnspxmyzpapjzm8macrv411ss63xb39nb00xix75glqmg9dsa";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-4.15.nix b/pkgs/os-specific/linux/kernel/linux-4.15.nix
index 83fbfa81bf35..4bdcfba5db73 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.15.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.15.nix
@@ -3,7 +3,7 @@
 with stdenv.lib;
 
 buildLinux (args // rec {
-  version = "4.15.3";
+  version = "4.15.4";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = concatStrings (intersperse "." (take 3 (splitString "." "${version}.0")));
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "055p02in09rj95z9hc1kjh4r12ydwdcl3ds2cp4dckhlnyhnxf4g";
+    sha256 = "0fla9k90y6vaqvyjk81f59smcifcwickx4yr662m4whzkhd7wgd2";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-4.4.nix b/pkgs/os-specific/linux/kernel/linux-4.4.nix
index 4316ba4cf4be..94425f4d1e47 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.4.nix
@@ -1,11 +1,11 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.4.115";
+  version = "4.4.116";
   extraMeta.branch = "4.4";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1pxm4r09402h4k8zgl0w1wm4vfvcaa3y7l36h50jr5wgi6l8rx2q";
+    sha256 = "18sz68gbms5rvjiy51b1dg1jlr7pwazw9fg6q5ffczk22icflvsn";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-4.9.nix b/pkgs/os-specific/linux/kernel/linux-4.9.nix
index 2bb8ac1d948d..80db885170e4 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.9.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.9.nix
@@ -1,11 +1,11 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.9.81";
+  version = "4.9.82";
   extraMeta.branch = "4.9";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1bjwca7m3ksab6d23a05ciphzaj6nv6qmc5n6dxrgim0yhjpmvk4";
+    sha256 = "105im51ax2cwfqkljfi1sqh6sap6sc76zh5l9n7fpbys04khnwab";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-copperhead-hardened.nix b/pkgs/os-specific/linux/kernel/linux-copperhead-hardened.nix
index 304c085f4aa7..0e39bc421c95 100644
--- a/pkgs/os-specific/linux/kernel/linux-copperhead-hardened.nix
+++ b/pkgs/os-specific/linux/kernel/linux-copperhead-hardened.nix
@@ -3,9 +3,9 @@
 with stdenv.lib;
 
 let
-  version = "4.15.3";
+  version = "4.15.4";
   revision = "a";
-  sha256 = "1fxdllg60hwlbmjijcj7w6c3xz0rf9268f12qy45diahmydyccgc";
+  sha256 = "0j7nla8vjrxr82nfx8dl34qk8b56piwqbndqch9rv7plgl30hkj7";
 
   # modVersion needs to be x.y.z, will automatically add .0 if needed
   modVersion = concatStrings (intersperse "." (take 3 (splitString "." "${version}.0")));
diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix
index 3f511cd2545c..43b2418db771 100644
--- a/pkgs/servers/home-assistant/component-packages.nix
+++ b/pkgs/servers/home-assistant/component-packages.nix
@@ -2,7 +2,7 @@
 # Do not edit!
 
 {
-  version = "0.63.2";
+  version = "0.63.3";
   components = {
     "nuimo_controller" = ps: with ps; [  ];
     "bbb_gpio" = ps: with ps; [  ];
diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix
index e61d44369012..edc3539b0bdf 100644
--- a/pkgs/servers/home-assistant/default.nix
+++ b/pkgs/servers/home-assistant/default.nix
@@ -44,7 +44,7 @@ let
   extraBuildInputs = extraPackages py.pkgs;
 
   # Don't forget to run parse-requirements.py after updating
-  hassVersion = "0.63.2";
+  hassVersion = "0.63.3";
 
 in with py.pkgs; buildPythonApplication rec {
   pname = "homeassistant";
@@ -57,7 +57,7 @@ in with py.pkgs; buildPythonApplication rec {
     owner = "home-assistant";
     repo = "home-assistant";
     rev = version;
-    sha256 = "057xp3l3amzxbzzdqmgbmd0qk6fz29lpdbw3zcbjigjxbdi14h2l";
+    sha256 = "1lrdrn0x8i81vbqxziv5fgcc8ldz7x5r62kfz3nyg4g43rk3dqq8";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
index d08be79e6c55..6c217be4ea3c 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
@@ -17,4 +17,5 @@ in with (import ../../../lib).systems.examples; {
   i686-musl    = make musl32;
   armv6l-musl  = make muslpi;
   aarch64-musl = make aarch64-multiplatform-musl;
+  riscv64 = make riscv64;
 }
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 86801e3f0447..8033d47d5db5 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -19,7 +19,7 @@ in with pkgs; rec {
   tarMinimal = gnutar.override { acl = null; };
 
   busyboxMinimal = busybox.override {
-    useMusl = true;
+    useMusl = !targetPlatform.isRiscV;
     enableStatic = true;
     enableMinimal = true;
     extraConfig = ''
@@ -143,7 +143,7 @@ in with pkgs; rec {
         # These needed for cross but not native tools because the stdenv
         # GCC has certain things built in statically. See
         # pkgs/stdenv/linux/default.nix for the details.
-        cp -d ${isl_0_14.out}/lib/libisl*.so* $out/lib
+        cp -d ${isl_0_17.out}/lib/libisl*.so* $out/lib
 
       '' + ''
         cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
diff --git a/pkgs/tools/networking/arping/default.nix b/pkgs/tools/networking/arping/default.nix
new file mode 100644
index 000000000000..4358d22142d9
--- /dev/null
+++ b/pkgs/tools/networking/arping/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, libnet, libpcap }:
+
+stdenv.mkDerivation rec {
+  version = "2.19";
+  name = "arping-${version}";
+
+  buildInputs = [ libnet libpcap ];
+
+  src = fetchFromGitHub {
+    owner = "ThomasHabets";
+    repo = "arping";
+    rev = "arping-${version}";
+    sha256 = "10gpil6ic17x8v628vhz9s98rnw1k8ci2xs56i52pr103irirczw";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = with stdenv.lib; {
+    description = "Broadcasts a who-has ARP packet on the network and prints answers";
+    homepage = https://github.com/ThomasHabets/arping;
+    license = with licenses; [ gpl2 ];
+    maintainers = [ maintainers.michalrus ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/tools/package-management/conda/default.nix b/pkgs/tools/package-management/conda/default.nix
new file mode 100644
index 000000000000..4589cfcec880
--- /dev/null
+++ b/pkgs/tools/package-management/conda/default.nix
@@ -0,0 +1,71 @@
+{ lib
+, stdenv
+, fetchurl
+, runCommand
+, makeWrapper
+, buildFHSUserEnv
+, libselinux
+, xorg
+# Conda installs its packages and environments under this directory
+, installationPath ? "~/.conda"
+# Conda manages most pkgs itself, but expects a few to be on the system.
+, condaDeps ? [ stdenv.cc xorg.libSM xorg.libICE xorg.libXrender libselinux ]
+# Any extra nixpkgs you'd like available in the FHS env for Conda to use
+, extraPkgs ? [ ]
+}:
+
+# How to use this package?
+#
+# First-time setup: this nixpkg downloads the conda installer and provides a FHS
+# env in which it can run. On first use, the user will need to install conda to
+# the installPath using the installer:
+# $ nix-env -iA conda
+# $ conda-shell
+# $ conda-install
+#
+# Under normal usage, simply call `conda-shell` to activate the FHS env,
+# and then use conda commands as normal:
+# $ conda-shell
+# $ conda install spyder
+let
+  version = "4.3.31";
+  src = fetchurl {
+      url = "https://repo.continuum.io/miniconda/Miniconda3-${version}-Linux-x86_64.sh";
+      sha256 = "1rklq81s9v7xz1q0ha99w2sl6kyc5vhk6b21cza0jr3b8cgz0lam";
+  };
+
+  conda = runCommand "conda-install" { buildInputs = [ makeWrapper ]; }
+    ''
+      mkdir -p $out/bin
+      cp ${src} $out/bin/miniconda-installer.sh
+      chmod +x $out/bin/miniconda-installer.sh
+
+      makeWrapper                            \
+        $out/bin/miniconda-installer.sh      \
+        $out/bin/conda-install               \
+        --add-flags "-p ${installationPath}" \
+        --add-flags "-b"
+    '';
+in
+  buildFHSUserEnv {
+    name = "conda-shell";
+    targetPkgs = pkgs: (builtins.concatLists [ [ conda ] condaDeps extraPkgs]);
+    profile = ''
+      # Add conda to PATH
+      export PATH=${installationPath}/bin:$PATH
+      # Paths for gcc if compiling some C sources with pip
+      export NIX_CFLAGS_COMPILE="-I${installationPath}/include"
+      export NIX_CFLAGS_LINK="-L${installationPath}lib"
+      # Some other required environment variables
+      export FONTCONFIG_FILE=/etc/fonts/fonts.conf
+      export QTCOMPOSE=${xorg.libX11}/share/X11/locale
+    '';
+
+    meta = {
+      description = "Conda is a package manager for Python";
+      homepage = https://conda.io/;
+      platforms = lib.platforms.linux;
+      license = lib.licenses.bsd3;
+      maintainers = with lib.maintainers; [ jluttine bhipple ];
+    };
+  }
diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix
index 21b333f32316..f6e6988270ad 100644
--- a/pkgs/tools/package-management/nix/default.nix
+++ b/pkgs/tools/package-management/nix/default.nix
@@ -30,7 +30,7 @@ let
     buildInputs = [ curl openssl sqlite xz bzip2 ]
       ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
       ++ lib.optionals fromGit [ brotli ] # Since 1.12
-      ++ lib.optional stdenv.isLinux libseccomp
+      ++ lib.optional (stdenv.isLinux && !hostPlatform.isRiscV) libseccomp
       ++ lib.optional ((stdenv.isLinux || stdenv.isDarwin) && is20)
           (aws-sdk-cpp.override {
             apis = ["s3"];
@@ -55,7 +55,9 @@ let
       ]
       ++ lib.optional (
           hostPlatform != buildPlatform && hostPlatform ? nix && hostPlatform.nix ? system
-      ) ''--with-system=${hostPlatform.nix.system}'';
+      ) ''--with-system=${hostPlatform.nix.system}''
+         # RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50
+      ++ lib.optional hostPlatform.isRiscV "--disable-seccomp-sandboxing";
 
     makeFlags = "profiledir=$(out)/etc/profile.d";
 
@@ -124,12 +126,12 @@ in rec {
 
   nixUnstable = (lib.lowPrio (common rec {
     name = "nix-2.0${suffix}";
-    suffix = "pre5950_3a5a241b";
+    suffix = "pre5951_690ac7c9";
     src = fetchFromGitHub {
       owner = "NixOS";
       repo = "nix";
-      rev = "3a5a241b3209f14f8801b902ba20b5cb0666c9df";
-      sha256 = "0cwjyhgyfzi2dz561nj897zhkbyx6lzi49avcyia2pr4498jcl6k";
+      rev = "690ac7c90b5bf3c599e210c53365c7d229c8b0ff";
+      sha256 = "1yn2p38kp1i67makbawr1rhdiwihgnvk2zwrz0gvf6q65mj2k89c";
     };
     fromGit = true;
   })) // { perl-bindings = perl-bindings { nix = nixUnstable; }; };
diff --git a/pkgs/tools/text/catdocx/default.nix b/pkgs/tools/text/catdocx/default.nix
new file mode 100644
index 000000000000..adf9d17815b0
--- /dev/null
+++ b/pkgs/tools/text/catdocx/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, fetchFromGitHub, makeWrapper, unzip, catdoc }:
+
+stdenv.mkDerivation {
+  name = "catdocx-20170102";
+
+  src = fetchFromGitHub {
+    owner = "jncraton";
+    repo = "catdocx";
+    rev = "04fa0416ec1f116d4996685e219f0856d99767cb";
+    sha256 = "1sxiqhkvdqn300ygfgxdry2dj2cqzjhkzw13c6349gg5vxfypcjh";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/libexec $out/bin
+    cp catdocx.sh $out/libexec
+    chmod +x $out/libexec/catdocx.sh
+    wrapProgram $out/libexec/catdocx.sh --prefix PATH : "${lib.makeBinPath [ unzip catdoc ]}"
+    ln -s $out/libexec/catdocx.sh $out/bin/catdocx
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Extracts plain text from docx files";
+    homepage = https://github.com/jncraton/catdocx;
+    license = with licenses; [ bsd3 ];
+    maintainers = [ maintainers.michalrus ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d4ef900e1b4f..3b5f9d2ff486 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -931,6 +931,8 @@ with pkgs;
 
   catdoc = callPackage ../tools/text/catdoc { };
 
+  catdocx = callPackage ../tools/text/catdocx { };
+
   catclock = callPackage ../applications/misc/catclock { };
 
   cde = callPackage ../tools/package-management/cde { };
@@ -1368,6 +1370,8 @@ with pkgs;
 
   appdata-tools = callPackage ../tools/misc/appdata-tools { };
 
+  arping = callPackage ../tools/networking/arping { };
+
   asciidoc = callPackage ../tools/typesetting/asciidoc {
     inherit (python2Packages) matplotlib numpy aafigure recursivePthLoader;
     w3m = w3m-batch;
@@ -1677,6 +1681,8 @@ with pkgs;
 
   checkbashisms = callPackage ../development/tools/misc/checkbashisms { };
 
+  ckb = libsForQt5.callPackage ../tools/misc/ckb { };
+
   clamav = callPackage ../tools/security/clamav { };
 
   clex = callPackage ../tools/misc/clex { };
@@ -1699,10 +1705,10 @@ with pkgs;
 
   cloud-utils = callPackage ../tools/misc/cloud-utils { };
 
-  ckb = libsForQt5.callPackage ../tools/misc/ckb { };
-
   compass = callPackage ../development/tools/compass { };
 
+  conda = callPackage ../tools/package-management/conda { };
+
   convmv = callPackage ../tools/misc/convmv { };
 
   convoy = callPackage ../tools/filesystems/convoy { };
@@ -5872,7 +5878,7 @@ with pkgs;
         inherit noSysDirs;
         # PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
         profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
-        isl = if !stdenv.isDarwin then isl_0_14 else null;
+        isl = if !stdenv.isDarwin then isl_0_17 else null;
 
         # just for stage static
         crossStageStatic = true;
@@ -8745,6 +8751,9 @@ with pkgs;
   glibc = callPackage ../development/libraries/glibc {
     installLocales = config.glibc.locales or false;
   };
+  glibc_2_27 = callPackage ../development/libraries/glibc/2.27.nix {
+    installLocales = config.glibc.locales or false;
+  };
 
   glibc_memusage = callPackage ../development/libraries/glibc {
     installLocales = false;
@@ -8752,7 +8761,11 @@ with pkgs;
   };
 
   # Being redundant to avoid cycles on boot. TODO: find a better way
-  glibcCross = callPackage ../development/libraries/glibc {
+  glibcCross = let
+    expr = if hostPlatform.isRiscV
+             then ../development/libraries/glibc/2.27.nix
+           else ../development/libraries/glibc;
+  in callPackage expr {
     installLocales = config.glibc.locales or false;
     stdenv = crossLibcStdenv;
   };
@@ -12944,7 +12957,7 @@ with pkgs;
 
   inherit (callPackages ../os-specific/linux/kernel-headers { })
     linuxHeaders_4_4 linuxHeaders_4_15;
-  linuxHeaders = if hostPlatform.isMusl then linuxHeaders_4_15 else linuxHeaders_4_4;
+  linuxHeaders = if hostPlatform.isMusl || hostPlatform.isRiscV then linuxHeaders_4_15 else linuxHeaders_4_4;
 
   kernelPatches = callPackage ../os-specific/linux/kernel/patches.nix { };
 
@@ -16915,6 +16928,8 @@ with pkgs;
     inherit (darwin.stubs) rez setfile;
   };
 
+  qemu-riscv = callPackage ../applications/virtualization/qemu/riscv.nix {};
+
   qgis = callPackage ../applications/gis/qgis {};
 
   qgroundcontrol = libsForQt5.callPackage ../applications/science/robotics/qgroundcontrol { };
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index c44124c3ffff..1fffa3fa800b 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -375,6 +375,10 @@ let
       lwt = lwt3;
     };
 
+    lwt_ssl = callPackage ../development/ocaml-modules/lwt_ssl {
+      lwt = lwt3;
+    };
+
     macaque = callPackage ../development/ocaml-modules/macaque { };
 
     magic-mime = callPackage ../development/ocaml-modules/magic-mime { };
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 5608cd85ef26..0eebd578c3a3 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -10139,6 +10139,8 @@ in {
     };
   };
 
+  micawber = callPackage ../development/python-modules/micawber { };
+
   minimock = buildPythonPackage rec {
     version = "1.2.8";
     name = "minimock-${version}";
@@ -10372,24 +10374,8 @@ in {
     };
   };
 
-  moinmoin = buildPythonPackage (rec {
-    name = "moinmoin-${ver}";
-    disabled = isPy3k;
-    ver = "1.9.8";
-
-    src = pkgs.fetchurl {
-      url = "http://static.moinmo.in/files/moin-${ver}.tar.gz";
-      sha256 = "19hi16iy75lpx9ch799djc4hr4gai5rmvi542n29x6zhikysfjx7";
-    };
-
-    meta = {
-      description = "Advanced, easy to use and extensible WikiEngine";
-
-      homepage = http://moinmo.in/;
-
-      license = licenses.gpl2Plus;
-    };
-  });
+  # Needed here because moinmoin is loaded as a Python library.
+  moinmoin = callPackage ../development/python-modules/moinmoin { };
 
   moretools = callPackage ../development/python-modules/moretools { };
 
@@ -19960,18 +19946,7 @@ EOF
     propagatedBuildInputs = with self; [];
   };
 
-  pymacaroons-pynacl = buildPythonPackage rec {
-    name = "pymacaroons-pynacl-${version}";
-    version = "0.9.3";
-
-    src = pkgs.fetchgit {
-      url = "https://github.com/matrix-org/pymacaroons.git";
-      rev = "refs/tags/v${version}";
-      sha256 = "0bykjk01zdndp6gjr30x46blsn0cvxa7j0zh5g8raxwaawchjhii";
-    };
-
-    propagatedBuildInputs = with self; [ pynacl six ];
-  };
+  pymacaroons-pynacl = callPackage ../development/python-modules/pymacaroons-pynacl { };
 
   pynacl = callPackage ../development/python-modules/pynacl { };