about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/bs-platform/build-bs-platform.nix5
-rw-r--r--pkgs/development/compilers/computecpp/default.nix52
-rw-r--r--pkgs/development/compilers/crystal/default.nix50
-rw-r--r--pkgs/development/compilers/cudatoolkit/default.nix8
-rw-r--r--pkgs/development/compilers/dale/default.nix12
-rw-r--r--pkgs/development/compilers/dale/link-llvm.patch10
-rw-r--r--pkgs/development/compilers/dotnet/buildDotnet.nix67
-rw-r--r--pkgs/development/compilers/dotnet/combinePackages.nix20
-rw-r--r--pkgs/development/compilers/dotnet/default.nix68
-rw-r--r--pkgs/development/compilers/dotnet/sdk/default.nix54
-rw-r--r--pkgs/development/compilers/gavrasm/default.nix39
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix8
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix328
-rw-r--r--pkgs/development/compilers/ghc/8.2.2-binary.nix4
-rw-r--r--pkgs/development/compilers/ghc/8.6.3-binary.nix3
-rw-r--r--pkgs/development/compilers/ghc/8.8.2.nix6
-rw-r--r--pkgs/development/compilers/graalvm/enterprise-edition.nix296
-rw-r--r--pkgs/development/compilers/halide/default.nix2
-rw-r--r--pkgs/development/compilers/iasl/default.nix4
-rw-r--r--pkgs/development/compilers/jetbrains-jdk/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/3.5/clang-purity.patch22
-rw-r--r--pkgs/development/compilers/llvm/3.5/clang-separate-build.patch8
-rw-r--r--pkgs/development/compilers/llvm/3.5/clang.nix59
-rw-r--r--pkgs/development/compilers/llvm/3.5/default.nix43
-rw-r--r--pkgs/development/compilers/llvm/3.5/dragonegg.nix27
-rw-r--r--pkgs/development/compilers/llvm/3.5/fix-15974.patch15
-rw-r--r--pkgs/development/compilers/llvm/3.5/libc++/darwin.patch30
-rw-r--r--pkgs/development/compilers/llvm/3.5/libc++/default.nix54
-rw-r--r--pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh6
-rw-r--r--pkgs/development/compilers/llvm/3.5/libc++/xlocale-glibc-2.26.patch17
-rw-r--r--pkgs/development/compilers/llvm/3.5/libc++abi/default.nix60
-rw-r--r--pkgs/development/compilers/llvm/3.5/lld.nix30
-rw-r--r--pkgs/development/compilers/llvm/3.5/lldb.nix45
-rw-r--r--pkgs/development/compilers/llvm/3.5/llvm-separate-build.patch12
-rw-r--r--pkgs/development/compilers/llvm/3.5/llvm.nix97
-rw-r--r--pkgs/development/compilers/llvm/3.5/polly-separate-build.patch12
-rw-r--r--pkgs/development/compilers/llvm/3.5/polly.nix26
-rw-r--r--pkgs/development/compilers/llvm/3.9/clang/0001-Fix-compilation-w-gcc9.patch63
-rw-r--r--pkgs/development/compilers/llvm/3.9/clang/default.nix85
-rw-r--r--pkgs/development/compilers/llvm/3.9/clang/purity.patch16
-rw-r--r--pkgs/development/compilers/llvm/3.9/default.nix59
-rw-r--r--pkgs/development/compilers/llvm/3.9/libc++/darwin.patch39
-rw-r--r--pkgs/development/compilers/llvm/3.9/libc++/default.nix52
-rw-r--r--pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh6
-rw-r--r--pkgs/development/compilers/llvm/3.9/libc++/xlocale-glibc-2.26.patch19
-rw-r--r--pkgs/development/compilers/llvm/3.9/libc++abi.nix52
-rw-r--r--pkgs/development/compilers/llvm/3.9/lldb.nix57
-rw-r--r--pkgs/development/compilers/llvm/3.9/llvm-outputs.patch26
-rw-r--r--pkgs/development/compilers/llvm/3.9/llvm.nix174
-rw-r--r--pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch59
-rw-r--r--pkgs/development/compilers/llvm/4/clang/default.nix116
-rw-r--r--pkgs/development/compilers/llvm/4/clang/purity.patch16
-rw-r--r--pkgs/development/compilers/llvm/4/cmdline-help.patch39
-rw-r--r--pkgs/development/compilers/llvm/4/default.nix74
-rw-r--r--pkgs/development/compilers/llvm/4/fix-gcc9.patch33
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/default.nix59
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch41
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/setup-hook.sh6
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch19
-rw-r--r--pkgs/development/compilers/llvm/4/libc++abi.nix52
-rw-r--r--pkgs/development/compilers/llvm/4/lld.nix33
-rw-r--r--pkgs/development/compilers/llvm/4/lldb-libedit.patch30
-rw-r--r--pkgs/development/compilers/llvm/4/lldb.nix63
-rw-r--r--pkgs/development/compilers/llvm/4/llvm-outputs.patch26
-rw-r--r--pkgs/development/compilers/llvm/4/llvm.nix194
-rw-r--r--pkgs/development/compilers/llvm/4/openmp.nix26
-rw-r--r--pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch368
-rw-r--r--pkgs/development/compilers/llvm/5/clang/default.nix6
-rw-r--r--pkgs/development/compilers/llvm/5/compiler-rt.nix4
-rw-r--r--pkgs/development/compilers/llvm/5/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/5/libc++/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/5/lldb.nix4
-rw-r--r--pkgs/development/compilers/llvm/5/llvm.nix8
-rw-r--r--pkgs/development/compilers/llvm/6/clang/default.nix6
-rw-r--r--pkgs/development/compilers/llvm/6/compiler-rt.nix4
-rw-r--r--pkgs/development/compilers/llvm/6/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/6/libc++/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/6/lldb.nix4
-rw-r--r--pkgs/development/compilers/llvm/6/llvm.nix8
-rw-r--r--pkgs/development/compilers/llvm/7/clang/default.nix6
-rw-r--r--pkgs/development/compilers/llvm/7/compiler-rt.nix4
-rw-r--r--pkgs/development/compilers/llvm/7/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/7/libc++/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/7/lldb.nix4
-rw-r--r--pkgs/development/compilers/llvm/7/llvm.nix8
-rw-r--r--pkgs/development/compilers/llvm/8/clang/default.nix6
-rw-r--r--pkgs/development/compilers/llvm/8/compiler-rt.nix4
-rw-r--r--pkgs/development/compilers/llvm/8/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/8/libc++/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/8/lldb.nix4
-rw-r--r--pkgs/development/compilers/llvm/8/llvm.nix8
-rw-r--r--pkgs/development/compilers/llvm/9/clang/default.nix6
-rw-r--r--pkgs/development/compilers/llvm/9/compiler-rt.nix4
-rw-r--r--pkgs/development/compilers/llvm/9/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/9/libc++/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/9/lldb.nix4
-rw-r--r--pkgs/development/compilers/llvm/9/llvm.nix8
-rw-r--r--pkgs/development/compilers/llvm/dynamiclibrary-musl.patch33
-rw-r--r--pkgs/development/compilers/llvm/fix-llvm-config.patch13
-rw-r--r--pkgs/development/compilers/llvm/libcxx-max_align_t.patch54
-rw-r--r--pkgs/development/compilers/mlton/20130715.nix2
-rw-r--r--pkgs/development/compilers/mozart/default.nix10
-rw-r--r--pkgs/development/compilers/nim/default.nix4
-rw-r--r--pkgs/development/compilers/ocaml/4.10.nix6
-rw-r--r--pkgs/development/compilers/openjdk/11.nix4
-rw-r--r--pkgs/development/compilers/picat/default.nix15
-rw-r--r--pkgs/development/compilers/purescript/psc-package/default.nix4
-rw-r--r--pkgs/development/compilers/purescript/purescript/default.nix8
-rw-r--r--pkgs/development/compilers/rust/1_38_0.nix1
-rw-r--r--pkgs/development/compilers/rust/default.nix2
-rw-r--r--pkgs/development/compilers/rust/rustc.nix13
-rw-r--r--pkgs/development/compilers/sbcl/default.nix4
-rw-r--r--pkgs/development/compilers/scala/2.11.nix5
-rw-r--r--pkgs/development/compilers/scala/2.12.nix1
-rw-r--r--pkgs/development/compilers/scala/2.13.nix1
-rw-r--r--pkgs/development/compilers/solc/default.nix2
-rw-r--r--pkgs/development/compilers/souffle/default.nix2
-rw-r--r--pkgs/development/compilers/swift/default.nix160
-rw-r--r--pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch16
-rw-r--r--pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch20
-rw-r--r--pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patch10
-rw-r--r--pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch16
-rw-r--r--pkgs/development/compilers/swift/patches/glibc-arch-headers.patch2
-rw-r--r--pkgs/development/compilers/swift/patches/libdispatch-fortify-fix.patch13
-rw-r--r--pkgs/development/compilers/swift/patches/llvm-include-dirs.patch13
-rw-r--r--pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch24
-rw-r--r--pkgs/development/compilers/swift/purity.patch16
-rw-r--r--pkgs/development/compilers/tinygo/default.nix4
-rw-r--r--pkgs/development/compilers/unison/default.nix6
129 files changed, 766 insertions, 3409 deletions
diff --git a/pkgs/development/compilers/bs-platform/build-bs-platform.nix b/pkgs/development/compilers/bs-platform/build-bs-platform.nix
index 03e01a7a0da5..830a0b647c42 100644
--- a/pkgs/development/compilers/bs-platform/build-bs-platform.nix
+++ b/pkgs/development/compilers/bs-platform/build-bs-platform.nix
@@ -35,11 +35,12 @@ stdenv.mkDerivation {
   '';
 
   buildPhase = ''
-    node scripts/ninja.js build
+    # This is an unfortunate name, but it's actually how to build a release
+    # binary for BuckleScript
+    node scripts/install.js
   '';
 
   installPhase = ''
-    node scripts/install.js
     mkdir -p $out/bin
     cp -rf jscomp lib vendor odoc_gen native $out
     cp bsconfig.json package.json $out
diff --git a/pkgs/development/compilers/computecpp/default.nix b/pkgs/development/compilers/computecpp/default.nix
new file mode 100644
index 000000000000..65cfcaa7ff63
--- /dev/null
+++ b/pkgs/development/compilers/computecpp/default.nix
@@ -0,0 +1,52 @@
+{ stdenv
+, fetchzip
+, pkg-config
+, autoPatchelfHook
+, installShellFiles
+, ncurses5
+, ocl-icd
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "computecpp";
+  version = "1.2.0";
+
+  src = fetchzip {
+    url = "https://computecpp.codeplay.com/downloads/computecpp-ce/${version}/ubuntu-16.04-64bit.tar.gz";
+    sha256 = "191kwvzxfg1sbaq6aw6f84chi7bhsibb2a63zsyz3gz8m0c0syr5";
+    stripRoot = true;
+  };
+
+  dontStrip = true;
+
+  buildInputs = [ stdenv.cc.cc.lib ncurses5 ocl-icd zlib ];
+  nativeBuildInputs = [ autoPatchelfHook pkg-config installShellFiles ];
+
+  installPhase = ''
+    runHook preInstall
+
+    find ./lib -type f -exec install -D -m 0755 {} -t $out/lib \;
+    find ./bin -type l -exec install -D -m 0755 {} -t $out/bin \;
+    find ./bin -type f -exec install -D -m 0755 {} -t $out/bin \;
+    find ./doc -type f -exec install -D -m 0644 {} -t $out/doc \;
+    find ./include -type f -exec install -D -m 0644 {} -t $out/include \;
+
+    runHook postInstall
+  '';
+
+  passthru = {
+    isClang = true;
+  } // stdenv.lib.optionalAttrs (stdenv.targetPlatform.isLinux || (stdenv.cc.isGNU && stdenv.cc.cc ? gcc)) {
+    gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
+  };
+
+  meta = with stdenv.lib; {
+    description =
+      "Accelerate Complex C++ Applications on Heterogeneous Compute Systems using Open Standards";
+    homepage = https://www.codeplay.com/products/computesuite/computecpp;
+    license = licenses.unfree;
+    maintainers = with maintainers; [ davidtwco ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix
index 03a914695a06..124643443482 100644
--- a/pkgs/development/compilers/crystal/default.nix
+++ b/pkgs/development/compilers/crystal/default.nix
@@ -58,16 +58,17 @@ let
 
     outputs = [ "out" "lib" "bin" ];
 
-    # we are almost able to run the full test suite now
     postPatch = ''
       substituteInPlace src/crystal/system/unix/time.cr \
         --replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo
 
       ln -s spec/compiler spec/std
 
+      mkdir /tmp/crystal
       substituteInPlace spec/std/file_spec.cr \
         --replace '/bin/ls' '${coreutils}/bin/ls' \
-        --replace '/usr/share' '/tmp/test'
+        --replace '/usr/share' '/tmp/crystal' \
+        --replace '/usr' '/tmp'
 
       substituteInPlace spec/std/process_spec.cr \
         --replace '/bin/cat' '${coreutils}/bin/cat' \
@@ -76,8 +77,23 @@ let
         --replace '"env"' '"${coreutils}/bin/env"' \
         --replace '"/usr"' '"/tmp"'
 
+      substituteInPlace spec/std/socket/tcp_server_spec.cr \
+        --replace '{% if flag?(:gnu) %}"listen: "{% else %}"bind: "{% end %}' '"bind: "'
+
       substituteInPlace spec/std/system_spec.cr \
         --replace '`hostname`' '`${nettools}/bin/hostname`'
+
+      # See https://github.com/crystal-lang/crystal/pull/8640
+      substituteInPlace spec/std/http/cookie_spec.cr \
+        --replace '01 Jan 2020' '01 Jan #{Time.utc.year + 2}'
+
+      # See https://github.com/crystal-lang/crystal/issues/8629
+      substituteInPlace spec/std/socket/udp_socket_spec.cr \
+        --replace 'it "joins and transmits to multicast groups"' 'pending "joins and transmits to multicast groups"'
+
+      # See https://github.com/crystal-lang/crystal/pull/8699
+      substituteInPlace spec/std/xml/xml_spec.cr \
+        --replace 'it "handles errors"' 'pending "handles errors"'
     '';
 
     buildInputs = commonBuildInputs extraBuildInputs;
@@ -189,6 +205,24 @@ in rec {
     };
   };
 
+  binaryCrystal_0_30 = genericBinary {
+    version = "0.30.1";
+    sha256s = {
+      x86_64-linux  = "1k2mb74jh3ns3m7y73j4wpf571sayn73zbn6d7q81d09r280zrma";
+      i686-linux    = "0vsq1ayf922spydp2g2mmimc797jmm7nl5nljhfppcclrwygdyk2";
+      x86_64-darwin = "1p3s4lwdgykb7h7aysjhrs7vm0zhinzw5d7rfv6jsyin4j8yxhzz";
+    };
+  };
+
+  binaryCrystal_0_31 = genericBinary {
+    version = "0.31.1";
+    sha256s = {
+      x86_64-linux  = "0r8salf572xrnr4m6ll9q5hz6jj8q7ff1rljlhmqb1r26a8mi2ih";
+      i686-linux    = "0hridnis5vvrswflx0q67xfg5hryhz6ivlwrb9n4pryj5d1gwjrr";
+      x86_64-darwin = "1dgxgv0s3swkc5cwawzgpbc6bcd2nx4hjxc7iw2h907y1vgmbipz";
+    };
+  };
+
   crystal_0_25 = generic {
     version = "0.25.1";
     sha256  = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl";
@@ -228,18 +262,16 @@ in rec {
     version = "0.31.1";
     sha256  = "1dswxa32w16gnc6yjym12xj7ibg0g6zk3ngvl76lwdjqb1h6lwz8";
     doCheck = false; # 5 checks are failing now
-    binary = crystal_0_30;
+    binary = binaryCrystal_0_30;
   };
 
   crystal_0_32 = generic {
-    version = "255bfc5fa925b95b72e34b26ad997fb2b3f83059";
-    sha256  = "1dgk36cj5lwhs1c4zp0s1c9hjk0h3vljq6zwhlnzkl1xs7cgzim1";
-    doCheck = false; # 5 checks are failing now
-    binary = crystal_0_31;
-    extraBuildInputs = [ readline ];
+    version = "0.32.1";
+    sha256  = "120ndi3nhh2r52hjvhwfb49cdggr1bzdq6b8xg7irzavhjinfza6";
+    binary = binaryCrystal_0_31;
   };
 
-  crystal = crystal_0_31;
+  crystal = crystal_0_32;
 
   crystal2nix = callPackage ./crystal2nix.nix {};
 }
diff --git a/pkgs/development/compilers/cudatoolkit/default.nix b/pkgs/development/compilers/cudatoolkit/default.nix
index 6531316fa12b..c3b16293204a 100644
--- a/pkgs/development/compilers/cudatoolkit/default.nix
+++ b/pkgs/development/compilers/cudatoolkit/default.nix
@@ -2,8 +2,6 @@
 , callPackage
 , fetchurl
 , gcc48
-, gcc49
-, gcc5
 , gcc6
 , gcc7
 }:
@@ -29,14 +27,14 @@ in rec {
     version = "7.0.28";
     url = "http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run";
     sha256 = "1km5hpiimx11jcazg0h3mjzk220klwahs2vfqhjavpds5ff2wafi";
-    gcc = gcc49;
+    gcc = gcc6;
   };
 
   cudatoolkit_7_5 = common {
     version = "7.5.18";
     url = "http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run";
     sha256 = "1v2ylzp34ijyhcxyh5p6i0cwawwbbdhni2l5l4qm21s1cx9ish88";
-    gcc = gcc49;
+    gcc = gcc6;
   };
 
   cudatoolkit_8 = common {
@@ -49,7 +47,7 @@ in rec {
         sha256 = "1iaz5rrsnsb1p99qiqvxn6j3ksc7ry8xlr397kqcjzxqbljbqn9d";
       })
     ];
-    gcc = gcc5;
+    gcc = gcc6;
   };
 
   cudatoolkit_9_0 = common {
diff --git a/pkgs/development/compilers/dale/default.nix b/pkgs/development/compilers/dale/default.nix
index 128c245d2773..9c70e96a9c09 100644
--- a/pkgs/development/compilers/dale/default.nix
+++ b/pkgs/development/compilers/dale/default.nix
@@ -3,12 +3,12 @@
 , cmake
 , pkgconfig
 , libffi
-, llvm_35
+, llvm_6
 , doCheck ? false
 , perl
 }:
 
-let version = "20170519";
+let version = "20181024";
 
 in stdenv.mkDerivation {
   pname = "dale";
@@ -17,16 +17,14 @@ in stdenv.mkDerivation {
   src = fetchFromGitHub {
     owner = "tomhrr";
     repo = "dale";
-    rev = "39e16d8e89fa070de65a673d4462e783d530f95a";
-    sha256 = "0dc5cjahv7lzlp92hidlh83rwgrpgb6xz2pnba2pm5xrv2pnsskl";
+    rev = "f5db8b486f4e7c423fc25941a8315f1209bc0e54";
+    sha256 = "0v4ajrzrqvf279kd7wsd9flrpsav57lzxlwwimk9vnfwh7xpzf9v";
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ cmake libffi llvm_35 ]
+  buildInputs = [ cmake libffi llvm_6 ]
              ++ stdenv.lib.optional doCheck perl;
 
-  patches = [ ./link-llvm.patch ];
-
   inherit doCheck;
 
   checkTarget = "tests";
diff --git a/pkgs/development/compilers/dale/link-llvm.patch b/pkgs/development/compilers/dale/link-llvm.patch
deleted file mode 100644
index 3facec91874f..000000000000
--- a/pkgs/development/compilers/dale/link-llvm.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- dale-39e16d8e89fa070de65a673d4462e783d530f95a-src.org/CMakeLists.txt	2017-06-22 08:01:05.839531242 +0100
-+++ dale-39e16d8e89fa070de65a673d4462e783d530f95a-src/CMakeLists.txt	2017-06-22 07:59:11.777566801 +0100
-@@ -78,6 +78,7 @@
- execute_process (COMMAND ${LLVM_CONFIG} --libs
-                  OUTPUT_VARIABLE LLVM_LIBS
-                  OUTPUT_STRIP_TRAILING_WHITESPACE)
-+STRING(REGEX REPLACE " " ";" LLVM_LIBS "${LLVM_LIBS}")
- if (${D_LLVM_VERSION_MINOR} GREATER 4)
-     execute_process (COMMAND ${LLVM_CONFIG} --system-libs
-                      OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
diff --git a/pkgs/development/compilers/dotnet/buildDotnet.nix b/pkgs/development/compilers/dotnet/buildDotnet.nix
new file mode 100644
index 000000000000..58e67ff008ae
--- /dev/null
+++ b/pkgs/development/compilers/dotnet/buildDotnet.nix
@@ -0,0 +1,67 @@
+{ type
+, version
+, sha512
+}:
+assert builtins.elem type [ "aspnetcore" "netcore" "sdk"];
+{ stdenv
+, fetchurl
+, libunwind
+, openssl
+, icu
+, libuuid
+, zlib
+, curl
+}: 
+let pname = if type == "aspnetcore" then "aspnetcore-runtime" else if type == "netcore" then "dotnet-runtime" else "dotnet-sdk";
+    urls = {
+        aspnetcore = "https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/${version}/${pname}-${version}-linux-x64.tar.gz";
+        netcore = "https://dotnetcli.azureedge.net/dotnet/Runtime/${version}/${pname}-${version}-linux-x64.tar.gz";
+        sdk = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-linux-x64.tar.gz";
+    };
+    descriptions = {
+        aspnetcore = "ASP .NET Core runtime ${version}";
+        netcore = ".NET Core runtime ${version}";
+        sdk = ".NET SDK ${version}";
+    };
+in stdenv.mkDerivation rec {
+    inherit pname version;
+
+    rpath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc libunwind libuuid icu openssl zlib curl ];
+
+    src = fetchurl {
+        url = builtins.getAttr type urls;
+        inherit sha512;
+    };
+
+    sourceRoot = ".";
+
+    dontPatchELF = true;
+
+    installPhase = ''
+        runHook preInstall
+        mkdir -p $out/bin
+        cp -r ./ $out
+        ln -s $out/dotnet $out/bin/dotnet
+        runHook postInstall
+    '';
+
+    postFixup = ''
+        patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $out/dotnet
+        patchelf --set-rpath "${rpath}" $out/dotnet
+        find $out -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \;
+        find $out -type f -name "apphost" -exec patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" --set-rpath '$ORIGIN:${rpath}' {} \;
+    '';
+
+    doInstallCheck = true;
+    installCheckPhase = ''
+        $out/bin/dotnet --info
+    '';
+
+    meta = with stdenv.lib; {
+        homepage = https://dotnet.github.io/;
+        description = builtins.getAttr type descriptions;
+        platforms = [ "x86_64-linux" ];
+        maintainers = with maintainers; [ kuznero ];
+        license = licenses.mit;
+    };
+}
diff --git a/pkgs/development/compilers/dotnet/combinePackages.nix b/pkgs/development/compilers/dotnet/combinePackages.nix
new file mode 100644
index 000000000000..00fb7c6d9b41
--- /dev/null
+++ b/pkgs/development/compilers/dotnet/combinePackages.nix
@@ -0,0 +1,20 @@
+packages:
+{ buildEnv, lib }:
+let cli = builtins.head packages;
+in
+assert lib.assertMsg ((builtins.length packages) != 0)
+    ''You must include at least one package, e.g
+      `with dotnetCorePackages; combinePackages {
+          packages = [ sdk_3_0 aspnetcore_2_1 ];
+       };`'' ;
+  buildEnv {
+    name = "dotnet-core-combined";
+    paths = packages;
+    pathsToLink = [ "/host" "/packs" "/sdk" "/shared" "/templates" ];
+    ignoreCollisions = true;
+    postBuild = ''
+      cp ${cli}/dotnet $out/dotnet
+      mkdir $out/bin
+      ln -s $out/dotnet $out/bin/
+    '';
+  }
diff --git a/pkgs/development/compilers/dotnet/default.nix b/pkgs/development/compilers/dotnet/default.nix
new file mode 100644
index 000000000000..58d49a505156
--- /dev/null
+++ b/pkgs/development/compilers/dotnet/default.nix
@@ -0,0 +1,68 @@
+/*
+How to combine packages for use in development:
+dotnetCombined = with dotnetCorePackages; combinePackages [ sdk_3_1 sdk_2_2 sdk_3_0 sdk aspnetcore_2_1 ];
+*/
+{ callPackage }:
+let
+  buildDotnet = attrs: callPackage (import ./buildDotnet.nix attrs) {};
+  buildAspNetCore = attrs: buildDotnet (attrs // { type = "aspnetcore"; } );
+  buildNetCore = attrs: buildDotnet (attrs // { type = "netcore"; } );
+  buildNetCoreSdk = attrs: buildDotnet (attrs // { type = "sdk"; } );
+in rec {
+  combinePackages = attrs: callPackage (import ./combinePackages.nix attrs) {};
+
+  # v2.1.15 (LTS)
+
+  aspnetcore_2_1 = buildAspNetCore {
+    version = "2.1.15";
+    sha512 = "a557f175cca92bb1dd66cf638ff84fe85750fab67028bd4472748b22ef0591f5f3812446a3dbe21c3d1be28c47d459d854d690dbace1b95bc7136b248af87334";
+  };
+
+  netcore_2_1 = buildNetCore {
+    version = "2.1.15";
+    sha512 = "cfd7f7caea7e896dd4d68a05c827c86f38595f24e854edb3f934715ee1268e2623f17ff768215e465fe596cd474497384be2b1381f04ddd6d555665a341f65f6";
+  };
+
+  sdk_2_1 = buildNetCoreSdk {
+    version = "2.1.803";
+    sha512 = "57d48d6ca1bd92ac348dc05220d984811c0cf005774d7afdfbbf125a842acb0a26572146ed25a7eb26f4e0404fe840b70d1e7ec1fb7c9a5c6cfe81fefc41b363";
+  };
+
+  # v2.2
+
+  sdk_2_2 = throw "Dotnet SDK 2.2 is EOL, please use 3.1";
+
+  # v3.0.2 (Maintenance)
+
+  aspnetcore_3_0 = buildAspNetCore {
+    version = "3.0.2";
+    sha512 = "84dcc2a2a9e43afbc166771153d85b19cb09f964c85c787d77b362fd1d9e076345ae153305fa9040999846a56b69041eb89282804587478b926179d2613d259d";
+  };
+
+  netcore_3_0 = buildNetCore {
+    version = "3.0.2";
+    sha512 = "c8f0e4eb220fa896c4a803a8d9d0c704ae7b8383801a977036f3089b1d779159f5a2d9293dc11ff5f4f6c76febc6f70f6cfcdff0debd3243cad5eb635f853d45";
+  };
+
+  sdk_3_0 = buildNetCoreSdk {
+    version = "3.0.102";
+    sha512 = "77bc287d9c20630976ac4c0736192ba4899154c9e7cc5b87bc9d94d5d8abafdd832cfe8f385b6ba584c702d9261566109df15ab46b0d62bd218d950d3b47893e";
+  };
+
+  # v3.1.1 (LTS)
+
+  aspnetcore_3_1 = buildAspNetCore {
+    version = "3.1.1";
+    sha512 = "cc27828cacbc783ef83cc1378078e14ac558aec30726b36c4f154fad0d08ff011e7e1dfc17bc851926ea3b0da9c7d71496af14ee13184bdf503856eca30a89ae";
+  };
+
+  netcore_3_1 = buildNetCore {
+    version = "3.1.1";
+    sha512 = "991a89ac7b52d3bf6c00359ce94c5a3f7488cd3d9e4663ba0575e1a5d8214c5fcc459e2cb923c369c2cdb789a96f0b1dfb5c5aae1a04df6e7f1f365122072611";
+  };
+
+  sdk_3_1 = buildNetCoreSdk {
+    version = "3.1.101";
+    sha512 = "eeee75323be762c329176d5856ec2ecfd16f06607965614df006730ed648a5b5d12ac7fd1942fe37cfc97e3013e796ef278e7c7bc4f32b8680585c4884a8a6a1";
+  };
+}
diff --git a/pkgs/development/compilers/dotnet/sdk/default.nix b/pkgs/development/compilers/dotnet/sdk/default.nix
deleted file mode 100644
index 984ab39c91ad..000000000000
--- a/pkgs/development/compilers/dotnet/sdk/default.nix
+++ /dev/null
@@ -1,54 +0,0 @@
-{ stdenv
-, fetchurl
-, libunwind
-, openssl
-, icu
-, libuuid
-, zlib
-, curl
-}:
-
-let
-  rpath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc libunwind libuuid icu openssl zlib curl ];
-in
-  stdenv.mkDerivation rec {
-    version = "2.2.401";
-    netCoreVersion = "2.2.6";
-    pname = "dotnet-sdk";
-
-    src = fetchurl {
-      url = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-linux-x64.tar.gz";
-      # use sha512 from the download page
-      sha512 = "05w3zk7bcd8sv3k4kplf20j906and2006g1fggq7y6kaxrlhdnpd6jhy6idm8v5bz48wfxga5b4yys9qx0fp3p8yl7wi67qljpzrq88";
-    };
-
-    sourceRoot = ".";
-
-    buildPhase = ''
-      runHook preBuild
-      patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" ./dotnet
-      patchelf --set-rpath "${rpath}" ./dotnet
-      find -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \;
-      echo -n "dotnet-sdk version: "
-      ./dotnet --version
-      runHook postBuild
-    '';
-
-    dontPatchELF = true;
-
-    installPhase = ''
-      runHook preInstall
-      mkdir -p $out/bin
-      cp -r ./ $out
-      ln -s $out/dotnet $out/bin/dotnet
-      runHook postInstall
-    '';
-
-    meta = with stdenv.lib; {
-      homepage = https://dotnet.github.io/;
-      description = ".NET Core SDK ${version} with .NET Core ${netCoreVersion}";
-      platforms = [ "x86_64-linux" ];
-      maintainers = with maintainers; [ kuznero ];
-      license = licenses.mit;
-    };
-  }
diff --git a/pkgs/development/compilers/gavrasm/default.nix b/pkgs/development/compilers/gavrasm/default.nix
new file mode 100644
index 000000000000..92781d79cc7f
--- /dev/null
+++ b/pkgs/development/compilers/gavrasm/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchzip, fpc , lang ? "en" } :
+assert stdenv.lib.assertOneOf "lang" lang ["cn" "de" "en" "fr" "tr"];
+stdenv.mkDerivation rec {
+  pname = "gavrasm";
+  version = "4.5";
+
+  src = fetchzip {
+    url ="http://www.avr-asm-tutorial.net/gavrasm/v45/gavrasm_sources_lin_45.zip";
+    sha256 = "1f5g5ran74pznwj4g7vfqh2qhymaj3p26f2lvzbmlwq447iid52c";
+    stripRoot=false;
+  };
+
+  nativeBuildInputs = [ fpc ];
+
+  configurePhase = ''
+    cp gavrlang_${lang}.pas gavrlang.pas
+  '';
+
+  buildPhase = ''
+    fpc gavrasm.pas
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp gavrasm $out/bin
+    mkdir -p $out/doc
+    cp instr.asm $out/doc
+    cp ReadMe.Txt $out/doc
+    cp LiesMich.Txt $out/doc
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.avr-asm-tutorial.net/gavrasm;
+    description = "AVR Assembler for ATMEL AVR-Processors";
+    license = licenses.unfree;
+    maintainers = with maintainers; [ mafo ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 2f85fc4b7e8c..b287a8551f3c 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -61,7 +61,13 @@ let majorVersion = "4";
     inherit (stdenv) buildPlatform hostPlatform targetPlatform;
 
     patches =
-      [ ../use-source-date-epoch.patch ../parallel-bconfig.patch ./parallel-strsignal.patch ]
+      [ ../use-source-date-epoch.patch ../parallel-bconfig.patch ./parallel-strsignal.patch
+        (fetchpatch {
+          name = "avoid-ustat-glibc-2.28.patch";
+          url = "https://gitweb.gentoo.org/proj/gcc-patches.git/plain/4.9.4/gentoo/100_all_avoid-ustat-glibc-2.28.patch?id=55fcb515620a8f7d3bb77eba938aa0fcf0d67c96";
+          sha256 = "0b32sb4psv5lq0ij9fwhi1b4pjbwdjnv24nqprsk14dsc6xmi1g0";
+        })
+      ]
       ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
       ++ optional noSysDirs ../no-sys-dirs.patch
       ++ optional langFortran ../gfortran-driving.patch
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
deleted file mode 100644
index f68ddc81f81f..000000000000
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ /dev/null
@@ -1,328 +0,0 @@
-{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
-, langC ? true, langCC ? true, langFortran ? false
-, langObjC ? stdenv.targetPlatform.isDarwin
-, langObjCpp ? stdenv.targetPlatform.isDarwin
-, langJava ? false
-, langGo ? false
-, profiledCompiler ? false
-, staticCompiler ? false
-, enableShared ? true
-, enableLTO ? true
-, texinfo ? null
-, perl ? null # optional, for texi2pod (then pod2man); required for Java
-, gmp, mpfr, libmpc, gettext, which
-, libelf                      # optional, for link-time optimizations (LTO)
-, isl ? null # optional, for the Graphite optimization framework.
-, zlib ? null, boehmgc ? null
-, zip ? null, unzip ? null, pkgconfig ? null
-, gtk2 ? null, libart_lgpl ? null
-, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
-, libXrender ? null, xorgproto ? null
-, libXrandr ? null, libXi ? null
-, x11Support ? langJava
-, enableMultilib ? false
-, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
-, name ? "gcc"
-, libcCross ? null
-, threadsCross ? null # for MinGW
-, crossStageStatic ? false
-, # Strip kills static libs of other archs (hence no cross)
-  stripped ? stdenv.hostPlatform == stdenv.buildPlatform
-          && stdenv.targetPlatform == stdenv.hostPlatform
-, gnused ? null
-, cloog # unused; just for compat with gcc4, as we override the parameter on some places
-, buildPackages
-}:
-
-assert langJava     -> zip != null && unzip != null
-                       && zlib != null && boehmgc != null
-                       && perl != null;  # for `--enable-java-home'
-
-# LTO needs libelf and zlib.
-assert libelf != null -> zlib != null;
-
-# Make sure we get GNU sed.
-assert stdenv.hostPlatform.isDarwin -> gnused != null;
-
-# The go frontend is written in c++
-assert langGo -> langCC;
-
-# threadsCross is just for MinGW
-assert threadsCross != null -> stdenv.targetPlatform.isWindows;
-
-with stdenv.lib;
-with builtins;
-
-let majorVersion = "5";
-    version = "${majorVersion}.5.0";
-
-    inherit (stdenv) buildPlatform hostPlatform targetPlatform;
-
-    patches =
-      [ ../use-source-date-epoch.patch ]
-      ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
-      ++ optional noSysDirs ../no-sys-dirs.patch
-      ++ optional langFortran ../gfortran-driving.patch
-      ++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
-      ++ optional stdenv.hostPlatform.isMusl (fetchpatch {
-        url = https://raw.githubusercontent.com/richfelker/musl-cross-make/e84b1bd1fc12a3def33111ca6df522cd6e5ec361/patches/gcc-5.3.0/0001-musl.diff;
-        sha256 = "0pppbf8myi2kjhm3z3479ihn1cm60kycfv60gj8yy1bs0pl1qcfm";
-      })
-      ++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
-        url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
-        sha256 = "074bl5n27d1ksa31pvzj4vd8xd46r118k0w94gdv3s1vydg7mah0";
-      });
-
-    javaEcj = fetchurl {
-      # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
-      # `configure' time.
-
-      # XXX: Eventually we might want to take it from upstream.
-      url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
-      sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
-    };
-
-    # Antlr (optional) allows the Java `gjdoc' tool to be built.  We want a
-    # binary distribution here to allow the whole chain to be bootstrapped.
-    javaAntlr = fetchurl {
-      url = https://www.antlr.org/download/antlr-4.4-complete.jar;
-      sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
-    };
-
-    xlibs = [
-      libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
-      xorgproto
-    ];
-
-    javaAwtGtk = langJava && x11Support;
-
-    /* Cross-gcc settings (build == host != target) */
-    crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
-    stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
-    crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
-
-in
-
-# We need all these X libraries when building AWT with GTK.
-assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
-
-stdenv.mkDerivation ({
-  pname = "${crossNameAddon}${name}${if stripped then "" else "-debug"}";
-  inherit version;
-
-  builder = ../builder.sh;
-
-  src = fetchurl {
-    url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
-    sha256 = "11zd1hgzkli3b2v70qsm2hyqppngd4616qc96lmm9zl2kl9yl32k";
-  };
-
-  inherit patches;
-
-  outputs = [ "out" "lib" "man" "info" ];
-  setOutputFlags = false;
-  NIX_NO_SELF_RPATH = true;
-
-  libc_dev = stdenv.cc.libc_dev;
-
-  hardeningDisable = [ "format" "pie" ];
-
-  # This should kill all the stdinc frameworks that gcc and friends like to
-  # insert into default search paths.
-  prePatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
-    substituteInPlace gcc/config/darwin-c.c \
-      --replace 'if (stdinc)' 'if (0)'
-
-    substituteInPlace libgcc/config/t-slibgcc-darwin \
-      --replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)"
-
-    substituteInPlace libgfortran/configure \
-      --replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
-  '';
-
-  postPatch =
-    if targetPlatform != hostPlatform || stdenv.cc.libc != null then
-      # On NixOS, use the right path to the dynamic linker instead of
-      # `/lib/ld*.so'.
-      let
-        libc = if libcCross != null then libcCross else stdenv.cc.libc;
-      in
-        (
-        '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
-           for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
-           do
-             grep -q _DYNAMIC_LINKER "$header" || continue
-             echo "  fixing \`$header'..."
-             sed -i "$header" \
-                 -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
-                 -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
-           done
-        ''
-        + stdenv.lib.optionalString (targetPlatform.libc == "musl")
-        ''
-            sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
-        ''
-        )
-    else null;
-
-  inherit noSysDirs staticCompiler langJava crossStageStatic
-    libcCross crossMingw;
-
-  depsBuildBuild = [ buildPackages.stdenv.cc ];
-  nativeBuildInputs = [ texinfo which gettext ]
-    ++ (optional (perl != null) perl)
-    ++ (optional javaAwtGtk pkgconfig);
-
-  # For building runtime libs
-  depsBuildTarget =
-    if hostPlatform == buildPlatform then [
-      targetPackages.stdenv.cc.bintools # newly-built gcc will be used
-    ] else assert targetPlatform == hostPlatform; [ # build != host == target
-      stdenv.cc
-    ];
-
-  buildInputs = [
-    gmp mpfr libmpc libelf
-    targetPackages.stdenv.cc.bintools # For linking code at run-time
-  ] ++ (optional (isl != null) isl)
-    ++ (optional (zlib != null) zlib)
-    ++ (optionals langJava [ boehmgc zip unzip ])
-    ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
-
-    # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
-    # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
-    ++ (optional hostPlatform.isDarwin gnused)
-    ;
-
-  depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
-
-  NIX_LDFLAGS = stdenv.lib.optionalString  hostPlatform.isSunOS "-lm -ldl";
-
-  preConfigure = import ../common/pre-configure.nix {
-    inherit (stdenv) lib;
-    inherit version hostPlatform langJava langGo;
-  };
-
-  dontDisableStatic = true;
-
-  # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
-
-  configureFlags = import ../common/configure-flags.nix {
-    inherit
-      stdenv
-      targetPackages
-      crossStageStatic libcCross
-      version
-
-      gmp mpfr libmpc libelf isl
-
-      enableLTO
-      enableMultilib
-      enablePlugin
-      enableShared
-
-      langC
-      langCC
-      langFortran
-      langJava javaAwtGtk javaAntlr javaEcj
-      langGo
-      langObjC
-      langObjCpp
-      ;
-  };
-
-  targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
-
-  buildFlags = optional
-    (targetPlatform == hostPlatform && hostPlatform == buildPlatform)
-    (if profiledCompiler then "profiledbootstrap" else "bootstrap");
-
-  dontStrip = !stripped;
-
-  doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
-
-  installTargets = optional stripped "install-strip";
-
-  # https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
-
-  # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
-  # library headers and binaries, regarless of the language being compiled.
-  #
-  # Note: When building the Java AWT GTK peer, the build system doesn't honor
-  # `--with-gmp' et al., e.g., when building
-  # `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
-  # them to $CPATH and $LIBRARY_PATH in this case.
-  #
-  # Likewise, the LTO code doesn't find zlib.
-  #
-  # Cross-compiling, we need gcc not to read ./specs in order to build the g++
-  # compiler (after the specs for the cross-gcc are created). Having
-  # LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
-
-  CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
-    ++ optional (zlib != null) zlib
-    ++ optional langJava boehmgc
-    ++ optionals javaAwtGtk xlibs
-    ++ optionals javaAwtGtk [ gmp mpfr ]
-  ));
-
-  LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
-    ++ optional (zlib != null) zlib
-    ++ optional langJava boehmgc
-    ++ optionals javaAwtGtk xlibs
-    ++ optionals javaAwtGtk [ gmp mpfr ]
-  ));
-
-  inherit
-    (import ../common/extra-target-flags.nix {
-      inherit stdenv crossStageStatic libcCross threadsCross;
-    })
-    EXTRA_TARGET_FLAGS
-    EXTRA_TARGET_LDFLAGS
-    ;
-
-  passthru = {
-    inherit langC langCC langObjC langObjCpp langFortran langGo version;
-    isGNU = true;
-  };
-
-  enableParallelBuilding = true;
-  inherit enableMultilib;
-
-  inherit (stdenv) is64bit;
-
-  meta = {
-    homepage = https://gcc.gnu.org/;
-    license = stdenv.lib.licenses.gpl3Plus;  # runtime support libraries are typically LGPLv3+
-    description = "GNU Compiler Collection, version ${version}"
-      + (if stripped then "" else " (with debugging info)");
-
-    longDescription = ''
-      The GNU Compiler Collection includes compiler front ends for C, C++,
-      Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well
-      as libraries for these languages (libstdc++, libgcj, libgomp,...).
-
-      GCC development is a part of the GNU Project, aiming to improve the
-      compiler used in the GNU system including the GNU/Linux variant.
-    '';
-
-    maintainers = with stdenv.lib.maintainers; [ peti ];
-
-    platforms =
-      stdenv.lib.platforms.linux ++
-      stdenv.lib.platforms.freebsd ++
-      stdenv.lib.platforms.illumos ++
-      stdenv.lib.platforms.darwin;
-    badPlatforms = [ "x86_64-darwin" ];
-  };
-}
-
-// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
-  makeFlags = [ "all-gcc" "all-target-libgcc" ];
-  installTargets = "install-gcc install-target-libgcc";
-}
-
-// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
-)
diff --git a/pkgs/development/compilers/ghc/8.2.2-binary.nix b/pkgs/development/compilers/ghc/8.2.2-binary.nix
index d68bf7e24b5e..1f24b9a1ff24 100644
--- a/pkgs/development/compilers/ghc/8.2.2-binary.nix
+++ b/pkgs/development/compilers/ghc/8.2.2-binary.nix
@@ -1,5 +1,5 @@
 { stdenv, substituteAll
-, fetchurl, perl, gcc, llvm_39
+, fetchurl, perl, gcc, llvm
 , ncurses5, gmp, glibc, libiconv
 }:
 
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     or (throw "cannot bootstrap GHC on this platform"));
 
   nativeBuildInputs = [ perl ];
-  buildInputs = stdenv.lib.optionals (stdenv.targetPlatform.isAarch32 || stdenv.targetPlatform.isAarch64) [ llvm_39 ];
+  buildInputs = stdenv.lib.optionals (stdenv.targetPlatform.isAarch32 || stdenv.targetPlatform.isAarch64) [ llvm ];
 
   # Cannot patchelf beforehand due to relative RPATHs that anticipate
   # the final install location/
diff --git a/pkgs/development/compilers/ghc/8.6.3-binary.nix b/pkgs/development/compilers/ghc/8.6.3-binary.nix
index 152bd5e4874c..fe576186b0e5 100644
--- a/pkgs/development/compilers/ghc/8.6.3-binary.nix
+++ b/pkgs/development/compilers/ghc/8.6.3-binary.nix
@@ -1,5 +1,5 @@
 { stdenv
-, fetchurl, perl, gcc, llvm_39
+, fetchurl, perl, gcc
 , ncurses5, gmp, glibc, libiconv
 }:
 
@@ -45,7 +45,6 @@ stdenv.mkDerivation rec {
     or (throw "cannot bootstrap GHC on this platform"));
 
   nativeBuildInputs = [ perl ];
-  buildInputs = stdenv.lib.optionals (stdenv.targetPlatform.isAarch32 || stdenv.targetPlatform.isAarch64) [ llvm_39 ];
 
   # Cannot patchelf beforehand due to relative RPATHs that anticipate
   # the final install location/
diff --git a/pkgs/development/compilers/ghc/8.8.2.nix b/pkgs/development/compilers/ghc/8.8.2.nix
index 4ed99a8402aa..b0eef9ef924d 100644
--- a/pkgs/development/compilers/ghc/8.8.2.nix
+++ b/pkgs/development/compilers/ghc/8.8.2.nix
@@ -86,12 +86,12 @@ let
 
 in
 stdenv.mkDerivation (rec {
-  version = "8.8.1.20191211";
+  version = "8.8.2";
   name = "${targetPrefix}ghc-${version}";
 
   src = fetchurl {
-    url = "https://downloads.haskell.org/ghc/8.8.2-rc1/ghc-${version}-src.tar.xz";
-    sha256 = "1gl4fzakjbhd94v1saxmr9sfzgk22m1b95jq51rxm93b2g4cixl4";
+    url = "https://downloads.haskell.org/ghc/8.8.2/ghc-${version}-src.tar.xz";
+    sha256 = "02qa6wgjpxgakg7hv4zfdlrx9k7zxa5i02wnr6y9fsv8j16sbkh1";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/compilers/graalvm/enterprise-edition.nix b/pkgs/development/compilers/graalvm/enterprise-edition.nix
index e180455cb7cd..c34c4695a236 100644
--- a/pkgs/development/compilers/graalvm/enterprise-edition.nix
+++ b/pkgs/development/compilers/graalvm/enterprise-edition.nix
@@ -1,133 +1,167 @@
-{ stdenv, requireFile, perl, unzip, glibc, zlib, gdk-pixbuf, xorg, glib, fontconfig, freetype, cairo, pango, gtk3, gtk2, ffmpeg, libGL, atk, alsaLib, libav_0_8, setJavaClassPath }:
+{ stdenv, requireFile, perl, unzip, glibc, zlib, bzip2, gdk-pixbuf, xorg, glib, fontconfig, freetype, cairo, pango, gtk3, gtk2, ffmpeg, libGL, atk, alsaLib, libav_0_8, setJavaClassPath }:
 
 let
-  graalvm8-ee = stdenv.mkDerivation rec {
-    pname = "graalvm8-ee";
-    version = "19.2.0";
-    srcs = [
-      (requireFile {
-         name   = "graalvm-ee-linux-amd64-${version}.tar.gz";
-         sha256 = "1j56lyids48zyjhxk8xl4niy8hk6qzi1aj7c55yfh62id8v6cpbw";
-         url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
-      })
-      (requireFile {
-         name   = "native-image-installable-svm-svmee-linux-amd64-${version}.jar";
-         sha256 = "07c25l27msxccqrbz4bknz0sxsl0z2k8990cdfkbrgxvhxspfnnm";
-         url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
-      })
-      (requireFile {
-         name   = "python-installable-svm-svmee-linux-amd64-${version}.jar";
-         sha256 = "1c7kpz56w9p418li97ymixdwywscr85vhn7jkzxq71bj7ia7pxwz";
-         url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
-      })
-      (requireFile {
-         name   = "ruby-installable-svm-svmee-linux-amd64-${version}.jar";
-         sha256 = "13jfm5qpxqxz7f5n9yyvqrv1vwigifrjwk3hssp23maski2ssys1";
-         url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
-      })
-    ];
-    nativeBuildInputs = [ unzip perl ];
-    unpackPhase = ''
-      unpack_jar() {
-        jar=$1
-        unzip $jar -d $out
-        perl -ne 'use File::Path qw(make_path);
-                  use File::Basename qw(dirname);
-                  if (/^(.+) = (.+)$/) {
-                    make_path dirname("$ENV{out}/$1");
-                    system "ln -s $2 $ENV{out}/$1";
-                  }' $out/META-INF/symlinks
-        perl -ne 'if (/^(.+) = ([r-])([w-])([x-])([r-])([w-])([x-])([r-])([w-])([x-])$/) {
-                    my $mode = ($2 eq 'r' ? 0400 : 0) + ($3 eq 'w' ? 0200 : 0) + ($4  eq 'x' ? 0100 : 0) +
-                               ($5 eq 'r' ? 0040 : 0) + ($6 eq 'w' ? 0020 : 0) + ($7  eq 'x' ? 0010 : 0) +
-                               ($8 eq 'r' ? 0004 : 0) + ($9 eq 'w' ? 0002 : 0) + ($10 eq 'x' ? 0001 : 0);
-                    chmod $mode, "$ENV{out}/$1";
-                  }' $out/META-INF/permissions
-        rm -rf $out/META-INF
-      }
-
-      mkdir -p $out
-      arr=($srcs)
-      tar xf ''${arr[0]} -C $out --strip-components=1
-      unpack_jar ''${arr[1]}
-      unpack_jar ''${arr[2]}
-      unpack_jar ''${arr[3]}
-    '';
-
-    installPhase = ''
-      # BUG workaround http://mail.openjdk.java.net/pipermail/graal-dev/2017-December/005141.html
-      substituteInPlace $out/jre/lib/security/java.security \
-        --replace file:/dev/random    file:/dev/./urandom \
-        --replace NativePRNGBlocking  SHA1PRNG
-
-      # provide libraries needed for static compilation
-      for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do
-        ln -s $f $out/jre/lib/svm/clibraries/linux-amd64/$(basename $f)
-      done
-    '';
-
-    dontStrip = true;
-
-    preFixup = ''
-      # Set JAVA_HOME automatically.
-      mkdir -p $out/nix-support
-      cat <<EOF > $out/nix-support/setup-hook
-      if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
-      EOF
-    '';
-
-    postFixup = ''
-      rpath="$out/jre/lib/amd64/jli:$out/jre/lib/amd64/server:$out/jre/lib/amd64:${
-        stdenv.lib.strings.makeLibraryPath [ glibc xorg.libXxf86vm xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXrender
-                                             glib zlib alsaLib fontconfig freetype pango gtk3 gtk2 cairo gdk-pixbuf atk ffmpeg libGL ]}"
-
-      for f in $(find $out -type f -perm -0100); do
-        patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" || true
-        patchelf --set-rpath   "$rpath"                                    "$f" || true
-      done
-
-      for f in $(find $out -type f -perm -0100); do
-        if ldd "$f" | fgrep 'not found'; then echo "in file $f"; fi
-      done
-    '';
-
-    propagatedBuildInputs = [ setJavaClassPath zlib ]; # $out/bin/native-image needs zlib to build native executables
-    
-    doInstallCheck = true;
-    installCheckPhase = ''
-      echo ${stdenv.lib.escapeShellArg ''
-               public class HelloWorld {
-                 public static void main(String[] args) {
-                   System.out.println("Hello World");
-                 }
-               }
-             ''} > HelloWorld.java
-      $out/bin/javac HelloWorld.java
-
-      # run on JVM with Graal Compiler
-      $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld
-      $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World'
-
-      # Ahead-Of-Time compilation
-      $out/bin/native-image --no-server HelloWorld
-      ./helloworld
-      ./helloworld | fgrep 'Hello World'
-
-      # Ahead-Of-Time compilation with --static
-      $out/bin/native-image --no-server --static HelloWorld
-      ./helloworld
-      ./helloworld | fgrep 'Hello World'
-    '';
-
-    passthru.home = graalvm8-ee;
-
-    meta = with stdenv.lib; {
-      homepage = https://www.graalvm.org/;
-      description = "High-Performance Polyglot VM";
-      license = licenses.unfree;
-      maintainers = with maintainers; [ volth hlolli ];
-      platforms = [ "x86_64-linux" ];
-    };
-  };
-in
-  graalvm8-ee
+  common = javaVersion:
+    let
+      graalvmXXX-ee = stdenv.mkDerivation rec {
+        pname = "graalvm${javaVersion}-ee";
+        version = "19.3.1";
+        srcs = [
+          (requireFile {
+             name   = "graalvm-ee-java${javaVersion}-linux-amd64-${version}.tar.gz";
+             sha256 = {  "8" = "b4833f1996e0e271d8abde1d0af3420e2bc6797624515a3720bdbedfa99b1e82";
+                        "11" = "a965abb093934712f31cd2183f3f0d68ed1410a50365489f665a30e5382908dc";
+                      }.${javaVersion};
+             url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
+          })
+          (requireFile {
+             name   = "native-image-installable-svm-svmee-java${javaVersion}-linux-amd64-${version}.jar";
+             sha256 = {  "8" = "fe3447dd60fbe3da39c650654594796873cd6bc9995d1430a421363e71d41702";
+                        "11" = "53357b7facb36c7b38857a2369471d0e869c0ff45555aa8baf2ab84de0c4782c";
+                      }.${javaVersion};
+             url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
+          })
+          (requireFile {
+             name   = "python-installable-svm-svmee-java${javaVersion}-linux-amd64-${version}.jar";
+             sha256 = {  "8" = "003e9574e18656a82626aa5d310fac31979abc04955587d68ff977808829a91d";
+                        "11" = "65558e14a25802001f3c79571a09170fa11564de34df6987724163416d3889bf";
+                      }.${javaVersion};
+             url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
+          })
+          (requireFile {
+             name   = "ruby-installable-svm-svmee-java${javaVersion}-linux-amd64-${version}.jar";
+             sha256 = {  "8" = "45abe74d10e09680f1e40101f93def5615e65f29ced328054a40c8517e054290";
+                        "11" = "3d4de372b78b68dbd966b36489d1c6d84a326990e91a0314fb77404eed0741ad";
+                      }.${javaVersion};
+             url    = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
+          })
+        ];
+        nativeBuildInputs = [ unzip perl ];
+        unpackPhase = ''
+          unpack_jar() {
+            jar=$1
+            unzip $jar -d $out
+            perl -ne 'use File::Path qw(make_path);
+                      use File::Basename qw(dirname);
+                      if (/^(.+) = (.+)$/) {
+                        make_path dirname("$ENV{out}/$1");
+                        system "ln -s $2 $ENV{out}/$1";
+                      }' $out/META-INF/symlinks
+            perl -ne 'if (/^(.+) = ([r-])([w-])([x-])([r-])([w-])([x-])([r-])([w-])([x-])$/) {
+                        my $mode = ($2 eq 'r' ? 0400 : 0) + ($3 eq 'w' ? 0200 : 0) + ($4  eq 'x' ? 0100 : 0) +
+                                   ($5 eq 'r' ? 0040 : 0) + ($6 eq 'w' ? 0020 : 0) + ($7  eq 'x' ? 0010 : 0) +
+                                   ($8 eq 'r' ? 0004 : 0) + ($9 eq 'w' ? 0002 : 0) + ($10 eq 'x' ? 0001 : 0);
+                        chmod $mode, "$ENV{out}/$1";
+                      }' $out/META-INF/permissions
+            rm -rf $out/META-INF
+          }
+
+          mkdir -p $out
+          arr=($srcs)
+          tar xf ''${arr[0]} -C $out --strip-components=1
+          unpack_jar ''${arr[1]}
+          unpack_jar ''${arr[2]}
+          unpack_jar ''${arr[3]}
+        '';
+
+        installPhase = {
+          "8" = ''
+            # BUG workaround http://mail.openjdk.java.net/pipermail/graal-dev/2017-December/005141.html
+            substituteInPlace $out/jre/lib/security/java.security \
+              --replace file:/dev/random    file:/dev/./urandom \
+              --replace NativePRNGBlocking  SHA1PRNG
+
+            # provide libraries needed for static compilation
+            for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do
+              ln -s $f $out/jre/lib/svm/clibraries/linux-amd64/$(basename $f)
+            done
+
+            # allow using external truffle-api.jar and languages not included in the distrubution
+            rm $out/jre/lib/jvmci/parentClassLoader.classpath
+          '';
+          "11" = ''
+            # BUG workaround http://mail.openjdk.java.net/pipermail/graal-dev/2017-December/005141.html
+            substituteInPlace $out/conf/security/java.security \
+              --replace file:/dev/random    file:/dev/./urandom \
+              --replace NativePRNGBlocking  SHA1PRNG
+
+            # provide libraries needed for static compilation
+            for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do
+              ln -s $f $out/lib/svm/clibraries/linux-amd64/$(basename $f)
+            done
+           '';
+        }.${javaVersion};
+
+        dontStrip = true;
+
+        # copy-paste openjdk's preFixup
+        preFixup = ''
+          # Set JAVA_HOME automatically.
+          mkdir -p $out/nix-support
+          cat <<EOF > $out/nix-support/setup-hook
+            if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
+          EOF
+        '';
+
+        postFixup = ''
+          rpath="${ {  "8" = "$out/jre/lib/amd64/jli:$out/jre/lib/amd64/server:$out/jre/lib/amd64";
+                      "11" = "$out/lib/jli:$out/lib/server:$out/lib";
+                    }.${javaVersion}
+                 }:${
+            stdenv.lib.strings.makeLibraryPath [ glibc xorg.libXxf86vm xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXrender
+                                                 glib zlib bzip2 alsaLib fontconfig freetype pango gtk3 gtk2 cairo gdk-pixbuf atk ffmpeg libGL ]}"
+
+          for f in $(find $out -type f -perm -0100); do
+            patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" || true
+            patchelf --set-rpath   "$rpath"                                    "$f" || true
+          done
+
+          for f in $(find $out -type f -perm -0100); do
+            if ldd "$f" | fgrep 'not found'; then echo "in file $f"; fi
+          done
+        '';
+
+        propagatedBuildInputs = [ setJavaClassPath zlib ]; # $out/bin/native-image needs zlib to build native executables
+
+        doInstallCheck = true;
+        installCheckPhase = ''
+          echo ${stdenv.lib.escapeShellArg ''
+                   public class HelloWorld {
+                     public static void main(String[] args) {
+                       System.out.println("Hello World");
+                     }
+                   }
+                 ''} > HelloWorld.java
+          $out/bin/javac HelloWorld.java
+
+          # run on JVM with Graal Compiler
+          $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld
+          $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World'
+
+          # Ahead-Of-Time compilation
+          $out/bin/native-image --no-server HelloWorld
+          ./helloworld
+          ./helloworld | fgrep 'Hello World'
+
+          # Ahead-Of-Time compilation with --static
+          $out/bin/native-image --no-server --static HelloWorld
+          ./helloworld
+          ./helloworld | fgrep 'Hello World'
+        '';
+
+        passthru.home = graalvmXXX-ee;
+
+        meta = with stdenv.lib; {
+          homepage = https://www.graalvm.org/;
+          description = "High-Performance Polyglot VM";
+          license = licenses.unfree;
+          maintainers = with maintainers; [ volth hlolli ];
+          platforms = [ "x86_64-linux" ];
+        };
+      };
+    in
+      graalvmXXX-ee;
+in {
+  graalvm8-ee  = common  "8";
+  graalvm11-ee = common "11";
+}
diff --git a/pkgs/development/compilers/halide/default.nix b/pkgs/development/compilers/halide/default.nix
index 0b28b61a27b2..44c079af9263 100644
--- a/pkgs/development/compilers/halide/default.nix
+++ b/pkgs/development/compilers/halide/default.nix
@@ -29,7 +29,7 @@ in llvmPackages.stdenv.mkDerivation {
   # To handle the lack of 'local' RPATH; required, as they call one of
   # their built binaries requiring their libs, in the build process.
   preBuild = ''
-    export LD_LIBRARY_PATH="$(pwd)/lib:$LD_LIBRARY_PATH"
+    export LD_LIBRARY_PATH="$(pwd)/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
   '';
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/compilers/iasl/default.nix b/pkgs/development/compilers/iasl/default.nix
index e98d7cc27dbf..1e7a46e78072 100644
--- a/pkgs/development/compilers/iasl/default.nix
+++ b/pkgs/development/compilers/iasl/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "iasl";
-  version = "20191213";
+  version = "20200110";
 
   src = fetchurl {
     url = "https://acpica.org/sites/acpica/files/acpica-unix-${version}.tar.gz";
-    sha256 = "1ip684is3dplf7snkn024vv6bg3dv5msx8v7pz6x9lrnk3gk0j9h";
+    sha256 = "1cb6aa6acrixmdzvj9vv4qs9lmlsbkd27pjlz14i1kq1x3xn0gwx";
   };
 
   NIX_CFLAGS_COMPILE = "-O3";
diff --git a/pkgs/development/compilers/jetbrains-jdk/default.nix b/pkgs/development/compilers/jetbrains-jdk/default.nix
index 276b9ae150a0..54d95fbd8a88 100644
--- a/pkgs/development/compilers/jetbrains-jdk/default.nix
+++ b/pkgs/development/compilers/jetbrains-jdk/default.nix
@@ -7,17 +7,17 @@
 
 let drv = stdenv.mkDerivation rec {
   pname = "jetbrainsjdk";
-  version = "485.1";
+  version = "520.30";
 
   src = if stdenv.hostPlatform.system == "x86_64-linux" then
     fetchurl {
-      url = "https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_4-linux-x64-b${version}.tar.gz";
-      sha256 = "18jnn0dra9nsnyllwq0ljxzr58k2pg8d0kg10y39vnxwccic4f76";
+      url = "https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_5-linux-x64-b${version}.tar.gz";
+      sha256 = "0xmr5jjnr4af7byz5w01phyrrdyizfhqmwhs4k8ih566fkhyzj02";
     }
   else if stdenv.hostPlatform.system == "x86_64-darwin" then
     fetchurl {
-      url = "https://bintray.com/jetbrains/intellij-jdk/download_file?file_path=jbrsdk-11_0_2-osx-x64-b${version}.tar.gz";
-      sha256 = "1ly6kf59knvzbr2pjkc9fqyzfs28pdvnqg5pfffr8zp14xm44zmd";
+      url = "https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_5-osx-x64-b${version}.tar.gz";
+      sha256 = "0wfcw66wv5rkkjzyzi9j7zk7c2fgi33ny09drgihxi2kdzyfrpcb";
     }
   else
     throw "unsupported system: ${stdenv.hostPlatform.system}";
diff --git a/pkgs/development/compilers/llvm/3.5/clang-purity.patch b/pkgs/development/compilers/llvm/3.5/clang-purity.patch
deleted file mode 100644
index dc3b54e304fc..000000000000
--- a/pkgs/development/compilers/llvm/3.5/clang-purity.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
-index 198e82e..810d006 100644
---- a/lib/Driver/Tools.cpp
-+++ b/lib/Driver/Tools.cpp
-@@ -7355,17 +7355,6 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
-     CmdArgs.push_back("-shared");
-   }
- 
--  if (ToolChain.getArch() == llvm::Triple::arm ||
--      ToolChain.getArch() == llvm::Triple::armeb ||
--      ToolChain.getArch() == llvm::Triple::thumb ||
--      ToolChain.getArch() == llvm::Triple::thumbeb ||
--      (!Args.hasArg(options::OPT_static) &&
--       !Args.hasArg(options::OPT_shared))) {
--    CmdArgs.push_back("-dynamic-linker");
--    CmdArgs.push_back(Args.MakeArgString(
--        D.DyldPrefix + getLinuxDynamicLinker(Args, ToolChain)));
--  }
--
-   CmdArgs.push_back("-o");
-   CmdArgs.push_back(Output.getFilename());
- 
diff --git a/pkgs/development/compilers/llvm/3.5/clang-separate-build.patch b/pkgs/development/compilers/llvm/3.5/clang-separate-build.patch
deleted file mode 100644
index 5fb67f169f45..000000000000
--- a/pkgs/development/compilers/llvm/3.5/clang-separate-build.patch
+++ /dev/null
@@ -1,8 +0,0 @@
-diff -Naur clang-3.4-orig/tools/extra/CMakeLists.txt clang-3.4/tools/extra/CMakeLists.txt
---- clang-3.4-orig/tools/extra/CMakeLists.txt	2013-11-07 19:08:23.000000000 -0500
-+++ clang-3.4/tools/extra/CMakeLists.txt	2014-01-20 11:47:22.678435223 -0500
-@@ -1,3 +1,4 @@
-+include(CheckLibraryExists)
- check_library_exists(edit el_init "" HAVE_LIBEDIT)
- 
- add_subdirectory(clang-apply-replacements)
diff --git a/pkgs/development/compilers/llvm/3.5/clang.nix b/pkgs/development/compilers/llvm/3.5/clang.nix
deleted file mode 100644
index 9a602c62777d..000000000000
--- a/pkgs/development/compilers/llvm/3.5/clang.nix
+++ /dev/null
@@ -1,59 +0,0 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src }:
-let
-  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
-in stdenv.mkDerivation {
-  pname = "clang";
-  inherit version;
-
-  src = fetch "cfe" "0846h8vn3zlc00jkmvrmy88gc6ql6014c02l4jv78fpvfigmgssg";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv cfe-${version}.src clang
-    sourceRoot=$PWD/clang
-    unpackFile ${clang-tools-extra_src}
-    mv clang-tools-extra-* $sourceRoot/tools/extra
-  '';
-
-  buildInputs = [ cmake libxml2 llvm ];
-
-  cmakeFlags = [
-    "-DCMAKE_CXX_FLAGS=-std=c++11"
-  ] ++
-  # Maybe with compiler-rt this won't be needed?
-  (stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}") ++
-  (stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include");
-
-  patches = [ ./clang-purity.patch ];
-
-  postPatch = ''
-    sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
-    sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
-  '';
-
-  # Clang expects to find LLVMgold in its own prefix
-  # Clang expects to find sanitizer libraries in its own prefix
-  postInstall = ''
-    if [ -e ${llvm}/lib/LLVMgold.so ]; then
-      ln -sv ${llvm}/lib/LLVMgold.so $out/lib
-    fi
-
-    ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
-    ln -sv $out/bin/clang $out/bin/cpp
-  '';
-
-  enableParallelBuilding = true;
-
-  passthru = {
-    isClang = true;
-  } // stdenv.lib.optionalAttrs stdenv.isLinux {
-    inherit gcc;
-  };
-
-  meta = {
-    description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.5/default.nix b/pkgs/development/compilers/llvm/3.5/default.nix
deleted file mode 100644
index b87fa747f145..000000000000
--- a/pkgs/development/compilers/llvm/3.5/default.nix
+++ /dev/null
@@ -1,43 +0,0 @@
-{ pkgs, newScope, stdenv, isl, fetchurl }:
-let
-  callPackage = newScope (self // { inherit stdenv isl version fetch; });
-
-  version = "3.5.2";
-
-  fetch = fetch_v version;
-  fetch_v = ver: name: sha256: fetchurl {
-    url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
-    inherit sha256;
-  };
-
-  compiler-rt_src = fetch "compiler-rt" "1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal";
-  clang-tools-extra_src = fetch "clang-tools-extra" "01607w6hdf1pjgaapn9fy6smk22i3d4ncqjlhk4xi55ifi6kf6pj";
-
-  self = {
-    llvm = callPackage ./llvm.nix rec {
-      version = "3.5.2";
-      fetch = fetch_v version;
-      inherit compiler-rt_src;
-    };
-
-    clang = callPackage ./clang.nix rec {
-      version = "3.5.2";
-      fetch = fetch_v version;
-      inherit clang-tools-extra_src;
-    };
-
-    lld = callPackage ./lld.nix {};
-
-    lldb = callPackage ./lldb.nix {};
-
-    polly = callPackage ./polly.nix {};
-
-    dragonegg = callPackage ./dragonegg.nix {};
-
-    libcxx = callPackage ./libc++ { stdenv = pkgs.clangStdenv; };
-
-    libcxxabi = callPackage ./libc++abi { stdenv = pkgs.clangStdenv; };
-
-    #openmp = callPackage ./openmp {};
-  };
-in self
diff --git a/pkgs/development/compilers/llvm/3.5/dragonegg.nix b/pkgs/development/compilers/llvm/3.5/dragonegg.nix
deleted file mode 100644
index e327fa79c6f0..000000000000
--- a/pkgs/development/compilers/llvm/3.5/dragonegg.nix
+++ /dev/null
@@ -1,27 +0,0 @@
-{stdenv, fetch, llvm, gmp, mpfr, libmpc, ncurses, zlib, version}:
-
-stdenv.mkDerivation rec {
-  pname = "dragonegg";
-  inherit version;
-
-  src = fetch "dragonegg" "1va4wv2b1dj0dpzsksnpnd0jic52q7pqj79w3m9jwdb58h7104dw";
-
-  # The gcc the plugin will be built for (the same used building dragonegg)
-  GCC = "gcc";
-
-  buildInputs = [ llvm gmp mpfr libmpc ncurses zlib ];
-
-  installPhase = ''
-    mkdir -p $out/lib $out/share/doc/${pname}-${version}
-    cp -d dragonegg.so $out/lib
-    cp README COPYING $out/share/doc/${pname}-${version}
-  '';
-
-  meta = {
-    homepage = http://dragonegg.llvm.org/;
-    description = "gcc plugin that replaces gcc's optimizers and code generators by those in LLVM";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.5/fix-15974.patch b/pkgs/development/compilers/llvm/3.5/fix-15974.patch
deleted file mode 100644
index 446004cd9988..000000000000
--- a/pkgs/development/compilers/llvm/3.5/fix-15974.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h
-index f9df378..9d860ec 100644
---- a/include/llvm/ADT/IntrusiveRefCntPtr.h
-+++ b/include/llvm/ADT/IntrusiveRefCntPtr.h
-@@ -134,9 +134,9 @@ public:
- //===----------------------------------------------------------------------===//
-   template <typename T>
-   class IntrusiveRefCntPtr {
-+  public:
-     T* Obj;
- 
--  public:
-     typedef T element_type;
- 
-     explicit IntrusiveRefCntPtr() : Obj(nullptr) {}
diff --git a/pkgs/development/compilers/llvm/3.5/libc++/darwin.patch b/pkgs/development/compilers/llvm/3.5/libc++/darwin.patch
deleted file mode 100644
index bf83f169cfc3..000000000000
--- a/pkgs/development/compilers/llvm/3.5/libc++/darwin.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff -ru -x '*~' libcxx-3.4.2.src-orig/lib/CMakeLists.txt libcxx-3.4.2.src/lib/CMakeLists.txt
---- libcxx-3.4.2.src-orig/lib/CMakeLists.txt	2013-11-15 18:18:57.000000000 +0100
-+++ libcxx-3.4.2.src/lib/CMakeLists.txt	2014-09-24 14:04:01.000000000 +0200
-@@ -56,7 +56,7 @@
-       "-compatibility_version 1"
-       "-current_version ${LIBCXX_VERSION}"
-       "-install_name /usr/lib/libc++.1.dylib"
--      "-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
-+      "-Wl,-reexport_library,${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
-       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
-       "/usr/lib/libSystem.B.dylib")
-   else()
-@@ -64,14 +64,14 @@
-       list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
-       if (OSX_HAS_ARMV7)
-         set(OSX_RE_EXPORT_LINE
--          "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
-+          "${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
-           "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
-       else()
-         set(OSX_RE_EXPORT_LINE
--          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
-+          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib")
-       endif()
-     else()
--      set (OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
-+      set (OSX_RE_EXPORT_LINE "${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
-     endif()
- 
-     list(APPEND link_flags
diff --git a/pkgs/development/compilers/llvm/3.5/libc++/default.nix b/pkgs/development/compilers/llvm/3.5/libc++/default.nix
deleted file mode 100644
index 44610a1b11d3..000000000000
--- a/pkgs/development/compilers/llvm/3.5/libc++/default.nix
+++ /dev/null
@@ -1,54 +0,0 @@
-{ lib, stdenv, fetchurl, cmake, libcxxabi, fixDarwinDylibNames }:
-
-let version = "3.5.2"; in
-
-stdenv.mkDerivation {
-  pname = "libc++";
-  inherit version;
-
-  src = fetchurl {
-    url = "http://llvm.org/releases/${version}/libcxx-${version}.src.tar.xz";
-    sha256 = "0irnl54fwzh2hzn9x4jfvnfyq5kd0zn0iwbzdivgwhqzw6fjdwdv";
-  };
-
-  # instead of allowing libc++ to link with /usr/lib/libc++abi.dylib,
-  # force it to link with our copy
-  preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
-    substituteInPlace lib/CMakeLists.txt \
-      --replace 'OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib' \
-                'OSX_RE_EXPORT_LINE "${libcxxabi}/lib/libc++abi.dylib' \
-      --replace '"''${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"' \
-                '"${libcxxabi}/lib/libc++abi.dylib"'
-  '';
-
-  patches = [
-    ./darwin.patch
-    # glibc 2.26 fix
-    ./xlocale-glibc-2.26.patch
-  ];
-
-  buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-  cmakeFlags = [
-    "-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=${libcxxabi}/include"
-    "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
-    "-DLIBCXX_LIBCPPABI_VERSION=2"
-    "-DLIBCXX_CXX_ABI=libcxxabi"
-  ];
-
-  enableParallelBuilding = true;
-
-  linkCxxAbi = stdenv.isLinux;
-
-  setupHooks = [
-    ../../../../../build-support/setup-hooks/role.bash
-    ./setup-hook.sh
-  ];
-
-  meta = {
-    homepage = http://libcxx.llvm.org/;
-    description = "A new implementation of the C++ standard library, targeting C++11";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh
deleted file mode 100644
index 6611259165ae..000000000000
--- a/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# See pkgs/build-support/setup-hooks/role.bash
-getHostRole
-
-linkCxxAbi="@linkCxxAbi@"
-export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/3.5/libc++/xlocale-glibc-2.26.patch b/pkgs/development/compilers/llvm/3.5/libc++/xlocale-glibc-2.26.patch
deleted file mode 100644
index 250bb49fc231..000000000000
--- a/pkgs/development/compilers/llvm/3.5/libc++/xlocale-glibc-2.26.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/include/__locale b/include/__locale
-index 3daa1f1..cb8e151 100644
---- a/include/__locale
-+++ b/include/__locale
-@@ -29,10 +29,10 @@
- # if __ANDROID_API__ <= 20
- #  include <support/android/locale_bionic.h>
- # endif
--#elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
-+#elif (defined(__APPLE__)      || defined(__FreeBSD__) \
-     || defined(__sun__)   || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
- # include <xlocale.h>
--#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
-+#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
- 
- #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- #pragma GCC system_header
diff --git a/pkgs/development/compilers/llvm/3.5/libc++abi/default.nix b/pkgs/development/compilers/llvm/3.5/libc++abi/default.nix
deleted file mode 100644
index d295ddbf8a44..000000000000
--- a/pkgs/development/compilers/llvm/3.5/libc++abi/default.nix
+++ /dev/null
@@ -1,60 +0,0 @@
-{ stdenv, cmake, fetchurl, libcxx, libunwind, llvm }:
-
-let
-  version = "3.5.2";
-  cmakeLists = fetchurl {
-    name   = "CMakeLists.txt";
-    url    = "http://llvm.org/svn/llvm-project/libcxxabi/trunk/CMakeLists.txt?p=217324";
-    sha256 = "10idgcbs4pcx6mjsbq1vjm8hzqqdk2p7k86cw9f473jmfyfwgf5j";
-  };
-in stdenv.mkDerivation {
-  pname = "libc++abi";
-  inherit version;
-
-  src = fetchurl {
-    url    = "http://llvm.org/releases/${version}/libcxxabi-${version}.src.tar.xz";
-    sha256 = "1c6rv0zx0na1w4hdmdfq2f6nj7limb7d1krrknwajxxkcn4yws92";
-  };
-
-  buildInputs = [ cmake ] ++ stdenv.lib.optional (!stdenv.isDarwin) libunwind;
-
-  postUnpack = ''
-    unpackFile ${libcxx.src}
-    unpackFile ${llvm.src}
-    echo cp ${cmakeLists} libcxxabi-*/CMakeLists.txt
-    cp ${cmakeLists} libcxxabi-*/CMakeLists.txt
-    export NIX_CFLAGS_COMPILE+=" -I$PWD/include"
-    export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
-    export TRIPLE=x86_64-apple-darwin
-  '';
-
-  installPhase = if stdenv.isDarwin
-    then ''
-      for file in lib/*; do
-        # this should be done in CMake, but having trouble figuring out
-        # the magic combination of necessary CMake variables
-        # if you fancy a try, take a look at
-        # http://www.cmake.org/Wiki/CMake_RPATH_handling
-        install_name_tool -id $out/$file $file
-      done
-      make install
-      install -d 755 $out/include
-      install -m 644 ../include/cxxabi.h $out/include
-    ''
-    else ''
-      install -d -m 755 $out/include $out/lib
-      install -m 644 lib/libc++abi.so.1.0 $out/lib
-      install -m 644 $src/include/cxxabi.h $out/include
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
-    '';
-
-  meta = {
-    homepage = http://libcxxabi.llvm.org/;
-    description = "A new implementation of low level support for a standard C++ library";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    maintainers = with stdenv.lib.maintainers; [ vlstill ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.5/lld.nix b/pkgs/development/compilers/llvm/3.5/lld.nix
deleted file mode 100644
index 8fe4dd6f1d5f..000000000000
--- a/pkgs/development/compilers/llvm/3.5/lld.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ stdenv, fetch, cmake, llvm, ncurses, zlib, python, version }:
-
-stdenv.mkDerivation {
-  pname = "lld";
-  inherit version;
-
-  src = fetch "lld" "1hpqawg1sc8mdqxqaxqmlzbrn69w1pkj8rxhjgqgmwra6c0xky89";
-
-  preUnpack = ''
-    # !!! Hopefully won't be needed for 3.5
-    unpackFile ${llvm.src}
-    export cmakeFlags="$cmakeFlags -DLLD_PATH_TO_LLVM_SOURCE="`ls -d $PWD/llvm-*`
-  '';
-
-  buildInputs = [ cmake ncurses zlib python ];
-
-  cmakeFlags = [
-    "-DCMAKE_CXX_FLAGS=-std=c++11"
-    "-DLLD_PATH_TO_LLVM_BUILD=${llvm}"
-  ];
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "A set of modular code for creating linker tools";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.5/lldb.nix b/pkgs/development/compilers/llvm/3.5/lldb.nix
deleted file mode 100644
index b4823e9d8c2a..000000000000
--- a/pkgs/development/compilers/llvm/3.5/lldb.nix
+++ /dev/null
@@ -1,45 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, zlib
-, ncurses
-, swig
-, which
-, libedit
-, llvm
-, clang
-, python
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "lldb";
-  inherit version;
-
-  src = fetch "lldb" "0ffi9jn4k3yd0hvxs1v4n710x8siq21lb49v3351d7j5qinrpgi7";
-
-  patchPhase = ''
-    sed -i 's|/usr/bin/env||' \
-      scripts/Python/finish-swig-Python-LLDB.sh \
-      scripts/Python/build-swig-Python.sh
-  '';
-
-  buildInputs = [ cmake python which swig ncurses zlib libedit ];
-
-  cmakeFlags = [
-    "-DCMAKE_CXX_FLAGS=-std=c++11"
-    "-DLLDB_PATH_TO_LLVM_BUILD=${llvm}"
-    "-DLLDB_PATH_TO_CLANG_BUILD=${clang}"
-    "-DLLDB_DISABLE_LIBEDIT=1" # https://llvm.org/bugs/show_bug.cgi?id=28898
-  ];
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "A next-generation high-performance debugger";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-    broken = true;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.5/llvm-separate-build.patch b/pkgs/development/compilers/llvm/3.5/llvm-separate-build.patch
deleted file mode 100644
index abfc11513cdc..000000000000
--- a/pkgs/development/compilers/llvm/3.5/llvm-separate-build.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur llvm-3.4-orig/cmake/modules/TableGen.cmake llvm-3.4/cmake/modules/TableGen.cmake
---- llvm-3.4-orig/cmake/modules/TableGen.cmake	2013-10-06 21:00:07.000000000 -0400
-+++ llvm-3.4/cmake/modules/TableGen.cmake	2014-01-20 13:06:55.273022149 -0500
-@@ -78,8 +78,6 @@
- endif()
- 
- macro(add_tablegen target project)
--  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
--
-   set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
-   set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen)
-   add_llvm_utility(${target} ${ARGN})
diff --git a/pkgs/development/compilers/llvm/3.5/llvm.nix b/pkgs/development/compilers/llvm/3.5/llvm.nix
deleted file mode 100644
index fc53ad266a65..000000000000
--- a/pkgs/development/compilers/llvm/3.5/llvm.nix
+++ /dev/null
@@ -1,97 +0,0 @@
-{ stdenv
-, fetch
-, fetchpatch
-, perl
-, groff
-, cmake
-, python
-, libffi
-, libbfd
-, libxml2
-, valgrind
-, ncurses
-, version
-, zlib
-, compiler-rt_src
-, debugVersion ? false
-, enableSharedLibraries ? !stdenv.isDarwin
-}:
-
-stdenv.mkDerivation {
-  pname = "llvm";
-  inherit version;
-
-  src = fetch "llvm" "0xf5q17kkxsrm2gsi93h4pwlv663kji73r2g4asb97klsmb626a4";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv llvm-${version}.src llvm
-    sourceRoot=$PWD/llvm
-    unpackFile ${compiler-rt_src}
-    mv compiler-rt-* $sourceRoot/projects/compiler-rt
-  '';
-
-  buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
-
-  propagatedBuildInputs = [ ncurses zlib ];
-
-  prePatch = ''
-    substituteInPlace CMakeLists.txt \
-      --replace 'set(CMAKE_INSTALL_NAME_DIR "@rpath")' "set(CMAKE_INSTALL_NAME_DIR "$out/lib")" \
-      --replace 'set(CMAKE_INSTALL_RPATH "@executable_path/../lib")' ""
-  '';
-
-  postPatch = stdenv.lib.optionalString (stdenv ? glibc) ''
-    (
-      cd projects/compiler-rt
-      patch -p1 < ${
-        fetchpatch {
-          name = "sigaltstack.patch"; # for glibc-2.26
-          url = https://github.com/llvm-mirror/compiler-rt/commit/8a5e425a68d.diff;
-          sha256 = "0h4y5vl74qaa7dl54b1fcyqalvlpd8zban2d1jxfkxpzyi7m8ifi";
-        }
-      }
-
-      sed -i "s,#include <pthread.h>,&\n#include <signal.h>,g" \
-        lib/asan/asan_linux.cc
-    )
-  '';
-
-  # hacky fix: created binaries need to be run before installation
-  preBuild = ''
-    mkdir -p $out/
-    ln -sv $PWD/lib $out
-  '';
-
-  cmakeFlags = with stdenv; [
-    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
-    "-DLLVM_BUILD_TESTS=ON"
-    "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_REQUIRES_RTTI=1"
-  ] ++ stdenv.lib.optional enableSharedLibraries
-    "-DBUILD_SHARED_LIBS=ON"
-    ++ stdenv.lib.optional (!isDarwin)
-    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
-    ++ stdenv.lib.optionals ( isDarwin) [
-    "-DCMAKE_CXX_FLAGS=-stdlib=libc++"
-    "-DCAN_TARGET_i386=false"
-  ];
-
-  patches = [ ./fix-15974.patch ] ++
-    stdenv.lib.optionals (!stdenv.isDarwin) [../fix-llvm-config.patch ];
-
-  postBuild = ''
-    rm -fR $out
-  '';
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "Collection of modular and reusable compiler and toolchain technologies";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    maintainers = with stdenv.lib.maintainers; [ lovek323 raskin ];
-    platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" "armv7l-linux"];
-  };
-}
-
diff --git a/pkgs/development/compilers/llvm/3.5/polly-separate-build.patch b/pkgs/development/compilers/llvm/3.5/polly-separate-build.patch
deleted file mode 100644
index 618dd4dc3b12..000000000000
--- a/pkgs/development/compilers/llvm/3.5/polly-separate-build.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur polly-3.4-orig/CMakeLists.txt polly-3.4/CMakeLists.txt
---- polly-3.4-orig/CMakeLists.txt	2013-11-21 06:51:46.000000000 -0500
-+++ polly-3.4/CMakeLists.txt	2014-01-20 18:49:34.907919933 -0500
-@@ -53,7 +53,7 @@
-   execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --cxxflags
-                   OUTPUT_VARIABLE LLVM_CXX_FLAGS
-                   OUTPUT_STRIP_TRAILING_WHITESPACE)
--  set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS})
-+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS}")
- endif(NOT DEFINED LLVM_MAIN_SRC_DIR)
- 
- set(POLLY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/pkgs/development/compilers/llvm/3.5/polly.nix b/pkgs/development/compilers/llvm/3.5/polly.nix
deleted file mode 100644
index 06bc7490c7b5..000000000000
--- a/pkgs/development/compilers/llvm/3.5/polly.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ stdenv, fetch, cmake, isl, python, gmp, llvm, version }:
-
-stdenv.mkDerivation {
-  pname = "polly";
-  inherit version;
-
-  src =  fetch "polly" "1s6v54czmgq626an4yk2k34lrzkwmz1bjrbiafh7j23yc2w4nalx";
-
-  patches = [ ./polly-separate-build.patch ];
-
-  buildInputs = [ cmake isl python gmp ];
-
-  cmakeFlags = [
-    "-DCMAKE_CXX_FLAGS=-std=c++11"
-    "-DLLVM_INSTALL_ROOT=${llvm}"
-  ];
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "A polyhedral optimizer for llvm";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.9/clang/0001-Fix-compilation-w-gcc9.patch b/pkgs/development/compilers/llvm/3.9/clang/0001-Fix-compilation-w-gcc9.patch
deleted file mode 100644
index 1058cd031767..000000000000
--- a/pkgs/development/compilers/llvm/3.9/clang/0001-Fix-compilation-w-gcc9.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 7225c7754cc3431d05df367c60f309f27586f188 Mon Sep 17 00:00:00 2001
-From: Maximilian Bosch <maximilian@mbosch.me>
-Date: Mon, 30 Dec 2019 01:42:52 +0100
-Subject: [PATCH] Fix compilation w/gcc9
-
-Build broken with the following errors:
-
-```
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6078:55: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6078 |                          &NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
-clang> |                                      ~~~~~~~~~~~~~~~~~^~~
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6126:53: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6126 |                        &NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
-clang> |                                    ~~~~~~~~~~~~~~~~~^~~
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6191:56: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6191 |   auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-clang> |                                       ~~~~~~~~~~~~~~~~~^~~
-```
-
-This was due to a bug about name-collisions fixed in GCC 9.0[1].
-
-[1] http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2211
----
- lib/CodeGen/CGOpenMPRuntime.cpp | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
-index 6a0edbe..96c281c 100644
---- a/lib/CodeGen/CGOpenMPRuntime.cpp
-+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
-@@ -6073,7 +6073,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(CodeGenFunction &CGF,
-   // Generate the code for the opening of the data environment. Capture all the
-   // arguments of the runtime call by reference because they are used in the
-   // closing of the region.
--  auto &&BeginThenGen = [&D, &CGF, &BasePointersArray, &PointersArray,
-+  auto &&BeginThenGen = [&D, &BasePointersArray, &PointersArray,
-                          &SizesArray, &MapTypesArray, Device,
-                          &NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
-     // Fill up the arrays with all the mapped variables.
-@@ -6121,7 +6121,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(CodeGenFunction &CGF,
-   };
- 
-   // Generate code for the closing of the data region.
--  auto &&EndThenGen = [&CGF, &BasePointersArray, &PointersArray, &SizesArray,
-+  auto &&EndThenGen = [&BasePointersArray, &PointersArray, &SizesArray,
-                        &MapTypesArray, Device,
-                        &NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
-     assert(BasePointersArray && PointersArray && SizesArray && MapTypesArray &&
-@@ -6188,7 +6188,7 @@ void CGOpenMPRuntime::emitTargetDataStandAloneCall(
-          "Expecting either target enter, exit data, or update directives.");
- 
-   // Generate the code for the opening of the data environment.
--  auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-+  auto &&ThenGen = [&D, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-     // Fill up the arrays with all the mapped variables.
-     MappableExprsHandler::MapValuesArrayTy BasePointers;
-     MappableExprsHandler::MapValuesArrayTy Pointers;
--- 
-2.23.1
-
diff --git a/pkgs/development/compilers/llvm/3.9/clang/default.nix b/pkgs/development/compilers/llvm/3.9/clang/default.nix
deleted file mode 100644
index 1666b3d842d9..000000000000
--- a/pkgs/development/compilers/llvm/3.9/clang/default.nix
+++ /dev/null
@@ -1,85 +0,0 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python }:
-
-let
-  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
-  self = stdenv.mkDerivation {
-    pname = "clang";
-    inherit version;
-
-    src = fetch "cfe" "0qsyyb40iwifhhlx9a3drf8z6ni6zwyk3bvh0kx2gs6yjsxwxi76";
-
-    unpackPhase = ''
-      unpackFile $src
-      mv cfe-${version}.src clang
-      sourceRoot=$PWD/clang
-      unpackFile ${clang-tools-extra_src}
-      mv clang-tools-extra-* $sourceRoot/tools/extra
-    '';
-
-    nativeBuildInputs = [ cmake ];
-
-    buildInputs = [ libxml2 llvm python ];
-
-    cmakeFlags = [
-      "-DCMAKE_CXX_FLAGS=-std=c++11"
-    ] ++
-    # Maybe with compiler-rt this won't be needed?
-    (stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}") ++
-    (stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include");
-
-    patches = [
-      ./purity.patch
-      ./0001-Fix-compilation-w-gcc9.patch
-    ];
-
-    postPatch = ''
-      sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
-      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
-    '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
-    '';
-
-    outputs = [ "out" "lib" "python" ];
-
-    # Clang expects to find LLVMgold in its own prefix
-    # Clang expects to find sanitizer libraries in its own prefix
-    postInstall = ''
-      if [ -e ${llvm}/lib/LLVMgold.so ]; then
-        ln -sv ${llvm}/lib/LLVMgold.so $out/lib
-      fi
-
-      ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
-      ln -sv $out/bin/clang $out/bin/cpp
-
-      # Move libclang to 'lib' output
-      moveToOutput "lib/libclang.*" "$lib"
-      substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
-          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang."
-
-      mkdir -p $python/bin $python/share/clang/
-      mv $out/bin/{git-clang-format,scan-view} $python/bin
-      if [ -e $out/bin/set-xcode-analyzer ]; then
-        mv $out/bin/set-xcode-analyzer $python/bin
-      fi
-      mv $out/share/clang/*.py $python/share/clang
-
-      rm $out/bin/c-index-test
-    '';
-
-    enableParallelBuilding = true;
-
-    passthru = {
-      isClang = true;
-      inherit llvm;
-    } // stdenv.lib.optionalAttrs stdenv.isLinux {
-      inherit gcc;
-    };
-
-    meta = {
-      description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
-      homepage    = http://llvm.org/;
-      license     = stdenv.lib.licenses.ncsa;
-      platforms   = stdenv.lib.platforms.all;
-    };
-  };
-in self
diff --git a/pkgs/development/compilers/llvm/3.9/clang/purity.patch b/pkgs/development/compilers/llvm/3.9/clang/purity.patch
deleted file mode 100644
index f5fb4c73af47..000000000000
--- a/pkgs/development/compilers/llvm/3.9/clang/purity.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/lib/Driver/Tools.cpp	2016-08-25 15:48:05.187553443 +0200
-+++ b/lib/Driver/Tools.cpp	2016-08-25 15:48:47.534468882 +0200
-@@ -9420,13 +9420,6 @@
-   if (!Args.hasArg(options::OPT_static)) {
-     if (Args.hasArg(options::OPT_rdynamic))
-       CmdArgs.push_back("-export-dynamic");
--
--    if (!Args.hasArg(options::OPT_shared)) {
--      const std::string Loader =
--          D.DyldPrefix + ToolChain.getDynamicLinker(Args);
--      CmdArgs.push_back("-dynamic-linker");
--      CmdArgs.push_back(Args.MakeArgString(Loader));
--    }
-   }
- 
-   CmdArgs.push_back("-o");
diff --git a/pkgs/development/compilers/llvm/3.9/default.nix b/pkgs/development/compilers/llvm/3.9/default.nix
deleted file mode 100644
index 752790cdd853..000000000000
--- a/pkgs/development/compilers/llvm/3.9/default.nix
+++ /dev/null
@@ -1,59 +0,0 @@
-{ newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCCWith
-, buildLlvmTools # tools, but from the previous stage, for cross
-, targetLlvmLibraries # libraries, but from the next stage, for cross
-}:
-
-let
-  version = "3.9.1";
-
-  fetch = fetch_v version;
-  fetch_v = ver: name: sha256: fetchurl {
-    url = "https://releases.llvm.org/${version}/${name}-${ver}.src.tar.xz";
-    inherit sha256;
-  };
-
-  compiler-rt_src = fetch "compiler-rt" "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk";
-  clang-tools-extra_src = fetch "clang-tools-extra" "0d9nh7j7brbh9avigcn69dlaihsl9p3cf9s45mw6fxzzvrdvd999";
-
-  tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv isl version fetch; });
-  in {
-    llvm = callPackage ./llvm.nix {
-      inherit compiler-rt_src;
-    };
-
-    clang-unwrapped = callPackage ./clang {
-      inherit clang-tools-extra_src;
-    };
-
-    libclang = tools.clang-unwrapped.lib;
-
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
-
-    libstdcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ libstdcxxHook ];
-    };
-
-    libcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ targetLlvmLibraries.libcxx targetLlvmLibraries.libcxxabi ];
-    };
-
-    lldb = callPackage ./lldb.nix {};
-  });
-
-  libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv isl version fetch; });
-  in {
-
-    stdenv = overrideCC stdenv buildLlvmTools.clang;
-
-    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
-
-    libcxx = callPackage ./libc++ {};
-
-    libcxxabi = callPackage ./libc++abi.nix {};
-  });
-
-in { inherit tools libraries; } // libraries // tools
diff --git a/pkgs/development/compilers/llvm/3.9/libc++/darwin.patch b/pkgs/development/compilers/llvm/3.9/libc++/darwin.patch
deleted file mode 100644
index 6dd756f01cc2..000000000000
--- a/pkgs/development/compilers/llvm/3.9/libc++/darwin.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- libcxx-3.8.0.src.org/lib/CMakeLists.txt	2015-12-16 15:41:05.000000000 -0800
-+++ libcxx-3.8.0.src/lib/CMakeLists.txt	2016-06-17 19:40:00.293394500 -0700
-@@ -94,30 +94,30 @@
-     add_definitions(-D__STRICT_ANSI__)
-     add_link_flags(
-       "-compatibility_version 1"
-       "-current_version 1"
--      "-install_name /usr/lib/libc++.1.dylib"
--      "-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
-+      "-install_name ${LIBCXX_LIBCXXABI_LIB_PATH}/libc++.1.dylib"
-+      "-Wl,-reexport_library,${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
-       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
-       "/usr/lib/libSystem.B.dylib")
-   else()
-     if ( ${CMAKE_OSX_SYSROOT} )
-       list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
-       if (OSX_HAS_ARMV7)
-         set(OSX_RE_EXPORT_LINE
--          "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
-+          "${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
-           "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
-       else()
-         set(OSX_RE_EXPORT_LINE
--          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
-+          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib")
-       endif()
-     else()
--      set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
-+      set(OSX_RE_EXPORT_LINE "${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
-     endif()
- 
-     add_link_flags(
-       "-compatibility_version 1"
--      "-install_name /usr/lib/libc++.1.dylib"
-+      "-install_name ${LIBCXX_LIBCXXABI_LIB_PATH}/libc++.1.dylib"
-       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
-       "${OSX_RE_EXPORT_LINE}"
-       "-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp"
-       "-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/weak.exp")
diff --git a/pkgs/development/compilers/llvm/3.9/libc++/default.nix b/pkgs/development/compilers/llvm/3.9/libc++/default.nix
deleted file mode 100644
index 9d82aa230357..000000000000
--- a/pkgs/development/compilers/llvm/3.9/libc++/default.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ lib, stdenv, fetch, cmake, libcxxabi, fixDarwinDylibNames, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++";
-  inherit version;
-
-  src = fetch "libcxx" "0qbl3afl2p2h87p977lsqr5kykl6cgjpkzczs0g6a3pn53j1bri5";
-
-  postUnpack = ''
-    unpackFile ${libcxxabi.src}
-  '';
-
-  preConfigure = ''
-    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
-    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include")
-  '';
-
-  patches = [
-    # glibc 2.26 fix
-    ./xlocale-glibc-2.26.patch
-  ]
-  ++ lib.optional stdenv.isDarwin ./darwin.patch
-  ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-    ../../libcxx-0001-musl-hacks.patch
-    ../../libcxx-max_align_t.patch
-  ];
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-  cmakeFlags = [
-    "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
-    "-DLIBCXX_LIBCPPABI_VERSION=2"
-    "-DLIBCXX_CXX_ABI=libcxxabi"
-  ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
-
-  enableParallelBuilding = true;
-
-  linkCxxAbi = stdenv.isLinux;
-
-  setupHooks = [
-    ../../../../../build-support/setup-hooks/role.bash
-    ./setup-hook.sh
-  ];
-
-  meta = {
-    homepage = http://libcxx.llvm.org/;
-    description = "A new implementation of the C++ standard library, targeting C++11";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh
deleted file mode 100644
index 6611259165ae..000000000000
--- a/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# See pkgs/build-support/setup-hooks/role.bash
-getHostRole
-
-linkCxxAbi="@linkCxxAbi@"
-export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/3.9/libc++/xlocale-glibc-2.26.patch b/pkgs/development/compilers/llvm/3.9/libc++/xlocale-glibc-2.26.patch
deleted file mode 100644
index 4cc042554c85..000000000000
--- a/pkgs/development/compilers/llvm/3.9/libc++/xlocale-glibc-2.26.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/include/__locale b/include/__locale
-index 7bc701d..ea75c86 100644
---- a/include/__locale
-+++ b/include/__locale
-@@ -34,12 +34,12 @@
- # include <support/solaris/xlocale.h>
- #elif defined(_NEWLIB_VERSION)
- # include <support/newlib/xlocale.h>
--#elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
-+#elif (defined(__APPLE__)      || defined(__FreeBSD__) \
-     || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
- # include <xlocale.h>
- #elif defined(_LIBCPP_HAS_MUSL_LIBC)
- # include <support/musl/xlocale.h>
--#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
-+#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
- 
- #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- #pragma GCC system_header
diff --git a/pkgs/development/compilers/llvm/3.9/libc++abi.nix b/pkgs/development/compilers/llvm/3.9/libc++abi.nix
deleted file mode 100644
index f799199d449f..000000000000
--- a/pkgs/development/compilers/llvm/3.9/libc++abi.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++abi";
-  inherit version;
-
-  src = fetch "libcxxabi" "1qi9q06zanqm8awzq83810avmvi52air6gr9zfip8mbg5viqn3cj";
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
-
-  postUnpack = ''
-    unpackFile ${libcxx.src}
-    unpackFile ${llvm.src}
-    export NIX_CFLAGS_COMPILE+=" -I$PWD/include"
-    export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
-    export TRIPLE=x86_64-apple-darwin
-  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
-  '';
-
-  installPhase = if stdenv.isDarwin
-    then ''
-      for file in lib/*.dylib; do
-        # this should be done in CMake, but having trouble figuring out
-        # the magic combination of necessary CMake variables
-        # if you fancy a try, take a look at
-        # http://www.cmake.org/Wiki/CMake_RPATH_handling
-        install_name_tool -id $out/$file $file
-      done
-      make install
-      install -d 755 $out/include
-      install -m 644 ../include/*.h $out/include
-    ''
-    else ''
-      install -d -m 755 $out/include $out/lib
-      install -m 644 lib/libc++abi.so.1.0 $out/lib
-      install -m 644 ../include/cxxabi.h $out/include
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
-    '';
-
-  meta = {
-    homepage = http://libcxxabi.llvm.org/;
-    description = "A new implementation of low level support for a standard C++ library";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    maintainers = with stdenv.lib.maintainers; [ vlstill ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.9/lldb.nix b/pkgs/development/compilers/llvm/3.9/lldb.nix
deleted file mode 100644
index 1a7c9aeead86..000000000000
--- a/pkgs/development/compilers/llvm/3.9/lldb.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, zlib
-, ncurses
-, swig
-, which
-, libedit
-, llvm
-, clang-unwrapped
-, python
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "lldb";
-  inherit version;
-
-  src = fetch "lldb" "1z30ljmcpp261bjng1i5k3bb9jkrs1cr97z04qs4s3zql6r12cvy";
-
-  postUnpack = ''
-    # Hack around broken standalone build as of 3.8
-    unpackFile ${llvm.src}
-    srcDir="$(ls -d lldb-*.src)"
-    mkdir -p "$srcDir/tools/lib/Support"
-    cp "$(ls -d llvm-*.src)/lib/Support/regex_impl.h" "$srcDir/tools/lib/Support/"
-
-    # Fix up various paths that assume llvm and clang are installed in the same place
-    substituteInPlace $srcDir/cmake/modules/LLDBStandalone.cmake \
-      --replace CheckAtomic $(readlink -f llvm-*.src)/cmake/modules/CheckAtomic.cmake
-    sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
-      $srcDir/cmake/modules/LLDBStandalone.cmake
-    sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
-      $srcDir/cmake/modules/LLDBStandalone.cmake
-    sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
-      $srcDir/cmake/modules/LLDBStandalone.cmake
-  '';
-
-  buildInputs = [ cmake python which swig ncurses zlib libedit llvm ];
-
-  CXXFLAGS = "-fno-rtti";
-  hardeningDisable = [ "format" ];
-
-  cmakeFlags = [
-    "-DLLVM_MAIN_INCLUDE_DIR=${llvm}/include"
-    "-DLLDB_DISABLE_LIBEDIT=1" # https://llvm.org/bugs/show_bug.cgi?id=28898
-  ];
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "A next-generation high-performance debugger";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.9/llvm-outputs.patch b/pkgs/development/compilers/llvm/3.9/llvm-outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/pkgs/development/compilers/llvm/3.9/llvm-outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix
deleted file mode 100644
index 474cfcde9c0b..000000000000
--- a/pkgs/development/compilers/llvm/3.9/llvm.nix
+++ /dev/null
@@ -1,174 +0,0 @@
-{ stdenv
-, fetch
-, fetchpatch
-, perl
-, groff
-, cmake
-, python
-, libffi
-, libbfd
-, libxml2
-, ncurses
-, version
-, zlib
-, compiler-rt_src
-, debugVersion ? false
-, enableSharedLibraries ? (stdenv.buildPlatform == stdenv.hostPlatform)
-, buildPackages
-}:
-
-assert (stdenv.hostPlatform != stdenv.buildPlatform) -> !enableSharedLibraries;
-
-let
-  # Used when creating a versioned symlinks of libLLVM.dylib
-  versionSuffixes = with stdenv.lib;
-    let parts = splitVersion version; in
-    imap (i: _: concatStringsSep "." (take i parts)) parts;
-in
-
-stdenv.mkDerivation {
-  pname = "llvm";
-  inherit version;
-
-  src = fetch "llvm" "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv llvm-${version}.src llvm
-    sourceRoot=$PWD/llvm
-    unpackFile ${compiler-rt_src}
-    mv compiler-rt-* $sourceRoot/projects/compiler-rt
-  '';
-
-  outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
-
-  nativeBuildInputs = [
-    perl
-    cmake
-    python
-  ];
-
-  buildInputs = [
-    groff
-    libxml2
-    libffi
-  ];
-
-  propagatedBuildInputs = [ ncurses zlib ];
-
-  patches = [
-    # fix output of llvm-config (fixed in llvm 4.0)
-    (fetchpatch {
-      url = https://github.com/llvm-mirror/llvm/commit/5340b5b3d970069aebf3dde49d8964583742e01a.patch;
-      sha256 = "095f8knplwqbc2p7rad1kq8633i34qynni9jna93an7kyc80wdxl";
-   })
-   ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-     ../TLI-musl.patch
-     ../dynamiclibrary-musl.patch
-   ];
-
-  postPatch = ""
-  + ''
-    patch -p1 --reverse < ${fetchpatch {
-      name = "fix-red-icons.diff"; # https://bugs.freedesktop.org/show_bug.cgi?id=99078
-      url = https://github.com/llvm-mirror/llvm/commit/c280d74837d8.diff;
-      sha256 = "11sq86spw41v72f676igksapdlsgh7fiqp5qkkmgfj0ndqcn9skf";
-    }}
-  ''
-  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
-  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
-  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
-  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
-  # a flag and turn the flag off during the stdenv build. I realize that this LLVM isn't used in the stdenv but I want to
-  # keep it consistent with 4.0. We really shouldn't be copying and pasting all this code around...
-  + stdenv.lib.optionalString stdenv.isDarwin ''
-    substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
-      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
-
-    substituteInPlace CMakeLists.txt \
-      --replace 'set(CMAKE_INSTALL_NAME_DIR "@rpath")' "set(CMAKE_INSTALL_NAME_DIR "$lib/lib")" \
-      --replace 'set(CMAKE_INSTALL_RPATH "@executable_path/../lib")' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + stdenv.lib.optionalString (enableSharedLibraries) ''
-    substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
-    patch -p1 < ./llvm-outputs.patch
-  ''
-  + ''
-    (
-      cd projects/compiler-rt
-      patch -p1 < ${
-        fetchpatch {
-          name = "sigaltstack.patch"; # for glibc-2.26
-          url = https://github.com/llvm-mirror/compiler-rt/commit/8a5e425a68d.diff;
-          sha256 = "0h4y5vl74qaa7dl54b1fcyqalvlpd8zban2d1jxfkxpzyi7m8ifi";
-        }
-      }
-      substituteInPlace lib/esan/esan_sideline_linux.cpp \
-        --replace 'struct sigaltstack' 'stack_t'
-    )
-  '';
-
-  # hacky fix: created binaries need to be run before installation
-  preBuild = ''
-    mkdir -p $out/
-    ln -sv $PWD/lib $out
-  '';
-
-  cmakeFlags = with stdenv; [
-    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
-    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
-    "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
-    "-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code
-
-    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
-  ] ++ stdenv.lib.optional enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
-  ] ++ stdenv.lib.optional (!isDarwin)
-    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
-    ++ stdenv.lib.optionals (isDarwin) [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DCAN_TARGET_i386=false"
-  ] ++ stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
-    "-DCMAKE_CROSSCOMPILING=True"
-    "-DLLVM_TABLEGEN=${buildPackages.llvmPackages_39.llvm}/bin/llvm-tblgen"
-  ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-    # Not yet supported
-    "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
-    "-DCOMPILER_RT_BUILD_XRAY=OFF"
-
-  ];
-
-  postBuild = ''
-    rm -fR $out
-  '';
-
-  postInstall = ""
-  + stdenv.lib.optionalString (enableSharedLibraries) ''
-    moveToOutput "lib/libLLVM-*" "$lib"
-    moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
-    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
-  ''
-  + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
-    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
-    ${stdenv.lib.concatMapStringsSep "\n" (v: ''
-      ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
-    '') versionSuffixes}
-  '';
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "Collection of modular and reusable compiler and toolchain technologies";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    maintainers = with stdenv.lib.maintainers; [ lovek323 raskin ];
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch b/pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch
deleted file mode 100644
index ea9342574087..000000000000
--- a/pkgs/development/compilers/llvm/4/clang/0001-Fix-compilation-w-gcc9.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From a2af0b02eba35d0670e3e442ff7c61b3e2304edd Mon Sep 17 00:00:00 2001
-From: Maximilian Bosch <maximilian@mbosch.me>
-Date: Mon, 30 Dec 2019 02:11:35 +0100
-Subject: [PATCH] Fix compilation w/gcc9
-
-Build broken with the following errors:
-
-```
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6275:24: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6275 |       CodeGenFunction &CGF, PrePostActionTy &) {
-clang> |       ~~~~~~~~~~~~~~~~~^~~
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6321:62: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6321 |   auto &&EndThenGen = [&CGF, Device, &Info](CodeGenFunction &CGF,
-clang> |                                             ~~~~~~~~~~~~~~~~~^~~
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
-clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6400:56: error: lambda parameter 'CGF' previously declared as a capture
-clang> 6400 |   auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-clang> |                                       ~~~~~~~~~~~~~~~~~^~~
-```
----
- lib/CodeGen/CGOpenMPRuntime.cpp | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
-index 4025217..40a73ef 100644
---- a/lib/CodeGen/CGOpenMPRuntime.cpp
-+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
-@@ -6271,7 +6271,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(
-   // Generate the code for the opening of the data environment. Capture all the
-   // arguments of the runtime call by reference because they are used in the
-   // closing of the region.
--  auto &&BeginThenGen = [&D, &CGF, Device, &Info, &CodeGen, &NoPrivAction](
-+  auto &&BeginThenGen = [&D, Device, &Info, &CodeGen, &NoPrivAction](
-       CodeGenFunction &CGF, PrePostActionTy &) {
-     // Fill up the arrays with all the mapped variables.
-     MappableExprsHandler::MapBaseValuesArrayTy BasePointers;
-@@ -6318,7 +6318,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(
-   };
- 
-   // Generate code for the closing of the data region.
--  auto &&EndThenGen = [&CGF, Device, &Info](CodeGenFunction &CGF,
-+  auto &&EndThenGen = [Device, &Info](CodeGenFunction &CGF,
-                                             PrePostActionTy &) {
-     assert(Info.isValid() && "Invalid data environment closing arguments.");
- 
-@@ -6397,7 +6397,7 @@ void CGOpenMPRuntime::emitTargetDataStandAloneCall(
-          "Expecting either target enter, exit data, or update directives.");
- 
-   // Generate the code for the opening of the data environment.
--  auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-+  auto &&ThenGen = [&D, Device](CodeGenFunction &CGF, PrePostActionTy &) {
-     // Fill up the arrays with all the mapped variables.
-     MappableExprsHandler::MapBaseValuesArrayTy BasePointers;
-     MappableExprsHandler::MapValuesArrayTy Pointers;
--- 
-2.23.1
-
diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix
deleted file mode 100644
index a90fbe6ae837..000000000000
--- a/pkgs/development/compilers/llvm/4/clang/default.nix
+++ /dev/null
@@ -1,116 +0,0 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, release_version, clang-tools-extra_src, python
-, fixDarwinDylibNames
-, enableManpages ? false
-}:
-
-let
-  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
-  self = stdenv.mkDerivation ({
-    pname = "clang";
-    inherit version;
-
-    src = fetch "cfe" "16vnv3msnvx33dydd17k2cq0icndi1a06bg5vcxkrhjjb1rqlwv1";
-
-    unpackPhase = ''
-      unpackFile $src
-      mv cfe-${version}* clang
-      sourceRoot=$PWD/clang
-      unpackFile ${clang-tools-extra_src}
-      mv clang-tools-extra-* $sourceRoot/tools/extra
-    '';
-
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
-
-    buildInputs = [ libxml2 llvm ]
-      ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-    cmakeFlags = [
-      "-DCMAKE_CXX_FLAGS=-std=c++11"
-    ] ++ stdenv.lib.optionals enableManpages [
-      "-DCLANG_INCLUDE_DOCS=ON"
-      "-DLLVM_ENABLE_SPHINX=ON"
-      "-DSPHINX_OUTPUT_MAN=ON"
-      "-DSPHINX_OUTPUT_HTML=OFF"
-      "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
-    ]
-    # Maybe with compiler-rt this won't be needed?
-    ++ stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}"
-    ++ stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include";
-
-    patches = [
-      ./purity.patch
-      ./0001-Fix-compilation-w-gcc9.patch
-    ];
-
-    postPatch = ''
-      sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
-      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
-
-      # Patch for standalone doc building
-      sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
-    '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
-    '';
-
-    outputs = [ "out" "lib" "python" ];
-
-    # Clang expects to find LLVMgold in its own prefix
-    # Clang expects to find sanitizer libraries in its own prefix
-    postInstall = ''
-      if [ -e ${llvm}/lib/LLVMgold.so ]; then
-        ln -sv ${llvm}/lib/LLVMgold.so $out/lib
-      fi
-
-      ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/
-      ln -sv $out/bin/clang $out/bin/cpp
-
-      # Move libclang to 'lib' output
-      moveToOutput "lib/libclang.*" "$lib"
-      substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
-          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang."
-
-      mkdir -p $python/bin $python/share/clang/
-      mv $out/bin/{git-clang-format,scan-view} $python/bin
-      if [ -e $out/bin/set-xcode-analyzer ]; then
-        mv $out/bin/set-xcode-analyzer $python/bin
-      fi
-      mv $out/share/clang/*.py $python/share/clang
-      rm $out/bin/c-index-test
-    '';
-
-    enableParallelBuilding = true;
-
-    passthru = {
-      isClang = true;
-      inherit llvm;
-    } // stdenv.lib.optionalAttrs stdenv.isLinux {
-      inherit gcc;
-    };
-
-    meta = {
-      description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
-      homepage    = http://llvm.org/;
-      license     = stdenv.lib.licenses.ncsa;
-      platforms   = stdenv.lib.platforms.all;
-    };
-  } // stdenv.lib.optionalAttrs enableManpages {
-    pname = "clang-manpages";
-
-    buildPhase = ''
-      make docs-clang-man
-    '';
-
-    installPhase = ''
-      mkdir -p $out/share/man/man1
-      # Manually install clang manpage
-      cp docs/man/*.1 $out/share/man/man1/
-    '';
-
-    outputs = [ "out" ];
-
-    doCheck = false;
-
-    meta.description = "man page for Clang ${version}";
-  });
-in self
diff --git a/pkgs/development/compilers/llvm/4/clang/purity.patch b/pkgs/development/compilers/llvm/4/clang/purity.patch
deleted file mode 100644
index f5fb4c73af47..000000000000
--- a/pkgs/development/compilers/llvm/4/clang/purity.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/lib/Driver/Tools.cpp	2016-08-25 15:48:05.187553443 +0200
-+++ b/lib/Driver/Tools.cpp	2016-08-25 15:48:47.534468882 +0200
-@@ -9420,13 +9420,6 @@
-   if (!Args.hasArg(options::OPT_static)) {
-     if (Args.hasArg(options::OPT_rdynamic))
-       CmdArgs.push_back("-export-dynamic");
--
--    if (!Args.hasArg(options::OPT_shared)) {
--      const std::string Loader =
--          D.DyldPrefix + ToolChain.getDynamicLinker(Args);
--      CmdArgs.push_back("-dynamic-linker");
--      CmdArgs.push_back(Args.MakeArgString(Loader));
--    }
-   }
- 
-   CmdArgs.push_back("-o");
diff --git a/pkgs/development/compilers/llvm/4/cmdline-help.patch b/pkgs/development/compilers/llvm/4/cmdline-help.patch
deleted file mode 100644
index a693719c2cfa..000000000000
--- a/pkgs/development/compilers/llvm/4/cmdline-help.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From c7a9aa3a697c81432786a5583bf973771c7be15e Mon Sep 17 00:00:00 2001
-From: Don Hinton <hintonda@gmail.com>
-Date: Wed, 12 Jul 2017 01:15:46 +0000
-Subject: [PATCH] Fix minor typo introduced in r276404
-
-Summary:
-A space was added between '-' and 'help' when emitting help output.
-
-See https://reviews.llvm.org/D22621 for details.
-
-Reviewers: MaggieYi, vsk
-
-Reviewed By: vsk
-
-Subscribers: llvm-commits
-
-Differential Revision: https://reviews.llvm.org/D35283
-
-git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307745 91177308-0d34-0410-b5e6-96231b3b80d8
----
- lib/Support/CommandLine.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
-index 3889902eea5..79defa5c36c 100644
---- a/lib/Support/CommandLine.cpp
-+++ b/lib/Support/CommandLine.cpp
-@@ -1236,7 +1236,7 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
-              << ": Not enough positional command line arguments specified!\n"
-              << "Must specify at least " << NumPositionalRequired
-              << " positional argument" << (NumPositionalRequired > 1 ? "s" : "")
--             << ": See: " << argv[0] << " - help\n";
-+             << ": See: " << argv[0] << " -help\n";
-     }
- 
-     ErrorParsing = true;
--- 
-2.14.0
-
diff --git a/pkgs/development/compilers/llvm/4/default.nix b/pkgs/development/compilers/llvm/4/default.nix
deleted file mode 100644
index 9651dbb72f4d..000000000000
--- a/pkgs/development/compilers/llvm/4/default.nix
+++ /dev/null
@@ -1,74 +0,0 @@
-{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
-, buildLlvmTools # tools, but from the previous stage, for cross
-, targetLlvmLibraries # libraries, but from the next stage, for cross
-}:
-
-let
-  release_version = "4.0.1";
-  version = release_version; # differentiating these is important for rc's
-
-  fetch = name: sha256: fetchurl {
-    url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
-    inherit sha256;
-  };
-
-  compiler-rt_src = fetch "compiler-rt" "0h5lpv1z554szi4r4blbskhwrkd78ir50v3ng8xvk1s86fa7gj53";
-  clang-tools-extra_src = fetch "clang-tools-extra" "1dhmp7ccfpr42bmvk3kp37ngjpf3a9m5d4kkpsn7d00hzi7fdl9m";
-
-  tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
-  in {
-
-    llvm = callPackage ./llvm.nix {
-      inherit compiler-rt_src;
-    };
-    clang-unwrapped = callPackage ./clang {
-      inherit clang-tools-extra_src;
-    };
-
-    llvm-manpages = lowPrio (tools.llvm.override {
-      enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
-    });
-
-    clang-manpages = lowPrio (tools.clang-unwrapped.override {
-      enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
-    });
-
-    libclang = tools.clang-unwrapped.lib;
-
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
-
-    libstdcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ libstdcxxHook ];
-    };
-
-    libcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ targetLlvmLibraries.libcxx targetLlvmLibraries.libcxxabi ];
-    };
-
-    lld = callPackage ./lld.nix {};
-
-    lldb = callPackage ./lldb.nix {};
-  });
-
-  libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
-  in {
-
-    stdenv = overrideCC stdenv buildLlvmTools.clang;
-
-    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
-
-    libcxx = callPackage ./libc++ {};
-
-    libcxxabi = callPackage ./libc++abi.nix {};
-
-    openmp = callPackage ./openmp.nix {};
-  });
-
-in { inherit tools libraries; } // libraries // tools
diff --git a/pkgs/development/compilers/llvm/4/fix-gcc9.patch b/pkgs/development/compilers/llvm/4/fix-gcc9.patch
deleted file mode 100644
index 8ea5ca970855..000000000000
--- a/pkgs/development/compilers/llvm/4/fix-gcc9.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-diff --git a/lib/Target/Mips/MipsFastISel.cpp b/lib/Target/Mips/MipsFastISel.cpp
-index f79cb0e6..c6279046 100644
---- a/lib/Target/Mips/MipsFastISel.cpp
-+++ b/lib/Target/Mips/MipsFastISel.cpp
-@@ -32,6 +32,7 @@
- #include "llvm/MC/MCSymbol.h"
- #include "llvm/Target/TargetInstrInfo.h"
- #include "llvm/Support/Debug.h"
-+#include <array>
- 
- #define DEBUG_TYPE "mips-fastisel"
- 
-@@ -1268,13 +1269,13 @@ bool MipsFastISel::fastLowerArguments() {
-     return false;
-   }
- 
--  const ArrayRef<MCPhysReg> GPR32ArgRegs = {Mips::A0, Mips::A1, Mips::A2,
--                                            Mips::A3};
--  const ArrayRef<MCPhysReg> FGR32ArgRegs = {Mips::F12, Mips::F14};
--  const ArrayRef<MCPhysReg> AFGR64ArgRegs = {Mips::D6, Mips::D7};
--  ArrayRef<MCPhysReg>::iterator NextGPR32 = GPR32ArgRegs.begin();
--  ArrayRef<MCPhysReg>::iterator NextFGR32 = FGR32ArgRegs.begin();
--  ArrayRef<MCPhysReg>::iterator NextAFGR64 = AFGR64ArgRegs.begin();
-+   std::array<MCPhysReg, 4> GPR32ArgRegs = {{Mips::A0, Mips::A1, Mips::A2,
-+                                            Mips::A3}};
-+   std::array<MCPhysReg, 2> FGR32ArgRegs = {{Mips::F12, Mips::F14}};
-+   std::array<MCPhysReg, 2> AFGR64ArgRegs = {{Mips::D6, Mips::D7}};
-+   auto NextGPR32 = GPR32ArgRegs.begin();
-+   auto NextFGR32 = FGR32ArgRegs.begin();
-+   auto NextAFGR64 = AFGR64ArgRegs.begin();
- 
-   struct AllocatedReg {
-     const TargetRegisterClass *RC;
diff --git a/pkgs/development/compilers/llvm/4/libc++/default.nix b/pkgs/development/compilers/llvm/4/libc++/default.nix
deleted file mode 100644
index 0213741e3e06..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/default.nix
+++ /dev/null
@@ -1,59 +0,0 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++";
-  inherit version;
-
-  src = fetch "libcxx" "0k6cmjcxnp2pyl8xwy1wkyyckkmdrjddim94yf1gzjbjy9qi22jj";
-
-  postUnpack = ''
-    unpackFile ${libcxxabi.src}
-    export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
-  '';
-
-  patches = [
-    # https://github.com/llvm-mirror/libcxx/commit/bcc92d75df0274b9593ebd097fcae60494e3bffc
-    ./pthread_mach_thread_np.patch
-    # glibc 2.26 fix
-    ./xlocale-glibc-2.26.patch
-  ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-    ../../libcxx-0001-musl-hacks.patch
-    ../../libcxx-max_align_t.patch
-  ];
-
-  prePatch = ''
-    substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
-  '';
-
-  preConfigure = ''
-    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
-    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
-  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-    patchShebangs utils/cat_files.py
-  '';
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
-
-  buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-  cmakeFlags = [
-    "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
-    "-DLIBCXX_LIBCPPABI_VERSION=2"
-    "-DLIBCXX_CXX_ABI=libcxxabi"
-  ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
-
-  enableParallelBuilding = true;
-
-  linkCxxAbi = stdenv.isLinux;
-
-  setupHooks = [
-    ../../../../../build-support/setup-hooks/role.bash
-    ./setup-hook.sh
-  ];
-
-  meta = {
-    homepage = http://libcxx.llvm.org/;
-    description = "A new implementation of the C++ standard library, targeting C++11";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch b/pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch
deleted file mode 100644
index 8c71f1b815db..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/pthread_mach_thread_np.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From bcc92d75df0274b9593ebd097fcae60494e3bffc Mon Sep 17 00:00:00 2001
-From: Asiri Rathnayake <asiri.rathnayake@arm.com>
-Date: Thu, 26 Jan 2017 10:40:17 +0000
-Subject: [PATCH] Fix chromium build (libcxx)
-
-Remove the reference to pthread_mach_thread_np() in libcxx headers.
-
-git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293167 91177308-0d34-0410-b5e6-96231b3b80d8
----
- include/__threading_support | 11 -----------
- 1 file changed, 11 deletions(-)
-
-diff --git a/include/__threading_support b/include/__threading_support
-index 13ab769..dfe7fe1 100644
---- a/include/__threading_support
-+++ b/include/__threading_support
-@@ -149,11 +149,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-                           void (*init_routine)(void));
- 
- // Thread id
--#if defined(__APPLE__) && !defined(__arm__)
--_LIBCPP_THREAD_ABI_VISIBILITY
--mach_port_t __libcpp_thread_get_port();
--#endif
--
- _LIBCPP_THREAD_ABI_VISIBILITY
- bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
- 
-@@ -297,12 +292,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
- }
- 
- // Thread id
--#if defined(__APPLE__) && !defined(__arm__)
--mach_port_t __libcpp_thread_get_port() {
--    return pthread_mach_thread_np(pthread_self());
--}
--#endif
--
- // Returns non-zero if the thread ids are equal, otherwise 0
- bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
- {
diff --git a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
deleted file mode 100644
index 6611259165ae..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# See pkgs/build-support/setup-hooks/role.bash
-getHostRole
-
-linkCxxAbi="@linkCxxAbi@"
-export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch b/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch
deleted file mode 100644
index e411d85066b4..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/include/__locale b/include/__locale
-index f4882de..29443b4 100644
---- a/include/__locale
-+++ b/include/__locale
-@@ -34,12 +34,12 @@
- # include <support/solaris/xlocale.h>
- #elif defined(_NEWLIB_VERSION)
- # include <support/newlib/xlocale.h>
--#elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
-+#elif (defined(__APPLE__)      || defined(__FreeBSD__) \
-     || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
- # include <xlocale.h>
- #elif defined(_LIBCPP_HAS_MUSL_LIBC)
- # include <support/musl/xlocale.h>
--#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
-+#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
- 
- #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- #pragma GCC system_header
diff --git a/pkgs/development/compilers/llvm/4/libc++abi.nix b/pkgs/development/compilers/llvm/4/libc++abi.nix
deleted file mode 100644
index 8e36c5ad53a6..000000000000
--- a/pkgs/development/compilers/llvm/4/libc++abi.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++abi";
-  inherit version;
-
-  src = fetch "libcxxabi" "0cqvzallxh0nwiijsf6i4d5ds9m5ijfzywg7376ncv50i64if24g";
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
-
-  postUnpack = ''
-    unpackFile ${libcxx.src}
-    unpackFile ${llvm.src}
-    export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
-    export TRIPLE=x86_64-apple-darwin
-  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
-  '';
-
-  installPhase = if stdenv.isDarwin
-    then ''
-      for file in lib/*.dylib; do
-        # this should be done in CMake, but having trouble figuring out
-        # the magic combination of necessary CMake variables
-        # if you fancy a try, take a look at
-        # http://www.cmake.org/Wiki/CMake_RPATH_handling
-        install_name_tool -id $out/$file $file
-      done
-      make install
-      install -d 755 $out/include
-      install -m 644 ../include/*.h $out/include
-    ''
-    else ''
-      install -d -m 755 $out/include $out/lib
-      install -m 644 lib/libc++abi.a $out/lib
-      install -m 644 lib/libc++abi.so.1.0 $out/lib
-      install -m 644 ../include/cxxabi.h $out/include
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
-    '';
-
-  meta = {
-    homepage = http://libcxxabi.llvm.org/;
-    description = "A new implementation of low level support for a standard C++ library";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    maintainers = with stdenv.lib.maintainers; [ vlstill ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/lld.nix b/pkgs/development/compilers/llvm/4/lld.nix
deleted file mode 100644
index 3ab56677d72f..000000000000
--- a/pkgs/development/compilers/llvm/4/lld.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, llvm
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "lld";
-  inherit version;
-
-  src = fetch "lld" "1v9nkpr158j4yd4zmi6rpnfxkp78r1fapr8wji9s6v176gji1kk3";
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ llvm ];
-
-  outputs = [ "out" "dev" ];
-
-  enableParallelBuilding = true;
-
-  postInstall = ''
-    moveToOutput include "$dev"
-    moveToOutput lib "$dev"
-  '';
-
-  meta = {
-    description = "The LLVM Linker";
-    homepage    = http://lld.llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-    badPlatforms = [ "x86_64-darwin" ];
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/lldb-libedit.patch b/pkgs/development/compilers/llvm/4/lldb-libedit.patch
deleted file mode 100644
index 73459ce6c864..000000000000
--- a/pkgs/development/compilers/llvm/4/lldb-libedit.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 94764369222a8e6c65420a6981d7f179a18a5417 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Thu, 25 May 2017 15:03:42 -0500
-Subject: [PATCH] EditLine.h: libedit supports wide chars on NixOS
-
----
- include/lldb/Host/Editline.h | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h
-index faed373bc..b248cdee1 100644
---- a/include/lldb/Host/Editline.h
-+++ b/include/lldb/Host/Editline.h
-@@ -43,12 +43,9 @@
- // will only be
- // used in cases where this is true.  This is a compile time dependecy, for now
- // selected per target Platform
--#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
-+// (libedit on NixOS is always wide-char capable)
- #define LLDB_EDITLINE_USE_WCHAR 1
- #include <codecvt>
--#else
--#define LLDB_EDITLINE_USE_WCHAR 0
--#endif
- 
- #include "lldb/Host/ConnectionFileDescriptor.h"
- #include "lldb/lldb-private.h"
--- 
-2.13.0
-
diff --git a/pkgs/development/compilers/llvm/4/lldb.nix b/pkgs/development/compilers/llvm/4/lldb.nix
deleted file mode 100644
index 8adf11abddda..000000000000
--- a/pkgs/development/compilers/llvm/4/lldb.nix
+++ /dev/null
@@ -1,63 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, zlib
-, ncurses
-, swig
-, which
-, libedit
-, libxml2
-, llvm
-, clang-unwrapped
-, python
-, version
-, darwin
-}:
-
-stdenv.mkDerivation {
-  pname = "lldb";
-  inherit version;
-
-  src = fetch "lldb" "0yy43a27zx3r51b6gkv3v2mdiqcq3mf0ngki47ya0i30v3gx4cl4";
-
-  patches = [ ./lldb-libedit.patch ];
-  postPatch = ''
-    # Fix up various paths that assume llvm and clang are installed in the same place
-    sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
-      cmake/modules/LLDBStandalone.cmake
-    sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
-      cmake/modules/LLDBStandalone.cmake
-    sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
-      cmake/modules/LLDBStandalone.cmake
-  '';
-
-  nativeBuildInputs = [ cmake python which swig ];
-  buildInputs = [ ncurses zlib libedit libxml2 llvm ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
-
-  CXXFLAGS = "-fno-rtti";
-  hardeningDisable = [ "format" ];
-
-  cmakeFlags = [
-    "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
-  ];
-
-  # Add missing include to fix error when using std::bind
-  prePatch = ''
-    sed -i -e '30i#include <functional>' include/lldb/Utility/TaskPool.h
-  '';
-
-  enableParallelBuilding = true;
-
-  postInstall = ''
-    mkdir -p $out/share/man/man1
-    cp ../docs/lldb.1 $out/share/man/man1/
-  '';
-
-  meta = with stdenv.lib; {
-    description = "A next-generation high-performance debugger";
-    homepage    = http://llvm.org/;
-    license     = licenses.ncsa;
-    platforms   = platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/llvm-outputs.patch b/pkgs/development/compilers/llvm/4/llvm-outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/pkgs/development/compilers/llvm/4/llvm-outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix
deleted file mode 100644
index 317a5ea06f48..000000000000
--- a/pkgs/development/compilers/llvm/4/llvm.nix
+++ /dev/null
@@ -1,194 +0,0 @@
-{ stdenv
-, fetch
-, fetchpatch
-, cmake
-, python
-, libffi
-, libbfd
-, libxml2
-, ncurses
-, version
-, release_version
-, zlib
-, compiler-rt_src
-, debugVersion ? false
-, enableManpages ? false
-, enableSharedLibraries ? !enableManpages
-}:
-
-let
-  # Used when creating a versioned symlinks of libLLVM.dylib
-  versionSuffixes = with stdenv.lib;
-    let parts = splitVersion release_version; in
-    imap (i: _: concatStringsSep "." (take i parts)) parts;
-in
-
-stdenv.mkDerivation ({
-  pname = "llvm";
-  inherit version;
-
-  src = fetch "llvm" "0l9bf7kdwhlj0kq1hawpyxhna1062z3h7qcz2y8nfl9dz2qksy6s";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv llvm-${version}* llvm
-    sourceRoot=$PWD/llvm
-    unpackFile ${compiler-rt_src}
-    mv compiler-rt-* $sourceRoot/projects/compiler-rt
-  '';
-
-  outputs = [ "out" ]
-    ++ stdenv.lib.optional enableSharedLibraries "lib";
-
-  nativeBuildInputs = [ cmake python ]
-    ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
-
-  buildInputs = [ libxml2 libffi ];
-
-  propagatedBuildInputs = [ ncurses zlib ];
-
-  patches = [
-    (fetchpatch {
-      name = "0001-Fix-return-type-in-ORC-readMem-client-interface.patch";
-      url = "https://bugzilla.redhat.com/attachment.cgi?id=1389687";
-      sha256 = "0ga2123aclq3x9w72d0rm0az12m8c1i4r1106vh701hf4cghgbch";
-    })
-    ./fix-gcc9.patch
-    (fetchpatch {
-      name = "llvm4-avoid-undefined-behavior-in-unittest.patch";
-      url = "https://aur.archlinux.org/cgit/aur.git/plain/D32089-Avoid-undefined-behavior-in-unittest.patch?h=llvm40&id=f459b0bad8aa3b94bc2733d79d176071a32846a6";
-      sha256 = "0x5q6a8lk6xg4ns4qh75fxvvmfnifwvyrq17ck85q8c0753i1irf";
-      extraPrefix = "";
-    })
-  ];
-
-  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
-  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
-  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
-  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
-  # a flag and turn the flag off during the stdenv build.
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
-    substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
-      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
-
-    substituteInPlace cmake/modules/AddLLVM.cmake \
-      --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
-      --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + stdenv.lib.optionalString (enableSharedLibraries) ''
-    substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
-    patch -p1 < ./llvm-outputs.patch
-  ''
-  + ''
-    (
-      cd projects/compiler-rt
-      patch -p1 < ${
-        fetchpatch {
-          name = "sigaltstack.patch"; # for glibc-2.26
-          url = https://github.com/llvm-mirror/compiler-rt/commit/8a5e425a68d.diff;
-          sha256 = "0h4y5vl74qaa7dl54b1fcyqalvlpd8zban2d1jxfkxpzyi7m8ifi";
-        }
-      }
-      substituteInPlace lib/esan/esan_sideline_linux.cpp \
-        --replace 'struct sigaltstack' 'stack_t'
-    )
-  '' + # Fix extra space printed in commandline help sometimes, "- help"
-  ''
-    patch -p1 -i ${./cmdline-help.patch}
-  '' + stdenv.lib.optionalString stdenv.isAarch64 ''
-    patch -p0 < ${../aarch64.patch}
-  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -i ${../TLI-musl.patch}
-    patch -p1 -i ${../dynamiclibrary-musl.patch}
-    patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt
-  '';
-
-  # hacky fix: created binaries need to be run before installation
-  preBuild = ''
-    mkdir -p $out/
-    ln -sv $PWD/lib $out
-  '';
-
-  cmakeFlags = with stdenv; [
-    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
-    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
-    "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
-    "-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code
-
-    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
-  ]
-  ++ stdenv.lib.optional enableSharedLibraries
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
-  ++ stdenv.lib.optionals enableManpages [
-    "-DLLVM_BUILD_DOCS=ON"
-    "-DLLVM_ENABLE_SPHINX=ON"
-    "-DSPHINX_OUTPUT_MAN=ON"
-    "-DSPHINX_OUTPUT_HTML=OFF"
-    "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
-  ]
-  ++ stdenv.lib.optional (!isDarwin)
-    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
-  ++ stdenv.lib.optionals (isDarwin) [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DCAN_TARGET_i386=false"
-  ];
-
-  postBuild = ''
-    rm -fR $out
-  '';
-
-  preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
-  '';
-
-  postInstall = stdenv.lib.optionalString enableSharedLibraries ''
-    moveToOutput "lib/libLLVM-*" "$lib"
-    moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
-    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
-  ''
-  + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
-    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
-    ${stdenv.lib.concatMapStringsSep "\n" (v: ''
-      ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
-    '') versionSuffixes}
-  '';
-
-  doCheck = stdenv.isLinux && (!stdenv.isi686);
-
-  checkTarget = "check-all";
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "Collection of modular and reusable compiler and toolchain technologies";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    maintainers = with stdenv.lib.maintainers; [ lovek323 raskin dtzWill ];
-    platforms   = stdenv.lib.platforms.all;
-  };
-} // stdenv.lib.optionalAttrs enableManpages {
-  pname = "llvm-manpages";
-
-  buildPhase = ''
-    make docs-llvm-man
-  '';
-
-  propagatedBuildInputs = [ ];
-
-  installPhase = ''
-    make -C docs install
-  '';
-
-  outputs = [ "out" ];
-
-  doCheck = false;
-
-  meta.description = "man pages for LLVM ${version}";
-})
diff --git a/pkgs/development/compilers/llvm/4/openmp.nix b/pkgs/development/compilers/llvm/4/openmp.nix
deleted file mode 100644
index a69fe286ecc0..000000000000
--- a/pkgs/development/compilers/llvm/4/openmp.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, llvm
-, perl
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "openmp";
-  inherit version;
-
-  src = fetch "openmp" "195dykamd39yhi5az7nqj3ksqhb3wq30l93jnfkxl0061qbknsgc";
-
-  nativeBuildInputs = [ cmake perl ];
-  buildInputs = [ llvm ];
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "Components required to build an executable OpenMP program";
-    homepage    = http://openmp.llvm.org/;
-    license     = stdenv.lib.licenses.mit;
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch b/pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch
deleted file mode 100644
index 5bd858f8ae79..000000000000
--- a/pkgs/development/compilers/llvm/4/sanitizers-nongnu.patch
+++ /dev/null
@@ -1,368 +0,0 @@
-From dac4d3912378069b44340204e5fc6237aa1baf94 Mon Sep 17 00:00:00 2001
-From: Matthias Maier <tamiko@43-1.org>
-Date: Fri, 5 May 2017 17:47:39 +0000
-Subject: [PATCH] Musl patches
-
-Ported to compiler-rt-sanitizers-4.0.0. Taken from
-
-  https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch
----
- lib/asan/asan_linux.cc                             |  4 +--
- lib/interception/interception_linux.cc             |  2 +-
- lib/interception/interception_linux.h              |  2 +-
- lib/msan/msan_linux.cc                             |  2 +-
- .../sanitizer_common_interceptors_ioctl.inc        |  4 +--
- lib/sanitizer_common/sanitizer_common_syscalls.inc |  2 +-
- lib/sanitizer_common/sanitizer_linux_libcdep.cc    | 12 +++----
- lib/sanitizer_common/sanitizer_platform.h          |  7 ++++
- .../sanitizer_platform_interceptors.h              |  2 +-
- .../sanitizer_platform_limits_posix.cc             | 39 +++++++++++++---------
- lib/tsan/rtl/tsan_platform_linux.cc                |  2 +-
- 11 files changed, 46 insertions(+), 32 deletions(-)
-
-diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc
-index c051573dd..e295f6004 100644
---- a/lib/asan/asan_linux.cc
-+++ b/lib/asan/asan_linux.cc
-@@ -39,7 +39,7 @@
- #include <sys/link_elf.h>
- #endif
- 
--#if SANITIZER_ANDROID || SANITIZER_FREEBSD
-+#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_NONGNU
- #include <ucontext.h>
- extern "C" void* _DYNAMIC;
- #else
-@@ -80,7 +80,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) {
-   UNIMPLEMENTED();
- }
- 
--#if SANITIZER_ANDROID
-+#if SANITIZER_ANDROID || SANITIZER_NONGNU
- // FIXME: should we do anything for Android?
- void AsanCheckDynamicRTPrereqs() {}
- void AsanCheckIncompatibleRT() {}
-diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc
-index 6e908ac01..8f23d9adc 100644
---- a/lib/interception/interception_linux.cc
-+++ b/lib/interception/interception_linux.cc
-@@ -24,7 +24,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
-   return real == wrapper;
- }
- 
--#if !defined(__ANDROID__)  // android does not have dlvsym
-+#if !defined(__ANDROID__) && !SANITIZER_NONGNU  // android does not have dlvsym
- void *GetFuncAddrVer(const char *func_name, const char *ver) {
-   return dlvsym(RTLD_NEXT, func_name, ver);
- }
-diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h
-index 27a66c882..3b559a303 100644
---- a/lib/interception/interception_linux.h
-+++ b/lib/interception/interception_linux.h
-@@ -34,7 +34,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver);
-       (::__interception::uptr) & (func),                                   \
-       (::__interception::uptr) & WRAP(func))
- 
--#if !defined(__ANDROID__)  // android does not have dlvsym
-+#if !defined(__ANDROID__) && !SANITIZER_NONGNU  // android does not have dlvsym
- #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
-   (::__interception::real_##func = (func##_f)(                \
-        unsigned long)::__interception::GetFuncAddrVer(#func, symver))
-diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc
-index 0a687f620..0852d97d7 100644
---- a/lib/msan/msan_linux.cc
-+++ b/lib/msan/msan_linux.cc
-@@ -13,7 +13,7 @@
- //===----------------------------------------------------------------------===//
- 
- #include "sanitizer_common/sanitizer_platform.h"
--#if SANITIZER_FREEBSD || SANITIZER_LINUX
-+#if SANITIZER_FREEBSD || SANITIZER_LINUX && !SANITIZER_NONGNU
- 
- #include "msan.h"
- #include "msan_thread.h"
-diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-index 4ed9afedf..64f584e93 100644
---- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-+++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-@@ -100,7 +100,7 @@ static void ioctl_table_fill() {
-   _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz);
- #endif
- 
--#if SANITIZER_LINUX
-+#if SANITIZER_LINUX && !SANITIZER_NONGNU
-   // Conflicting request ids.
-   // _(CDROMAUDIOBUFSIZ, NONE, 0);
-   // _(SNDCTL_TMR_CONTINUE, NONE, 0);
-@@ -361,7 +361,7 @@ static void ioctl_table_fill() {
-   _(VT_WAITACTIVE, NONE, 0);
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
-   _(CYGETDEFTHRESH, WRITE, sizeof(int));
-   _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
-diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc
-index 469c8eb7e..24f87867d 100644
---- a/lib/sanitizer_common/sanitizer_common_syscalls.inc
-+++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc
-@@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) {
-   }
- }
- 
--#if !SANITIZER_ANDROID
-+#if !SANITIZER_ANDROID && !SANITIZER_NONGNU
- PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim,
-                        void *old_rlim) {
-   if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz);
-diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
-index f99f0b594..3a773a94e 100644
---- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc
-+++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
-@@ -152,7 +152,7 @@ bool SanitizerGetThreadName(char *name, int max_len) {
- #endif
- }
- 
--#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO
-+#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU
- static uptr g_tls_size;
- 
- #ifdef __i386__
-@@ -180,11 +180,11 @@ void InitTlsSize() {
- }
- #else
- void InitTlsSize() { }
--#endif  // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO
-+#endif  // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU
- 
- #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \
-     || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__)) \
--    && SANITIZER_LINUX && !SANITIZER_ANDROID
-+    && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- // sizeof(struct pthread) from glibc.
- static atomic_uintptr_t kThreadDescriptorSize;
- 
-@@ -338,7 +338,7 @@ uptr ThreadSelf() {
- 
- #if !SANITIZER_GO
- static void GetTls(uptr *addr, uptr *size) {
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- # if defined(__x86_64__) || defined(__i386__) || defined(__s390__)
-   *addr = ThreadSelf();
-   *size = GetTlsSize();
-@@ -364,7 +364,7 @@ static void GetTls(uptr *addr, uptr *size) {
-     *addr = (uptr) dtv[2];
-     *size = (*addr == 0) ? 0 : ((uptr) segbase[0] - (uptr) dtv[2]);
-   }
--#elif SANITIZER_ANDROID
-+#elif SANITIZER_ANDROID || SANITIZER_NONGNU
-   *addr = 0;
-   *size = 0;
- #else
-@@ -375,7 +375,7 @@ static void GetTls(uptr *addr, uptr *size) {
- 
- #if !SANITIZER_GO
- uptr GetTlsSize() {
--#if SANITIZER_FREEBSD || SANITIZER_ANDROID
-+#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NONGNU
-   uptr addr, size;
-   GetTls(&addr, &size);
-   return size;
-diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h
-index d9a8e8df1..fe01c5744 100644
---- a/lib/sanitizer_common/sanitizer_platform.h
-+++ b/lib/sanitizer_common/sanitizer_platform.h
-@@ -162,6 +162,13 @@
- # define SANITIZER_PPC64V2 0
- #endif
- 
-+
-+#if defined(__linux__) && !defined(__GLIBC__)
-+# define SANITIZER_NONGNU 1
-+#else
-+# define SANITIZER_NONGNU 0
-+#endif
-+
- // By default we allow to use SizeClassAllocator64 on 64-bit platform.
- // But in some cases (e.g. AArch64's 39-bit address space) SizeClassAllocator64
- // does not work well and we need to fallback to SizeClassAllocator32.
-diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h
-index 62875d11a..212e6e882 100644
---- a/lib/sanitizer_common/sanitizer_platform_interceptors.h
-+++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h
-@@ -23,7 +23,7 @@
- # define SI_NOT_WINDOWS 0
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- # define SI_LINUX_NOT_ANDROID 1
- #else
- # define SI_LINUX_NOT_ANDROID 0
-diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
-index 683f019d7..fd4880962 100644
---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
-+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
-@@ -14,6 +14,8 @@
- 
- #include "sanitizer_platform.h"
- 
-+#define _LINUX_SYSINFO_H
-+
- #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC
- // Tests in this file assume that off_t-dependent data structures match the
- // libc ABI. For example, struct dirent here is what readdir() function (as
-@@ -139,12 +141,14 @@ typedef struct user_fpregs elf_fpregset_t;
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
- #include <glob.h>
--#include <obstack.h>
-+#  if !SANITIZER_NONGNU
-+#    include <obstack.h>
-+#  endif
- #include <mqueue.h>
--#include <net/if_ppp.h>
--#include <netax25/ax25.h>
--#include <netipx/ipx.h>
--#include <netrom/netrom.h>
-+#include <linux/if_ppp.h>
-+#include <linux/ax25.h>
-+#include <linux/ipx.h>
-+#include <linux/netrom.h>
- #if HAVE_RPC_XDR_H
- # include <rpc/xdr.h>
- #elif HAVE_TIRPC_RPC_XDR_H
-@@ -160,7 +164,8 @@ typedef struct user_fpregs elf_fpregset_t;
- # include <sys/procfs.h>
- #endif
- #include <sys/user.h>
--#include <sys/ustat.h>
-+// #include <sys/ustat.h>
-+#include <sys/statfs.h>
- #include <linux/cyclades.h>
- #include <linux/if_eql.h>
- #include <linux/if_plip.h>
-@@ -252,7 +257,7 @@ namespace __sanitizer {
-   unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   unsigned struct_ustat_sz = sizeof(struct ustat);
-   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
-   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
-@@ -310,7 +315,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr));
- unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
- #endif
- 
--#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
-+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   int glob_nomatch = GLOB_NOMATCH;
-   int glob_altdirfunc = GLOB_ALTDIRFUNC;
- #endif
-@@ -404,7 +409,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned struct_termios_sz = sizeof(struct termios);
-   unsigned struct_winsize_sz = sizeof(struct winsize);
- 
--#if SANITIZER_LINUX
-+#if SANITIZER_LINUX && !SANITIZER_NONGNU
-   unsigned struct_arpreq_sz = sizeof(struct arpreq);
-   unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf);
-   unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession);
-@@ -454,7 +459,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned struct_vt_mode_sz = sizeof(struct vt_mode);
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
-   unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
- #if EV_VERSION > (0x010000)
-@@ -822,7 +827,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE;
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
-   unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
-   unsigned IOCTL_CYGETMON = CYGETMON;
-@@ -985,7 +990,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr);
- CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
- #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
- 
--#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
-+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- CHECK_TYPE_SIZE(glob_t);
- CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
- CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
-@@ -1019,6 +1024,7 @@ CHECK_TYPE_SIZE(iovec);
- CHECK_SIZE_AND_OFFSET(iovec, iov_base);
- CHECK_SIZE_AND_OFFSET(iovec, iov_len);
- 
-+#if !SANITIZER_NONGNU
- CHECK_TYPE_SIZE(msghdr);
- CHECK_SIZE_AND_OFFSET(msghdr, msg_name);
- CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen);
-@@ -1032,6 +1038,7 @@ CHECK_TYPE_SIZE(cmsghdr);
- CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len);
- CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
- CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
-+#endif
- 
- COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
- CHECK_SIZE_AND_OFFSET(dirent, d_ino);
-@@ -1134,7 +1141,7 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno);
- 
- CHECK_TYPE_SIZE(ether_addr);
- 
--#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
-+#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- CHECK_TYPE_SIZE(ipc_perm);
- # if SANITIZER_FREEBSD
- CHECK_SIZE_AND_OFFSET(ipc_perm, key);
-@@ -1195,7 +1202,7 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
- CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data);
- #endif
- 
--#if SANITIZER_LINUX
-+#if SANITIZER_LINUX && !SANITIZER_NONGNU
- COMPILER_CHECK(sizeof(__sanitizer_mallinfo) == sizeof(struct mallinfo));
- #endif
- 
-@@ -1245,7 +1252,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE);
- COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE);
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
- CHECK_SIZE_AND_OFFSET(FILE, _flags);
- CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr);
-@@ -1264,7 +1271,7 @@ CHECK_SIZE_AND_OFFSET(FILE, _chain);
- CHECK_SIZE_AND_OFFSET(FILE, _fileno);
- #endif
- 
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
- COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk));
- CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit);
- CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev);
-diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc
-index 3313288a7..103c7b6b9 100644
---- a/lib/tsan/rtl/tsan_platform_linux.cc
-+++ b/lib/tsan/rtl/tsan_platform_linux.cc
-@@ -287,7 +287,7 @@ void InitializePlatform() {
- // This is required to properly "close" the fds, because we do not see internal
- // closes within glibc. The code is a pure hack.
- int ExtractResolvFDs(void *state, int *fds, int nfd) {
--#if SANITIZER_LINUX && !SANITIZER_ANDROID
-+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
-   int cnt = 0;
-   __res_state *statp = (__res_state*)state;
-   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
--- 
-2.16.2
-
diff --git a/pkgs/development/compilers/llvm/5/clang/default.nix b/pkgs/development/compilers/llvm/5/clang/default.nix
index 6695609b8ecd..e391ce046dbc 100644
--- a/pkgs/development/compilers/llvm/5/clang/default.nix
+++ b/pkgs/development/compilers/llvm/5/clang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
+{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
 , fixDarwinDylibNames
 , enableManpages ? false
 }:
@@ -19,8 +19,8 @@ let
       mv clang-tools-extra-* $sourceRoot/tools/extra
     '';
 
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+    nativeBuildInputs = [ cmake python3 ]
+      ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
 
     buildInputs = [ libxml2 llvm ]
       ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
diff --git a/pkgs/development/compilers/llvm/5/compiler-rt.nix b/pkgs/development/compilers/llvm/5/compiler-rt.nix
index c87b0f235961..0282591b6e20 100644
--- a/pkgs/development/compilers/llvm/5/compiler-rt.nix
+++ b/pkgs/development/compilers/llvm/5/compiler-rt.nix
@@ -1,11 +1,11 @@
-{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
+{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
 with stdenv.lib;
 stdenv.mkDerivation {
   pname = "compiler-rt";
   inherit version;
   src = fetch "compiler-rt" "0ipd4jdxpczgr2w6lzrabymz6dhzj69ywmyybjjc1q397zgrvziy";
 
-  nativeBuildInputs = [ cmake python llvm ];
+  nativeBuildInputs = [ cmake python3 llvm ];
   buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   configureFlags = [
diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix
index 6807240df81e..05f4dbf6aa06 100644
--- a/pkgs/development/compilers/llvm/5/default.nix
+++ b/pkgs/development/compilers/llvm/5/default.nix
@@ -1,5 +1,5 @@
 { lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
+, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
 }:
@@ -16,7 +16,7 @@ let
   clang-tools-extra_src = fetch "clang-tools-extra" "018b3fiwah8f8br5i26qmzh6sjvzchpn358sn8v079m49f2jldm3";
 
   tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
     mkExtraBuildCommands = cc: ''
       rsrc="$out/resource-root"
       mkdir "$rsrc"
@@ -36,12 +36,12 @@ let
 
     llvm-manpages = lowPrio (tools.llvm.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     clang-manpages = lowPrio (tools.clang-unwrapped.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     libclang = tools.clang-unwrapped.lib;
@@ -74,7 +74,7 @@ let
   });
 
   libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
   in {
 
     compiler-rt = callPackage ./compiler-rt.nix {};
diff --git a/pkgs/development/compilers/llvm/5/libc++/default.nix b/pkgs/development/compilers/llvm/5/libc++/default.nix
index 03d8a2085d0b..b02e09a83a81 100644
--- a/pkgs/development/compilers/llvm/5/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/5/libc++/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }:
+{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version }:
 
 stdenv.mkDerivation {
   pname = "libc++";
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
   '' + lib.optionalString stdenv.hostPlatform.isMusl ''
     patchShebangs utils/cat_files.py
   '';
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
+  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python3;
 
   buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
diff --git a/pkgs/development/compilers/llvm/5/lldb.nix b/pkgs/development/compilers/llvm/5/lldb.nix
index cce44c7e50f9..a91a7e4354ef 100644
--- a/pkgs/development/compilers/llvm/5/lldb.nix
+++ b/pkgs/development/compilers/llvm/5/lldb.nix
@@ -9,7 +9,7 @@
 , libxml2
 , llvm
 , clang-unwrapped
-, python
+, python3
 , version
 , darwin
 }:
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
       cmake/modules/LLDBStandalone.cmake
   '';
 
-  nativeBuildInputs = [ cmake python which swig ];
+  nativeBuildInputs = [ cmake python3 which swig ];
   buildInputs = [ ncurses zlib libedit libxml2 llvm ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
 
diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix
index d26af8438e73..2ce17765d633 100644
--- a/pkgs/development/compilers/llvm/5/llvm.nix
+++ b/pkgs/development/compilers/llvm/5/llvm.nix
@@ -2,7 +2,7 @@
 , fetch
 , fetchpatch
 , cmake
-, python
+, python3
 , libffi
 , libbfd
 , libxml2
@@ -37,8 +37,8 @@ stdenv.mkDerivation ({
   outputs = [ "out" "python" ]
     ++ stdenv.lib.optional enableSharedLibraries "lib";
 
-  nativeBuildInputs = [ cmake python ]
-    ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+  nativeBuildInputs = [ cmake python3 ]
+    ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
 
   buildInputs = [ libxml2 libffi ];
 
@@ -119,7 +119,7 @@ stdenv.mkDerivation ({
   '';
 
   preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
   '';
 
   postInstall = ''
diff --git a/pkgs/development/compilers/llvm/6/clang/default.nix b/pkgs/development/compilers/llvm/6/clang/default.nix
index d093379b3c99..9374fc0bda9f 100644
--- a/pkgs/development/compilers/llvm/6/clang/default.nix
+++ b/pkgs/development/compilers/llvm/6/clang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
+{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
 , fixDarwinDylibNames
 , enableManpages ? false
 }:
@@ -19,8 +19,8 @@ let
       mv clang-tools-extra-* $sourceRoot/tools/extra
     '';
 
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+    nativeBuildInputs = [ cmake python3 ]
+      ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
 
     buildInputs = [ libxml2 llvm ]
       ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
diff --git a/pkgs/development/compilers/llvm/6/compiler-rt.nix b/pkgs/development/compilers/llvm/6/compiler-rt.nix
index 4cf79e79569c..b3b6e86fc525 100644
--- a/pkgs/development/compilers/llvm/6/compiler-rt.nix
+++ b/pkgs/development/compilers/llvm/6/compiler-rt.nix
@@ -1,11 +1,11 @@
-{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
+{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
 with stdenv.lib;
 stdenv.mkDerivation {
   pname = "compiler-rt";
   inherit version;
   src = fetch "compiler-rt" "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl";
 
-  nativeBuildInputs = [ cmake python llvm ];
+  nativeBuildInputs = [ cmake python3 llvm ];
   buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   configureFlags = [
diff --git a/pkgs/development/compilers/llvm/6/default.nix b/pkgs/development/compilers/llvm/6/default.nix
index ae51c19ec728..d4745930ed3f 100644
--- a/pkgs/development/compilers/llvm/6/default.nix
+++ b/pkgs/development/compilers/llvm/6/default.nix
@@ -1,5 +1,5 @@
 { lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
+, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
 }:
@@ -16,7 +16,7 @@ let
   clang-tools-extra_src = fetch "clang-tools-extra" "1w8ml7fyn4vyxmy59n2qm4r1k1kgwgwkaldp6m45fdv4g0kkfbhd";
 
   tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
     mkExtraBuildCommands = cc: ''
       rsrc="$out/resource-root"
       mkdir "$rsrc"
@@ -36,12 +36,12 @@ let
 
     llvm-manpages = lowPrio (tools.llvm.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     clang-manpages = lowPrio (tools.clang-unwrapped.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     libclang = tools.clang-unwrapped.lib;
@@ -74,7 +74,7 @@ let
   });
 
   libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
   in {
 
     compiler-rt = callPackage ./compiler-rt.nix {};
diff --git a/pkgs/development/compilers/llvm/6/libc++/default.nix b/pkgs/development/compilers/llvm/6/libc++/default.nix
index 658068cbfaff..831c6c9c7002 100644
--- a/pkgs/development/compilers/llvm/6/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/6/libc++/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }:
+{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version }:
 
 stdenv.mkDerivation {
   pname = "libc++";
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
   '' + lib.optionalString stdenv.hostPlatform.isMusl ''
     patchShebangs utils/cat_files.py
   '';
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
+  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python3;
 
   buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
diff --git a/pkgs/development/compilers/llvm/6/lldb.nix b/pkgs/development/compilers/llvm/6/lldb.nix
index d3db8082c963..30d72d944264 100644
--- a/pkgs/development/compilers/llvm/6/lldb.nix
+++ b/pkgs/development/compilers/llvm/6/lldb.nix
@@ -9,7 +9,7 @@
 , libxml2
 , llvm
 , clang-unwrapped
-, python
+, python3
 , version
 , darwin
 }:
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
       cmake/modules/LLDBStandalone.cmake
   '';
 
-  nativeBuildInputs = [ cmake python which swig ];
+  nativeBuildInputs = [ cmake python3 which swig ];
   buildInputs = [ ncurses zlib libedit libxml2 llvm ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
 
diff --git a/pkgs/development/compilers/llvm/6/llvm.nix b/pkgs/development/compilers/llvm/6/llvm.nix
index c6d2c09c2df6..80acd3fa2fe1 100644
--- a/pkgs/development/compilers/llvm/6/llvm.nix
+++ b/pkgs/development/compilers/llvm/6/llvm.nix
@@ -1,7 +1,7 @@
 { stdenv
 , fetch
 , cmake
-, python
+, python3
 , libffi
 , libbfd
 , libxml2
@@ -40,8 +40,8 @@ stdenv.mkDerivation ({
   outputs = [ "out" "python" ]
     ++ optional enableSharedLibraries "lib";
 
-  nativeBuildInputs = [ cmake python ]
-    ++ optional enableManpages python.pkgs.sphinx;
+  nativeBuildInputs = [ cmake python3 ]
+    ++ optional enableManpages python3.pkgs.sphinx;
 
   buildInputs = [ libxml2 libffi ];
 
@@ -120,7 +120,7 @@ stdenv.mkDerivation ({
   '';
 
   preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
   '';
 
   postInstall = ''
diff --git a/pkgs/development/compilers/llvm/7/clang/default.nix b/pkgs/development/compilers/llvm/7/clang/default.nix
index 5ac9a7a2672a..cc5dcfc160bc 100644
--- a/pkgs/development/compilers/llvm/7/clang/default.nix
+++ b/pkgs/development/compilers/llvm/7/clang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
+{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
 , fixDarwinDylibNames
 , enableManpages ? false
 , enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -19,8 +19,8 @@ let
       mv clang-tools-extra-* $sourceRoot/tools/extra
     '';
 
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+    nativeBuildInputs = [ cmake python3 ]
+      ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
 
     buildInputs = [ libxml2 llvm ]
       ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix
index a7d4bcb86962..ae98940adeab 100644
--- a/pkgs/development/compilers/llvm/7/compiler-rt.nix
+++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix
@@ -1,10 +1,10 @@
-{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
+{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
 stdenv.mkDerivation {
   pname = "compiler-rt";
   inherit version;
   src = fetch "compiler-rt" "1n48p8gjarihkws0i2bay5w9bdwyxyxxbpwyng7ba58jb30dlyq5";
 
-  nativeBuildInputs = [ cmake python llvm ];
+  nativeBuildInputs = [ cmake python3 llvm ];
   buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix
index 621a246225d7..f5dbea58a7db 100644
--- a/pkgs/development/compilers/llvm/7/default.nix
+++ b/pkgs/development/compilers/llvm/7/default.nix
@@ -1,5 +1,5 @@
 { lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
+, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
 }:
@@ -16,7 +16,7 @@ let
   clang-tools-extra_src = fetch "clang-tools-extra" "0lb4kdh7j2fhfz8kd6iv5df7m3pikiryk1vvwsf87spc90n09q0w";
 
   tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
     mkExtraBuildCommands = cc: ''
       rsrc="$out/resource-root"
       mkdir "$rsrc"
@@ -42,12 +42,12 @@ let
 
     llvm-manpages = lowPrio (tools.llvm.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     clang-manpages = lowPrio (tools.clang-unwrapped.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     libclang = tools.clang-unwrapped.lib;
@@ -126,7 +126,7 @@ let
   });
 
   libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
   in {
 
     compiler-rt = callPackage ./compiler-rt.nix {
diff --git a/pkgs/development/compilers/llvm/7/libc++/default.nix b/pkgs/development/compilers/llvm/7/libc++/default.nix
index f6f9970d7a6e..f2cdd2f6f5fa 100644
--- a/pkgs/development/compilers/llvm/7/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/7/libc++/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version
+{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
 , enableShared ? ! stdenv.hostPlatform.isMusl }:
 
 stdenv.mkDerivation {
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
   '' + lib.optionalString stdenv.hostPlatform.isMusl ''
     patchShebangs utils/cat_files.py
   '';
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
+  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python3;
 
   buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
diff --git a/pkgs/development/compilers/llvm/7/lldb.nix b/pkgs/development/compilers/llvm/7/lldb.nix
index 44687ead4d1c..ace6ae812fde 100644
--- a/pkgs/development/compilers/llvm/7/lldb.nix
+++ b/pkgs/development/compilers/llvm/7/lldb.nix
@@ -10,7 +10,7 @@
 , llvm
 , clang-unwrapped
 , perl
-, python
+, python3
 , version
 , darwin
 }:
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
 
   src = fetch "lldb" "0klsscg1sczc4nw2l53xggi969k361cng2sjjrfp3bv4g5x14s4v";
 
-  nativeBuildInputs = [ cmake perl python which swig ];
+  nativeBuildInputs = [ cmake perl python3 which swig ];
   buildInputs = [ ncurses zlib libedit libxml2 llvm ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
 
diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix
index c56bbfd0eab9..d7fb1fe4b93f 100644
--- a/pkgs/development/compilers/llvm/7/llvm.nix
+++ b/pkgs/development/compilers/llvm/7/llvm.nix
@@ -2,7 +2,7 @@
 , fetch
 , fetchpatch
 , cmake
-, python
+, python3
 , libffi
 , libbfd
 , libpfm
@@ -48,8 +48,8 @@ in stdenv.mkDerivation ({
   outputs = [ "out" "python" ]
     ++ optional enableSharedLibraries "lib";
 
-  nativeBuildInputs = [ cmake python ]
-    ++ optional enableManpages python.pkgs.sphinx;
+  nativeBuildInputs = [ cmake python3 ]
+    ++ optional enableManpages python3.pkgs.sphinx;
 
   buildInputs = [ libxml2 libffi ]
     ++ optional enablePFM libpfm; # exegesis
@@ -141,7 +141,7 @@ in stdenv.mkDerivation ({
   '';
 
   preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
   '';
 
   postInstall = ''
diff --git a/pkgs/development/compilers/llvm/8/clang/default.nix b/pkgs/development/compilers/llvm/8/clang/default.nix
index 8c540e45b286..8601f6d06809 100644
--- a/pkgs/development/compilers/llvm/8/clang/default.nix
+++ b/pkgs/development/compilers/llvm/8/clang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
+{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
 , fixDarwinDylibNames
 , enableManpages ? false
 , enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -19,8 +19,8 @@ let
       mv clang-tools-extra-* $sourceRoot/tools/extra
     '';
 
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+    nativeBuildInputs = [ cmake python3 ]
+      ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
 
     buildInputs = [ libxml2 llvm ]
       ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
diff --git a/pkgs/development/compilers/llvm/8/compiler-rt.nix b/pkgs/development/compilers/llvm/8/compiler-rt.nix
index 344ff7256755..9c0829146f72 100644
--- a/pkgs/development/compilers/llvm/8/compiler-rt.nix
+++ b/pkgs/development/compilers/llvm/8/compiler-rt.nix
@@ -1,10 +1,10 @@
-{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
+{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
 stdenv.mkDerivation {
   pname = "compiler-rt";
   inherit version;
   src = fetch "compiler-rt" "0dqqf8f930l8gag4d9qjgn1n0pj0nbv2anviqqhdi1rkhas8z0hi";
 
-  nativeBuildInputs = [ cmake python llvm ];
+  nativeBuildInputs = [ cmake python3 llvm ];
   buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
diff --git a/pkgs/development/compilers/llvm/8/default.nix b/pkgs/development/compilers/llvm/8/default.nix
index 36d7a14142b4..8b916e1cda7d 100644
--- a/pkgs/development/compilers/llvm/8/default.nix
+++ b/pkgs/development/compilers/llvm/8/default.nix
@@ -1,5 +1,5 @@
 { lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
+, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
 }:
@@ -16,7 +16,7 @@ let
   clang-tools-extra_src = fetch "clang-tools-extra" "1qf3097bc5ia8p6cpmbx985rjr3yaah5s8fc0nv7pw742yv7jw8q";
 
   tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
     mkExtraBuildCommands = cc: ''
       rsrc="$out/resource-root"
       mkdir "$rsrc"
@@ -42,12 +42,12 @@ let
 
     llvm-manpages = lowPrio (tools.llvm.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     clang-manpages = lowPrio (tools.clang-unwrapped.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     libclang = tools.clang-unwrapped.lib;
@@ -162,7 +162,7 @@ let
   });
 
   libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
   in {
 
     compiler-rt = callPackage ./compiler-rt.nix ({} //
diff --git a/pkgs/development/compilers/llvm/8/libc++/default.nix b/pkgs/development/compilers/llvm/8/libc++/default.nix
index 8ec1c419748d..883d9c8776f3 100644
--- a/pkgs/development/compilers/llvm/8/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/8/libc++/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version
+{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
 , enableShared ? true }:
 
 stdenv.mkDerivation {
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
     patchShebangs utils/cat_files.py
   '';
   nativeBuildInputs = [ cmake ]
-    ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python;
+    ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3;
 
   buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
diff --git a/pkgs/development/compilers/llvm/8/lldb.nix b/pkgs/development/compilers/llvm/8/lldb.nix
index 254933c82a09..75be5b993df3 100644
--- a/pkgs/development/compilers/llvm/8/lldb.nix
+++ b/pkgs/development/compilers/llvm/8/lldb.nix
@@ -9,7 +9,7 @@
 , libxml2
 , llvm
 , clang-unwrapped
-, python
+, python3
 , version
 , darwin
 }:
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
       cmake/modules/LLDBStandalone.cmake
   '';
 
-  nativeBuildInputs = [ cmake python which swig ];
+  nativeBuildInputs = [ cmake python3 which swig ];
   buildInputs = [ ncurses zlib libedit libxml2 llvm ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
 
diff --git a/pkgs/development/compilers/llvm/8/llvm.nix b/pkgs/development/compilers/llvm/8/llvm.nix
index df3d6e796aa0..a9c4a6b0ba25 100644
--- a/pkgs/development/compilers/llvm/8/llvm.nix
+++ b/pkgs/development/compilers/llvm/8/llvm.nix
@@ -1,7 +1,7 @@
 { stdenv
 , fetch
 , cmake
-, python
+, python3
 , libffi
 , libbfd
 , libpfm
@@ -46,8 +46,8 @@ in stdenv.mkDerivation ({
   outputs = [ "out" "python" ]
     ++ optional enableSharedLibraries "lib";
 
-  nativeBuildInputs = [ cmake python ]
-    ++ optionals enableManpages [ python.pkgs.sphinx python.pkgs.recommonmark ];
+  nativeBuildInputs = [ cmake python3 ]
+    ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
 
   buildInputs = [ libxml2 libffi ]
     ++ optional enablePFM libpfm; # exegesis
@@ -117,7 +117,7 @@ in stdenv.mkDerivation ({
   '';
 
   preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
   '';
 
   postInstall = ''
diff --git a/pkgs/development/compilers/llvm/9/clang/default.nix b/pkgs/development/compilers/llvm/9/clang/default.nix
index 1b779b118a7f..5f89c3dc3b71 100644
--- a/pkgs/development/compilers/llvm/9/clang/default.nix
+++ b/pkgs/development/compilers/llvm/9/clang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
+{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
 , fixDarwinDylibNames
 , enableManpages ? false
 , enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -19,8 +19,8 @@ let
       mv clang-tools-extra-* $sourceRoot/tools/extra
     '';
 
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+    nativeBuildInputs = [ cmake python3 ]
+      ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
 
     buildInputs = [ libxml2 llvm ]
       ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
diff --git a/pkgs/development/compilers/llvm/9/compiler-rt.nix b/pkgs/development/compilers/llvm/9/compiler-rt.nix
index 75d0614b5142..037953bb23d8 100644
--- a/pkgs/development/compilers/llvm/9/compiler-rt.nix
+++ b/pkgs/development/compilers/llvm/9/compiler-rt.nix
@@ -1,10 +1,10 @@
-{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
+{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
 stdenv.mkDerivation rec {
   pname = "compiler-rt";
   inherit version;
   src = fetch pname "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2";
 
-  nativeBuildInputs = [ cmake python llvm ];
+  nativeBuildInputs = [ cmake python3 llvm ];
   buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix
index c9e8ce91f0ce..38ab7794018f 100644
--- a/pkgs/development/compilers/llvm/9/default.nix
+++ b/pkgs/development/compilers/llvm/9/default.nix
@@ -1,5 +1,5 @@
 { lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
+, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
 }:
@@ -16,7 +16,7 @@ let
   clang-tools-extra_src = fetch "clang-tools-extra" "01vgzd4k1q93nfs8gyl83mjlc4x0qsgfqw32lacbjzdxg0mdfvxj";
 
   tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
     mkExtraBuildCommands = cc: ''
       rsrc="$out/resource-root"
       mkdir "$rsrc"
@@ -42,12 +42,12 @@ let
 
     llvm-manpages = lowPrio (tools.llvm.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     clang-manpages = lowPrio (tools.clang-unwrapped.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     libclang = tools.clang-unwrapped.lib;
@@ -162,7 +162,7 @@ let
   });
 
   libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
   in {
 
     compiler-rt = callPackage ./compiler-rt.nix ({} //
diff --git a/pkgs/development/compilers/llvm/9/libc++/default.nix b/pkgs/development/compilers/llvm/9/libc++/default.nix
index 1166c7bd76c9..9e3525574d5c 100644
--- a/pkgs/development/compilers/llvm/9/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/9/libc++/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version
+{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
 , enableShared ? true }:
 
 stdenv.mkDerivation {
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
     patchShebangs utils/cat_files.py
   '';
   nativeBuildInputs = [ cmake ]
-    ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python;
+    ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3;
 
   buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
diff --git a/pkgs/development/compilers/llvm/9/lldb.nix b/pkgs/development/compilers/llvm/9/lldb.nix
index 64f111502cc5..506fc1c3e505 100644
--- a/pkgs/development/compilers/llvm/9/lldb.nix
+++ b/pkgs/development/compilers/llvm/9/lldb.nix
@@ -9,7 +9,7 @@
 , libxml2
 , llvm
 , clang-unwrapped
-, python
+, python3
 , version
 , darwin
 , lit
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./lldb-procfs.patch ];
 
-  nativeBuildInputs = [ cmake python which swig lit ];
+  nativeBuildInputs = [ cmake python3 which swig lit ];
   buildInputs = [
     ncurses
     zlib
diff --git a/pkgs/development/compilers/llvm/9/llvm.nix b/pkgs/development/compilers/llvm/9/llvm.nix
index acd3ec92897f..2cdc5a5fd066 100644
--- a/pkgs/development/compilers/llvm/9/llvm.nix
+++ b/pkgs/development/compilers/llvm/9/llvm.nix
@@ -1,7 +1,7 @@
 { stdenv
 , fetch
 , cmake
-, python
+, python3
 , libffi
 , libbfd
 , libpfm
@@ -46,8 +46,8 @@ in stdenv.mkDerivation (rec {
   outputs = [ "out" "python" ]
     ++ optional enableSharedLibraries "lib";
 
-  nativeBuildInputs = [ cmake python ]
-    ++ optionals enableManpages [ python.pkgs.sphinx python.pkgs.recommonmark ];
+  nativeBuildInputs = [ cmake python3 ]
+    ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
 
   buildInputs = [ libxml2 libffi ]
     ++ optional enablePFM libpfm; # exegesis
@@ -134,7 +134,7 @@ in stdenv.mkDerivation (rec {
   '';
 
   preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
   '';
 
   postInstall = ''
diff --git a/pkgs/development/compilers/llvm/dynamiclibrary-musl.patch b/pkgs/development/compilers/llvm/dynamiclibrary-musl.patch
deleted file mode 100644
index d5d7f07b5e11..000000000000
--- a/pkgs/development/compilers/llvm/dynamiclibrary-musl.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Thu, 18 Feb 2016 15:33:21 +0100
-Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc
-
-stdin/out/err is part of the libc and not the kernel so we check for the
-specific libc that does the unexpected instead of linux.
-
-This is needed for making it build with musl libc.
----
- lib/Support/DynamicLibrary.cpp | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp
-index 9a7aeb5..0c1c8f8 100644
---- a/lib/Support/DynamicLibrary.cpp
-+++ b/lib/Support/DynamicLibrary.cpp
-@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
- #define EXPLICIT_SYMBOL(SYM) \
-    if (!strcmp(symbolName, #SYM)) return &SYM
- 
--// On linux we have a weird situation. The stderr/out/in symbols are both
-+// On GNU libc we have a weird situation. The stderr/out/in symbols are both
- // macros and global variables because of standards requirements. So, we
- // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
--#if defined(__linux__) and !defined(__ANDROID__)
-+#if defined(__GLIBC__)
-   {
-     EXPLICIT_SYMBOL(stderr);
-     EXPLICIT_SYMBOL(stdout);
--- 
-2.7.3
-
diff --git a/pkgs/development/compilers/llvm/fix-llvm-config.patch b/pkgs/development/compilers/llvm/fix-llvm-config.patch
deleted file mode 100644
index 772c49609275..000000000000
--- a/pkgs/development/compilers/llvm/fix-llvm-config.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
-index eacefdf60bf..40d25f5cef8 100644
---- a/utils/llvm-build/llvmbuild/main.py
-+++ b/utils/llvm-build/llvmbuild/main.py
-@@ -412,7 +412,7 @@ subdirectories = %s
-             if library_name is None:
-                 library_name_as_cstr = '0'
-             else:
--                library_name_as_cstr = '"lib%s.a"' % library_name
-+                library_name_as_cstr = '"lib%s.so"' % library_name
-             f.write('  { "%s", %s, %d, { %s } },\n' % (
-                 name, library_name_as_cstr, is_installed,
-                 ', '.join('"%s"' % dep
diff --git a/pkgs/development/compilers/llvm/libcxx-max_align_t.patch b/pkgs/development/compilers/llvm/libcxx-max_align_t.patch
deleted file mode 100644
index 060be5b23de8..000000000000
--- a/pkgs/development/compilers/llvm/libcxx-max_align_t.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 917331c88bd2afce0cf0fdbcab55a64541b5bcf0 Mon Sep 17 00:00:00 2001
-From: "David L. Jones" <dlj@google.com>
-Date: Fri, 10 Feb 2017 01:27:42 +0000
-Subject: [PATCH] Check for musl-libc's max_align_t in addition to other
- variants.
-
-Summary:
-Libcxx will define its own max_align_t when it is not available. However, the
-availability checks today only check for Clang's definition and GCC's
-definition. In particular, it does not check for musl's definition, which is the
-same as GCC's but guarded with a different macro.
-
-Reviewers: mclow.lists, EricWF
-
-Reviewed By: EricWF
-
-Subscribers: chandlerc, cfe-commits
-
-Differential Revision: https://reviews.llvm.org/D28478
-
-git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294683 91177308-0d34-0410-b5e6-96231b3b80d8
----
- include/cstddef  | 3 ++-
- include/stddef.h | 3 ++-
- 2 files changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/include/cstddef b/include/cstddef
-index edd106c00..103898b7d 100644
---- a/include/cstddef
-+++ b/include/cstddef
-@@ -48,7 +48,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
- using ::ptrdiff_t;
- using ::size_t;
- 
--#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
-+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
-+    defined(__DEFINED_max_align_t)
- // Re-use the compiler's <stddef.h> max_align_t where possible.
- using ::max_align_t;
- #else
-diff --git a/include/stddef.h b/include/stddef.h
-index 8841bbea2..faf8552d8 100644
---- a/include/stddef.h
-+++ b/include/stddef.h
-@@ -53,7 +53,8 @@ using std::nullptr_t;
- }
- 
- // Re-use the compiler's <stddef.h> max_align_t where possible.
--#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
-+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
-+    !defined(__DEFINED_max_align_t)
- typedef long double max_align_t;
- #endif
- 
diff --git a/pkgs/development/compilers/mlton/20130715.nix b/pkgs/development/compilers/mlton/20130715.nix
index 207ed8f29bc7..52bb0a0775cf 100644
--- a/pkgs/development/compilers/mlton/20130715.nix
+++ b/pkgs/development/compilers/mlton/20130715.nix
@@ -77,7 +77,7 @@ stdenv.mkDerivation rec {
     chmod u+x $(pwd)/../${usr_prefix}/bin/mlton
 
     # So the builder runs the binary compiler with gmp.
-    export LD_LIBRARY_PATH=${gmp.out}/lib:$LD_LIBRARY_PATH
+    export LD_LIBRARY_PATH=${gmp.out}/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
 
   '' + stdenv.lib.optionalString stdenv.isLinux ''
     # Patch ELF interpreter.
diff --git a/pkgs/development/compilers/mozart/default.nix b/pkgs/development/compilers/mozart/default.nix
index 97634bca8ef7..b8951c8c8004 100644
--- a/pkgs/development/compilers/mozart/default.nix
+++ b/pkgs/development/compilers/mozart/default.nix
@@ -6,7 +6,7 @@
 , makeWrapper
 , boost
 , llvmPackages
-, llvmPackages_4
+, llvmPackages_5
 , gmp
 , emacs
 , emacs25-nox
@@ -48,7 +48,7 @@ in stdenv.mkDerivation rec {
     "-DCMAKE_C_COMPILER=${llvmPackages.clang}/bin/clang"
     "-DBoost_USE_STATIC_LIBS=OFF"
     "-DMOZART_BOOST_USE_STATIC_LIBS=OFF"
-    "-DCMAKE_PROGRAM_PATH=${llvmPackages_4.clang}/bin"
+    "-DCMAKE_PROGRAM_PATH=${llvmPackages_5.clang}/bin"
     # Rationale: Nix's cc-wrapper needs to see a compile flag (like -c) to
     # infer that it is not a linking call, and stop trashing the command line
     # with linker flags.
@@ -69,9 +69,9 @@ in stdenv.mkDerivation rec {
 
   buildInputs = [
     boost
-    llvmPackages_4.llvm
-    llvmPackages_4.clang
-    llvmPackages_4.clang-unwrapped
+    llvmPackages_5.llvm
+    llvmPackages_5.clang
+    llvmPackages_5.clang-unwrapped
     gmp
     emacs25-nox
     jre_headless
diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix
index bdb16c922071..316ddbfcb607 100644
--- a/pkgs/development/compilers/nim/default.nix
+++ b/pkgs/development/compilers/nim/default.nix
@@ -5,11 +5,11 @@
 
 stdenv.mkDerivation rec {
   pname = "nim";
-  version = "1.0.4";
+  version = "1.0.6";
 
   src = fetchurl {
     url = "https://nim-lang.org/download/${pname}-${version}.tar.xz";
-    sha256 = "1q5fx9g40bk4ajghi856w5l34fmrl7avq5j6p0dr2xa4l52ib149";
+    sha256 = "1cv6bxc7w21455c0pv0r2h64ljyzw266jsk1fsgiiyk2rx8mfkhk";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/compilers/ocaml/4.10.nix b/pkgs/development/compilers/ocaml/4.10.nix
new file mode 100644
index 000000000000..6f78ae05e02e
--- /dev/null
+++ b/pkgs/development/compilers/ocaml/4.10.nix
@@ -0,0 +1,6 @@
+import ./generic.nix {
+  major_version = "4";
+  minor_version = "10";
+  patch_version = "0+beta1";
+  sha256 = "18jrgww98v1famb2x5jhbsnm4ngph2rvq0z4cxpqxfn06yb53jyf";
+}
diff --git a/pkgs/development/compilers/openjdk/11.nix b/pkgs/development/compilers/openjdk/11.nix
index b8381feef095..2081d3396707 100644
--- a/pkgs/development/compilers/openjdk/11.nix
+++ b/pkgs/development/compilers/openjdk/11.nix
@@ -10,7 +10,7 @@
 
 let
   major = "11";
-  update = ".0.4";
+  update = ".0.6";
   build = "ga";
 
   openjdk = stdenv.mkDerivation rec {
@@ -19,7 +19,7 @@ let
 
     src = fetchurl {
       url = "http://hg.openjdk.java.net/jdk-updates/jdk${major}u/archive/jdk-${version}.tar.gz";
-      sha256 = "1v6pam38iidlhz46046h17hf5kki6n3kl302awjcyxzk7bmkvb8x";
+      sha256 = "1w6n0cnz9izpjb3sc870q7a0jz85a6c7fiszymxin10cnsajkzir";
     };
 
     nativeBuildInputs = [ pkgconfig autoconf ];
diff --git a/pkgs/development/compilers/picat/default.nix b/pkgs/development/compilers/picat/default.nix
index b520a5e703c8..87af63c671a5 100644
--- a/pkgs/development/compilers/picat/default.nix
+++ b/pkgs/development/compilers/picat/default.nix
@@ -1,13 +1,16 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, zlib }:
 
 stdenv.mkDerivation {
-  name = "picat-1.9-4";
+  pname = "picat";
+  version = "2.8-2";
 
   src = fetchurl {
-    url = http://picat-lang.org/download/picat19_src.tar.gz;
-    sha256 = "0wvl95gf4pjs93632g4wi0mw1glzzhjp9g4xg93ll2zxggbxibli";
+    url = http://picat-lang.org/download/picat28_src.tar.gz;
+    sha256 = "10hf2fxxbpq28gi39icr8c9wafdiy9ddfkk6l4rx7kkqyrdi7n85";
   };
 
+  buildInputs = [ zlib ];
+
   ARCH = if stdenv.hostPlatform.system == "i686-linux" then "linux32"
          else if stdenv.hostPlatform.system == "x86_64-linux" then "linux64"
          else throw "Unsupported system";
@@ -16,12 +19,12 @@ stdenv.mkDerivation {
 
   buildPhase = ''
     cd emu
-    make -f Makefile.picat.$ARCH
+    make -f Makefile.$ARCH
   '';
 
   installPhase = ''
     mkdir -p $out/bin
-    cp picat_$ARCH $out/bin/picat
+    cp picat $out/bin/picat
   '';
 
   meta = {
diff --git a/pkgs/development/compilers/purescript/psc-package/default.nix b/pkgs/development/compilers/purescript/psc-package/default.nix
index 68b676d5a3ef..c2f8765a131c 100644
--- a/pkgs/development/compilers/purescript/psc-package/default.nix
+++ b/pkgs/development/compilers/purescript/psc-package/default.nix
@@ -4,13 +4,13 @@ with lib;
 
 mkDerivation rec {
   pname = "psc-package";
-  version = "0.5.1";
+  version = "0.6.0";
 
   src = fetchFromGitHub {
     owner = "purescript";
     repo = pname;
     rev = "v${version}";
-    sha256 = "1zadbph1vha3b5hvmjvs138dcwbab49f3v63air1l6r4cvpb6831";
+    sha256 = "165yax131rj1mdlqd28g6wcy1ps3k4w50z8gj9yc3nfs09dy0lab";
   };
 
   isLibrary = false;
diff --git a/pkgs/development/compilers/purescript/purescript/default.nix b/pkgs/development/compilers/purescript/purescript/default.nix
index f1126fdeddfd..d1797a448ad1 100644
--- a/pkgs/development/compilers/purescript/purescript/default.nix
+++ b/pkgs/development/compilers/purescript/purescript/default.nix
@@ -18,19 +18,19 @@ let
 
 in stdenv.mkDerivation rec {
   pname = "purescript";
-  version = "0.13.5";
+  version = "0.13.6";
 
   src =
     if stdenv.isDarwin
     then
     fetchurl {
       url = "https://github.com/${pname}/${pname}/releases/download/v${version}/macos.tar.gz";
-      sha256 = "19bb50m0cd738r353blgy21d842b3yj58xfbplk7bz59jawj9lym";
+      sha256 = "04kwjjrriyizpvhs96jgyx21ppyd1ynblk24i5825ywxlw9hja25";
     }
     else
     fetchurl {
       url = "https://github.com/${pname}/${pname}/releases/download/v${version}/linux64.tar.gz";
-      sha256 = "016wvwypgb4859f0n1lqsqv9a8cca2y8g7d6ffvzx6rncd115gxi";
+      sha256 = "012znrj32aq96qh1g2hscdvhl3flgihhimiz40agk0dykpksblns";
     };
 
 
@@ -59,7 +59,7 @@ in stdenv.mkDerivation rec {
     description = "A strongly-typed functional programming language that compiles to JavaScript";
     homepage = http://www.purescript.org/;
     license = licenses.bsd3;
-    maintainers = [ maintainers.justinwoo ];
+    maintainers = [ maintainers.justinwoo maintainers.mbbx6spp ];
     platforms = [ "x86_64-linux" "x86_64-darwin" ];
   };
 }
diff --git a/pkgs/development/compilers/rust/1_38_0.nix b/pkgs/development/compilers/rust/1_38_0.nix
index be43e074228d..13d2139bffdc 100644
--- a/pkgs/development/compilers/rust/1_38_0.nix
+++ b/pkgs/development/compilers/rust/1_38_0.nix
@@ -1,6 +1,7 @@
 import ./default.nix {
   rustcVersion = "1.38.0";
   rustcSha256 = "101dlpsfkq67p0hbwx4acqq6n90dj4bbprndizpgh1kigk566hk4";
+  enableRustcDev = false;
 
   # Note: the version MUST be one version prior to the version we're
   # building
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index 60e31c6def47..da3421a987da 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -1,5 +1,6 @@
 { rustcVersion
 , rustcSha256
+, enableRustcDev ? true
 , bootstrapVersion
 , bootstrapHashes
 , selectRustPackage
@@ -70,6 +71,7 @@
       rustc = self.callPackage ./rustc.nix ({
         version = rustcVersion;
         sha256 = rustcSha256;
+        inherit enableRustcDev;
 
         # Use boot package set to break cycle
         rustPlatform = bootRustPlatform;
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index e5c8a709a900..b0c26f3dffdf 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -4,6 +4,7 @@
 , pkgconfig, openssl
 , which, libffi
 , withBundledLLVM ? false
+, enableRustcDev ? true
 , version
 , sha256
 }:
@@ -132,9 +133,15 @@ in stdenv.mkDerivation rec {
   outputs = [ "out" "man" "doc" ];
   setOutputFlags = false;
 
-  # remove references to llvm-config in lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
-  # and thus a transitive dependency on ncurses
-  postInstall = ''
+  postInstall = stdenv.lib.optionalString enableRustcDev ''
+    # install rustc-dev components. Necessary to build rls, clippy...
+    python x.py dist rustc-dev
+    tar xf build/dist/rustc-dev*tar.gz
+    cp -r rustc-dev*/rustc-dev*/lib/* $out/lib/
+
+  '' + ''
+    # remove references to llvm-config in lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
+    # and thus a transitive dependency on ncurses
     find $out/lib -name "*.so" -type f -exec remove-references-to -t ${llvmShared} '{}' '+'
   '';
 
diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix
index e3d9ee98635b..79173871095c 100644
--- a/pkgs/development/compilers/sbcl/default.nix
+++ b/pkgs/development/compilers/sbcl/default.nix
@@ -10,11 +10,11 @@
 
 stdenv.mkDerivation rec {
   pname = "sbcl";
-  version = "1.5.6";
+  version = "2.0.1";
 
   src = fetchurl {
     url    = "mirror://sourceforge/project/sbcl/sbcl/${version}/${pname}-${version}-source.tar.bz2";
-    sha256 = "10z43dc29p7s8dl3jixklhmzqfp7gcm3fccjdfd36qqhyfxqxx3a";
+    sha256 = "1s2nrq26czl7f8jpa9qjpmdqbzvldvf4c7c1z1c438v4f85xcl44";
   };
 
   buildInputs = [texinfo];
diff --git a/pkgs/development/compilers/scala/2.11.nix b/pkgs/development/compilers/scala/2.11.nix
index a1f803b67193..db1a8f4edcad 100644
--- a/pkgs/development/compilers/scala/2.11.nix
+++ b/pkgs/development/compilers/scala/2.11.nix
@@ -16,6 +16,11 @@ stdenv.mkDerivation rec {
     rm "bin/"*.bat
     mv * $out
 
+    # put docs in correct subdirectory
+    mkdir -p $out/share/doc
+    mv $out/doc $out/share/doc/${name}
+    mv $out/man $out/share/man
+
     for p in $(ls $out/bin/) ; do
       wrapProgram $out/bin/$p \
         --prefix PATH ":" ${coreutils}/bin \
diff --git a/pkgs/development/compilers/scala/2.12.nix b/pkgs/development/compilers/scala/2.12.nix
index 9e11daced4a9..3f61669b938d 100644
--- a/pkgs/development/compilers/scala/2.12.nix
+++ b/pkgs/development/compilers/scala/2.12.nix
@@ -19,6 +19,7 @@ stdenv.mkDerivation rec {
     # put docs in correct subdirectory
     mkdir -p $out/share/doc
     mv $out/doc $out/share/doc/scala
+    mv $out/{LICENSE,NOTICE} $out/share/doc/scala
 
     for p in $(ls $out/bin/) ; do
       wrapProgram $out/bin/$p \
diff --git a/pkgs/development/compilers/scala/2.13.nix b/pkgs/development/compilers/scala/2.13.nix
index 6bba11af9d46..b140d4e2a2db 100644
--- a/pkgs/development/compilers/scala/2.13.nix
+++ b/pkgs/development/compilers/scala/2.13.nix
@@ -19,6 +19,7 @@ stdenv.mkDerivation rec {
     # put docs in correct subdirectory
     mkdir -p $out/share/doc
     mv $out/doc $out/share/doc/scala
+    mv $out/{LICENSE,NOTICE} $out/share/doc/scala
 
     for p in $(ls $out/bin/) ; do
       wrapProgram $out/bin/$p \
diff --git a/pkgs/development/compilers/solc/default.nix b/pkgs/development/compilers/solc/default.nix
index 23e6c64f3ffc..0f71ed79e7ee 100644
--- a/pkgs/development/compilers/solc/default.nix
+++ b/pkgs/development/compilers/solc/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
   checkPhase = ''
     while IFS= read -r -d ''' dir
     do
-      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$dir
+      LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$(pwd)/$dir
       export LD_LIBRARY_PATH
     done <   <(find . -type d -print0)
 
diff --git a/pkgs/development/compilers/souffle/default.nix b/pkgs/development/compilers/souffle/default.nix
index 35ee7de7a2dc..00d1a2f79600 100644
--- a/pkgs/development/compilers/souffle/default.nix
+++ b/pkgs/development/compilers/souffle/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "A translator of declarative Datalog programs into the C++ language";
-    homepage    = "http://souffle-lang.github.io/";
+    homepage    = "https://souffle-lang.github.io/";
     platforms   = platforms.unix;
     maintainers = with maintainers; [ thoughtpolice copumpkin wchresta ];
     license     = licenses.upl;
diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix
index 817f81f9257b..77bc3cc5b73e 100644
--- a/pkgs/development/compilers/swift/default.nix
+++ b/pkgs/development/compilers/swift/default.nix
@@ -33,33 +33,40 @@
 }:
 
 let
-  v_base = "5.0.2";
-  version = "${v_base}-RELEASE";
-  version_friendly = v_base;
+  version = "5.1.1";
 
-  tag = "refs/tags/swift-${version}";
   fetch = { repo, sha256, fetchSubmodules ? false }:
     fetchFromGitHub {
       owner = "apple";
       inherit repo sha256 fetchSubmodules;
-      rev = tag;
+      rev = "swift-${version}-RELEASE";
       name = "${repo}-${version}-src";
     };
 
   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 = "046p7f4044ls8hhgklsz32md5jvxkaaim1d75n0fmnwap6di3n1q";
-    };
     llvm = fetch {
       repo = "swift-llvm";
-      sha256 = "1bnscqsiljiclij60f44h2fyx5c84pzry0lz1jbwknphwmqd6f84";
+      sha256 = "00ldd9dby6fl6nk3z17148fvb7g9x4jkn1afx26y51v8rwgm1i7f";
     };
     compilerrt = fetch {
       repo = "swift-compiler-rt";
-      sha256 = "0bba54xa7z0wj6k7a24q74gc4yajc6s64g1m894i3yd6swdk7f6r";
+      sha256 = "1431f74l0n2dxn728qp65nc6hivx88fax1wzfrnrv19y77br05wj";
+    };
+    clang = fetch {
+      repo = "swift-clang";
+      sha256 = "0n7k6nvzgqp6h6bfqcmna484w90db3zv4sh5rdh89wxyhdz6rk4v";
+    };
+    clangtools = fetch {
+      repo = "swift-clang-tools-extra";
+      sha256 = "0snp2rpd60z239pr7fxpkj332rkdjhg63adqvqdkjsbrxcqqcgqa";
+    };
+    indexstore = fetch {
+      repo = "indexstore-db";
+      sha256 = "1gwkqkdmpd5hn7555dpdkys0z50yh00hjry2886h6rx7avh5p05n";
+    };
+    sourcekit = fetch {
+      repo = "sourcekit-lsp";
+      sha256 = "0k84ssr1k7grbvpk81rr21ii8csnixn9dp0cga98h6i1gshn8ml4";
     };
     cmark = fetch {
       repo = "swift-cmark";
@@ -67,32 +74,32 @@ let
     };
     lldb = fetch {
       repo = "swift-lldb";
-      sha256 = "01yrhc1ggv89qii03fdjdvb2aq9v4hd1wk83n8ygrwwc75p44qmi";
+      sha256 = "0j787475f0nlmvxqblkhn3yrvn9qhcb2jcijwijxwq95ar2jdygs";
     };
     llbuild = fetch {
       repo = "swift-llbuild";
-      sha256 = "0ipwryzpqxpk3rzkxilfahlkz06k39j91q2lv7fprf0slqknrdms";
+      sha256 = "1n2s5isxyl6b6ya617gdzjbw68shbvd52vsfqc1256rk4g448v8b";
     };
     pm = fetch {
       repo = "swift-package-manager";
-      sha256 = "1mnywlm7i2mbp16q0rskskvnbx1ap8lchwr8q3gx0xs3b2fs6chh";
+      sha256 = "1a49jmag5mpld9zr96g8a773334mrz1c4nyw38gf4p6sckf4jp29";
     };
     xctest = fetch {
       repo = "swift-corelibs-xctest";
-      sha256 = "1vpljkxhfk3yd07ry0xsv3qwbn62pwd2mdn9cw22jhbhvqinc13z";
+      sha256 = "0rxy9sq7i0s0kxfkz0hvdp8zyb40h31f7g4m0kry36qk82gzzh89";
     };
     foundation = fetch {
       repo = "swift-corelibs-foundation";
-      sha256 = "1wys4xh7f6c7yjf210x41n2krmyi2qj1wpxbv0p48d230va1azj1";
+      sha256 = "1iiiijsnys0r3hjcj1jlkn3yszzi7hwb2041cnm5z306nl9sybzp";
     };
     libdispatch = fetch {
       repo = "swift-corelibs-libdispatch";
-      sha256 = "0chnb0d4xjyn9wnc8bgimd5ji5igfyq891flgnqpfwr4y26496c1";
+      sha256 = "0laqsizsikyjhrzn0rghvxd8afg4yav7cbghvnf7ywk9wc6kpkmn";
       fetchSubmodules = true;
     };
     swift = fetch {
       repo = "swift";
-      sha256 = "0fsq1y8dz4ssn90akvzj36cqyblalb09bjzy4ikqn67mb5x99wpb";
+      sha256 = "0m4r1gzrnn0s1c7haqq9dlmvpqxbgbkbdfmq6qaph869wcmvdkvy";
     };
   };
 
@@ -116,23 +123,9 @@ let
     "-DGCC_INSTALL_PREFIX=${clang.cc.gcc}"
   ];
 
-  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"
-    # During the Swift build, a full local LLVM build is performed and the resulting clang is invoked.
-    # This compiler is not using the Nix wrappers, so it needs some help to find things.
-    export NIX_LDFLAGS_BEFORE="-rpath ${clang.cc.gcc.lib}/lib -L${clang.cc.gcc.lib}/lib $NIX_LDFLAGS_BEFORE"
-
-    $SWIFT_SOURCE_ROOT/swift/utils/build-script \
-      --preset=buildbot_linux \
-      installable_package=$INSTALLABLE_PACKAGE \
-      install_prefix=$out \
-      install_destdir=$SWIFT_INSTALL_DIR \
-      extra_cmake_options="${stdenv.lib.concatStringsSep "," cmakeFlags}"'';
-
 in
 stdenv.mkDerivation {
-  name = "swift-${version_friendly}";
+  name = "swift-${version}";
 
   nativeBuildInputs = [
     autoconf
@@ -164,32 +157,17 @@ stdenv.mkDerivation {
 
   hardeningDisable = [ "format" ]; # for LLDB
 
-  configurePhase = ''
-    cd ..
-
-    export INSTALLABLE_PACKAGE=$PWD/swift.tar.gz
-
-    mkdir build install
-    export SWIFT_BUILD_ROOT=$PWD/build
-    export SWIFT_INSTALL_DIR=$PWD/install
-
-    cd $SWIFT_BUILD_ROOT
-
-    unset CC
-    unset CXX
-
-    export NIX_ENFORCE_PURITY=
-  '';
-
   unpackPhase = ''
     mkdir src
     cd src
-    export sourceRoot=$PWD
     export SWIFT_SOURCE_ROOT=$PWD
 
-    cp -r ${sources.clang} clang
     cp -r ${sources.llvm} llvm
     cp -r ${sources.compilerrt} compiler-rt
+    cp -r ${sources.clang} clang
+    cp -r ${sources.clangtools} clang-tools-extra
+    cp -r ${sources.indexstore} indexstore-db
+    cp -r ${sources.sourcekit} sourcekit-lsp
     cp -r ${sources.cmark} cmark
     cp -r ${sources.lldb} lldb
     cp -r ${sources.llbuild} llbuild
@@ -234,33 +212,75 @@ stdenv.mkDerivation {
       \
       -e 's/^swift-install-components=autolink.*$/\0;editor-integration/'
 
-    # https://bugs.swift.org/browse/SR-10559
-    patch -p1 -d swift-corelibs-libdispatch -i ${./patches/libdispatch-fortify-fix.patch}
-
+    substituteInPlace clang/lib/Driver/ToolChains/Linux.cpp \
+      --replace 'SysRoot + "/lib' '"${glibc}/lib" "'
     substituteInPlace clang/lib/Driver/ToolChains/Linux.cpp \
       --replace 'SysRoot + "/usr/lib' '"${glibc}/lib" "'
-    patch -p1 -d clang -i ${./patches/llvm-include-dirs.patch}
+    patch -p1 -d clang -i ${./patches/llvm-toolchain-dir.patch}
     patch -p1 -d clang -i ${./purity.patch}
 
     # Workaround hardcoded dep on "libcurses" (vs "libncurses"):
-    sed -i 's,curses,ncurses,' llbuild/*/*/CMakeLists.txt
+    sed -i 's/curses/ncurses/' llbuild/*/*/CMakeLists.txt
+    # uuid.h is not part of glibc, but of libuuid
+    sed -i 's|''${GLIBC_INCLUDE_PATH}/uuid/uuid.h|${libuuid.dev}/include/uuid/uuid.h|' swift/stdlib/public/Platform/glibc.modulemap.gyb
 
     PREFIX=''${out/#\/}
+    substituteInPlace indexstore-db/Utilities/build-script-helper.py \
+      --replace usr "$PREFIX"
+    substituteInPlace sourcekit-lsp/Utilities/build-script-helper.py \
+      --replace usr "$PREFIX"
     substituteInPlace swift-corelibs-xctest/build_script.py \
       --replace usr "$PREFIX"
   '';
 
-  buildPhase = builder;
+  configurePhase = ''
+    cd ..
+
+    mkdir build install
+    export SWIFT_BUILD_ROOT=$PWD/build
+    export SWIFT_INSTALL_DIR=$PWD/install
+
+    export INSTALLABLE_PACKAGE=$PWD/swift.tar.gz
+    export NIX_ENFORCE_PURITY=
 
-  doCheck = false;
+    cd $SWIFT_BUILD_ROOT
+  '';
+
+  buildPhase = ''
+    # gcc-6.4.0/include/c++/6.4.0/cstdlib:75:15: fatal error: 'stdlib.h' file not found
+    export NIX_CFLAGS_COMPILE="$( echo ${clang.default_cxx_stdlib_compile} ) $NIX_CFLAGS_COMPILE"
+    # During the Swift build, a full local LLVM build is performed and the resulting clang is invoked.
+    # This compiler is not using the Nix wrappers, so it needs some help to find things.
+    export NIX_LDFLAGS_BEFORE="-rpath ${clang.cc.gcc.lib}/lib -L${clang.cc.gcc.lib}/lib $NIX_LDFLAGS_BEFORE"
+    # However, we want to use the wrapped compiler whenever possible.
+    export CC="${clang}/bin/clang"
+
+    # fix for https://bugs.llvm.org/show_bug.cgi?id=39743
+    # see also https://forums.swift.org/t/18138/15
+    export CCC_OVERRIDE_OPTIONS="#x-fmodules s/-fmodules-cache-path.*//"
+
+    $SWIFT_SOURCE_ROOT/swift/utils/build-script \
+      --preset=buildbot_linux \
+      installable_package=$INSTALLABLE_PACKAGE \
+      install_prefix=$out \
+      install_destdir=$SWIFT_INSTALL_DIR \
+      extra_cmake_options="${stdenv.lib.concatStringsSep "," cmakeFlags}"
+  '';
+
+  doCheck = true;
 
   checkInputs = [ file ];
 
-  # TODO: investigate the non-working tests
   checkPhase = ''
+    # FIXME: disable non-working tests
+    rm $SWIFT_SOURCE_ROOT/swift/test/Driver/static-stdlib-linux.swift  # static linkage of libatomic.a complains about missing PIC
+    rm $SWIFT_SOURCE_ROOT/swift/validation-test/Python/build_swift.swift  # install_prefix not passed properly
+
+    # match the swift wrapper in the install phase
+    export LIBRARY_PATH=${icu}/lib:${libuuid.out}/lib
+
     checkTarget=check-swift-all
     ninjaFlags='-C buildbot_linux/swift-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}'
-
     ninjaCheckPhase
   '';
 
@@ -268,18 +288,22 @@ stdenv.mkDerivation {
     mkdir -p $out
 
     # Extract the generated tarball into the store
-    PREFIX=''${out/#\/}
-    tar xf $INSTALLABLE_PACKAGE -C $out --strip-components=3 $PREFIX
+    tar xf $INSTALLABLE_PACKAGE -C $out --strip-components=3 ''${out/#\/}
     find $out -type d -empty -delete
 
+    # fix installation weirdness, also present in Appleā€™s official tarballs
+    mv $out/local/include/indexstore $out/include
+    rmdir $out/local/include $out/local
+    rm -r $out/bin/sdk-module-lists $out/bin/swift-api-checker.py
+
     wrapProgram $out/bin/swift \
       --suffix C_INCLUDE_PATH : $out/lib/swift/clang/include \
       --suffix CPLUS_INCLUDE_PATH : $out/lib/swift/clang/include \
-      --suffix LIBRARY_PATH : $icu/lib
+      --suffix LIBRARY_PATH : ${icu}/lib:${libuuid.out}/lib
   '';
 
-  # Hack to avoid TMPDIR in RPATHs.
-  preFixup = ''rm -rf "$(pwd)" '';
+  # Hack to avoid build and install directories in RPATHs.
+  preFixup = ''rm -rf $SWIFT_BUILD_ROOT $SWIFT_INSTALL_DIR'';
 
   meta = with stdenv.lib; {
     description = "The Swift Programming Language";
diff --git a/pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch b/pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch
index 79482ac10e69..60b2996b3405 100644
--- a/pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch
+++ b/pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch
@@ -1,17 +1,8 @@
-From 1fc49285c7a198de14005803dfde64bda17f4120 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Tue, 28 Mar 2017 15:01:16 -0500
-Subject: [PATCH 1/4] build-presets: (linux) don't require using Ninja
+Don't build Ninja, we use our own.
 
----
- utils/build-presets.ini | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/utils/build-presets.ini b/utils/build-presets.ini
-index 7ee57ad2df..e6b0af3581 100644
 --- a/utils/build-presets.ini
 +++ b/utils/build-presets.ini
-@@ -721,7 +721,7 @@ swiftpm
+@@ -745,7 +745,7 @@ swiftpm
  
  dash-dash
  
@@ -20,6 +11,3 @@ index 7ee57ad2df..e6b0af3581 100644
  install-swift
  install-lldb
  install-llbuild
--- 
-2.12.2
-
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 5c1927acb7f1..5ca6bf1354dc 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
@@ -1,25 +1,13 @@
-From fca6624b7a0ad670157105336a737cc95f9ce9fb Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Tue, 28 Mar 2017 15:01:40 -0500
-Subject: [PATCH 2/4] build-presets: (linux) allow custom install prefix
+allow custom install prefix
 
----
- utils/build-presets.ini | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/utils/build-presets.ini b/utils/build-presets.ini
-index e6b0af3581..1095cbaab7 100644
 --- a/utils/build-presets.ini	2019-04-11 14:51:40.060259462 +0200
 +++ b/utils/build-presets.ini	2019-04-11 15:16:17.471137969 +0200
-@@ -728,7 +728,7 @@
+@@ -752,7 +752,7 @@
  install-swiftpm
  install-xctest
  install-libicu
 -install-prefix=/usr
 +install-prefix=%(install_prefix)s
- swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
- llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-headers;compiler-rt
  install-libcxx
--- 
-2.12.2
-
+ install-sourcekit-lsp
+ build-swift-static-stdlib
diff --git a/pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patch b/pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patch
index 5d766bc25901..0a66af9e5137 100644
--- a/pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patch
+++ b/pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patch
@@ -1,6 +1,8 @@
+Disable targets, where we use Nix packages.
+
 --- a/utils/build-presets.ini	2019-04-11 15:19:57.845178834 +0200
 +++ b/utils/build-presets.ini	2019-04-11 15:27:42.041297057 +0200
-@@ -716,8 +716,6 @@
+@@ -740,8 +740,6 @@
  llbuild
  swiftpm
  xctest
@@ -9,15 +11,13 @@
  
  dash-dash
  
-@@ -727,11 +725,9 @@
+@@ -751,9 +749,7 @@
  install-llbuild
  install-swiftpm
  install-xctest
 -install-libicu
  install-prefix=%(install_prefix)s
- swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
- llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-headers;compiler-rt
 -install-libcxx
+ install-sourcekit-lsp
  build-swift-static-stdlib
  build-swift-static-sdk-overlay
- build-swift-stdlib-unittest-extra
diff --git a/pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch b/pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch
index 1d0a6a9577aa..304b53a1dbf1 100644
--- a/pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch
+++ b/pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch
@@ -1,17 +1,8 @@
-From 4a46b12f580d0a9779937d07c4f1fd347570c4ef Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Tue, 28 Mar 2017 15:02:37 -0500
-Subject: [PATCH 4/4] build-presets: (linux) plumb extra-cmake-options
+plumb extra-cmake-options
 
----
- utils/build-presets.ini | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/utils/build-presets.ini b/utils/build-presets.ini
-index 1739e91dc2..0608fed9c1 100644
 --- a/utils/build-presets.ini
 +++ b/utils/build-presets.ini
-@@ -743,6 +743,8 @@ install-destdir=%(install_destdir)s
+@@ -766,6 +766,8 @@ install-destdir=%(install_destdir)s
  # Path to the .tar.gz package we would create.
  installable-package=%(installable_package)s
  
@@ -20,6 +11,3 @@ index 1739e91dc2..0608fed9c1 100644
  [preset: buildbot_linux]
  mixin-preset=mixin_linux_installation
  build-subdir=buildbot_linux
--- 
-2.12.2
-
diff --git a/pkgs/development/compilers/swift/patches/glibc-arch-headers.patch b/pkgs/development/compilers/swift/patches/glibc-arch-headers.patch
index df906f9c84c7..c05db5208012 100644
--- a/pkgs/development/compilers/swift/patches/glibc-arch-headers.patch
+++ b/pkgs/development/compilers/swift/patches/glibc-arch-headers.patch
@@ -2,7 +2,7 @@ The Nix glibc headers do not use include/x86_64-linux-gnu subdirectories.
 
 --- swift/stdlib/public/Platform/CMakeLists.txt	2019-04-09 20:14:44.493801403 +0200
 +++ swift/stdlib/public/Platform/CMakeLists.txt	2019-04-09 20:14:44.577800593 +0200
-@@ -68,7 +68,7 @@
+@@ -77,7 +77,7 @@
      endif()
  
      set(GLIBC_INCLUDE_PATH "${GLIBC_SYSROOT_RELATIVE_INCLUDE_PATH}")
diff --git a/pkgs/development/compilers/swift/patches/libdispatch-fortify-fix.patch b/pkgs/development/compilers/swift/patches/libdispatch-fortify-fix.patch
deleted file mode 100644
index d23a308d68f4..000000000000
--- a/pkgs/development/compilers/swift/patches/libdispatch-fortify-fix.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Nix compiles with _FORTIFY_SOURCE enabled. Fix error due to -Werror and an unused return value warning.
-
---- swift-corelibs-libdispatch/src/internal.h	2019-04-26 09:33:38.287289099 +0200
-+++ swift-corelibs-libdispatch/src/internal.h	2019-04-26 15:31:10.485334128 +0200
-@@ -1053,7 +1053,7 @@
- #else
- #define _dispatch_client_assert_fail(fmt, ...)  do { \
- 		char *_msg = NULL; \
--		asprintf(&_msg, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, \
-+		(void)asprintf(&_msg, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, \
- 				##__VA_ARGS__); \
- 		_dispatch_assert_crash(_msg); \
- 		free(_msg); \
diff --git a/pkgs/development/compilers/swift/patches/llvm-include-dirs.patch b/pkgs/development/compilers/swift/patches/llvm-include-dirs.patch
deleted file mode 100644
index 789c0be7e7a8..000000000000
--- a/pkgs/development/compilers/swift/patches/llvm-include-dirs.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Only use the Nix include dirs when no sysroot is configured.
-
---- clang/lib/Driver/ToolChains/Linux.cpp	2018-10-05 18:01:15.731109551 +0200
-+++ clang/lib/Driver/ToolChains/Linux.cpp	2018-10-05 18:00:27.959509924 +0200
-@@ -641,7 +641,7 @@
- 
-   // Check for configure-time C include directories.
-   StringRef CIncludeDirs(C_INCLUDE_DIRS);
--  if (CIncludeDirs != "") {
-+  if (CIncludeDirs != "" && (SysRoot.empty() || SysRoot == "/")) {
-     SmallVector<StringRef, 5> dirs;
-     CIncludeDirs.split(dirs, ":");
-     for (StringRef dir : dirs) {
diff --git a/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch b/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch
new file mode 100644
index 000000000000..c22b5c820c85
--- /dev/null
+++ b/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch
@@ -0,0 +1,24 @@
+Use the Nix include dirs and gcc runtime dir, when no sysroot is configured.
+
+--- clang/lib/Driver/ToolChains/Linux.cpp	2018-10-05 18:01:15.731109551 +0200
++++ clang/lib/Driver/ToolChains/Linux.cpp	2018-10-05 18:00:27.959509924 +0200
+@@ -665,7 +665,7 @@
+ 
+   // Check for configure-time C include directories.
+   StringRef CIncludeDirs(C_INCLUDE_DIRS);
+-  if (CIncludeDirs != "") {
++  if (CIncludeDirs != "" && (SysRoot.empty() || SysRoot == "/")) {
+     SmallVector<StringRef, 5> dirs;
+     CIncludeDirs.split(dirs, ":");
+     for (StringRef dir : dirs) {
+--- clang/lib/Driver/ToolChains/Gnu.cpp	2019-10-26 09:49:27.003752743 +0200
++++ clang/lib/Driver/ToolChains/Gnu.cpp	2019-10-26 09:50:49.067236497 +0200
+@@ -1743,7 +1743,7 @@
+   // If we have a SysRoot, ignore GCC_INSTALL_PREFIX.
+   // GCC_INSTALL_PREFIX specifies the gcc installation for the default
+   // sysroot and is likely not valid with a different sysroot.
+-  if (!SysRoot.empty())
++  if (!(SysRoot.empty() || SysRoot == "/"))
+     return "";
+ 
+   return GCC_INSTALL_PREFIX;
diff --git a/pkgs/development/compilers/swift/purity.patch b/pkgs/development/compilers/swift/purity.patch
index 832decdc41f5..4133e89c2830 100644
--- a/pkgs/development/compilers/swift/purity.patch
+++ b/pkgs/development/compilers/swift/purity.patch
@@ -1,17 +1,8 @@
-From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Thu, 18 May 2017 11:56:12 -0500
-Subject: [PATCH] "purity" patch for 5.0
+"purity" patch for 5.0
 
----
- lib/Driver/ToolChains/Gnu.cpp | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index fe3c0191bb..c6a482bece 100644
 --- a/lib/Driver/ToolChains/Gnu.cpp
 +++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -380,13 +380,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+@@ -402,13 +402,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
    if (!Args.hasArg(options::OPT_static)) {
      if (Args.hasArg(options::OPT_rdynamic))
        CmdArgs.push_back("-export-dynamic");
@@ -25,6 +16,3 @@ index fe3c0191bb..c6a482bece 100644
    }
  
    CmdArgs.push_back("-o");
--- 
-2.11.0
-
diff --git a/pkgs/development/compilers/tinygo/default.nix b/pkgs/development/compilers/tinygo/default.nix
index 015c955000c2..1c7363a83bb9 100644
--- a/pkgs/development/compilers/tinygo/default.nix
+++ b/pkgs/development/compilers/tinygo/default.nix
@@ -3,13 +3,13 @@
 
 buildGoModule rec {
   pname = "tinygo";
-  version = "0.10.0";
+  version = "0.11.0";
 
   src = fetchFromGitHub {
     owner = "tinygo-org";
     repo = "tinygo";
     rev = "v${version}";
-    sha256 = "03di8500dqk25giiajglcdf2gbc0jidsn8qsw2sxmkmnd1np7gyd";
+    sha256 = "0cmg8x9hpvzlxp6hiy9hkh9nn7ig7b0x6k8a2c3bw19pfx9lxksf";
   };
 
   modSha256 = "0r3lfi1bj550sf3b7ysz62c2c33f8zfli8208xixj3jadycb6r3z";
diff --git a/pkgs/development/compilers/unison/default.nix b/pkgs/development/compilers/unison/default.nix
index 2a8c07fa0fe0..c24786cd9a04 100644
--- a/pkgs/development/compilers/unison/default.nix
+++ b/pkgs/development/compilers/unison/default.nix
@@ -4,18 +4,18 @@
 
 stdenv.mkDerivation rec {
   pname = "unison-code-manager";
-  milestone_id = "M1g";
+  milestone_id = "M1h";
   version = "1.0.${milestone_id}-alpha";
 
   src = if (stdenv.isDarwin) then
     fetchurl {
       url = "https://github.com/unisonweb/unison/releases/download/release/${milestone_id}/unison-osx.tar.gz";
-      sha256 = "186y7y7ffg976w01cbb8am84ajbifb7lcnsc4g3x262mkswr7lry";
+      sha256 = "0iivm5gmbk0fq0zr3lvck6p1c2i7i54l3rf70z677529w9irzchp";
     }
   else
     fetchurl {
       url = "https://github.com/unisonweb/unison/releases/download/release/${milestone_id}/unison-linux64.tar.gz";
-      sha256 = "1ki9car1clpaspnl5jb5qnr6nzv108q279n8m8bjm8azfcnl61ab";
+      sha256 = "0fb84c1yn8pidflh7kq696j3v4blkvbk1fsqp36h30p7vv676yci";
     };
 
   # The tarball is just the prebuilt binary, in the archive root.