about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers')
-rw-r--r--nixpkgs/pkgs/development/compilers/armips/default.nix31
-rw-r--r--nixpkgs/pkgs/development/compilers/compcert/default.nix125
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch15
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch40
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/8.10.4.nix16
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix16
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix16
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/head.nix16
-rw-r--r--nixpkgs/pkgs/development/compilers/gleam/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/jrsonnet/default.nix26
-rw-r--r--nixpkgs/pkgs/development/compilers/kotlin/default.nix7
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/lldb/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/lldb/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/lldb/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch14
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/6/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch39
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/lldb/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch40
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/clang-11-12-LLVMgold-path.patch13
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/clang-6-10-LLVMgold-path.patch15
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/default.nix13
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix5
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch91
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/default.nix5
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch20
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/libunwind/gnu-install-dirs.patch16
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/llvm/gnu-install-dirs.patch120
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/openmp/default.nix4
-rwxr-xr-xnixpkgs/pkgs/development/compilers/llvm/update-git.py22
-rw-r--r--nixpkgs/pkgs/development/compilers/mosml/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/nim/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/ocaml/4.13.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/11.nix10
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/12.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/13.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/14.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/15.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/16.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/meta.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/fix-library-path-jdk11.patch37
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/meta.nix8
-rw-r--r--nixpkgs/pkgs/development/compilers/rust/1_52.nix13
-rw-r--r--nixpkgs/pkgs/development/compilers/scryer-prolog/cargo.patch101
-rw-r--r--nixpkgs/pkgs/development/compilers/scryer-prolog/default.nix36
-rw-r--r--nixpkgs/pkgs/development/compilers/serpent/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/shaderc/default.nix16
-rw-r--r--nixpkgs/pkgs/development/compilers/terra/default.nix92
-rw-r--r--nixpkgs/pkgs/development/compilers/terra/nix-cflags.patch11
-rw-r--r--nixpkgs/pkgs/development/compilers/unison/default.nix10
-rw-r--r--nixpkgs/pkgs/development/compilers/vala/default.nix15
-rw-r--r--nixpkgs/pkgs/development/compilers/zig/default.nix9
69 files changed, 888 insertions, 528 deletions
diff --git a/nixpkgs/pkgs/development/compilers/armips/default.nix b/nixpkgs/pkgs/development/compilers/armips/default.nix
new file mode 100644
index 000000000000..b6fbb5ef34c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/armips/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "armips";
+  version = "0.11.0";
+
+  src = fetchFromGitHub {
+    owner = "Kingcom";
+    repo = "armips";
+    rev = "v${version}";
+    sha256 = "sha256-L+Uxww/WtvDJn1xZqoqA6Pkzq/98sy1qTxZbv6eEjbA=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin
+    cp armips $out/bin
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/Kingcom/armips";
+    description = "Assembler for various ARM and MIPS platforms.";
+    license = licenses.mit;
+    maintainers = with maintainers; [ marius851000 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/compcert/default.nix b/nixpkgs/pkgs/development/compilers/compcert/default.nix
deleted file mode 100644
index beafd6414f43..000000000000
--- a/nixpkgs/pkgs/development/compilers/compcert/default.nix
+++ /dev/null
@@ -1,125 +0,0 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper
-, coqPackages, ocamlPackages, coq2html
-, tools ? stdenv.cc
-, version ? "3.9"
-}:
-
-let
-  ocaml-pkgs      = with ocamlPackages; [ ocaml findlib menhir menhirLib ];
-  ccomp-platform = if stdenv.isDarwin then "x86_64-macosx" else "x86_64-linux";
-  inherit (coqPackages) coq flocq;
-  inherit (lib) optional optionalString;
-in
-
-let param = {
-  "3.7" = {
-    sha256 = "1h4zhk9rrqki193nxs9vjvya7nl9yxjcf07hfqb6g77riy1vd2jr";
-    patches = [
-     (fetchpatch {
-        url = "https://github.com/AbsInt/CompCert/commit/0a2db0269809539ccc66f8ec73637c37fbd23580.patch";
-        sha256 = "0n8qrba70x8f422jdvq9ddgsx6avf2dkg892g4ldh3jiiidyhspy";
-      })
-     (fetchpatch {
-        url = "https://github.com/AbsInt/CompCert/commit/5e29f8b5ba9582ecf2a1d0baeaef195873640607.patch";
-        sha256 = "184nfdgxrkci880lkaj5pgnify3plka7xfgqrgv16275sqppc5hc";
-      })
-    ];
-  };
-  "3.8" = {
-    sha256 = "1gzlyxvw64ca12qql3wnq3bidcx9ygsklv9grjma3ib4hvg7vnr7";
-    patches = [
-     # Support for Coq 8.12.2
-     (fetchpatch {
-        url = "https://github.com/AbsInt/CompCert/commit/06956421b4307054af221c118c5f59593c0e67b9.patch";
-        sha256 = "1f90q6j3xfvnf3z830bkd4d8526issvmdlrjlc95bfsqs78i1yrl";
-      })
-     # Support for Coq 8.13.0
-     (fetchpatch {
-        url = "https://github.com/AbsInt/CompCert/commit/0895388e7ebf9c9f3176d225107e21968919fb97.patch";
-        sha256 = "0qhkzgb2xl5kxys81pldp3mr39gd30lvr2l2wmplij319vp3xavd";
-      })
-     # Support for Coq 8.13.1
-     (fetchpatch {
-        url = "https://github.com/AbsInt/CompCert/commit/6bf310dd678285dc193798e89fc2c441d8430892.patch";
-        sha256 = "026ahhvpj5pksy90f8pnxgmhgwfqk4kwyvcf8x3dsanvz98d4pj5";
-      })
-     # Drop support for Coq < 8.9
-     (fetchpatch {
-        url = "https://github.com/AbsInt/CompCert/commit/7563a5df926a4c6fb1489a7a4c847641c8a35095.patch";
-        sha256 = "05vkslzy399r3dm6dmjs722rrajnyfa30xsyy3djl52isvn4gyfb";
-      })
-     # Support for Coq 8.13.2
-     (fetchpatch {
-        url = "https://github.com/AbsInt/CompCert/commit/48bc183167c4ce01a5c9ea86e49d60530adf7290.patch";
-        sha256 = "0j62lppfk26d1brdp3qwll2wi4gvpx1k70qivpvby5f7dpkrkax1";
-      })
-    ];
-    useExternalFlocq = true;
-  };
-  "3.9" = {
-    sha256 = "1srcz2dqrvmbvv5cl66r34zqkm0hsbryk7gd3i9xx4slahc9zvdb";
-    useExternalFlocq = true;
-  };
-}."${version}"; in
-
-stdenv.mkDerivation rec {
-  pname = "compcert";
-  inherit version;
-
-  src = fetchFromGitHub {
-    owner = "AbsInt";
-    repo = "CompCert";
-    rev = "v${version}";
-    inherit (param) sha256;
-  };
-
-  patches = param.patches or [];
-
-  nativeBuildInputs = [ makeWrapper ];
-  buildInputs = ocaml-pkgs ++ [ coq coq2html ];
-  propagatedBuildInputs = optional (param.useExternalFlocq or false) flocq;
-  enableParallelBuilding = true;
-
-  postPatch = ''
-    substituteInPlace ./configure \
-      --replace \$\{toolprefix\}ar 'ar' \
-      --replace '{toolprefix}gcc' '{toolprefix}cc'
-  '';
-
-  configurePhase = ''
-    ./configure -clightgen \
-      -prefix $out \
-      -coqdevdir $lib/lib/coq/${coq.coq-version}/user-contrib/compcert/ \
-      -toolprefix ${tools}/bin/ \
-      ${optionalString (param.useExternalFlocq or false) "-use-external-Flocq"} \
-      ${ccomp-platform}
-  '';
-
-  installTargets = "documentation install";
-  postInstall = ''
-    # move man into place
-    mkdir -p $man/share
-    mv $out/share/man/ $man/share/
-
-    # move docs into place
-    mkdir -p $doc/share/doc/compcert
-    mv doc/html $doc/share/doc/compcert/
-
-    # wrap ccomp to undefine _FORTIFY_SOURCE; ccomp invokes cc1 which sets
-    # _FORTIFY_SOURCE=2 by default, but undefines __GNUC__ (as it should),
-    # which causes a warning in libc. this suppresses it.
-    for x in ccomp clightgen; do
-      wrapProgram $out/bin/$x --add-flags "-U_FORTIFY_SOURCE"
-    done
-  '';
-
-  outputs = [ "out" "lib" "doc" "man" ];
-
-  meta = with lib; {
-    description = "Formally verified C compiler";
-    homepage    = "https://compcert.org";
-    license     = licenses.inria-compcert;
-    platforms   = [ "x86_64-linux" "x86_64-darwin" ];
-    maintainers = with maintainers; [ thoughtpolice jwiegley vbgl ];
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/flutter/default.nix b/nixpkgs/pkgs/development/compilers/flutter/default.nix
index 736178e76ca2..f7dc6f8e87c3 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/default.nix
+++ b/nixpkgs/pkgs/development/compilers/flutter/default.nix
@@ -4,7 +4,7 @@ let
   getPatches = dir:
     let files = builtins.attrNames (builtins.readDir dir);
     in map (f: dir + ("/" + f)) files;
-  version = "2.0.3";
+  version = "2.2.1";
   channel = "stable";
   filename = "flutter_linux_${version}-${channel}.tar.xz";
 in
@@ -15,7 +15,7 @@ in
     pname = "flutter";
     src = fetchurl {
       url = "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}";
-      sha256 = "14a63cpkp78rgymmlrppds69jsrdarg33dr43nb7s61r0xfh9icm";
+      sha256 = "009pwk2casz10gibgjpz08102wxmkq9iq3994b3c2q342g6526g0";
     };
     patches = getPatches ./patches;
   };
diff --git a/nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch b/nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch
index 1fe098136843..d0fd363d3c64 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch
+++ b/nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch
@@ -1,5 +1,5 @@
 diff --git a/bin/internal/shared.sh b/bin/internal/shared.sh
-index c44f867746..c9eda34e26 100644
+index be9320210e..6eb50aae95 100644
 --- a/bin/internal/shared.sh
 +++ b/bin/internal/shared.sh
 @@ -218,8 +218,6 @@ function shared::execute() {
@@ -12,16 +12,23 @@ index c44f867746..c9eda34e26 100644
    case "$BIN_NAME" in
      flutter*)
 diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
-index 3dc7929dd1..e65d70d55b 100644
+index 550a75bc65..c98a4591cc 100644
 --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
 +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
-@@ -246,11 +246,7 @@ class FlutterCommandRunner extends CommandRunner<void> {
+@@ -244,7 +244,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
            globals.flutterUsage.suppressAnalytics = true;
          }
  
 -        globals.flutterVersion.ensureVersionFile();
          final bool machineFlag = topLevelResults['machine'] as bool;
--        if (topLevelResults.command?.name != 'upgrade' && topLevelResults['version-check'] as bool && !machineFlag) {
+         final bool ci = await globals.botDetector.isRunningOnBot;
+         final bool redirectedCompletion = !globals.stdio.hasTerminal &&
+@@ -253,10 +252,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
+         final bool versionCheckFlag = topLevelResults['version-check'] as bool;
+         final bool explicitVersionCheckPassed = topLevelResults.wasParsed('version-check') && versionCheckFlag;
+ 
+-        if (topLevelResults.command?.name != 'upgrade' &&
+-            (explicitVersionCheckPassed || (versionCheckFlag && !isMachine))) {
 -          await globals.flutterVersion.checkFlutterVersionFreshness();
 -        }
  
diff --git a/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch b/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch
index d6a45a97e581..2610c155804b 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch
+++ b/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch
@@ -1,24 +1,24 @@
 diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
-index a6c59bae07..21f6c9812a 100644
+index 80fb16673f..5723f93f9f 100644
 --- a/packages/flutter_tools/lib/src/asset.dart
 +++ b/packages/flutter_tools/lib/src/asset.dart
-@@ -5,6 +5,7 @@
+@@ -7,6 +7,7 @@
  import 'package:meta/meta.dart';
  import 'package:package_config/package_config.dart';
  
 +import 'base/common.dart';
  import 'base/context.dart';
+ import 'base/deferred_component.dart';
  import 'base/file_system.dart';
- import 'base/logger.dart';
-@@ -14,6 +15,7 @@ import 'cache.dart';
+@@ -16,6 +17,7 @@ import 'build_info.dart';
+ import 'cache.dart';
  import 'convert.dart';
  import 'dart/package_map.dart';
- import 'devfs.dart';
 +import 'globals.dart' as globals;
+ import 'devfs.dart';
  import 'flutter_manifest.dart';
  import 'license_collector.dart';
- import 'project.dart';
-@@ -377,7 +379,7 @@ class ManifestAssetBundle implements AssetBundle {
+@@ -449,7 +451,7 @@ class ManifestAssetBundle implements AssetBundle {
        for (final Map<String, Object> font in family['fonts'] as List<Map<String, Object>>) {
          final Uri entryUri = _fileSystem.path.toUri(font['asset'] as String);
          result.add(_Asset(
@@ -28,32 +28,40 @@ index a6c59bae07..21f6c9812a 100644
            entryUri: entryUri,
            package: null,
 diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
-index 11e3bf3e11..39d6fae0d1 100644
+index 152d4e75e5..1fcff7e2bd 100644
 --- a/packages/flutter_tools/lib/src/cache.dart
 +++ b/packages/flutter_tools/lib/src/cache.dart
-@@ -321,8 +321,15 @@ class Cache {
+@@ -9,6 +9,7 @@ import 'package:file/memory.dart';
+ import 'package:meta/meta.dart';
+ import 'package:process/process.dart';
+ 
++import 'globals.dart' as globals;
+ import 'base/common.dart';
+ import 'base/error_handling_io.dart';
+ import 'base/file_system.dart';
+@@ -298,8 +299,15 @@ class Cache {
        return;
      }
      assert(_lock == null);
 +
-+    final Directory dir = _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter'));
++    final Directory dir = _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
 +    if (!dir.existsSync()) {
 +      dir.createSync(recursive: true);
 +      globals.os.chmod(dir, '755');
 +    }
 +
      final File lockFile =
--      _fileSystem.file(_fileSystem.path.join(flutterRoot, 'bin', 'cache', 'lockfile'));
-+      _fileSystem.file(_fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter', 'lockfile'));
+-      _fileSystem.file(_fileSystem.path.join(flutterRoot!, 'bin', 'cache', 'lockfile'));
++      _fileSystem.file(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter', 'lockfile'));
      try {
        _lock = lockFile.openSync(mode: FileMode.write);
      } on FileSystemException catch (e) {
-@@ -424,7 +431,7 @@ class Cache {
+@@ -404,7 +412,7 @@ class Cache {
      if (_rootOverride != null) {
-       return _fileSystem.directory(_fileSystem.path.join(_rootOverride.path, 'bin', 'cache'));
+       return _fileSystem.directory(_fileSystem.path.join(_rootOverride!.path, 'bin', 'cache'));
      } else {
--      return _fileSystem.directory(_fileSystem.path.join(flutterRoot, 'bin', 'cache'));
-+      return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter'));
+-      return _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin', 'cache'));
++      return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
      }
    }
  
diff --git a/nixpkgs/pkgs/development/compilers/ghc/8.10.4.nix b/nixpkgs/pkgs/development/compilers/ghc/8.10.4.nix
index da957f93520b..fe42d0c1c6a3 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/8.10.4.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/8.10.4.nix
@@ -89,9 +89,19 @@ let
 
   targetCC = builtins.head toolsForTarget;
 
-  # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
+  # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
+  # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
   # see #84670 and #49071 for more background.
-  useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl;
+  useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl);
+
+  runtimeDeps = [
+    targetPackages.stdenv.cc.bintools
+    coreutils
+  ]
+  # On darwin, we need unwrapped bintools as well (for otool)
+  ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
+    targetPackages.stdenv.cc.bintools.bintools
+  ];
 
 in
 stdenv.mkDerivation (rec {
@@ -235,7 +245,7 @@ stdenv.mkDerivation (rec {
     for i in "$out/bin/"*; do
       test ! -h $i || continue
       egrep --quiet '^#!' <(head -n 1 $i) || continue
-      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
+      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
     done
   '';
 
diff --git a/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix b/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix
index b0336ad3992d..002d83ef6be1 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix
@@ -98,9 +98,19 @@ let
 
   targetCC = builtins.head toolsForTarget;
 
-  # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
+  # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
+  # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
   # see #84670 and #49071 for more background.
-  useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl;
+  useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl);
+
+  runtimeDeps = [
+    targetPackages.stdenv.cc.bintools
+    coreutils
+  ]
+  # On darwin, we need unwrapped bintools as well (for otool)
+  ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
+    targetPackages.stdenv.cc.bintools.bintools
+  ];
 
 in
 stdenv.mkDerivation (rec {
@@ -242,7 +252,7 @@ stdenv.mkDerivation (rec {
     for i in "$out/bin/"*; do
       test ! -h $i || continue
       egrep --quiet '^#!' <(head -n 1 $i) || continue
-      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
+      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
     done
   '';
 
diff --git a/nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix b/nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix
index 58beef5d6882..f5a6b5f32fa8 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix
@@ -90,9 +90,19 @@ let
 
   targetCC = builtins.head toolsForTarget;
 
-  # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
+  # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
+  # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
   # see #84670 and #49071 for more background.
-  useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl;
+  useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl);
+
+  runtimeDeps = [
+    targetPackages.stdenv.cc.bintools
+    coreutils
+  ]
+  # On darwin, we need unwrapped bintools as well (for otool)
+  ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
+    targetPackages.stdenv.cc.bintools.bintools
+  ];
 
 in
 stdenv.mkDerivation (rec {
@@ -225,7 +235,7 @@ stdenv.mkDerivation (rec {
     for i in "$out/bin/"*; do
       test ! -h $i || continue
       egrep --quiet '^#!' <(head -n 1 $i) || continue
-      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
+      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
     done
   '';
 
diff --git a/nixpkgs/pkgs/development/compilers/ghc/head.nix b/nixpkgs/pkgs/development/compilers/ghc/head.nix
index a0ca13270a24..ec236731afd7 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/head.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/head.nix
@@ -100,9 +100,19 @@ let
 
   targetCC = builtins.head toolsForTarget;
 
-  # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
+  # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
+  # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
   # see #84670 and #49071 for more background.
-  useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl;
+  useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl);
+
+  runtimeDeps = [
+    targetPackages.stdenv.cc.bintools
+    coreutils
+  ]
+  # On darwin, we need unwrapped bintools as well (for otool)
+  ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
+    targetPackages.stdenv.cc.bintools.bintools
+  ];
 
 in
 stdenv.mkDerivation (rec {
@@ -242,7 +252,7 @@ stdenv.mkDerivation (rec {
     for i in "$out/bin/"*; do
       test ! -h $i || continue
       egrep --quiet '^#!' <(head -n 1 $i) || continue
-      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
+      sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i
     done
   '';
 
diff --git a/nixpkgs/pkgs/development/compilers/gleam/default.nix b/nixpkgs/pkgs/development/compilers/gleam/default.nix
index 7bce45c455f2..5c88be00ba8f 100644
--- a/nixpkgs/pkgs/development/compilers/gleam/default.nix
+++ b/nixpkgs/pkgs/development/compilers/gleam/default.nix
@@ -2,13 +2,13 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "gleam";
-  version = "0.15.1";
+  version = "0.16.0";
 
   src = fetchFromGitHub {
     owner = "gleam-lang";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-vBxVGIgg2BpVvEYjmX99YSf1zy9aWOHr6ftaYxJWkzY=";
+    sha256 = "sha256-QcJudP4zhtY1CxV3XLkiC06hrKOqlLdb+X6lHvqc7ZA=";
   };
 
   nativeBuildInputs = [ pkg-config ];
@@ -16,7 +16,7 @@ rustPlatform.buildRustPackage rec {
   buildInputs = [ openssl ] ++
     lib.optionals stdenv.isDarwin [ Security libiconv ];
 
-  cargoSha256 = "sha256-2zHc7xk5MuEUO9YGifSWbgRTi51ZUk84QLro94LsBtQ=";
+  cargoSha256 = "sha256-een2aI6gDVx450mQcwF1uRG/tn9FzahTMWpPdvUBumE=";
 
   meta = with lib; {
     description = "A statically typed language for the Erlang VM";
diff --git a/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix b/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix
index 4012aa260f8c..f3bd5d9f4a31 100644
--- a/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix
+++ b/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix
@@ -24,9 +24,8 @@ openjdk11.overrideAttrs (oldAttrs: rec {
      your own risk.
     '';
     homepage = "https://bintray.com/jetbrains/intellij-jdk/";
-    license = licenses.gpl2;
+    inherit (openjdk11.meta) license platforms mainProgram;
     maintainers = with maintainers; [ edwtjo petabyteboy ];
-    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
   };
   passthru = oldAttrs.passthru // {
     home = "${jetbrains.jdk}/lib/openjdk";
diff --git a/nixpkgs/pkgs/development/compilers/jrsonnet/default.nix b/nixpkgs/pkgs/development/compilers/jrsonnet/default.nix
new file mode 100644
index 000000000000..82e15db66858
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/jrsonnet/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, lib, fetchFromGitHub, rustPlatform }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "jrsonnet";
+  version = "0.3.8";
+
+  src = fetchFromGitHub {
+    rev = "v${version}";
+    owner = "CertainLach";
+    repo = "jrsonnet";
+    sha256 = "sha256-u6P/j7j6S7iPQQh00YFtp2G9Kt4xdWJGsxbuBjvHHZ4=";
+  };
+
+  postInstall = ''
+    ln -s $out/bin/jrsonnet $out/bin/jsonnet
+  '';
+
+  cargoSha256 = "sha256-KGQ3n3BBgLCT3ITIM8p9AxNa62ek4GHymqoD0eQSVKQ=";
+
+  meta = {
+    description = "Purely-functional configuration language that helps you define JSON data";
+    maintainers = with lib.maintainers; [ lach ];
+    license = lib.licenses.mit;
+    homepage = "https://github.com/CertainLach/jrsonnet";
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/kotlin/default.nix b/nixpkgs/pkgs/development/compilers/kotlin/default.nix
index 5fdf58e56f5d..a2021c836fec 100644
--- a/nixpkgs/pkgs/development/compilers/kotlin/default.nix
+++ b/nixpkgs/pkgs/development/compilers/kotlin/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "kotlin";
-  version = "1.5.0";
+  version = "1.5.10";
 
   src = fetchurl {
     url = "https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-compiler-${version}.zip";
-    sha256 = "1dyiis96skflhlsmc8byp5j8j3vsicmlslwyrkn1pv4gc8gzqhq3";
+    sha256 = "0kiwddq5b0dk63nlifb8bbaimh8inxsbk97nbw2m8qw17gby339g";
   };
 
   propagatedBuildInputs = [ jre ] ;
@@ -37,8 +37,7 @@ stdenv.mkDerivation rec {
     '';
     homepage = "https://kotlinlang.org/";
     license = lib.licenses.asl20;
-    maintainers = with lib.maintainers;
-      [ ];
+    maintainers = with lib.maintainers; [ SubhrajyotiSen ];
     platforms = lib.platforms.all;
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
index e0c52651cadc..b42f40b96943 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -46,6 +46,10 @@ let
       # https://reviews.llvm.org/D51899
       ./compiler-rt-baremetal.patch
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ../../clang-6-10-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -64,12 +68,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/lldb/default.nix
index 04b9e06e77a3..a762151a586c 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/10/lldb/default.nix
@@ -13,6 +13,7 @@
 , version
 , darwin
 , lit
+, makeWrapper
 , enableManpages ? false
 }:
 
@@ -30,7 +31,7 @@ stdenv.mkDerivation (rec {
   outputs = [ "out" "lib" "dev" ];
 
   nativeBuildInputs = [
-    cmake python3 which swig lit
+    cmake python3 which swig lit makeWrapper
   ] ++ lib.optionals enableManpages [
     python3.pkgs.sphinx python3.pkgs.recommonmark
   ];
@@ -68,7 +69,15 @@ stdenv.mkDerivation (rec {
 
   doCheck = false;
 
+  installCheckPhase = ''
+    if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
+        return 1;
+    fi
+  '';
+
   postInstall = ''
+    wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
+
     # Editor support
     # vscode:
     install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch
index 053a580e45ec..0a7539db5e6b 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch
@@ -63,3 +63,29 @@ index aff75d7db334..98a527c5e761 100644
  install(TARGETS lldbIntelFeatures
 -  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
 +  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
+index 752113b..010f187 100644
+--- a/cmake/modules/LLDBStandalone.cmake
++++ b/cmake/modules/LLDBStandalone.cmake
+@@ -62,7 +62,7 @@ endif()
+
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
++set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 OR CYGWIN)
+   # DLL platform -- put DLLs into bin.
+   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bf74802..1c98cae 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -222,7 +222,7 @@ if (LLDB_ENABLE_PYTHON)
+   if(LLDB_BUILD_FRAMEWORK)
+     set(LLDB_PYTHON_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python)
+   else()
+-    set(LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_RELATIVE_PATH})
++    set(LLDB_PYTHON_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH})
+   endif()
+   if (NOT CMAKE_CFG_INTDIR STREQUAL  ".")
+     string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
index 74078c1ac667..9eed5269da6b 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, fetchpatch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, fetchpatch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -62,6 +62,10 @@ let
         excludes = [ "docs/*" "test/*" ];
         sha256 = "0gxgmi0qbm89mq911dahallhi8m6wa9vpklklqmxafx4rplrr8ph";
       })
+      (substituteAll {
+        src = ../../clang-11-12-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -80,12 +84,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/lldb/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/lldb/default.nix
index 785ac4671ef5..46d6c6628e10 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/lldb/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/lldb/default.nix
@@ -13,6 +13,7 @@
 , version
 , darwin
 , lit
+, makeWrapper
 , enableManpages ? false
 }:
 
@@ -30,7 +31,7 @@ stdenv.mkDerivation (rec {
   outputs = [ "out" "lib" "dev" ];
 
   nativeBuildInputs = [
-    cmake python3 which swig lit
+    cmake python3 which swig lit makeWrapper
   ] ++ lib.optionals enableManpages [
     python3.pkgs.sphinx python3.pkgs.recommonmark
   ];
@@ -68,7 +69,15 @@ stdenv.mkDerivation (rec {
 
   doCheck = false;
 
+  installCheckPhase = ''
+    if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
+        return 1;
+    fi
+  '';
+
   postInstall = ''
+    wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
+
     # Editor support
     # vscode:
     install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch
index a4769109523d..fd49be395a3a 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch
@@ -63,3 +63,29 @@ index efba2f74904f..e08413b1dbb1 100644
  install(TARGETS lldbIntelFeatures
 -  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
 +  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
+index 752113b..010f187 100644
+--- a/cmake/modules/LLDBStandalone.cmake
++++ b/cmake/modules/LLDBStandalone.cmake
+@@ -62,7 +62,7 @@ endif()
+
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
++set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 OR CYGWIN)
+   # DLL platform -- put DLLs into bin.
+   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bf74802..1c98cae 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -222,7 +222,7 @@ if (LLDB_ENABLE_PYTHON)
+   if(LLDB_BUILD_FRAMEWORK)
+     set(LLDB_PYTHON_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python)
+   else()
+-    set(LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_RELATIVE_PATH})
++    set(LLDB_PYTHON_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH})
+   endif()
+   if (NOT CMAKE_CFG_INTDIR STREQUAL  ".")
+     string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
index 3d1106dbc52c..dbd6ea1e1ac4 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -44,6 +44,10 @@ let
       ./purity.patch
       # https://reviews.llvm.org/D51899
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ../../clang-11-12-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -59,12 +63,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/lldb/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/lldb/default.nix
index 07517308b467..0712396cccfa 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/lldb/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/lldb/default.nix
@@ -19,6 +19,7 @@
 , Carbon
 , Cocoa
 , lit
+, makeWrapper
 , enableManpages ? false
 }:
 
@@ -41,7 +42,7 @@ stdenv.mkDerivation (rec {
   outputs = [ "out" "lib" "dev" ];
 
   nativeBuildInputs = [
-    cmake python3 which swig lit
+    cmake python3 which swig lit makeWrapper
   ] ++ lib.optionals enableManpages [
     python3.pkgs.sphinx python3.pkgs.recommonmark
   ];
@@ -84,7 +85,15 @@ stdenv.mkDerivation (rec {
 
   doCheck = false;
 
+  installCheckPhase = ''
+    if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
+        return 1;
+    fi
+  '';
+
   postInstall = ''
+    wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
+
     # Editor support
     # vscode:
     install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch
index 98321f4479e6..afc945ce2614 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch
@@ -63,3 +63,29 @@ index 734167e51bc5..f95761b5df58 100644
  install(TARGETS lldbIntelFeatures
 -  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
 +  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
+index 752113b..010f187 100644
+--- a/cmake/modules/LLDBStandalone.cmake
++++ b/cmake/modules/LLDBStandalone.cmake
+@@ -62,7 +62,7 @@ endif()
+
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
++set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 OR CYGWIN)
+   # DLL platform -- put DLLs into bin.
+   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b5633e2..86e4738 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -79,7 +79,7 @@ if (LLDB_ENABLE_PYTHON)
+   if(LLDB_BUILD_FRAMEWORK)
+     set(lldb_python_target_dir "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
+   else()
+-    set(lldb_python_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
++    set(lldb_python_target_dir "${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH}/lldb")
+   endif()
+   get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
+   finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
diff --git a/nixpkgs/pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch b/nixpkgs/pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch
new file mode 100644
index 000000000000..6a09c91b5132
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch
@@ -0,0 +1,14 @@
+diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
+index 00bd60bc24bb..17416b0bd3c0 100644
+--- a/lib/Driver/ToolChains/CommonArgs.cpp
++++ b/lib/Driver/ToolChains/CommonArgs.cpp
+@@ -376,8 +376,7 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
+   // as gold requires -plugin to come before any -plugin-opt that -Wl might
+   // forward.
+   CmdArgs.push_back("-plugin");
+-  std::string Plugin =
+-      ToolChain.getDriver().Dir + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold.so";
++  std::string Plugin = "@libllvmLibdir@" "/LLVMgold.so";
+   CmdArgs.push_back(Args.MakeArgString(Plugin));
+ 
+   // Try to pass driver level flags relevant to LTO code generation down to
diff --git a/nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix
index b5887a23c65e..df3d26139866 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/5/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -43,6 +43,10 @@ let
     patches = [
       ./purity.patch
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ./LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -58,12 +62,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/6/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/6/clang/default.nix
index eba9111d9d32..ee8859c159a1 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/6/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/6/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -43,6 +43,10 @@ let
     patches = [
       ./purity.patch
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ../../clang-6-10-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -58,12 +62,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix
index e1b031ad352b..afa1669ace61 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -52,6 +52,10 @@ let
       # needed for our bootstrapping to not interfere with C.
       ./unwindlib.patch
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ../../clang-6-10-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -70,12 +74,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
index c3399dccd1d7..5cb7720d026f 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -59,6 +59,10 @@ let
       # make clang -xhip use $PATH to find executables
       ./HIP-use-PATH-8.patch
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ../../clang-6-10-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -77,12 +81,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix
index ee1f678996a6..b6025f722ebb 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix
@@ -12,6 +12,7 @@
 , python3
 , version
 , darwin
+, makeWrapper
 }:
 
 stdenv.mkDerivation rec {
@@ -37,7 +38,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "lib" "dev" ];
 
   nativeBuildInputs = [
-    cmake python3 which swig
+    cmake python3 which swig makeWrapper
   ];
 
   buildInputs = [
@@ -61,7 +62,15 @@ stdenv.mkDerivation rec {
 
   doCheck = false;
 
+  installCheckPhase = ''
+    if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
+        return 1;
+    fi
+  '';
+
   postInstall = ''
+    wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
+
     mkdir -p $out/share/man/man1
     cp ../docs/lldb.1 $out/share/man/man1/
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch
index b2e79086beda..08b6fae654e5 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch
@@ -79,3 +79,42 @@ index b5316540fdf3..3c3c882d503f 100644
  install(TARGETS lldbIntelFeatures
 -  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
 +  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cdf22c4..d56fc6a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -146,7 +146,7 @@ if (NOT LLDB_DISABLE_PYTHON)
+                --cfgBldDir=${lldb_scripts_dir}
+                --prefix=${CMAKE_BINARY_DIR}
+                --cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
+-               --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
++               --lldbLibDir=${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+                ${use_python_wrapper_from_src_dir}
+                ${use_six_py_from_system}
+         VERBATIM
+diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
+index a9059dd..d76a47d 100644
+--- a/cmake/modules/LLDBStandalone.cmake
++++ b/cmake/modules/LLDBStandalone.cmake
+@@ -124,7 +124,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+   link_directories("${LLVM_LIBRARY_DIR}")
+
+   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+-  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
++  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/lib${LLVM_LIBDIR_SUFFIX})
+   set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+
+   set(LLDB_BUILT_STANDALONE 1)
+diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
+index 3598247..bd60451 100644
+--- a/scripts/CMakeLists.txt
++++ b/scripts/CMakeLists.txt
+@@ -47,7 +47,7 @@ if(NOT LLDB_BUILD_FRAMEWORK)
+   endif()
+
+   set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
+-  set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
++  set(SWIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+
+   # Install the LLDB python module
+   install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
index 700fcb414fce..c98b4a830c42 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -52,6 +52,10 @@ let
       # make clang -xhip use $PATH to find executables
       ./HIP-use-PATH-9.patch
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ../../clang-6-10-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -70,12 +74,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/lldb/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/lldb/default.nix
index 9957a0218da8..63edc60828eb 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/lldb/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/lldb/default.nix
@@ -12,6 +12,7 @@
 , python3
 , version
 , darwin
+, makeWrapper
 , lit
 }:
 
@@ -29,7 +30,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "lib" "dev" ];
 
   nativeBuildInputs = [
-    cmake python3 which swig lit
+    cmake python3 which swig lit makeWrapper
   ];
 
   buildInputs = [
@@ -58,7 +59,15 @@ stdenv.mkDerivation rec {
 
   doCheck = false;
 
+  installCheckPhase = ''
+    if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
+        return 1;
+    fi
+  '';
+
   postInstall = ''
+    wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
+
     # man page
     mkdir -p $out/share/man/man1
     install ../docs/lldb.1 -t $out/share/man/man1/
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch
index cb4e400b3678..6ceb29ced92f 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch
@@ -63,3 +63,43 @@ index b5316540fdf3..3c3c882d503f 100644
  install(TARGETS lldbIntelFeatures
 -  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
 +  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cdf22c4..d56fc6a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -146,7 +146,7 @@ if (NOT LLDB_DISABLE_PYTHON)
+                --cfgBldDir=${lldb_scripts_dir}
+                --prefix=${CMAKE_BINARY_DIR}
+                --cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
+-               --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
++               --lldbLibDir=${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+                ${use_python_wrapper_from_src_dir}
+                ${use_six_py_from_system}
+         VERBATIM
+diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
+index b726797..1f057ac 100644
+--- a/cmake/modules/LLDBStandalone.cmake
++++ b/cmake/modules/LLDBStandalone.cmake
+@@ -95,7 +95,7 @@ include_directories(
+   "${CLANG_INCLUDE_DIRS}")
+
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
++set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/lib${LLVM_LIBDIR_SUFFIX})
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+
+ set(LLDB_BUILT_STANDALONE 1)
+diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
+index 7de7973..b70aecc 100644
+--- a/scripts/CMakeLists.txt
++++ b/scripts/CMakeLists.txt
+@@ -50,7 +50,8 @@ if(NOT LLDB_BUILD_FRAMEWORK)
+     OUTPUT_STRIP_TRAILING_WHITESPACE)
+   execute_process(
+     COMMAND ${PYTHON_EXECUTABLE}
+-        -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
++        -c "import distutils.sysconfig, sys; print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
++        ${CMAKE_INSTALL_LIBDIR}/../
+     OUTPUT_VARIABLE SWIG_INSTALL_DIR
+     OUTPUT_STRIP_TRAILING_WHITESPACE)
+
diff --git a/nixpkgs/pkgs/development/compilers/llvm/clang-11-12-LLVMgold-path.patch b/nixpkgs/pkgs/development/compilers/llvm/clang-11-12-LLVMgold-path.patch
new file mode 100644
index 000000000000..8f8991976f33
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/clang-11-12-LLVMgold-path.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
+index 6b6e276b8ce7..7896542a1202 100644
+--- a/lib/Driver/ToolChains/CommonArgs.cpp
++++ b/lib/Driver/ToolChains/CommonArgs.cpp
+@@ -409,7 +409,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
+ 
+     SmallString<1024> Plugin;
+     llvm::sys::path::native(
+-        Twine(D.Dir) + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" + Suffix,
++        Twine("@libllvmLibdir@" "/LLVMgold") + Suffix,
+         Plugin);
+     CmdArgs.push_back(Args.MakeArgString(Plugin));
+   }
diff --git a/nixpkgs/pkgs/development/compilers/llvm/clang-6-10-LLVMgold-path.patch b/nixpkgs/pkgs/development/compilers/llvm/clang-6-10-LLVMgold-path.patch
new file mode 100644
index 000000000000..93504316edf3
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/clang-6-10-LLVMgold-path.patch
@@ -0,0 +1,15 @@
+diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
+index 37ec73468570..b73e75aa6e59 100644
+--- a/lib/Driver/ToolChains/CommonArgs.cpp
++++ b/lib/Driver/ToolChains/CommonArgs.cpp
+@@ -370,8 +370,8 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
+ #endif
+ 
+   SmallString<1024> Plugin;
+-  llvm::sys::path::native(Twine(ToolChain.getDriver().Dir) +
+-                              "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" +
++  llvm::sys::path::native(Twine("@libllvmLibdir@"
++                                "/LLVMgold") +
+                               Suffix,
+                           Plugin);
+   CmdArgs.push_back(Args.MakeArgString(Plugin));
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
index 38de0f70cf2e..1bbbbd963f68 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
@@ -18,18 +18,19 @@
 }:
 
 let
-  release_version = "12.0.0";
+  release_version = "13.0.0";
   candidate = ""; # empty or "rcN"
   dash-candidate = lib.optionalString (candidate != "") "-${candidate}";
-  rev = ""; # When using a Git commit
-  version = "${release_version}${dash-candidate}"; # differentiating these (variables) is important for RCs
+  rev = "643b6407faf460915679f304420cfbee87c47734"; # When using a Git commit
+  rev-version = "unstable-2021-06-11"; # When using a Git commit
+  version = if rev != "" then rev-version else "${release_version}${dash-candidate}";
   targetConfig = stdenv.targetPlatform.config;
 
   src = fetchFromGitHub {
     owner = "llvm";
     repo = "llvm-project";
     rev = if rev != "" then rev else "llvmorg-${version}";
-    sha256 = "07jz8pywc2qqa1srdnqg5p2y4lx3ki1inpigarzgxc3j20r4gb58";
+    sha256 = "0b06qqbks20m1cy9g1k8y4w8vh9zcbh9ag2bpk9xgg2xkmbq42az";
   };
 
   llvm_meta = {
@@ -256,9 +257,7 @@ let
 
     libunwind = callPackage ./libunwind {
       inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
-               else stdenv;
+      stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
     };
 
     openmp = callPackage ./openmp {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
index 8fb6b4a7dbd4..f511eba81dc5 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, src, cmake, python3, libcxxabi, fixDarwinDylibNames, version
+{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version
 , enableShared ? !stdenv.hostPlatform.isStatic
 }:
 
@@ -24,10 +24,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake python3 ]
     ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
-  buildInputs = [ libcxxabi ];
-
   cmakeFlags = [
-    "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
     ++ lib.optional stdenv.hostPlatform.isWasm [
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch
index 1f9de00a9d56..f59d7f8dfafc 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch
@@ -1,5 +1,5 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 9bf1a02f0908..612cd4aab76c 100644
+index 06ee1d74a03e..6c3c6f8f8d47 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -28,6 +28,8 @@ set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
@@ -9,92 +9,73 @@ index 9bf1a02f0908..612cd4aab76c 100644
 +  include(GNUInstallDirs)
 +
    set(PACKAGE_NAME libcxx)
-   set(PACKAGE_VERSION 12.0.0)
+   set(PACKAGE_VERSION 13.0.0git)
    set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-@@ -402,7 +404,7 @@ endif ()
- if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-   set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
--  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-+  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+@@ -409,7 +411,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+   set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+   set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
+-  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
++  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
+   set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1")
+   set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
    if(LIBCXX_LIBDIR_SUBDIR)
-     string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
-     string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
-@@ -410,11 +412,11 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
- elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+@@ -420,14 +422,14 @@ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
    set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
-   set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
+   set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+   set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
 -  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
 +  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+   set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1")
+   set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}")
  else()
    set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
-   set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
+   set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
+   set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
 -  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
 +  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+   set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1")
+   set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}")
  endif()
- 
- file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
 diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
-index 5d2764e870e9..bb1ec5de6ca2 100644
+index 5a8a4a270a1a..c06bae0001aa 100644
 --- a/cmake/Modules/HandleLibCXXABI.cmake
 +++ b/cmake/Modules/HandleLibCXXABI.cmake
 @@ -63,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
  
          if (LIBCXX_INSTALL_HEADERS)
            install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
--            DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
-+            DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+-            DESTINATION include/c++/v1/${dstdir}
++            DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
              COMPONENT cxx-headers
              PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
              )
-diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
-index 29a317b8ae9a..4747263cfd1b 100644
---- a/include/CMakeLists.txt
-+++ b/include/CMakeLists.txt
-@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS)
-   foreach(file ${files})
-     get_filename_component(dir ${file} DIRECTORY)
-     install(FILES ${file}
--      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
-+      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
-       COMPONENT cxx-headers
-       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-     )
-@@ -260,7 +260,7 @@ if (LIBCXX_INSTALL_HEADERS)
- 
-   # Install the generated header as __config.
-   install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
--    DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
-+    DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
-     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-     RENAME __config
-     COMPONENT cxx-headers)
 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 9965104cb5b2..9b55dbb1d822 100644
+index 87b71f7ba334..d20a783079b7 100644
 --- a/src/CMakeLists.txt
 +++ b/src/CMakeLists.txt
-@@ -352,21 +352,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY)
+@@ -369,21 +369,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY)
    install(TARGETS cxx_shared
-     ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
-     LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
--    RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
-+    RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+     ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+     LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+-    RUNTIME DESTINATION bin COMPONENT cxx)
++    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
  endif()
  
  if (LIBCXX_INSTALL_STATIC_LIBRARY)
    install(TARGETS cxx_static
-     ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
-     LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
--    RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
-+    RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+     ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+     LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+-    RUNTIME DESTINATION bin COMPONENT cxx)
++    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
  endif()
  
  if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
    install(TARGETS cxx_experimental
-     LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
-     ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
--    RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
-+    RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+     LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+     ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+-    RUNTIME DESTINATION bin COMPONENT cxx)
++    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
  endif()
  
  # NOTE: This install command must go after the cxx install command otherwise
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
index 3bb82d651ec7..7fadc6d6dcac 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, llvm_meta, cmake, python3, src, libunwind, version
 , enableShared ? !stdenv.hostPlatform.isStatic
+, libcxx
 }:
 
 stdenv.mkDerivation rec {
@@ -26,7 +27,9 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake python3 ];
   buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
 
-  cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
+  cmakeFlags = [
+    "-DLIBCXXABI_LIBCXX_INCLUDES=${libcxx.dev}/include/c++/v1"
+  ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
   ] ++ lib.optionals stdenv.hostPlatform.isWasm [
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch
index b49b1685940f..45641acb0c74 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch
@@ -1,5 +1,5 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 426c855288fc..a9812a994f53 100644
+index 1e8b73aa38cc..6f7b2a25d205 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -27,6 +27,8 @@ set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
@@ -9,26 +9,28 @@ index 426c855288fc..a9812a994f53 100644
 +  include(GNUInstallDirs)
 +
    set(PACKAGE_NAME libcxxabi)
-   set(PACKAGE_VERSION 11.0.0)
+   set(PACKAGE_VERSION 11.0.0git)
    set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-@@ -180,17 +182,17 @@ set(CMAKE_MODULE_PATH
- 
+@@ -196,7 +198,7 @@ set(CMAKE_MODULE_PATH
  if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
--  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-+  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+   set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
+   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+-  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
++  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
    if(LIBCXX_LIBDIR_SUBDIR)
      string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
      string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
-   endif()
+@@ -204,11 +206,11 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
  elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+   set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
    set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 -  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
 +  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
  else()
+   set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
    set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
 -  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
 +  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
  endif()
  
- set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/libunwind/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/git/libunwind/gnu-install-dirs.patch
index a791d6c43231..56231cd31b2a 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/libunwind/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/libunwind/gnu-install-dirs.patch
@@ -1,5 +1,5 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 48cb8e004e08..fec8144fb95a 100644
+index a2c03fd3f8aa..98de2f8ea7c8 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -23,6 +23,8 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
@@ -9,14 +9,14 @@ index 48cb8e004e08..fec8144fb95a 100644
 +  include(GNUInstallDirs)
 +
    set(PACKAGE_NAME libunwind)
-   set(PACKAGE_VERSION 12.0.0)
+   set(PACKAGE_VERSION 13.0.0git)
    set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-@@ -115,17 +117,17 @@ set(CMAKE_MODULE_PATH
+@@ -116,17 +118,17 @@ set(CMAKE_MODULE_PATH
  
  if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
--  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+-  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
++  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
    if(LIBCXX_LIBDIR_SUBDIR)
      string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
      string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
@@ -24,11 +24,11 @@ index 48cb8e004e08..fec8144fb95a 100644
  elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
    set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 -  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
++  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
  else()
    set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
 -  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
++  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
  endif()
  
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
index f65476a6fddd..daf4cfe808b6 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
@@ -12,6 +12,7 @@
 , version
 , release_version
 , zlib
+, which
 , buildLlvmTools
 , debugVersion ? false
 , enableManpages ? false
@@ -47,15 +48,10 @@ in stdenv.mkDerivation (rec {
 
   propagatedBuildInputs = [ ncurses zlib ];
 
+  checkInputs = [ which ];
+
   patches = [
     ./gnu-install-dirs.patch
-    # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
-    (fetchpatch {
-      name = "uops-CMOV16rm-noreg.diff";
-      url = "https://github.com/llvm/llvm-project/commit/9e9f991ac033.diff";
-      sha256 = "sha256:12s8vr6ibri8b48h2z38f3afhwam10arfiqfy4yg37bmc054p5hi";
-      stripLen = 1;
-    })
   ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
 
   postPatch = optionalString stdenv.isDarwin ''
@@ -75,6 +71,7 @@ in stdenv.mkDerivation (rec {
     substituteInPlace unittests/IR/CMakeLists.txt \
       --replace "PassBuilderCallbacksTest.cpp" ""
     rm unittests/IR/PassBuilderCallbacksTest.cpp
+    rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
   '' + optionalString stdenv.hostPlatform.isMusl ''
     patch -p1 -i ${../../TLI-musl.patch}
     substituteInPlace unittests/Support/CMakeLists.txt \
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/gnu-install-dirs.patch
index da8dc1445171..18fa5fc6d89c 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/gnu-install-dirs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/gnu-install-dirs.patch
@@ -1,8 +1,8 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 277d0fe54d7b..af69c8be8745 100644
+index 135036f509d2..265c36f8211b 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -256,15 +256,21 @@ if (CMAKE_BUILD_TYPE AND
+@@ -270,15 +270,21 @@ if (CMAKE_BUILD_TYPE AND
    message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
  endif()
  
@@ -25,7 +25,7 @@ index 277d0fe54d7b..af69c8be8745 100644
  # They are used as destination of target generators.
  set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
  set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-@@ -567,9 +573,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+@@ -581,9 +587,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
  option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
  option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
  
@@ -37,7 +37,7 @@ index 277d0fe54d7b..af69c8be8745 100644
      CACHE STRING "OCamldoc-generated HTML documentation install directory")
  
  option (LLVM_BUILD_EXTERNAL_COMPILER_RT
-@@ -1027,7 +1033,7 @@ endif()
+@@ -1048,7 +1054,7 @@ endif()
  
  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
    install(DIRECTORY include/llvm include/llvm-c
@@ -46,7 +46,7 @@ index 277d0fe54d7b..af69c8be8745 100644
      COMPONENT llvm-headers
      FILES_MATCHING
      PATTERN "*.def"
-@@ -1038,7 +1044,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+@@ -1059,7 +1065,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
      )
  
    install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
@@ -55,7 +55,7 @@ index 277d0fe54d7b..af69c8be8745 100644
      COMPONENT llvm-headers
      FILES_MATCHING
      PATTERN "*.def"
-@@ -1052,13 +1058,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+@@ -1073,13 +1079,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
  
    if (LLVM_INSTALL_MODULEMAPS)
      install(DIRECTORY include/llvm include/llvm-c
@@ -72,11 +72,11 @@ index 277d0fe54d7b..af69c8be8745 100644
              RENAME "module.extern.modulemap"
              )
 diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
-index 97c9980c7de3..409e8b615f75 100644
+index 9c2b85374307..5531ceeb2eeb 100644
 --- a/cmake/modules/AddLLVM.cmake
 +++ b/cmake/modules/AddLLVM.cmake
-@@ -804,9 +804,9 @@ macro(add_llvm_library name)
- 
+@@ -818,9 +818,9 @@ macro(add_llvm_library name)
+       get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella})
        install(TARGETS ${name}
                ${export_to_llvmexports}
 -              LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
@@ -88,7 +88,7 @@ index 97c9980c7de3..409e8b615f75 100644
  
        if (NOT LLVM_ENABLE_IDE)
          add_llvm_install_targets(install-${name}
-@@ -1022,7 +1022,7 @@ function(process_llvm_pass_plugins)
+@@ -1036,7 +1036,7 @@ function(process_llvm_pass_plugins)
            "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
        install(FILES
            ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
@@ -97,7 +97,7 @@ index 97c9980c7de3..409e8b615f75 100644
            COMPONENT cmake-exports)
  
        set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
-@@ -1242,7 +1242,7 @@ macro(add_llvm_example name)
+@@ -1250,7 +1250,7 @@ macro(add_llvm_example name)
    endif()
    add_llvm_executable(${name} ${ARGN})
    if( LLVM_BUILD_EXAMPLES )
@@ -106,7 +106,7 @@ index 97c9980c7de3..409e8b615f75 100644
    endif()
    set_target_properties(${name} PROPERTIES FOLDER "Examples")
  endmacro(add_llvm_example name)
-@@ -1854,7 +1854,7 @@ function(llvm_install_library_symlink name dest type)
+@@ -1868,7 +1868,7 @@ function(llvm_install_library_symlink name dest type)
    set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
    set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
  
@@ -115,8 +115,8 @@ index 97c9980c7de3..409e8b615f75 100644
    if(WIN32 AND "${type}" STREQUAL "SHARED")
      set(output_dir bin)
    endif()
-@@ -1871,7 +1871,7 @@ function(llvm_install_library_symlink name dest type)
-   endif()
+@@ -1879,7 +1879,7 @@ function(llvm_install_library_symlink name dest type)
+ 
  endfunction()
  
 -function(llvm_install_symlink name dest)
@@ -124,7 +124,7 @@ index 97c9980c7de3..409e8b615f75 100644
    cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
    foreach(path ${CMAKE_MODULE_PATH})
      if(EXISTS ${path}/LLVMInstallSymlink.cmake)
-@@ -1894,7 +1894,7 @@ function(llvm_install_symlink name dest)
+@@ -1902,7 +1902,7 @@ function(llvm_install_symlink name dest)
    set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
  
    install(SCRIPT ${INSTALL_SYMLINK}
@@ -133,7 +133,7 @@ index 97c9980c7de3..409e8b615f75 100644
            COMPONENT ${component})
  
    if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
-@@ -1977,7 +1977,8 @@ function(add_llvm_tool_symlink link_name target)
+@@ -1985,7 +1985,8 @@ function(add_llvm_tool_symlink link_name target)
      endif()
  
      if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
@@ -143,12 +143,12 @@ index 97c9980c7de3..409e8b615f75 100644
      endif()
    endif()
  endfunction()
-@@ -2100,9 +2101,9 @@ function(llvm_setup_rpath name)
- 
-   if (APPLE)
-     set(_install_name_dir INSTALL_NAME_DIR "@rpath")
--    set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-+    set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+@@ -2114,9 +2115,9 @@ function(llvm_setup_rpath name)
+     # Since BUILD_SHARED_LIBS is only recommended for use by developers,
+     # hardcode the rpath to build/install lib dir first in this mode.
+     # FIXME: update this when there is better solution.
+-    set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++    set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
    elseif(UNIX)
 -    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
 +    set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
@@ -185,16 +185,18 @@ index e80c3b5c1cac..482f6d715ef5 100644
  
          # '/.' indicates: copy the contents of the directory directly into
 diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
-index 505dc9a29d70..36e6c63af3f4 100644
+index 51b6a4fdc284..4adc2acfc074 100644
 --- a/cmake/modules/CMakeLists.txt
 +++ b/cmake/modules/CMakeLists.txt
-@@ -1,4 +1,4 @@
+@@ -1,6 +1,6 @@
+ include(LLVMDistributionSupport)
+ 
 -set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
 +set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
  set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
  
  # First for users who use an installed LLVM, create the LLVMExports.cmake file.
-@@ -107,13 +107,13 @@ foreach(p ${_count})
+@@ -109,13 +109,13 @@ foreach(p ${_count})
    set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
  get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
  endforeach(p)
@@ -212,32 +214,32 @@ index 505dc9a29d70..36e6c63af3f4 100644
  # Generate a default location for lit
  if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
 diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
-index 09fed8085c23..aa79f192abf0 100644
+index 3e6a2c9a2648..52e14d955c60 100644
 --- a/cmake/modules/LLVMInstallSymlink.cmake
 +++ b/cmake/modules/LLVMInstallSymlink.cmake
-@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
-     set(LINK_OR_COPY copy)
-   endif()
+@@ -4,7 +4,7 @@
  
+ function(install_symlink name target outdir)
+   set(DESTDIR $ENV{DESTDIR})
 -  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
 +  set(bindir "${DESTDIR}${outdir}/")
  
    message(STATUS "Creating ${name}")
  
 diff --git a/docs/CMake.rst b/docs/CMake.rst
-index bb821b417ad9..6a528f7c2ad3 100644
+index f1ac2c7d4934..c6e1469b5e13 100644
 --- a/docs/CMake.rst
 +++ b/docs/CMake.rst
-@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+@@ -202,7 +202,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
  **LLVM_LIBDIR_SUFFIX**:STRING
    Extra suffix to append to the directory where libraries are to be
    installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
 -  to install libraries to ``/usr/lib64``.
 +  to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
  
- **CMAKE_C_FLAGS**:STRING
-   Extra flags to use when compiling C source files.
-@@ -550,8 +550,8 @@ LLVM-specific variables
+ Rarely-used CMake variables
+ ---------------------------
+@@ -551,8 +551,8 @@ LLVM-specific variables
  
  **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
    The path to install Doxygen-generated HTML documentation to. This path can
@@ -246,47 +248,9 @@ index bb821b417ad9..6a528f7c2ad3 100644
 +  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
 +  `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
  
- **LLVM_ENABLE_SPHINX**:BOOL
-   If specified, CMake will search for the ``sphinx-build`` executable and will make
-@@ -582,13 +582,33 @@ LLVM-specific variables
- 
- **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
-   The path to install Sphinx-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
- 
- **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
-   The path to install OCamldoc-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/ocaml-html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
-+
-+**CMAKE_INSTALL_BINDIR**:STRING
-+  The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `bin`.
-+
-+**CMAKE_INSTALL_LIBDIR**:STRING
-+  The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `lib`.
-+
-+**CMAKE_INSTALL_INCLUDEDIR**:STRING
-+  The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `include`.
-+
-+**CMAKE_INSTALL_DOCDIR**:STRING
-+  The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/doc`.
-+
-+**CMAKE_INSTALL_MANDIR**:STRING
-+  The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/man`.
- 
- **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
-   macOS Only: If enabled CMake will generate a target named
-@@ -786,9 +806,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+ **LLVM_LINK_LLVM_DYLIB**:BOOL
+   If enabled, tools will be linked with the libLLVM shared library. Defaults
+@@ -792,9 +792,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
  
  This file is available in two different locations.
  
@@ -377,11 +341,11 @@ index 1a2f04552d13..44fa7d3eec6b 100644
    }
  
 diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
-index 2963f97cad88..69d66c9c9ca1 100644
+index 0af29ad762c5..37b99b83e35c 100644
 --- a/tools/lto/CMakeLists.txt
 +++ b/tools/lto/CMakeLists.txt
-@@ -25,7 +25,7 @@ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
-     intrinsics_gen)
+@@ -33,7 +33,7 @@ add_llvm_library(${LTO_LIBRARY_NAME} ${LTO_LIBRARY_TYPE} INSTALL_WITH_TOOLCHAIN
+     ${SOURCES} DEPENDS intrinsics_gen)
  
  install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
 -  DESTINATION include/llvm-c
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/openmp/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/openmp/default.nix
index 07488c1c33f4..c5a33df97560 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/openmp/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/openmp/default.nix
@@ -18,6 +18,10 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake perl ];
   buildInputs = [ llvm ];
 
+  cmakeFlags = [
+    "-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" # Building the AMDGCN device RTL currently fails
+  ];
+
   meta = llvm_meta // {
     homepage = "https://openmp.llvm.org/";
     description = "Support for the OpenMP language";
diff --git a/nixpkgs/pkgs/development/compilers/llvm/update-git.py b/nixpkgs/pkgs/development/compilers/llvm/update-git.py
index ec1a30c6b0ff..880cad1c72b1 100755
--- a/nixpkgs/pkgs/development/compilers/llvm/update-git.py
+++ b/nixpkgs/pkgs/development/compilers/llvm/update-git.py
@@ -7,12 +7,16 @@ import json
 import os
 import re
 import subprocess
+import sys
 
 from codecs import iterdecode
 from datetime import datetime
 from urllib.request import urlopen, Request
 
 
+DEFAULT_NIX = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'git/default.nix')
+
+
 def get_latest_chromium_build():
     HISTORY_URL = 'https://omahaproxy.appspot.com/history?os=linux'
     print(f'GET {HISTORY_URL}')
@@ -39,6 +43,16 @@ def get_commit(ref):
         return json.loads(http_response.read().decode())
 
 
+def get_current_revision():
+    """Get the current revision of llvmPackages_git."""
+    with open(DEFAULT_NIX) as f:
+        for line in f:
+            rev = re.search(r'^  rev = "(.*)";', line)
+            if rev:
+                return rev.group(1)
+    sys.exit(1)
+
+
 def nix_prefetch_url(url, algo='sha256'):
     """Prefetches the content of the given URL."""
     print(f'nix-prefetch-url {url}')
@@ -55,16 +69,18 @@ clang_revision = re.search(r"^CLANG_REVISION = '(.+)'$", clang_update_script, re
 clang_commit_short = re.search(r"llvmorg-[0-9]+-init-[0-9]+-g([0-9a-f]{8})", clang_revision).group(1)
 release_version = re.search(r"^RELEASE_VERSION = '(.+)'$", clang_update_script, re.MULTILINE).group(1)
 commit = get_commit(clang_commit_short)
+if get_current_revision() == commit["sha"]:
+    print('No new update available.')
+    sys.exit(0)
 date = datetime.fromisoformat(commit['commit']['committer']['date'].rstrip('Z')).date().isoformat()
 version = f'unstable-{date}'
 print('Prefetching source tarball...')
 hash = nix_prefetch_url(f'https://github.com/llvm/llvm-project/archive/{commit["sha"]}.tar.gz')
 print('Updating default.nix...')
-default_nix = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'git/default.nix')
-with fileinput.FileInput(default_nix, inplace=True) as f:
+with fileinput.FileInput(DEFAULT_NIX, inplace=True) as f:
     for line in f:
         result = re.sub(r'^  release_version = ".+";', f'  release_version = "{release_version}";', line)
-        result = re.sub(r'^  version = ".+";', f'  version = "{version}";', result)
         result = re.sub(r'^  rev = ".*";', f'  rev = "{commit["sha"]}";', result)
+        result = re.sub(r'^  rev-version = ".+";', f'  rev-version = "{version}";', result)
         result = re.sub(r'^    sha256 = ".+";', f'    sha256 = "{hash}";', result)
         print(result, end='')
diff --git a/nixpkgs/pkgs/development/compilers/mosml/default.nix b/nixpkgs/pkgs/development/compilers/mosml/default.nix
index f6d2053f315c..e7dc9ceae6d9 100644
--- a/nixpkgs/pkgs/development/compilers/mosml/default.nix
+++ b/nixpkgs/pkgs/development/compilers/mosml/default.nix
@@ -15,6 +15,10 @@ stdenv.mkDerivation rec {
 
   setSourceRoot = ''export sourceRoot="$(echo */src)"'';
 
+  # MosML needs a specific RPATH entry pointing to $(out)/lib (added
+  # by the build system), which patchelf will remove.
+  dontPatchELF = true;
+
   meta = with lib; {
     description = "A light-weight implementation of Standard ML";
     longDescription = ''
diff --git a/nixpkgs/pkgs/development/compilers/nim/default.nix b/nixpkgs/pkgs/development/compilers/nim/default.nix
index 21d1017a6753..25b1c4873572 100644
--- a/nixpkgs/pkgs/development/compilers/nim/default.nix
+++ b/nixpkgs/pkgs/development/compilers/nim/default.nix
@@ -95,12 +95,12 @@ in {
 
   nim-unwrapped = stdenv.mkDerivation rec {
     pname = "nim-unwrapped";
-    version = "1.4.6";
+    version = "1.4.8";
     strictDeps = true;
 
     src = fetchurl {
       url = "https://nim-lang.org/download/nim-${version}.tar.xz";
-      hash = "sha256-D7wPkoLP/oXembxHv6h2Ulud3aKi6uVcGFoIgEuY070=";
+      hash = "sha256-t5jFd0EdfZW4YxJh27Nnbp0a/Z42dA0ESWagVVtBRBo=";
     };
 
     buildInputs = [ boehmgc openssl pcre readline sqlite ];
@@ -290,6 +290,8 @@ in {
 
       makeWrapper \
         ${nim'}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \
+        --set-default CC $(command -v $CC) \
+        --set-default CXX $(command -v $CXX) \
         $wrapperArgs
       ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim
 
diff --git a/nixpkgs/pkgs/development/compilers/ocaml/4.13.nix b/nixpkgs/pkgs/development/compilers/ocaml/4.13.nix
new file mode 100644
index 000000000000..dc805f7e61cc
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/ocaml/4.13.nix
@@ -0,0 +1,9 @@
+import ./generic.nix {
+  major_version = "4";
+  minor_version = "13";
+  patch_version = "0-alpha1";
+  src = fetchTarball {
+    url = "https://caml.inria.fr/pub/distrib/ocaml-4.13/ocaml-4.13.0~alpha1.tar.xz";
+    sha256 = "071k12q8m2w9bcwvfclyc46pwd9r49v6av36fhjdlqq29niyq915";
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/11.nix b/nixpkgs/pkgs/development/compilers/openjdk/11.nix
index ef593422ff26..d7aaf2dcb55e 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/11.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/11.nix
@@ -39,6 +39,7 @@ let
       ./read-truststore-from-env-jdk10.patch
       ./currency-date-range-jdk10.patch
       ./increase-javadoc-heap.patch
+      ./fix-library-path-jdk11.patch
     ] ++ lib.optionals (!headless && enableGnome2) [
       ./swing-use-gtk-jdk10.patch
     ];
@@ -136,14 +137,7 @@ let
 
     disallowedReferences = [ openjdk11-bootstrap ];
 
-    meta = with lib; {
-      homepage = "http://openjdk.java.net/";
-      license = licenses.gpl2;
-      description = "The open-source Java Development Kit";
-      maintainers = with maintainers; [ edwtjo asbachb ];
-      platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
-      mainProgram = "java";
-    };
+    meta = import ./meta.nix lib;
 
     passthru = {
       architecture = "";
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/12.nix b/nixpkgs/pkgs/development/compilers/openjdk/12.nix
index 66aeff306e38..3bbe12477388 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/12.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/12.nix
@@ -145,14 +145,7 @@ let
 
     disallowedReferences = [ openjdk11 ];
 
-    meta = with lib; {
-      homepage = "http://openjdk.java.net/";
-      license = licenses.gpl2;
-      description = "The open-source Java Development Kit";
-      maintainers = with maintainers; [ edwtjo ];
-      platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
-      mainProgram = "java";
-    };
+    meta = import ./meta.nix lib;
 
     passthru = {
       architecture = "";
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/13.nix b/nixpkgs/pkgs/development/compilers/openjdk/13.nix
index 96a567895d6a..ed79ceafc55e 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/13.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/13.nix
@@ -145,14 +145,7 @@ let
 
     disallowedReferences = [ openjdk13-bootstrap ];
 
-    meta = with lib; {
-      homepage = "http://openjdk.java.net/";
-      license = licenses.gpl2;
-      description = "The open-source Java Development Kit";
-      maintainers = with maintainers; [ edwtjo ];
-      platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
-      mainProgram = "java";
-    };
+    meta = import ./meta.nix lib;
 
     passthru = {
       architecture = "";
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/14.nix b/nixpkgs/pkgs/development/compilers/openjdk/14.nix
index fae27b8ca754..247cf941f002 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/14.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/14.nix
@@ -141,14 +141,7 @@ let
 
     disallowedReferences = [ openjdk14-bootstrap ];
 
-    meta = with lib; {
-      homepage = "https://openjdk.java.net/";
-      license = licenses.gpl2;
-      description = "The open-source Java Development Kit";
-      maintainers = with maintainers; [ edwtjo ];
-      platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
-      mainProgram = "java";
-    };
+    meta = import ./meta.nix lib;
 
     passthru = {
       architecture = "";
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/15.nix b/nixpkgs/pkgs/development/compilers/openjdk/15.nix
index 11333b1ef66a..d41a245c5448 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/15.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/15.nix
@@ -141,14 +141,7 @@ let
 
     disallowedReferences = [ openjdk15-bootstrap ];
 
-    meta = with lib; {
-      homepage = "https://openjdk.java.net/";
-      license = licenses.gpl2;
-      description = "The open-source Java Development Kit";
-      maintainers = with maintainers; [ edwtjo ];
-      platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
-      mainProgram = "java";
-    };
+    meta = import ./meta.nix lib;
 
     passthru = {
       architecture = "";
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/16.nix b/nixpkgs/pkgs/development/compilers/openjdk/16.nix
index 99033e8738c5..df8a3a68f487 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/16.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/16.nix
@@ -147,14 +147,7 @@ let
 
     disallowedReferences = [ openjdk16-bootstrap ];
 
-    meta = with lib; {
-      homepage = "https://openjdk.java.net/";
-      license = licenses.gpl2;
-      description = "The open-source Java Development Kit";
-      maintainers = with maintainers; [ edwtjo ];
-      platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
-      mainProgram = "java";
-    };
+    meta = import ./meta.nix lib;
 
     passthru = {
       architecture = "";
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix
index 5dd979e5521a..ae045ddfdba0 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix
@@ -69,10 +69,6 @@ let
       home = jdk;
     };
 
-    meta = with lib; {
-      license = licenses.gpl2;
-      platforms = platforms.darwin;
-    };
-
+    meta = import ./meta.nix lib;
   };
 in jdk
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
index 0941aa728ead..c7367a5d642c 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
@@ -73,10 +73,6 @@ let
       home = jdk;
     };
 
-    meta = with lib; {
-      license = licenses.gpl2;
-      platforms = platforms.darwin;
-    };
-
+    meta = import ./meta.nix lib;
   };
 in jdk
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix
index 509d1ab55227..9478f83477c8 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix
@@ -69,10 +69,6 @@ let
       home = jdk;
     };
 
-    meta = with lib; {
-      license = licenses.gpl2;
-      platforms = platforms.darwin;
-    };
-
+    meta = import ./meta.nix lib;
   };
 in jdk
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/meta.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/meta.nix
new file mode 100644
index 000000000000..abe469af6915
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/meta.nix
@@ -0,0 +1,4 @@
+lib: (removeAttrs (import ../meta.nix lib) [ "maintainers" ]) // {
+  platforms = lib.platforms.darwin;
+  homepage = "https://www.azul.com/";
+}
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/fix-library-path-jdk11.patch b/nixpkgs/pkgs/development/compilers/openjdk/fix-library-path-jdk11.patch
new file mode 100644
index 000000000000..21263dd68926
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/fix-library-path-jdk11.patch
@@ -0,0 +1,37 @@
+diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
+index 0dbe03349e..847d56778d 100644
+--- a/src/hotspot/os/linux/os_linux.cpp
++++ b/src/hotspot/os/linux/os_linux.cpp
+@@ -326,13 +326,13 @@ void os::init_system_properties_values() {
+   //        ...
+   //        7: The default directories, normally /lib and /usr/lib.
+ #if defined(AMD64) || (defined(_LP64) && defined(SPARC)) || defined(PPC64) || defined(S390)
+-  #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib"
++  #define DEFAULT_LIBPATH ""
+ #else
+-  #define DEFAULT_LIBPATH "/lib:/usr/lib"
++  #define DEFAULT_LIBPATH ""
+ #endif
+ 
+ // Base path of extensions installed on the system.
+-#define SYS_EXT_DIR     "/usr/java/packages"
++#define SYS_EXT_DIR     ""
+ #define EXTENSIONS_DIR  "/lib/ext"
+ 
+   // Buffer that fits several sprintfs.
+@@ -392,13 +392,13 @@ void os::init_system_properties_values() {
+                                                      strlen(v) + 1 +
+                                                      sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1,
+                                                      mtInternal);
+-    sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
++    sprintf(ld_library_path, "%s", v);
+     Arguments::set_library_path(ld_library_path);
+     FREE_C_HEAP_ARRAY(char, ld_library_path);
+   }
+ 
+   // Extensions directories.
+-  sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
++  sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
+   Arguments::set_ext_dirs(buf);
+ 
+   FREE_C_HEAP_ARRAY(char, buf);
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/meta.nix b/nixpkgs/pkgs/development/compilers/openjdk/meta.nix
new file mode 100644
index 000000000000..d635d5c01e6b
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/meta.nix
@@ -0,0 +1,8 @@
+lib: with lib; {
+  homepage = "https://openjdk.java.net/";
+  license = licenses.gpl2Only;
+  description = "The open-source Java Development Kit";
+  maintainers = with maintainers; [ edwtjo asbachb ];
+  platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
+  mainProgram = "java";
+}
diff --git a/nixpkgs/pkgs/development/compilers/rust/1_52.nix b/nixpkgs/pkgs/development/compilers/rust/1_52.nix
index bfd6fc47ad20..49176ad3fedd 100644
--- a/nixpkgs/pkgs/development/compilers/rust/1_52.nix
+++ b/nixpkgs/pkgs/development/compilers/rust/1_52.nix
@@ -15,21 +15,22 @@
 , CoreFoundation, Security
 , pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost
 , makeRustPlatform
-, llvmPackages_11, llvm_11
+, llvmPackages_11
+, llvmPackages_12, llvm_12
 } @ args:
 
 import ./default.nix {
   rustcVersion = "1.52.1";
   rustcSha256 = "sha256-Om8jom0Oj4erv78yxc19qgwLcdCYar78Vrml+/vQv5g=";
 
-  llvmSharedForBuild = pkgsBuildBuild.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
-  llvmSharedForHost = pkgsBuildHost.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
-  llvmSharedForTarget = pkgsBuildTarget.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
+  llvmSharedForBuild = pkgsBuildBuild.llvmPackages_12.libllvm.override { enableSharedLibraries = true; };
+  llvmSharedForHost = pkgsBuildHost.llvmPackages_12.libllvm.override { enableSharedLibraries = true; };
+  llvmSharedForTarget = pkgsBuildTarget.llvmPackages_12.libllvm.override { enableSharedLibraries = true; };
 
   llvmBootstrapForDarwin = llvmPackages_11;
 
   # For use at runtime
-  llvmShared = llvm_11.override { enableSharedLibraries = true; };
+  llvmShared = llvm_12.override { enableSharedLibraries = true; };
 
   # Note: the version MUST be one version prior to the version we're
   # building
@@ -56,4 +57,4 @@ import ./default.nix {
   ];
 }
 
-(builtins.removeAttrs args [ "fetchpatch" "pkgsBuildHost" "llvmPackages_11" "llvm_11"])
+(builtins.removeAttrs args [ "fetchpatch" "pkgsBuildHost" "llvmPackages_11" "llvmPackages_12" "llvm_12"])
diff --git a/nixpkgs/pkgs/development/compilers/scryer-prolog/cargo.patch b/nixpkgs/pkgs/development/compilers/scryer-prolog/cargo.patch
new file mode 100644
index 000000000000..61a36c9ad1c9
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/scryer-prolog/cargo.patch
@@ -0,0 +1,101 @@
+diff --git a/Cargo.lock b/Cargo.lock
+index ef25833..d9de212 100644
+--- a/Cargo.lock
++++ b/Cargo.lock
+@@ -41,9 +41,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
+ 
+ [[package]]
+ name = "az"
+-version = "0.3.1"
++version = "1.0.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+-checksum = "41a6b78289a33e09b00818ca8c90ab17c5dabb6e74f4b29a6de679c0e0886ade"
++checksum = "e9bcd47d94aa4eb8c076b50fc61a75020789394ffb9bd74a180b3379130f6569"
+ 
+ [[package]]
+ name = "base64"
+@@ -384,9 +384,9 @@ dependencies = [
+ 
+ [[package]]
+ name = "gmp-mpfr-sys"
+-version = "1.2.2"
++version = "1.4.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+-checksum = "63d7f805cf9df081683d463f62864bda8b8e3ce7162a8e11cd0c49f27b8ce89b"
++checksum = "ad4e8e85ec9fb902b4564deeb17b1a263d3ba1334bef56154418aa045b159508"
+ dependencies = [
+  "libc",
+  "winapi 0.3.8",
+@@ -766,15 +766,6 @@ version = "0.1.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
+ 
+-[[package]]
+-name = "openssl-src"
+-version = "111.9.0+1.1.1g"
+-source = "registry+https://github.com/rust-lang/crates.io-index"
+-checksum = "a2dbe10ddd1eb335aba3780eb2eaa13e1b7b441d2562fd962398740927f39ec4"
+-dependencies = [
+- "cc",
+-]
+-
+ [[package]]
+ name = "openssl-sys"
+ version = "0.9.58"
+@@ -784,7 +775,6 @@ dependencies = [
+  "autocfg 1.0.0",
+  "cc",
+  "libc",
+- "openssl-src",
+  "pkg-config",
+  "vcpkg",
+ ]
+@@ -1159,9 +1149,9 @@ dependencies = [
+ 
+ [[package]]
+ name = "rug"
+-version = "1.8.0"
++version = "1.11.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+-checksum = "72315b6d9cb7d886fb99724330c47ceb29e923df657c31da3849fe88c0ded710"
++checksum = "e538d00da450a8e48aac7e6322e67b2dc86ec71a1feeac0e3954c4f07f01bc45"
+ dependencies = [
+  "az",
+  "gmp-mpfr-sys",
+@@ -1232,7 +1222,7 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+ 
+ [[package]]
+ name = "scryer-prolog"
+-version = "0.8.126"
++version = "0.8.127"
+ dependencies = [
+  "base64 0.12.3",
+  "blake2",
+@@ -1243,6 +1233,7 @@ dependencies = [
+  "divrem",
+  "downcast",
+  "git-version",
++ "gmp-mpfr-sys",
+  "hostname",
+  "indexmap",
+  "lazy_static",
+diff --git a/Cargo.toml b/Cargo.toml
+index c359e1b..75c4325 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -41,10 +41,14 @@ ring = "0.16.13"
+ ripemd160 = "0.8.0"
+ sha3 = "0.8.2"
+ blake2 = "0.8.1"
+-openssl = { version = "0.10.29", features = ["vendored"] }
++openssl = { version = "0.10.29" }
+ native-tls = "0.2.4"
+ chrono = "0.4.11"
+ select = "0.4.3"
+ roxmltree = "0.11.0"
+ base64 = "0.12.3"
+ sodiumoxide = "0.2.6"
++
++[dependencies.gmp-mpfr-sys]
++version = "1.4"
++features = ["use-system-libs"]
diff --git a/nixpkgs/pkgs/development/compilers/scryer-prolog/default.nix b/nixpkgs/pkgs/development/compilers/scryer-prolog/default.nix
new file mode 100644
index 000000000000..534379bcacfc
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/scryer-prolog/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, fetchFromGitHub
+, rustPlatform
+, gmp
+, libmpc
+, mpfr
+, openssl
+, pkg-config
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "scryer-prolog";
+  version = "0.8.127";
+
+  src = fetchFromGitHub {
+    owner = "mthom";
+    repo = "scryer-prolog";
+    rev = "v${version}";
+    sha256 = "0307yclslkdx6f0h0101a3da47rhz6qizf4i8q8rjh4id8wpdsn8";
+  };
+
+  # Use system openssl, gmp, mpc and mpfr.
+  cargoPatches = [ ./cargo.patch ];
+
+  cargoSha256 = "0gb0l2wwf8079jwggn9zxk8pz8pxg3b7pin1d7dsbd4ij52lzyi2";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ openssl gmp libmpc mpfr ];
+
+  meta = with lib; {
+    description = "A modern Prolog implementation written mostly in Rust.";
+    homepage = "https://github.com/mthom/scryer-prolog";
+    license = with licenses; [ bsd3 ];
+    maintainers = with maintainers; [ malbarbo ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/serpent/default.nix b/nixpkgs/pkgs/development/compilers/serpent/default.nix
index fbcbf4485a47..227e8037eaee 100644
--- a/nixpkgs/pkgs/development/compilers/serpent/default.nix
+++ b/nixpkgs/pkgs/development/compilers/serpent/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation {
     '';
     homepage = "https://github.com/ethereum/wiki/wiki/Serpent";
     license = with licenses; [ wtfpl ];
-    maintainers = with maintainers; [ chris-martin ];
+    maintainers = with maintainers; [ ];
     platforms = platforms.all;
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/shaderc/default.nix b/nixpkgs/pkgs/development/compilers/shaderc/default.nix
index 678ab3adb06c..40c216d79c34 100644
--- a/nixpkgs/pkgs/development/compilers/shaderc/default.nix
+++ b/nixpkgs/pkgs/development/compilers/shaderc/default.nix
@@ -8,24 +8,24 @@ let
   glslang = fetchFromGitHub {
     owner = "KhronosGroup";
     repo = "glslang";
-    rev = "3ee5f2f1d3316e228916788b300d786bb574d337";
-    sha256 = "1l5h9d92mzd35pgs0wibqfg7vbl771lwnvdlcsyhf6999khn5dzv";
+    rev = "18eef33bd7a4bf5ad8c69f99cb72022608cf6e73";
+    sha256 = "sha256-tkWVvYmSpJPaZ8VJOkAWndDWhA0PiHAkR3feBAo+knM=";
   };
   spirv-tools = fetchFromGitHub {
     owner = "KhronosGroup";
     repo = "SPIRV-Tools";
-    rev = "b63f0e5ed3e818870968ebf6af73317127fd07b0";
-    sha256 = "1chv30azfp76nha428ivg4ixrij6d8pxj5kn3jam87gmkmgc9zhm";
+    rev = "c2d5375fa7cc87c93f692e7200d5d974283d4391";
+    sha256 = "sha256-tMJRljrlH+qb+27rTn+3LuEyMOVpiU0zSCiGNfUTb6g=";
   };
   spirv-headers = fetchFromGitHub {
     owner = "KhronosGroup";
     repo = "SPIRV-Headers";
-    rev = "979924c8bc839e4cb1b69d03d48398551f369ce7";
-    sha256 = "07vyjlblpm4zhfds612h86lnz0qvrj5qqw5z2zzfa3m9fax7cm85";
+    rev = "0c28b6451d77774912e52949c1e57fa726edf113";
+    sha256 = "sha256-KpCMceTV/BRaoJe1qeXhKYQNQqdGaM6Q9nklpJKzHFY=";
   };
 in stdenv.mkDerivation rec {
   pname = "shaderc";
-  version = "2020.2";
+  version = "2021.0";
 
   outputs = [ "out" "lib" "bin" "dev" "static" ];
 
@@ -33,7 +33,7 @@ in stdenv.mkDerivation rec {
     owner = "google";
     repo = "shaderc";
     rev = "v${version}";
-    sha256 = "1sxz8872x3rdlrhmbn83r1vniq4j51jnk0ka3447fq68il4myf1w";
+    sha256 = "sha256-RfSMzrGVtdXbr/mjSrHoN447e3vMQfJbesQMvLOARBs=";
   };
 
   patchPhase = ''
diff --git a/nixpkgs/pkgs/development/compilers/terra/default.nix b/nixpkgs/pkgs/development/compilers/terra/default.nix
index bd50ea9caaaf..ac1851a683bf 100644
--- a/nixpkgs/pkgs/development/compilers/terra/default.nix
+++ b/nixpkgs/pkgs/development/compilers/terra/default.nix
@@ -1,27 +1,53 @@
-{ lib, stdenv, fetchurl, fetchFromGitHub
-, llvmPackages, ncurses, lua
-}:
+{ lib, stdenv, fetchFromGitHub, llvmPackages, ncurses, cmake, libxml2
+, symlinkJoin, breakpointHook, cudaPackages, enableCUDA ? false }:
 
 let
-  luajitArchive = "LuaJIT-2.0.5.tar.gz";
-  luajitSrc = fetchurl {
-    url    = "http://luajit.org/download/${luajitArchive}";
-    sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7";
+  luajitRev = "9143e86498436892cb4316550be4d45b68a61224";
+  luajitBase = "LuaJIT-${luajitRev}";
+  luajitArchive = "${luajitBase}.tar.gz";
+  luajitSrc = fetchFromGitHub {
+    owner = "LuaJIT";
+    repo = "LuaJIT";
+    rev = luajitRev;
+    sha256 = "1zw1yr0375d6jr5x20zvkvk76hkaqamjynbswpl604w6r6id070b";
   };
-in
-stdenv.mkDerivation rec {
+
+  llvmMerged = symlinkJoin {
+    name = "llvmClangMerged";
+    paths = with llvmPackages; [
+      llvm.out
+      llvm.dev
+      llvm.lib
+      clang-unwrapped.out
+      clang-unwrapped.dev
+      clang-unwrapped.lib
+    ];
+  };
+
+  cuda = cudaPackages.cudatoolkit_11;
+
+  clangVersion = llvmPackages.clang-unwrapped.version;
+
+in stdenv.mkDerivation rec {
   pname = "terra";
-  version = "1.0.0pre1175_${builtins.substring 0 7 src.rev}";
+  version = "1.0.0-beta3_${builtins.substring 0 7 src.rev}";
 
   src = fetchFromGitHub {
-    owner  = "zdevito";
-    repo   = "terra";
-    rev    = "ef6a75ffee15a30f3c74f4e6943851cfbc0fec3d";
-    sha256 = "0aky17vbv3d9zng34hp17p9zb00dbzwhvzsdjzrrqvk9lmyvix0s";
+    owner = "terralang";
+    repo = "terra";
+    rev = "99ff93f8c60c89bbe2dc7c63eab9bfe2f4c4833e";
+    sha256 = "0ww54xjvv6p8jwsh6hml3v527zgnv2gj58gpb818bbg4k1jwa5fl";
   };
 
-  nativeBuildInputs = [ lua ];
-  buildInputs = with llvmPackages; [ llvm clang-unwrapped ncurses ];
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ llvmMerged ncurses libxml2 ] ++ lib.optional enableCUDA cuda;
+
+  cmakeFlags = [
+    "-DHAS_TERRA_VERSION=0"
+    "-DTERRA_VERSION=${version}"
+    "-DTERRA_LUA=luajit"
+    "-DCLANG_RESOURCE_DIR=${llvmMerged}/lib/clang/${clangVersion}"
+  ] ++ lib.optional enableCUDA "-DTERRA_ENABLE_CUDA=ON";
 
   doCheck = true;
   enableParallelBuilding = true;
@@ -29,40 +55,36 @@ stdenv.mkDerivation rec {
   outputs = [ "bin" "dev" "out" "static" ];
 
   patches = [ ./nix-cflags.patch ];
+
   postPatch = ''
-    substituteInPlace Makefile \
-      --replace '-lcurses' '-lncurses'
+    sed -i '/file(DOWNLOAD "''${LUAJIT_URL}" "''${LUAJIT_TAR}")/d' \
+      cmake/Modules/GetLuaJIT.cmake
 
     substituteInPlace src/terralib.lua \
       --subst-var-by NIX_LIBC_INCLUDE ${lib.getDev stdenv.cc.libc}/include
   '';
 
-  preBuild = ''
-    cat >Makefile.inc<<EOF
-    CLANG = ${lib.getBin llvmPackages.clang-unwrapped}/bin/clang
-    LLVM_CONFIG = ${lib.getBin llvmPackages.llvm}/bin/llvm-config
-    EOF
-
+  preConfigure = ''
     mkdir -p build
-    cp ${luajitSrc} build/${luajitArchive}
+    ln -s ${luajitSrc} build/${luajitBase}
+    tar --mode="a+rwX" -chzf build/${luajitArchive} -C build ${luajitBase}
+    rm build/${luajitBase}
   '';
 
-  checkPhase = "(cd tests && ../terra run)";
-
   installPhase = ''
-    install -Dm755 -t $bin/bin release/bin/terra
-    install -Dm755 -t $out/lib release/lib/terra${stdenv.hostPlatform.extensions.sharedLibrary}
-    install -Dm644 -t $static/lib release/lib/libterra.a
+    install -Dm755 -t $bin/bin bin/terra
+    install -Dm755 -t $out/lib lib/terra${stdenv.hostPlatform.extensions.sharedLibrary}
+    install -Dm644 -t $static/lib lib/libterra_s.a
 
     mkdir -pv $dev/include
-    cp -rv release/include/terra $dev/include
+    cp -rv include/terra $dev/include
   '';
 
   meta = with lib; {
     description = "A low-level counterpart to Lua";
-    homepage    = "http://terralang.org/";
-    platforms   = platforms.x86_64;
-    maintainers = with maintainers; [ jb55 thoughtpolice ];
-    license     = licenses.mit;
+    homepage = "http://terralang.org/";
+    platforms = platforms.x86_64;
+    maintainers = with maintainers; [ jb55 seylerius thoughtpolice ];
+    license = licenses.mit;
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/terra/nix-cflags.patch b/nixpkgs/pkgs/development/compilers/terra/nix-cflags.patch
index 339ae23cef65..90ba7e63f1d0 100644
--- a/nixpkgs/pkgs/development/compilers/terra/nix-cflags.patch
+++ b/nixpkgs/pkgs/development/compilers/terra/nix-cflags.patch
@@ -1,12 +1,11 @@
 diff --git a/src/terralib.lua b/src/terralib.lua
-index 351238d..e638c90 100644
+index 532ed18..2c265dc 100644
 --- a/src/terralib.lua
 +++ b/src/terralib.lua
-@@ -3395,6 +3395,17 @@ function terra.includecstring(code,cargs,target)
+@@ -3426,6 +3426,16 @@ function terra.includecstring(code,cargs,target)
      	args:insert("-internal-isystem")
      	args:insert(path)
      end
-+
 +    -- NOTE(aseipp): include relevant Nix header files
 +    args:insert("-isystem")
 +    args:insert("@NIX_LIBC_INCLUDE@")
@@ -17,6 +16,6 @@ index 351238d..e638c90 100644
 +          args:insert(w)
 +        end
 +    end
-     
-     if cargs then
-         args:insertall(cargs)
+     -- Obey the SDKROOT variable on macOS to match Clang behavior.
+     local sdkroot = os.getenv("SDKROOT")
+     if sdkroot then
diff --git a/nixpkgs/pkgs/development/compilers/unison/default.nix b/nixpkgs/pkgs/development/compilers/unison/default.nix
index 433e07c68b07..d409ec8a276f 100644
--- a/nixpkgs/pkgs/development/compilers/unison/default.nix
+++ b/nixpkgs/pkgs/development/compilers/unison/default.nix
@@ -6,18 +6,18 @@
 
 stdenv.mkDerivation rec {
   pname = "unison-code-manager";
-  milestone_id = "M1m";
+  milestone_id = "M2g";
   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 = "06pxvp753j8pr0pn02l7cswmmas5pk1vlkw83yd04h3f2rx1s61v";
+      url = "https://github.com/unisonweb/unison/releases/download/release/${milestone_id}/ucm-macos.tar.gz";
+      sha256 = "1ib9pdzrfpzbi35fpwm9ym621nlydplvzgbhnyd86dbwbv3i9sga";
     }
   else
     fetchurl {
-      url = "https://github.com/unisonweb/unison/releases/download/release/${milestone_id}/unison-linux64.tar.gz";
-      sha256 = "1qspvfq805d34kz031pf9sqw8kzz7h637kc8lnbjlgvwixxkxc7c";
+      url = "https://github.com/unisonweb/unison/releases/download/release/${milestone_id}/ucm-linux.tar.gz";
+      sha256 = "004jx7q657mkcrvilk4lfkp8xcpl2bjflpn9m2p7jzlrlk97v9nj";
     };
 
   # The tarball is just the prebuilt binary, in the archive root.
diff --git a/nixpkgs/pkgs/development/compilers/vala/default.nix b/nixpkgs/pkgs/development/compilers/vala/default.nix
index 0c002227914a..0baf0505fa84 100644
--- a/nixpkgs/pkgs/development/compilers/vala/default.nix
+++ b/nixpkgs/pkgs/development/compilers/vala/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, fetchpatch, pkg-config, flex, bison, libxslt, autoconf, autoreconfHook
-, graphviz, glib, libiconv, libintl, libtool, expat, substituteAll
+, gnome, graphviz, glib, libiconv, libintl, libtool, expat, substituteAll
 }:
 
 let
@@ -88,13 +88,12 @@ let
 
     doCheck = false; # fails, requires dbus daemon
 
-    # Wait for PR #59372
-    # passthru = {
-    #  updateScript = gnome.updateScript {
-    #    attrPath = "${pname}_${lib.versions.major version}_${lib.versions.minor version}";
-    #    packageName = pname;
-    #  };
-    # };
+    passthru = {
+     updateScript = gnome.updateScript {
+       attrPath = "${pname}_${lib.versions.major version}_${lib.versions.minor version}";
+       packageName = pname;
+     };
+    };
 
     meta = with lib; {
       description = "Compiler for GObject type system";
diff --git a/nixpkgs/pkgs/development/compilers/zig/default.nix b/nixpkgs/pkgs/development/compilers/zig/default.nix
index a31a9e6ca43f..60ca574f1ccb 100644
--- a/nixpkgs/pkgs/development/compilers/zig/default.nix
+++ b/nixpkgs/pkgs/development/compilers/zig/default.nix
@@ -37,6 +37,13 @@ stdenv.mkDerivation rec {
     export HOME=$TMPDIR;
   '';
 
+  doCheck = true;
+  checkPhase = ''
+    runHook preCheck
+    ./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig
+    runHook postCheck
+  '';
+
   meta = with lib; {
     homepage = "https://ziglang.org/";
     description =
@@ -48,4 +55,4 @@ stdenv.mkDerivation rec {
     broken = stdenv.isDarwin;
   };
 }
-# TODO: checkPhase
+