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/asn1c/default.nix33
-rw-r--r--nixpkgs/pkgs/development/compilers/ats2/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/avra/default.nix27
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix17
-rw-r--r--nixpkgs/pkgs/development/compilers/closure/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/crystal/default.nix18
-rw-r--r--nixpkgs/pkgs/development/compilers/dictu/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/elm/default.nix349
-rw-r--r--nixpkgs/pkgs/development/compilers/elm/packages/elm-json.nix22
-rw-r--r--nixpkgs/pkgs/development/compilers/elm/packages/elm-test-rs.nix17
-rw-r--r--nixpkgs/pkgs/development/compilers/elm/packages/elm.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/default.nix8
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/flutter.nix13
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch16
-rw-r--r--nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch18
-rw-r--r--nixpkgs/pkgs/development/compilers/fpc/default.upstream6
-rw-r--r--nixpkgs/pkgs/development/compilers/fpc/lazarus.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/fsharp/default.nix10
-rw-r--r--nixpkgs/pkgs/development/compilers/fstar/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/gavrasm/default.nix17
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/9/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/no-sys-dirs-riscv-gcc9.patch17
-rw-r--r--nixpkgs/pkgs/development/compilers/gforth/boot-forth.nix24
-rw-r--r--nixpkgs/pkgs/development/compilers/gforth/default.nix33
-rw-r--r--nixpkgs/pkgs/development/compilers/gforth/swig.nix16
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/8.10.7.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/9.0.2.nix (renamed from nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix)29
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/9.2.1.nix19
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/cabal-paths.patch99
-rw-r--r--nixpkgs/pkgs/development/compilers/ghc/head.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/ghcjs/8.10/stage0.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/gleam/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/glslang/default.nix55
-rw-r--r--nixpkgs/pkgs/development/compilers/go/1.16.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/go/1.17.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/go/1.18.nix (renamed from nixpkgs/pkgs/development/compilers/go/1.15.nix)39
-rw-r--r--nixpkgs/pkgs/development/compilers/go/go_no_vendor_checks.patch23
-rw-r--r--nixpkgs/pkgs/development/compilers/go/skip-chown-tests-1.16.patch42
-rw-r--r--nixpkgs/pkgs/development/compilers/go/skip-external-network-tests-1.15.patch13
-rw-r--r--nixpkgs/pkgs/development/compilers/go/ssl-cert-file-1.15.patch76
-rw-r--r--nixpkgs/pkgs/development/compilers/graalvm/community-edition/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/graalvm/community-edition/hashes.nix66
-rw-r--r--nixpkgs/pkgs/development/compilers/hip/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/idris2/default.nix67
-rw-r--r--nixpkgs/pkgs/development/compilers/idris2/tests.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/inklecate/default.nix71
-rw-r--r--nixpkgs/pkgs/development/compilers/inklecate/deps-darwin.nix31
-rw-r--r--nixpkgs/pkgs/development/compilers/inklecate/deps-linux.nix31
-rw-r--r--nixpkgs/pkgs/development/compilers/intel-graphics-compiler/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix5
-rw-r--r--nixpkgs/pkgs/development/compilers/jrsonnet/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/jsonnet/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/julia/1.7-bin.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/ligo/default.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/lingua-franca/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix78
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix88
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/libcxx/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix90
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch13
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/libcxx/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix60
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/compiler-rt-5-cstddef.patch10
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/5/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/5/llvm/default.nix76
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/5/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/6/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/6/llvm/default.nix78
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/6/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/llvm/default.nix80
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix80
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix78
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix60
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/llvm/outputs.patch26
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/llvm-config-link-static.patch12
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/rocm/llvm/outputs.patch16
-rw-r--r--nixpkgs/pkgs/development/compilers/mezzo/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/mlton/from-git-source.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/mosml/default.nix10
-rw-r--r--nixpkgs/pkgs/development/compilers/myrddin/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/nextpnr/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/open-watcom/v2.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/openjfx/11.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/openjfx/15.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/openjfx/17.nix106
-rw-r--r--nixpkgs/pkgs/development/compilers/orc/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/passerine/default.nix10
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/default.nix25
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/fix-libstdcpp-path.patch14
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/make-safe-for-sandbox.patch33
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/pony-corral.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix25
-rw-r--r--nixpkgs/pkgs/development/compilers/qbe/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/rust/1_58.nix (renamed from nixpkgs/pkgs/development/compilers/rust/1_57.nix)30
-rw-r--r--nixpkgs/pkgs/development/compilers/rust/clippy.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/rust/rustc.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/sbcl/common.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/scala/2.x.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/swift/default.nix123
-rw-r--r--nixpkgs/pkgs/development/compilers/teyjus/default.nix18
-rw-r--r--nixpkgs/pkgs/development/compilers/tinycc/default.nix62
-rw-r--r--nixpkgs/pkgs/development/compilers/tvm/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/uasm/default.nix50
-rw-r--r--nixpkgs/pkgs/development/compilers/unison/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/vala/default.nix31
-rw-r--r--nixpkgs/pkgs/development/compilers/vala/disable-graphviz-0.40.12.patch208
-rw-r--r--nixpkgs/pkgs/development/compilers/vyper/default.nix16
-rw-r--r--nixpkgs/pkgs/development/compilers/xa/xa.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/yasm/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/default.nix52
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/plugins/bluespec.nix7
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/plugins/ghdl.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch15
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix106
-rw-r--r--nixpkgs/pkgs/development/compilers/zig/default.nix5
-rw-r--r--nixpkgs/pkgs/development/compilers/zulu/default.nix8
145 files changed, 2075 insertions, 1542 deletions
diff --git a/nixpkgs/pkgs/development/compilers/asn1c/default.nix b/nixpkgs/pkgs/development/compilers/asn1c/default.nix
deleted file mode 100644
index a4e822eec6da..000000000000
--- a/nixpkgs/pkgs/development/compilers/asn1c/default.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-{ lib, stdenv, fetchurl, perl }:
-
-stdenv.mkDerivation rec {
-  pname = "asn1c";
-  version = "0.9.28";
-
-  src = fetchurl {
-    url = "https://lionet.info/soft/asn1c-${version}.tar.gz";
-    sha256 = "1fc64g45ykmv73kdndr4zdm4wxhimhrir4rxnygxvwkych5l81w0";
-  };
-
-  outputs = [ "out" "doc" "man" ];
-
-  buildInputs = [ perl ];
-
-  preConfigure = ''
-    patchShebangs examples/crfc2asn1.pl
-  '';
-
-  postInstall = ''
-    cp -r skeletons/standard-modules $out/share/asn1c
-  '';
-
-  doCheck = true;
-
-  meta = with lib; {
-    homepage = "http://lionet.info/asn1c/compiler.html";
-    description = "Open Source ASN.1 Compiler";
-    license = licenses.bsd2;
-    platforms = platforms.all;
-    maintainers = [ maintainers.montag451 ];
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/ats2/default.nix b/nixpkgs/pkgs/development/compilers/ats2/default.nix
index c75600b5341a..e8c3af5d7e1e 100644
--- a/nixpkgs/pkgs/development/compilers/ats2/default.nix
+++ b/nixpkgs/pkgs/development/compilers/ats2/default.nix
@@ -36,6 +36,10 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gmp ];
 
+  # Disable parallel build, errors:
+  #  *** No rule to make target 'patscc.dats', needed by 'patscc_dats.c'.  Stop.
+  enableParallelBuilding = false;
+
   setupHook = with lib;
     let
       hookFiles =
diff --git a/nixpkgs/pkgs/development/compilers/avra/default.nix b/nixpkgs/pkgs/development/compilers/avra/default.nix
index 30fd5f52d116..f3bc33516a3f 100644
--- a/nixpkgs/pkgs/development/compilers/avra/default.nix
+++ b/nixpkgs/pkgs/development/compilers/avra/default.nix
@@ -1,28 +1,23 @@
-{ lib, stdenv, fetchurl, autoconf, automake }:
+{ lib, stdenv, fetchFromGitHub }:
+
 stdenv.mkDerivation rec {
   pname = "avra";
-  version = "1.3.0";
+  version = "1.4.2";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/avra/avra-${version}.tar.bz2";
-    sha256 = "04lp0k0h540l5pmnaai07637f0p4zi766v6sfm7cryfaca3byb56";
+  src = fetchFromGitHub {
+    owner = "Ro5bert";
+    repo = pname;
+    rev = version;
+    hash = "sha256-joOj89WZ9Si5fcu1w1VHj5fOcnB9N2313Yb29A+nCCY=";
   };
 
-  buildInputs = [ autoconf automake ];
-
-  preConfigure = ''
-    cd src/
-
-    aclocal
-    autoconf
+  makeFlags = [ "PREFIX=${placeholder "out"}" ];
 
-    touch NEWS README AUTHORS ChangeLog
-    automake -a
-  '';
+  doCheck = true;
 
   meta = with lib; {
     description = "Assembler for the Atmel AVR microcontroller family";
-    homepage = "http://avra.sourceforge.net/";
+    homepage = "https://github.com/Ro5bert/avra";
     license = licenses.gpl2Plus;
     platforms = platforms.all;
   };
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix b/nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix
index 422053ea9d81..dfbec7442ed4 100644
--- a/nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/egg2nix.nix
@@ -1,18 +1,19 @@
-{ lib, eggDerivation, fetchurl, chickenEggs }:
+{ lib, eggDerivation, fetchFromGitHub, chickenEggs }:
 
 # Note: This mostly reimplements the default.nix already contained in
 # the tarball. Is there a nicer way than duplicating code?
 
-let
+eggDerivation rec {
+  name = "egg2nix-${version}";
   version = "0.5";
-in
-eggDerivation {
-  src = fetchurl {
-    url = "https://github.com/the-kenny/egg2nix/archive/${version}.tar.gz";
-    sha256 = "0adal428v4i7h9lzs7sfq75q2mxhsbf1qqwzrsjv8j41paars20y";
+
+  src = fetchFromGitHub {
+    owner = "the-kenny";
+    repo = "egg2nix";
+    rev = version;
+    sha256 = "sha256-5ov2SWVyTUQ6NHnZNPRywd9e7oIxHlVWv4uWbsNaj/s=";
   };
 
-  name = "egg2nix-${version}";
   buildInputs = with chickenEggs; [
     matchable http-client
   ];
diff --git a/nixpkgs/pkgs/development/compilers/closure/default.nix b/nixpkgs/pkgs/development/compilers/closure/default.nix
index 3f32be22bd10..bb6b65e40a46 100644
--- a/nixpkgs/pkgs/development/compilers/closure/default.nix
+++ b/nixpkgs/pkgs/development/compilers/closure/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "closure-compiler";
-  version = "20211107";
+  version = "20220202";
 
   src = fetchurl {
     url = "mirror://maven/com/google/javascript/closure-compiler/v${version}/closure-compiler-v${version}.jar";
-    sha256 = "sha256-cz8A8KFlHJ1UCdkWLm+U8KPmFGNiiSXT1u9mvmDsFKY=";
+    sha256 = "sha256-I9kcK9oL6AMStI7eGfruJ+CYQuAsVsixTzkh0JWJrw8=";
   };
 
   dontUnpack = true;
diff --git a/nixpkgs/pkgs/development/compilers/crystal/default.nix b/nixpkgs/pkgs/development/compilers/crystal/default.nix
index 330cf851ab1b..4ac820b7e015 100644
--- a/nixpkgs/pkgs/development/compilers/crystal/default.nix
+++ b/nixpkgs/pkgs/development/compilers/crystal/default.nix
@@ -32,9 +32,11 @@ let
     x86_64-linux = "linux-x86_64";
     i686-linux = "linux-i686";
     x86_64-darwin = "darwin-x86_64";
+    aarch64-darwin = "darwin-universal";
   };
 
   arch = archs.${stdenv.system} or (throw "system ${stdenv.system} not supported");
+  isAarch64Darwin = stdenv.system == "aarch64-darwin";
 
   checkInputs = [ git gmp openssl readline libxml2 libyaml ];
 
@@ -53,6 +55,8 @@ let
         tar --strip-components=1 -C $out -xf ${src}
         patchShebangs $out/bin/crystal
       '';
+
+      meta.broken = lib.versionOlder version "1.2.0" && isAarch64Darwin;
     };
 
   commonBuildInputs = extraBuildInputs: [
@@ -206,7 +210,8 @@ let
         homepage = "https://crystal-lang.org/";
         license = licenses.asl20;
         maintainers = with maintainers; [ david50407 fabianhjr manveru peterhoeg ];
-        platforms = builtins.attrNames archs;
+        platforms = let archNames = builtins.attrNames archs; in
+          if (lib.versionOlder version "1.2.0") then remove "aarch64-darwin" archNames else archNames;
         broken = lib.versionOlder version "0.36.1" && stdenv.isDarwin;
       };
     })
@@ -223,6 +228,13 @@ rec {
     };
   };
 
+  binaryCrystal_1_2 = genericBinary {
+    version = "1.2.0";
+    sha256s = {
+      aarch64-darwin = "1hrs8cpjxdkcf8mr9qgzilwbg6bakq87sd4yydfsk2f4pqd6g7nf";
+    };
+  };
+
   crystal_1_0 = generic {
     version = "1.0.0";
     sha256 = "sha256-RI+a3w6Rr+uc5jRf7xw0tOenR+q6qii/ewWfID6dbQ8=";
@@ -238,10 +250,8 @@ rec {
   crystal_1_2 = generic {
     version = "1.2.2";
     sha256 = "sha256-nyOXhsutVBRdtJlJHe2dALl//BUXD1JeeQPgHU4SwiU=";
-    binary = crystal_1_1;
+    binary = if isAarch64Darwin then binaryCrystal_1_2 else crystal_1_1;
   };
 
   crystal = crystal_1_2;
-
-  crystal2nix = callPackage ./crystal2nix.nix { };
 }
diff --git a/nixpkgs/pkgs/development/compilers/dictu/default.nix b/nixpkgs/pkgs/development/compilers/dictu/default.nix
index c4fe29077f41..8ff6a5120f75 100644
--- a/nixpkgs/pkgs/development/compilers/dictu/default.nix
+++ b/nixpkgs/pkgs/development/compilers/dictu/default.nix
@@ -13,13 +13,13 @@ assert enableLTO -> stdenv.cc.isGNU;
 
 stdenv.mkDerivation rec {
   pname = "dictu";
-  version = "0.22.0";
+  version = "0.23.0";
 
   src = fetchFromGitHub {
     owner = "dictu-lang";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-bAoSFHX8sQgmV3hAXsR9qT4BnUsyneeynRAByEfzjE4=";
+    sha256 = "sha256-K/RbkRK8nCkmaNwWplWe2nWtULhn/GCNPXYStfMeUPg=";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/nixpkgs/pkgs/development/compilers/elm/default.nix b/nixpkgs/pkgs/development/compilers/elm/default.nix
index 11b5f58a12d8..149d81150548 100644
--- a/nixpkgs/pkgs/development/compilers/elm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/elm/default.nix
@@ -1,95 +1,101 @@
-{ lib, stdenv, pkgs
-, haskell, haskellPackages, nodejs-14_x
-, fetchurl, fetchpatch, makeWrapper, writeScriptBin
-  # Rust dependecies
-, curl, rustPlatform, openssl, pkg-config, Security, darwin
-}:
+{ pkgs, lib }:
+
 let
+
   # To controll nodejs version we pass down
-  nodejs = nodejs-14_x;
-
-  fetchElmDeps = import ./fetchElmDeps.nix { inherit stdenv lib fetchurl; };
-
-  hsPkgs = haskellPackages.override {
-    overrides = self: super: with haskell.lib.compose; with lib;
-      let elmPkgs = rec {
-            elm = overrideCabal (drv: {
-              # sadly with parallelism most of the time breaks compilation
-              enableParallelBuilding = false;
-              preConfigure = self.fetchElmDeps {
-                elmPackages = (import ./packages/elm-srcs.nix);
-                elmVersion = drv.version;
-                registryDat = ./registry.dat;
-              };
-              buildTools = drv.buildTools or [] ++ [ makeWrapper ];
-              jailbreak = true;
-              postInstall = ''
-                wrapProgram $out/bin/elm \
-                  --prefix PATH ':' ${lib.makeBinPath [ nodejs ]}
-              '';
-
-              description = "A delightful language for reliable webapps";
-              homepage = "https://elm-lang.org/";
-              license = licenses.bsd3;
-              maintainers = with maintainers; [ domenkozar turbomack ];
-            }) (self.callPackage ./packages/elm.nix { });
-
-            /*
-            The elm-format expression is updated via a script in the https://github.com/avh4/elm-format repo:
-            `package/nix/build.sh`
-            */
-            elm-format = justStaticExecutables (overrideCabal (drv: {
-              jailbreak = true;
-
-              description = "Formats Elm source code according to a standard set of rules based on the official Elm Style Guide";
-              homepage = "https://github.com/avh4/elm-format";
-              license = licenses.bsd3;
-              maintainers = with maintainers; [ avh4 turbomack ];
-            }) (self.callPackage ./packages/elm-format.nix {}));
-
-            elmi-to-json = justStaticExecutables (overrideCabal (drv: {
-              prePatch = ''
-                substituteInPlace package.yaml --replace "- -Werror" ""
-                hpack
-              '';
-              jailbreak = true;
-
-              description = "Tool that reads .elmi files (Elm interface file) generated by the elm compiler";
-              homepage = "https://github.com/stoeffel/elmi-to-json";
-              license = licenses.bsd3;
-              maintainers = [ maintainers.turbomack ];
-            }) (self.callPackage ./packages/elmi-to-json.nix {}));
-
-            elm-instrument = justStaticExecutables (overrideCabal (drv: {
-              prePatch = ''
-                sed "s/desc <-.*/let desc = \"${drv.version}\"/g" Setup.hs --in-place
-              '';
-              jailbreak = true;
-              # Tests are failing because of missing instances for Eq and Show type classes
-              doCheck = false;
-
-              description = "Instrument Elm code as a preprocessing step for elm-coverage";
-              homepage = "https://github.com/zwilias/elm-instrument";
-              license = licenses.bsd3;
-              maintainers = [ maintainers.turbomack ];
-            }) (self.callPackage ./packages/elm-instrument.nix {}));
-
-            inherit fetchElmDeps;
-            elmVersion = elmPkgs.elm.version;
-          };
-      in elmPkgs // {
-        inherit elmPkgs;
-
-        # Needed for elm-format
-        indents = self.callPackage ./packages/indents.nix {};
-        bimap = self.callPackage ./packages/bimap.nix {};
-        avh4-lib = doJailbreak (self.callPackage ./packages/avh4-lib.nix {});
-        elm-format-lib = doJailbreak (self.callPackage ./packages/elm-format-lib.nix {});
-        elm-format-test-lib = self.callPackage ./packages/elm-format-test-lib.nix {};
-        elm-format-markdown = self.callPackage ./packages/elm-format-markdown.nix {};
-      };
+  nodejs = pkgs.nodejs-14_x;
+
+  fetchElmDeps = pkgs.callPackage ./fetchElmDeps.nix { };
+
+  hsPkgs = self: pkgs.haskellPackages.override {
+    overrides = self: super: with pkgs.haskell.lib.compose; with lib;
+    let elmPkgs = rec {
+      elm = overrideCabal (drv: {
+        # sadly with parallelism most of the time breaks compilation
+        enableParallelBuilding = false;
+        preConfigure = fetchElmDeps {
+          elmPackages = (import ./packages/elm-srcs.nix);
+          elmVersion = drv.version;
+          registryDat = ./registry.dat;
+        };
+        buildTools = drv.buildTools or [] ++ [ pkgs.makeWrapper ];
+        jailbreak = true;
+        postInstall = ''
+          wrapProgram $out/bin/elm \
+            --prefix PATH ':' ${lib.makeBinPath [ nodejs ]}
+        '';
+
+        description = "A delightful language for reliable webapps";
+        homepage = "https://elm-lang.org/";
+        license = licenses.bsd3;
+        maintainers = with maintainers; [ domenkozar turbomack ];
+      }) (self.callPackage ./packages/elm.nix { });
+
+      /*
+      The elm-format expression is updated via a script in the https://github.com/avh4/elm-format repo:
+      `package/nix/build.sh`
+      */
+      elm-format = justStaticExecutables (overrideCabal (drv: {
+        jailbreak = true;
+
+        description = "Formats Elm source code according to a standard set of rules based on the official Elm Style Guide";
+        homepage = "https://github.com/avh4/elm-format";
+        license = licenses.bsd3;
+        maintainers = with maintainers; [ avh4 turbomack ];
+      }) (self.callPackage ./packages/elm-format.nix {}));
+
+      elmi-to-json = justStaticExecutables (overrideCabal (drv: {
+        prePatch = ''
+          substituteInPlace package.yaml --replace "- -Werror" ""
+          hpack
+        '';
+        jailbreak = true;
+
+        description = "Tool that reads .elmi files (Elm interface file) generated by the elm compiler";
+        homepage = "https://github.com/stoeffel/elmi-to-json";
+        license = licenses.bsd3;
+        maintainers = [ maintainers.turbomack ];
+      }) (self.callPackage ./packages/elmi-to-json.nix {}));
+
+      elm-instrument = justStaticExecutables (overrideCabal (drv: {
+        prePatch = ''
+          sed "s/desc <-.*/let desc = \"${drv.version}\"/g" Setup.hs --in-place
+        '';
+        jailbreak = true;
+        # Tests are failing because of missing instances for Eq and Show type classes
+        doCheck = false;
+
+        description = "Instrument Elm code as a preprocessing step for elm-coverage";
+        homepage = "https://github.com/zwilias/elm-instrument";
+        license = licenses.bsd3;
+        maintainers = [ maintainers.turbomack ];
+      }) (self.callPackage ./packages/elm-instrument.nix {}));
+
+      inherit fetchElmDeps;
+      elmVersion = elmPkgs.elm.version;
+    };
+    in elmPkgs // {
+      inherit elmPkgs;
+
+      # Needed for elm-format
+      indents = self.callPackage ./packages/indents.nix {};
+      bimap = self.callPackage ./packages/bimap.nix {};
+      avh4-lib = doJailbreak (self.callPackage ./packages/avh4-lib.nix {});
+      elm-format-lib = doJailbreak (self.callPackage ./packages/elm-format-lib.nix {});
+      elm-format-test-lib = self.callPackage ./packages/elm-format-test-lib.nix {};
+      elm-format-markdown = self.callPackage ./packages/elm-format-markdown.nix {};
+    };
   };
 
+  nodePkgs = pkgs.callPackage ./packages/node-composition.nix {
+    inherit pkgs;
+    nodejs = pkgs.nodejs-14_x;
+    inherit (pkgs.stdenv.hostPlatform) system;
+  };
+
+in lib.makeScope pkgs.newScope (self: with self; {
+  inherit fetchElmDeps nodejs;
+
   /* Node/NPM based dependecies can be upgraded using script `packages/generate-node-packages.sh`.
 
       * Packages which rely on `bin-wrap` will fail by default
@@ -98,110 +104,83 @@ let
       * Packages which depend on npm installation of elm can be patched using
         `patchNpmElm` function also defined in `packages/lib.nix`.
   */
-  elmLib = import ./packages/lib.nix {
-    inherit lib writeScriptBin stdenv;
-    inherit (hsPkgs.elmPkgs) elm;
+  elmLib = let
+    hsElmPkgs = hsPkgs self;
+  in import ./packages/lib.nix {
+    inherit lib;
+    inherit (pkgs) writeScriptBin stdenv;
+    inherit (hsElmPkgs.elmPkgs) elm;
   };
 
-  elmRustPackages =  {
-    elm-json = import ./packages/elm-json.nix {
-      inherit curl lib rustPlatform fetchurl openssl stdenv pkg-config Security;
-    } // {
-      meta = with lib; {
-        description = "Install, upgrade and uninstall Elm dependencies";
-        homepage = "https://github.com/zwilias/elm-json";
-        license = licenses.mit;
-        maintainers = [ maintainers.turbomack ];
-      };
-    };
+  elm-json = callPackage ./packages/elm-json.nix { };
 
-    elm-test-rs = import ./packages/elm-test-rs.nix {
-      inherit lib rustPlatform fetchurl openssl stdenv Security darwin;
-    } // {
-      meta = with lib; {
-        description = "Fast and portable executable to run your Elm tests";
-        homepage = "https://github.com/mpizenberg/elm-test-rs";
-        license = licenses.bsd3;
-        maintainers = [ maintainers.jpagex ];
-      };
+  elm-test-rs = callPackage ./packages/elm-test-rs.nix { };
+
+  elm-test = nodePkgs.elm-test // {
+    meta = with lib; nodePkgs.elm-test.meta // {
+      description = "Runs elm-test suites from Node.js";
+      homepage = "https://github.com/rtfeldman/node-test-runner";
+      license = licenses.bsd3;
+      maintainers = [ maintainers.turbomack ];
+    };
+  };
+} // (hsPkgs self).elmPkgs // (with elmLib; with (hsPkgs self).elmPkgs; {
+  elm-verify-examples = patchBinwrap [elmi-to-json] nodePkgs.elm-verify-examples // {
+    meta = with lib; nodePkgs.elm-verify-examples.meta // {
+      description = "Verify examples in your docs";
+      homepage = "https://github.com/stoeffel/elm-verify-examples";
+      license = licenses.bsd3;
+      maintainers = [ maintainers.turbomack ];
     };
   };
 
-  elmNodePackages = with elmLib;
-    let
-      nodePkgs = import ./packages/node-composition.nix {
-          inherit nodejs pkgs;
-          inherit (stdenv.hostPlatform) system;
-        };
-    in with hsPkgs.elmPkgs; {
-
-      elm-test =
-        nodePkgs.elm-test // {
-          meta = with lib; {
-            description = "Runs elm-test suites from Node.js";
-            homepage = "https://github.com/rtfeldman/node-test-runner";
-            license = licenses.bsd3;
-            maintainers = [ maintainers.turbomack ];
-          };
-        };
-
-      elm-verify-examples = patchBinwrap [elmi-to-json]
-        nodePkgs.elm-verify-examples // {
-          meta = with lib; {
-            description = "Verify examples in your docs";
-            homepage = "https://github.com/stoeffel/elm-verify-examples";
-            license = licenses.bsd3;
-            maintainers = [ maintainers.turbomack ];
-          };
-        };
+  elm-coverage = let
+      patched = patchNpmElm (patchBinwrap [elmi-to-json] nodePkgs.elm-coverage);
+    in patched.override (old: {
+      # Symlink Elm instrument binary
+      preRebuild = (old.preRebuild or "") + ''
+        # Noop custom installation script
+        sed 's/\"install\".*/\"install\":\"echo no-op\"/g' --in-place package.json
+
+        # This should not be needed (thanks to binwrap* being nooped) but for some reason it still needs to be done
+        # in case of just this package
+        # TODO: investigate
+        sed 's/\"install\".*/\"install\":\"echo no-op\",/g' --in-place node_modules/elmi-to-json/package.json
+      '';
+      postInstall = (old.postInstall or "") + ''
+        mkdir -p unpacked_bin
+        ln -sf ${elm-instrument}/bin/elm-instrument unpacked_bin/elm-instrument
+      '';
+      meta = with lib; nodePkgs.elm-coverage.meta // {
+        description = "Work in progress - Code coverage tooling for Elm";
+        homepage = "https://github.com/zwilias/elm-coverage";
+        license = licenses.bsd3;
+        maintainers = [ maintainers.turbomack ];
+      };
+    });
 
-      elm-coverage =
-        let patched = patchNpmElm (patchBinwrap [elmi-to-json] nodePkgs.elm-coverage);
-        in patched.override (old: {
-          # Symlink Elm instrument binary
-          preRebuild = (old.preRebuild or "") + ''
-            # Noop custom installation script
-            sed 's/\"install\".*/\"install\":\"echo no-op\"/g' --in-place package.json
-
-            # This should not be needed (thanks to binwrap* being nooped) but for some reason it still needs to be done
-            # in case of just this package
-            # TODO: investigate
-            sed 's/\"install\".*/\"install\":\"echo no-op\",/g' --in-place node_modules/elmi-to-json/package.json
-          '';
-          postInstall = (old.postInstall or "") + ''
-            mkdir -p unpacked_bin
-            ln -sf ${elm-instrument}/bin/elm-instrument unpacked_bin/elm-instrument
-          '';
-          meta = with lib; {
-            description = "Work in progress - Code coverage tooling for Elm";
-            homepage = "https://github.com/zwilias/elm-coverage";
-            license = licenses.bsd3;
-            maintainers = [ maintainers.turbomack ];
-          };
-        });
-
-      create-elm-app = patchNpmElm
-        nodePkgs.create-elm-app // {
-          meta = with lib; {
-            description = "Create Elm apps with no build configuration";
-            homepage = "https://github.com/halfzebra/create-elm-app";
-            license = licenses.mit;
-            maintainers = [ maintainers.turbomack ];
-          };
-        };
+    create-elm-app = patchNpmElm
+    nodePkgs.create-elm-app // {
+      meta = with lib; nodePkgs.create-elm-app.meta // {
+        description = "Create Elm apps with no build configuration";
+        homepage = "https://github.com/halfzebra/create-elm-app";
+        license = licenses.mit;
+        maintainers = [ maintainers.turbomack ];
+      };
+    };
 
-      elm-review =
-        nodePkgs.elm-review // {
-          meta = with lib; {
-            description = "Analyzes Elm projects, to help find mistakes before your users find them";
-            homepage = "https://package.elm-lang.org/packages/jfmengels/elm-review/${nodePkgs.elm-review.version}";
-            license = licenses.bsd3;
-            maintainers = [ maintainers.turbomack ];
-          };
+    elm-review =
+      nodePkgs.elm-review // {
+        meta = with lib; nodePkgs.elm-review.meta // {
+          description = "Analyzes Elm projects, to help find mistakes before your users find them";
+          homepage = "https://package.elm-lang.org/packages/jfmengels/elm-review/${nodePkgs.elm-review.version}";
+          license = licenses.bsd3;
+          maintainers = [ maintainers.turbomack ];
         };
+      };
 
       elm-language-server = nodePkgs."@elm-tooling/elm-language-server" // {
-        meta = with lib; {
+        meta = with lib; nodePkgs."@elm-tooling/elm-language-server".meta // {
           description = "Language server implementation for Elm";
           homepage = "https://github.com/elm-tooling/elm-language-server";
           license = licenses.mit;
@@ -210,7 +189,7 @@ let
       };
 
       elm-optimize-level-2 = nodePkgs."elm-optimize-level-2" // {
-        meta = with lib; {
+        meta = with lib; nodePkgs."elm-optimize-level-2".meta // {
           description = "A second level of optimization for the Javascript that the Elm Compiler produces";
           homepage = "https://github.com/mdgriffith/elm-optimize-level-2";
           license = licenses.bsd3;
@@ -219,8 +198,6 @@ let
       };
 
       inherit (nodePkgs) elm-doc-preview elm-live elm-upgrade elm-xref elm-analyse elm-git-install;
-    };
+    })
+  )
 
-in hsPkgs.elmPkgs // elmNodePackages // elmRustPackages // {
-  lib = elmLib;
-}
diff --git a/nixpkgs/pkgs/development/compilers/elm/packages/elm-json.nix b/nixpkgs/pkgs/development/compilers/elm/packages/elm-json.nix
index a480b9e0e1eb..faf6ffd8a2e1 100644
--- a/nixpkgs/pkgs/development/compilers/elm/packages/elm-json.nix
+++ b/nixpkgs/pkgs/development/compilers/elm/packages/elm-json.nix
@@ -1,4 +1,13 @@
-{ lib, curl, rustPlatform, fetchurl, openssl, stdenv, pkg-config, Security }:
+{ lib
+, curl
+, rustPlatform
+, fetchurl
+, openssl
+, stdenv
+, pkg-config
+, darwin
+}:
+
 rustPlatform.buildRustPackage rec {
   pname = "elm-json";
   version = "0.2.10";
@@ -12,10 +21,19 @@ rustPlatform.buildRustPackage rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  buildInputs = [ curl openssl ] ++ lib.optionals stdenv.isDarwin [ Security ];
+  buildInputs = [
+    curl openssl
+  ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
 
   cargoSha256 = "sha256:01zasrqf1va58i52s3kwdkj1rnwy80gv00xi6npfshjirj3ix07f";
 
   # Tests perform networking and therefore can't work in sandbox
   doCheck = false;
+
+  meta = with lib; {
+    description = "Install, upgrade and uninstall Elm dependencies";
+    homepage = "https://github.com/zwilias/elm-json";
+    license = licenses.mit;
+    maintainers = [ maintainers.turbomack ];
+  };
 }
diff --git a/nixpkgs/pkgs/development/compilers/elm/packages/elm-test-rs.nix b/nixpkgs/pkgs/development/compilers/elm/packages/elm-test-rs.nix
index a482809ab50d..09d453b00f83 100644
--- a/nixpkgs/pkgs/development/compilers/elm/packages/elm-test-rs.nix
+++ b/nixpkgs/pkgs/development/compilers/elm/packages/elm-test-rs.nix
@@ -1,4 +1,5 @@
-{ lib, rustPlatform, fetchurl, openssl, stdenv, Security, darwin }:
+{ lib, rustPlatform, fetchurl, openssl, stdenv, darwin }:
+
 rustPlatform.buildRustPackage rec {
   pname = "elm-test-rs";
   version = "2.0";
@@ -8,11 +9,23 @@ rustPlatform.buildRustPackage rec {
     sha256 = "sha256:1manr42w613r9vyji7pxx5gb08jcgkdxv29qqylrqlwxa8d5dcid";
   };
 
-  buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security darwin.apple_sdk.frameworks.CoreServices ];
+  buildInputs = lib.optionals (!stdenv.isDarwin) [
+    openssl
+  ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    Security
+    CoreServices
+  ]);
 
   cargoSha256 = "sha256:1dpdlzv96kpc25yf5jgsz9qldghyw35x382qpxhkadkn5dryzjvd";
   verifyCargoDeps = true;
 
   # Tests perform networking and therefore can't work in sandbox
   doCheck = false;
+
+  meta = with lib; {
+    description = "Fast and portable executable to run your Elm tests";
+    homepage = "https://github.com/mpizenberg/elm-test-rs";
+    license = licenses.bsd3;
+    maintainers = [ maintainers.jpagex ];
+  };
 }
diff --git a/nixpkgs/pkgs/development/compilers/elm/packages/elm.nix b/nixpkgs/pkgs/development/compilers/elm/packages/elm.nix
index c012d59d8ae3..e24ece00ffef 100644
--- a/nixpkgs/pkgs/development/compilers/elm/packages/elm.nix
+++ b/nixpkgs/pkgs/development/compilers/elm/packages/elm.nix
@@ -6,6 +6,7 @@
 , snap-core, snap-server, lib, template-haskell, time
 , unordered-containers, utf8-string, vector, zip-archive
 }:
+
 mkDerivation {
   pname = "elm";
   version = "0.19.1";
diff --git a/nixpkgs/pkgs/development/compilers/flutter/default.nix b/nixpkgs/pkgs/development/compilers/flutter/default.nix
index a91105adc33e..6f6130c36785 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/default.nix
+++ b/nixpkgs/pkgs/development/compilers/flutter/default.nix
@@ -4,20 +4,20 @@ let
   getPatches = dir:
     let files = builtins.attrNames (builtins.readDir dir);
     in map (f: dir + ("/" + f)) files;
-  version = "2.8.0";
+  version = "2.10.0";
   channel = "stable";
   filename = "flutter_linux_${version}-${channel}.tar.xz";
 
   # Decouples flutter derivation from dart derivation,
   # use specific dart version to not need to bump dart derivation when bumping flutter.
-  dartVersion = "2.15.0";
+  dartVersion = "2.16.0";
   dartSourceBase = "https://storage.googleapis.com/dart-archive/channels";
   dartForFlutter = dart.override {
     version = dartVersion;
     sources = {
       "${dartVersion}-x86_64-linux" = fetchurl {
         url = "${dartSourceBase}/stable/release/${dartVersion}/sdk/dartsdk-linux-x64-release.zip";
-        sha256 = "sha256-U1V1OPmFeNZCdBxFy7yqAbAE0cxh9f2UqKQmreJu9YA=";
+        sha256 = "sha256-n+hr3iMt5S0iEeR/X9zBQ86TbjCajaG0RyE+Ij1/aNM=";
       };
     };
   };
@@ -29,7 +29,7 @@ in {
     pname = "flutter";
     src = fetchurl {
       url = "https://storage.googleapis.com/flutter_infra_release/releases/${channel}/linux/${filename}";
-      sha256 = "sha256-sSz/owGdCMB5b9+cAWvLkrfFcIIq5665Xopd4JKv1G4=";
+      sha256 = "sha256-4ZEpZPGVnisnK9QT1o4G2G6CiflYElh+e3+X8odnx1U=";
     };
     patches = getPatches ./patches;
   };
diff --git a/nixpkgs/pkgs/development/compilers/flutter/flutter.nix b/nixpkgs/pkgs/development/compilers/flutter/flutter.nix
index d700f686f630..43538ede339e 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/flutter.nix
+++ b/nixpkgs/pkgs/development/compilers/flutter/flutter.nix
@@ -32,6 +32,7 @@
 , nss
 , systemd
 , which
+, callPackage
 }:
 let
   drvName = "flutter-${version}";
@@ -146,6 +147,8 @@ let
   };
 
 in
+let
+self = (self:
 runCommand drvName
 {
   startScript = ''
@@ -159,6 +162,9 @@ runCommand drvName
   passthru = {
     unwrapped = flutter;
     inherit dart;
+    mkFlutterApp = callPackage ../../../build-support/flutter {
+      flutter = self;
+    };
   };
   meta = with lib; {
     description = "Flutter is Google's SDK for building mobile, web and desktop with Dart";
@@ -174,6 +180,11 @@ runCommand drvName
 } ''
   mkdir -p $out/bin
 
+  mkdir -p $out/bin/cache/
+  ln -sf ${dart} $out/bin/cache/dart-sdk
+
   echo -n "$startScript" > $out/bin/${pname}
   chmod +x $out/bin/${pname}
-''
+'') self;
+in
+self
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 d0fd363d3c64..e799f6e1550b 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch
+++ b/nixpkgs/pkgs/development/compilers/flutter/patches/disable-auto-update.patch
@@ -1,8 +1,8 @@
 diff --git a/bin/internal/shared.sh b/bin/internal/shared.sh
-index be9320210e..6eb50aae95 100644
+index 05cba4393b..2a775bf24f 100644
 --- a/bin/internal/shared.sh
 +++ b/bin/internal/shared.sh
-@@ -218,8 +218,6 @@ function shared::execute() {
+@@ -217,8 +217,6 @@ function shared::execute() {
    # FLUTTER_TOOL_ARGS="--enable-asserts $FLUTTER_TOOL_ARGS"
    # FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --observe=65432"
  
@@ -12,19 +12,19 @@ index be9320210e..6eb50aae95 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 550a75bc65..c98a4591cc 100644
+index 396756808e..d324a6df59 100644
 --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
 +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
-@@ -244,7 +244,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
+@@ -241,7 +241,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
            globals.flutterUsage.suppressAnalytics = true;
          }
  
 -        globals.flutterVersion.ensureVersionFile();
-         final bool machineFlag = topLevelResults['machine'] as bool;
+         final bool machineFlag = topLevelResults['machine'] as bool? ?? false;
          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;
+@@ -250,10 +249,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
+         final bool versionCheckFlag = topLevelResults['version-check'] as bool? ?? false;
          final bool explicitVersionCheckPassed = topLevelResults.wasParsed('version-check') && versionCheckFlag;
  
 -        if (topLevelResults.command?.name != 'upgrade' &&
@@ -33,4 +33,4 @@ index 550a75bc65..c98a4591cc 100644
 -        }
  
          // See if the user specified a specific device.
-         globals.deviceManager.specifiedDeviceId = topLevelResults['device-id'] as String;
+         globals.deviceManager?.specifiedDeviceId = topLevelResults['device-id'] as String?;
diff --git a/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch b/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch
index 701cab54d807..a81d2def242c 100644
--- a/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch
+++ b/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch
@@ -1,5 +1,5 @@
 diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
-index ed42baea29..fee2fb1d62 100644
+index ed42baea29..12941f733a 100644
 --- a/packages/flutter_tools/lib/src/asset.dart
 +++ b/packages/flutter_tools/lib/src/asset.dart
 @@ -11,11 +11,11 @@ import 'base/file_system.dart';
@@ -25,7 +25,7 @@ index ed42baea29..fee2fb1d62 100644
            entryUri: entryUri,
            package: null,
 diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
-index 7870c7807f..3fcf92f20d 100644
+index defc86cc20..7fdf14d112 100644
 --- a/packages/flutter_tools/lib/src/cache.dart
 +++ b/packages/flutter_tools/lib/src/cache.dart
 @@ -22,6 +22,7 @@ import 'base/user_messages.dart';
@@ -36,7 +36,7 @@ index 7870c7807f..3fcf92f20d 100644
  
  const String kFlutterRootEnvironmentVariableName = 'FLUTTER_ROOT'; // should point to //flutter/ (root of flutter/flutter repo)
  const String kFlutterEngineEnvironmentVariableName = 'FLUTTER_ENGINE'; // should point to //engine/src/ (root of flutter/engine repo)
-@@ -302,8 +303,13 @@ class Cache {
+@@ -322,8 +323,13 @@ class Cache {
        return;
      }
      assert(_lock == null);
@@ -51,7 +51,17 @@ index 7870c7807f..3fcf92f20d 100644
      try {
        _lock = lockFile.openSync(mode: FileMode.write);
      } on FileSystemException catch (e) {
-@@ -453,7 +459,7 @@ class Cache {
+@@ -382,8 +388,7 @@ class Cache {
+ 
+   String get devToolsVersion {
+     if (_devToolsVersion == null) {
+-      const String devToolsDirPath = 'dart-sdk/bin/resources/devtools';
+-      final Directory devToolsDir = getCacheDir(devToolsDirPath, shouldCreate: false);
++      final Directory devToolsDir = _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin/cache/dart-sdk/bin/resources/devtools'));
+       if (!devToolsDir.existsSync()) {
+         throw Exception('Could not find directory at ${devToolsDir.path}');
+       }
+@@ -536,7 +541,7 @@ class Cache {
      if (_rootOverride != null) {
        return _fileSystem.directory(_fileSystem.path.join(_rootOverride!.path, 'bin', 'cache'));
      } else {
diff --git a/nixpkgs/pkgs/development/compilers/fpc/default.upstream b/nixpkgs/pkgs/development/compilers/fpc/default.upstream
deleted file mode 100644
index 9f16c1b645cd..000000000000
--- a/nixpkgs/pkgs/development/compilers/fpc/default.upstream
+++ /dev/null
@@ -1,6 +0,0 @@
-url https://sourceforge.net/projects/freepascal/files/Source/
-SF_version_dir
-version_link 'fpcbuild-[0-9.]+[.]tar[.]gz/download$'
-SF_redirect
-version '.*-([0-9.]+)[.]tar[.]gz' '\1'
-do_overwrite () { do_overwrite_just_version; }
diff --git a/nixpkgs/pkgs/development/compilers/fpc/lazarus.nix b/nixpkgs/pkgs/development/compilers/fpc/lazarus.nix
index 5cd0609960df..5ddaa7c429f2 100644
--- a/nixpkgs/pkgs/development/compilers/fpc/lazarus.nix
+++ b/nixpkgs/pkgs/development/compilers/fpc/lazarus.nix
@@ -45,6 +45,10 @@ stdenv.mkDerivation rec {
   ]
   ++ lib.optionals withQt [ libqt5pas qtbase ];
 
+  # Disable parallel build, errors:
+  #  Fatal: (1018) Compilation aborted
+  enableParallelBuilding = false;
+
   nativeBuildInputs = [
     makeWrapper
   ] ++ lib.optional withQt wrapQtAppsHook;
diff --git a/nixpkgs/pkgs/development/compilers/fsharp/default.nix b/nixpkgs/pkgs/development/compilers/fsharp/default.nix
index 19b79989dc23..20a33307bf3c 100644
--- a/nixpkgs/pkgs/development/compilers/fsharp/default.nix
+++ b/nixpkgs/pkgs/development/compilers/fsharp/default.nix
@@ -1,14 +1,16 @@
 # Temporarily avoid dependency on dotnetbuildhelpers to avoid rebuilding many times while working on it
 
-{ lib, stdenv, fetchurl, mono, pkg-config, dotnetbuildhelpers, autoconf, automake, which }:
+{ lib, stdenv, fetchFromGitHub, mono, pkg-config, dotnetbuildhelpers, autoconf, automake, which }:
 
 stdenv.mkDerivation rec {
   pname = "fsharp";
   version = "4.0.1.1";
 
-  src = fetchurl {
-    url = "https://github.com/fsharp/fsharp/archive/${version}.tar.gz";
-    sha256 = "0mvmvwwpl4zq0yvgzdizww8l9azvlrc82xm32nz1fi1nw8x5qfqk";
+  src = fetchFromGitHub {
+    owner = "fsharp";
+    repo = "fsharp";
+    rev = version;
+    sha256 = "sha256-dgTEM2aL8lVjVMuW0+HLc+TUA39IiuBv/RfHYNURh5s=";
   };
 
   nativeBuildInputs = [ pkg-config ];
diff --git a/nixpkgs/pkgs/development/compilers/fstar/default.nix b/nixpkgs/pkgs/development/compilers/fstar/default.nix
index 43bdbda81846..25abd7949071 100644
--- a/nixpkgs/pkgs/development/compilers/fstar/default.nix
+++ b/nixpkgs/pkgs/development/compilers/fstar/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "fstar";
-  version = "2021.12.25";
+  version = "2022.01.15";
 
   src = fetchFromGitHub {
     owner = "FStarLang";
     repo = "FStar";
     rev = "v${version}";
-    sha256 = "RmXKv/admC1w26z/ClNhH11J8n87WTfDr2lYOF6Fx7I=";
+    sha256 = "sha256-bK3McF/wTjT9q6luihPaEXjx7Lu6+ZbQ9G61Mc4KoB0=";
   };
 
   nativeBuildInputs = [ makeWrapper installShellFiles ];
diff --git a/nixpkgs/pkgs/development/compilers/gavrasm/default.nix b/nixpkgs/pkgs/development/compilers/gavrasm/default.nix
index 6bd813b56cfb..0a969a80c121 100644
--- a/nixpkgs/pkgs/development/compilers/gavrasm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/gavrasm/default.nix
@@ -1,36 +1,45 @@
 { lib, stdenv, fetchzip, fpc , lang ? "en" } :
+
 assert lib.assertOneOf "lang" lang ["cn" "de" "en" "fr" "tr"];
+
 stdenv.mkDerivation rec {
   pname = "gavrasm";
-  version = "4.5";
+  version = "5.1";
+  flatVersion = lib.strings.replaceStrings ["."] [""] version;
 
   src = fetchzip {
-    url ="http://www.avr-asm-tutorial.net/gavrasm/v45/gavrasm_sources_lin_45.zip";
-    sha256 = "1f5g5ran74pznwj4g7vfqh2qhymaj3p26f2lvzbmlwq447iid52c";
+    url = "http://www.avr-asm-tutorial.net/gavrasm/v${flatVersion}/gavrasm_sources_lin_${flatVersion}.zip";
+    sha256 = "0k94f8k4980wvhx3dpl1savpx4wqv9r5090l0skg2k8vlhsv58gf";
     stripRoot=false;
   };
 
   nativeBuildInputs = [ fpc ];
 
   configurePhase = ''
+    runHook preConfigure
     cp gavrlang_${lang}.pas gavrlang.pas
+    runHook postConfigure
   '';
 
   buildPhase = ''
+    runHook preBuild
     fpc gavrasm.pas
+    runHook postBuild
   '';
 
   installPhase = ''
+    runHook preInstall
     mkdir -p $out/bin
     cp gavrasm $out/bin
     mkdir -p $out/doc
     cp instr.asm $out/doc
     cp ReadMe.Txt $out/doc
     cp LiesMich.Txt $out/doc
+    runHook postInstall
   '';
 
   meta = with lib; {
-    homepage = "http://www.avr-asm-tutorial.net/gavrasm";
+    homepage = "http://www.avr-asm-tutorial.net/gavrasm/";
     description = "AVR Assembler for ATMEL AVR-Processors";
     license = licenses.unfree;
     maintainers = with maintainers; [ mafo ];
diff --git a/nixpkgs/pkgs/development/compilers/gcc/9/default.nix b/nixpkgs/pkgs/development/compilers/gcc/9/default.nix
index ebdc55ee3f8f..9d21ed667f6c 100644
--- a/nixpkgs/pkgs/development/compilers/gcc/9/default.nix
+++ b/nixpkgs/pkgs/development/compilers/gcc/9/default.nix
@@ -82,6 +82,7 @@ let majorVersion = "9";
       ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
       ++ optional targetPlatform.isNetBSD ../libstdc++-netbsd-ctypes.patch
       ++ optional noSysDirs ../no-sys-dirs.patch
+      ++ optional (noSysDirs && hostPlatform.isRiscV) ../no-sys-dirs-riscv-gcc9.patch
       /* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
         url = "https://git.busybox.net/buildroot/plain/package/gcc/${version}/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
         sha256 = ""; # TODO: uncomment and check hash when available.
diff --git a/nixpkgs/pkgs/development/compilers/gcc/no-sys-dirs-riscv-gcc9.patch b/nixpkgs/pkgs/development/compilers/gcc/no-sys-dirs-riscv-gcc9.patch
new file mode 100644
index 000000000000..afe3f26360e4
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/gcc/no-sys-dirs-riscv-gcc9.patch
@@ -0,0 +1,17 @@
+diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
+index 701f5ea1544..8de333caf54 100644
+--- a/gcc/config/riscv/riscv.h
++++ b/gcc/config/riscv/riscv.h
+@@ -886,11 +886,7 @@ extern unsigned riscv_stack_boundary;
+   "%{mabi=lp64f:lp64f}" \
+   "%{mabi=lp64d:lp64d}" \
+ 
+-#define STARTFILE_PREFIX_SPEC 			\
+-   "/lib" XLEN_SPEC "/" ABI_SPEC "/ "		\
+-   "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ "	\
+-   "/lib/ "					\
+-   "/usr/lib/ "
++#define STARTFILE_PREFIX_SPEC ""
+ 
+ /* ISA constants needed for code generation.  */
+ #define OPCODE_LW    0x2003
diff --git a/nixpkgs/pkgs/development/compilers/gforth/boot-forth.nix b/nixpkgs/pkgs/development/compilers/gforth/boot-forth.nix
new file mode 100644
index 000000000000..fc7b5ffa982d
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/gforth/boot-forth.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchurl, m4 }:
+
+let
+  version = "0.7.3";
+in
+stdenv.mkDerivation {
+  pname = "gforth-boot";
+  inherit version;
+  src = fetchurl {
+    url = "https://ftp.gnu.org/gnu/gforth/gforth-${version}.tar.gz";
+    sha256 = "1c1bahc9ypmca8rv2dijiqbangm1d9av286904yw48ph7ciz4qig";
+  };
+
+  buildInputs = [ m4 ];
+
+  configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ];
+
+  meta = {
+    description = "The Forth implementation of the GNU project (outdated version used to bootstrap)";
+    homepage = "https://www.gnu.org/software/gforth/";
+    license = lib.licenses.gpl3;
+    platforms = lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/gforth/default.nix b/nixpkgs/pkgs/development/compilers/gforth/default.nix
index bdf172cb9b99..3b60d9fb179f 100644
--- a/nixpkgs/pkgs/development/compilers/gforth/default.nix
+++ b/nixpkgs/pkgs/development/compilers/gforth/default.nix
@@ -1,17 +1,30 @@
-{ lib, stdenv, fetchurl, m4 }:
+{ lib, stdenv, fetchFromGitHub, callPackage
+, autoreconfHook, texinfo, libffi
+}:
 
 let
-  version = "0.7.3";
-in
-stdenv.mkDerivation {
+  swig = callPackage ./swig.nix { };
+  bootForth = callPackage ./boot-forth.nix { };
+in stdenv.mkDerivation rec {
+
   pname = "gforth";
-  inherit version;
-  src = fetchurl {
-    url = "https://ftp.gnu.org/gnu/gforth/gforth-${version}.tar.gz";
-    sha256 = "1c1bahc9ypmca8rv2dijiqbangm1d9av286904yw48ph7ciz4qig";
+  version = "0.7.9_20220127";
+
+  src = fetchFromGitHub {
+    owner = "forthy42";
+    repo = "gforth";
+    rev = version;
+    sha256 = "sha256-3+ObHhsPvW44UFiN0GWOhwo7aiqhjwxNY8hw2Wv4MK0=";
   };
 
-  buildInputs = [ m4 ];
+  nativeBuildInputs = [
+    autoreconfHook texinfo bootForth swig
+  ];
+  buildInputs = [
+    libffi
+  ];
+
+  passthru = { inherit bootForth; };
 
   configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ];
 
@@ -22,7 +35,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "The Forth implementation of the GNU project";
-    homepage = "https://www.gnu.org/software/gforth/";
+    homepage = "https://github.com/forthy42/gforth";
     license = lib.licenses.gpl3;
     platforms = lib.platforms.all;
   };
diff --git a/nixpkgs/pkgs/development/compilers/gforth/swig.nix b/nixpkgs/pkgs/development/compilers/gforth/swig.nix
new file mode 100644
index 000000000000..8de29407cc46
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/gforth/swig.nix
@@ -0,0 +1,16 @@
+{ swig3, fetchFromGitHub }:
+
+## for updating to swig4, see
+## https://github.com/GeraldWodni/swig/pull/6
+swig3.overrideDerivation (old: {
+  version = "3.0.9-forth";
+  src = fetchFromGitHub {
+    owner = "GeraldWodni";
+    repo = "swig";
+    rev = "a45b807e5f9d8ca1a43649c8265d2741a393862a";
+    sha256 = "sha256-6nOOPFGFNaQInEkul0ZAh+ks9n3wqCQ6/tbduvG/To0=";
+  };
+  configureFlags = old.configureFlags ++ [
+    "--enable-forth"
+  ];
+})
diff --git a/nixpkgs/pkgs/development/compilers/ghc/8.10.7.nix b/nixpkgs/pkgs/development/compilers/ghc/8.10.7.nix
index 40b57223fa1d..a8f05d6f15c1 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/8.10.7.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/8.10.7.nix
@@ -57,7 +57,7 @@
 
 , # Whether to disable the large address space allocator
   # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
-  disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64
+  disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
 }:
 
 assert !enableIntegerSimple -> gmp != null;
@@ -212,6 +212,15 @@ stdenv.mkDerivation (rec {
       url = "https://gitlab.haskell.org/ghc/ghc/-/commit/97d0b0a367e4c6a52a17c3299439ac7de129da24.patch";
       sha256 = "0r4zjj0bv1x1m2dgxp3adsf2xkr94fjnyj1igsivd9ilbs5ja0b5";
     })
+  ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
+
+    # Prevent the paths module from emitting symbols that we don't use
+    # when building with separate outputs.
+    #
+    # These cause problems as they're not eliminated by GHC's dead code
+    # elimination on aarch64-darwin. (see
+    # https://github.com/NixOS/nixpkgs/issues/140774 for details).
+    ./cabal-paths.patch
   ];
 
   postPatch = "patchShebangs .";
diff --git a/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix b/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix
index 3ce47a20bad8..8a352d0e0a90 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/8.8.4.nix
@@ -56,7 +56,7 @@
 
 , # Whether to disable the large address space allocator
   # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
-  disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64
+  disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
 }:
 
 assert !enableIntegerSimple -> gmp != null;
diff --git a/nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix b/nixpkgs/pkgs/development/compilers/ghc/9.0.2.nix
index 3f13fe1b9e1b..56b16c5d48c4 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/9.0.1.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/9.0.2.nix
@@ -2,7 +2,7 @@
 
 # build-tools
 , bootPkgs
-, autoconf, automake, coreutils, fetchurl, perl, python3, m4, sphinx
+, autoconf, automake, coreutils, fetchurl, perl, python3, m4, sphinx, xattr
 , autoSignDarwinBinariesHook
 , bash
 
@@ -20,9 +20,10 @@
   # build-time dependency too.
   buildTargetLlvmPackages, llvmPackages
 
-, # If enabled, GHC will be built with the GPL-free but slower integer-simple
-  # library instead of the faster but GPLed integer-gmp library.
-  enableIntegerSimple ? !(lib.meta.availableOn stdenv.hostPlatform gmp), gmp
+, # If enabled, GHC will be built with the GPL-free but slightly slower native
+  # bignum backend instead of the faster but GPLed gmp backend.
+  enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp)
+, gmp
 
 , # If enabled, use -fPIC when compiling static libs.
   enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
@@ -58,10 +59,10 @@
 
 , # Whether to disable the large address space allocator
   # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
-  disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64
+  disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
 }:
 
-assert !enableIntegerSimple -> gmp != null;
+assert !enableNativeBignum -> gmp != null;
 
 # Cross cannot currently build the `haddock` program for silly reasons,
 # see note [HADDOCK_DOCS].
@@ -98,7 +99,7 @@ let
   ''
     HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
     DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
-    INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
+    BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
   '' + lib.optionalString (targetPlatform != hostPlatform) ''
     Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
     CrossCompilePrefix = ${targetPrefix}
@@ -114,7 +115,7 @@ let
   # Splicer will pull out correct variations
   libDeps = platform: lib.optional enableTerminfo ncurses
     ++ [libffi]
-    ++ lib.optional (!enableIntegerSimple) gmp
+    ++ lib.optional (!enableNativeBignum) gmp
     ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
 
   # TODO(@sternenseemann): is buildTarget LLVM unnecessary?
@@ -152,7 +153,7 @@ let
   # Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
   variantSuffix = lib.concatStrings [
     (lib.optionalString stdenv.hostPlatform.isMusl "-musl")
-    (lib.optionalString enableIntegerSimple "-integer-simple")
+    (lib.optionalString enableNativeBignum "-native-bignum")
   ];
 
 in
@@ -165,12 +166,12 @@ assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
 assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
 
 stdenv.mkDerivation (rec {
-  version = "9.0.1";
+  version = "9.0.2";
   pname = "${targetPrefix}ghc${variantSuffix}";
 
   src = fetchurl {
     url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
-    sha256 = "1y9mi9bq76z04hmggavrn8jwi1gx92bm3zhx6z69ypq6wha068x5";
+    sha256 = "140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197";
   };
 
   enableParallelBuilding = true;
@@ -251,7 +252,7 @@ stdenv.mkDerivation (rec {
     "--with-system-libffi"
     "--with-ffi-includes=${targetPackages.libffi.dev}/include"
     "--with-ffi-libraries=${targetPackages.libffi.out}/lib"
-  ] ++ lib.optionals (targetPlatform == hostPlatform && !enableIntegerSimple) [
+  ] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
     "--with-gmp-includes=${targetPackages.gmp.dev}/include"
     "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
   ] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
@@ -280,6 +281,10 @@ stdenv.mkDerivation (rec {
     autoSignDarwinBinariesHook
   ] ++ lib.optionals enableDocs [
     sphinx
+  ] ++ lib.optionals stdenv.isDarwin [
+    # TODO(@sternenseemann): backport addition of XATTR env var like
+    # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6447
+    xattr
   ];
 
   # For building runtime libs
diff --git a/nixpkgs/pkgs/development/compilers/ghc/9.2.1.nix b/nixpkgs/pkgs/development/compilers/ghc/9.2.1.nix
index 77d741a4f2b8..75c728510eba 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/9.2.1.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/9.2.1.nix
@@ -21,9 +21,10 @@
   # build-time dependency too.
   buildTargetLlvmPackages, llvmPackages
 
-, # If enabled, GHC will be built with the GPL-free but slower integer-simple
-  # library instead of the faster but GPLed integer-gmp library.
-  enableIntegerSimple ? !(lib.meta.availableOn stdenv.hostPlatform gmp), gmp
+, # If enabled, GHC will be built with the GPL-free but slightly slower native
+  # bignum backend instead of the faster but GPLed gmp backend.
+  enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp)
+, gmp
 
 , # If enabled, use -fPIC when compiling static libs.
   enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
@@ -59,10 +60,10 @@
 
 , # Whether to disable the large address space allocator
   # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
-  disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64
+  disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
 }:
 
-assert !enableIntegerSimple -> gmp != null;
+assert !enableNativeBignum -> gmp != null;
 
 # Cross cannot currently build the `haddock` program for silly reasons,
 # see note [HADDOCK_DOCS].
@@ -99,7 +100,7 @@ let
   ''
     HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
     DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
-    INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
+    BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
   '' + lib.optionalString (targetPlatform != hostPlatform) ''
     Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
     CrossCompilePrefix = ${targetPrefix}
@@ -115,7 +116,7 @@ let
   # Splicer will pull out correct variations
   libDeps = platform: lib.optional enableTerminfo ncurses
     ++ [libffi]
-    ++ lib.optional (!enableIntegerSimple) gmp
+    ++ lib.optional (!enableNativeBignum) gmp
     ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
 
   # TODO(@sternenseemann): is buildTarget LLVM unnecessary?
@@ -153,7 +154,7 @@ let
   # Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
   variantSuffix = lib.concatStrings [
     (lib.optionalString stdenv.hostPlatform.isMusl "-musl")
-    (lib.optionalString enableIntegerSimple "-integer-simple")
+    (lib.optionalString enableNativeBignum "-native-bignum")
   ];
 
 in
@@ -252,7 +253,7 @@ stdenv.mkDerivation (rec {
     "--with-system-libffi"
     "--with-ffi-includes=${targetPackages.libffi.dev}/include"
     "--with-ffi-libraries=${targetPackages.libffi.out}/lib"
-  ] ++ lib.optionals (targetPlatform == hostPlatform && !enableIntegerSimple) [
+  ] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
     "--with-gmp-includes=${targetPackages.gmp.dev}/include"
     "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
   ] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
diff --git a/nixpkgs/pkgs/development/compilers/ghc/cabal-paths.patch b/nixpkgs/pkgs/development/compilers/ghc/cabal-paths.patch
new file mode 100644
index 000000000000..19adcf5388bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/ghc/cabal-paths.patch
@@ -0,0 +1,99 @@
+diff --git a/Cabal/Distribution/Simple/Build/PathsModule.hs b/Cabal/Distribution/Simple/Build/PathsModule.hs
+index 5e660e8d6..1ae603c94 100644
+--- a/libraries/Cabal/Cabal/Distribution/Simple/Build/PathsModule.hs
++++ b/libraries/Cabal/Cabal/Distribution/Simple/Build/PathsModule.hs
+@@ -37,6 +37,9 @@ import System.FilePath ( pathSeparator )
+ -- * Building Paths_<pkg>.hs
+ -- ------------------------------------------------------------
+ 
++splitPath :: FilePath -> [ String ]
++splitPath = unintersperse pathSeparator
++
+ generatePathsModule :: PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> String
+ generatePathsModule pkg_descr lbi clbi =
+    let pragmas =
+@@ -78,12 +81,44 @@ generatePathsModule pkg_descr lbi clbi =
+           "import System.Environment (getExecutablePath)\n"
+         | otherwise = ""
+ 
++       dirs = [ (flat_libdir, "LibDir")
++              , (flat_dynlibdir, "DynLibDir")
++              , (flat_datadir, "DataDir")
++              , (flat_libexecdir, "LibexecDir")
++              , (flat_sysconfdir, "SysconfDir") ];
++
++       shouldEmitPath p
++         | (splitPath flat_prefix) `isPrefixOf` (splitPath flat_bindir) = True
++         | (splitPath flat_prefix) `isPrefixOf` (splitPath p) = False
++         | otherwise = True
++
++       shouldEmitDataDir = shouldEmitPath flat_datadir
++
++       nixEmitPathFn (path, name) = let
++         varName = toLower <$> name
++         fnName = "get"++name
++         in if shouldEmitPath path then
++              varName ++ " :: FilePath\n"++
++              varName ++ " = " ++ show path ++
++              "\n" ++ fnName ++ " :: IO FilePath" ++
++              "\n" ++ fnName ++ " = " ++ mkGetEnvOr varName ("return " ++ varName)++"\n"
++            else ""
++
++       absBody = intercalate "\n" $ nixEmitPathFn <$> dirs
++
++       warnPragma = case filter (not . shouldEmitPath . fst) dirs of
++         [] -> ""
++         omittedDirs -> "{-# WARNING \"The functions: "++omittedFns++" Have been omitted by the Nix build system.\" #-}"
++           where omittedFns = intercalate ", " $ map snd omittedDirs
++
++       importList = intercalate ", " $ ("get" ++) . snd <$> filter (shouldEmitPath . fst) dirs
++
+        header =
+         pragmas++
+-        "module " ++ prettyShow paths_modulename ++ " (\n"++
+-        "    version,\n"++
+-        "    getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,\n"++
+-        "    getDataFileName, getSysconfDir\n"++
++        "module " ++ prettyShow paths_modulename ++ " " ++ warnPragma ++ " (\n"++
++        "    version, getBinDir,\n"++
++        (if shouldEmitDataDir then "    getDataFileName, \n" else "\n")++
++        "    " ++ importList ++"\n"++
+         "  ) where\n"++
+         "\n"++
+         foreign_imports++
+@@ -136,26 +171,18 @@ generatePathsModule pkg_descr lbi clbi =
+           "\n"++
+           filename_stuff
+         | absolute =
+-          "\nbindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath\n"++
++          "\nbindir :: FilePath\n"++
+           "\nbindir     = " ++ show flat_bindir ++
+-          "\nlibdir     = " ++ show flat_libdir ++
+-          "\ndynlibdir  = " ++ show flat_dynlibdir ++
+-          "\ndatadir    = " ++ show flat_datadir ++
+-          "\nlibexecdir = " ++ show flat_libexecdir ++
+-          "\nsysconfdir = " ++ show flat_sysconfdir ++
+           "\n"++
+-          "\ngetBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath\n"++
++          "\ngetBinDir :: IO FilePath\n"++
+           "getBinDir = "++mkGetEnvOr "bindir" "return bindir"++"\n"++
+-          "getLibDir = "++mkGetEnvOr "libdir" "return libdir"++"\n"++
+-          "getDynLibDir = "++mkGetEnvOr "dynlibdir" "return dynlibdir"++"\n"++
+-          "getDataDir = "++mkGetEnvOr "datadir" "return datadir"++"\n"++
+-          "getLibexecDir = "++mkGetEnvOr "libexecdir" "return libexecdir"++"\n"++
+-          "getSysconfDir = "++mkGetEnvOr "sysconfdir" "return sysconfdir"++"\n"++
+-          "\n"++
+-          "getDataFileName :: FilePath -> IO FilePath\n"++
+-          "getDataFileName name = do\n"++
+-          "  dir <- getDataDir\n"++
+-          "  return (dir ++ "++path_sep++" ++ name)\n"
++          absBody ++ "\n"++
++          (if shouldEmitDataDir then
++             "getDataFileName :: FilePath -> IO FilePath\n"++
++             "getDataFileName name = do\n"++
++             "  dir <- getDataDir\n"++
++             "  return (dir ++ "++path_sep++" ++ name)\n"
++           else "\n")
+         | otherwise =
+           "\nprefix, bindirrel :: FilePath" ++
+           "\nprefix        = " ++ show flat_prefix ++
diff --git a/nixpkgs/pkgs/development/compilers/ghc/head.nix b/nixpkgs/pkgs/development/compilers/ghc/head.nix
index a76964794015..1c4bf3059d55 100644
--- a/nixpkgs/pkgs/development/compilers/ghc/head.nix
+++ b/nixpkgs/pkgs/development/compilers/ghc/head.nix
@@ -64,7 +64,7 @@
 
 , # Whether to disable the large address space allocator
   # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
-  disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64
+  disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
 }:
 
 assert !enableNativeBignum -> gmp != null;
diff --git a/nixpkgs/pkgs/development/compilers/ghcjs/8.10/stage0.nix b/nixpkgs/pkgs/development/compilers/ghcjs/8.10/stage0.nix
index 1cb476ab0cb6..d173d5a2e557 100644
--- a/nixpkgs/pkgs/development/compilers/ghcjs/8.10/stage0.nix
+++ b/nixpkgs/pkgs/development/compilers/ghcjs/8.10/stage0.nix
@@ -60,7 +60,7 @@
       libraryHaskellDepends = [
         base binary bytestring containers ghc-prim ghci template-haskell
       ];
-      homepage = "http://github.com/ghcjs";
+      homepage = "https://github.com/ghcjs";
       license = lib.licenses.mit;
     }) {};
 
@@ -71,7 +71,7 @@
       version = "0.1.1.0";
       src = ./.;
       libraryHaskellDepends = [ base ghc-prim ];
-      homepage = "http://github.com/ghcjs";
+      homepage = "https://github.com/ghcjs";
       license = lib.licenses.mit;
     }) {};
 }
diff --git a/nixpkgs/pkgs/development/compilers/gleam/default.nix b/nixpkgs/pkgs/development/compilers/gleam/default.nix
index e766683f0228..891751a6ad6b 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.18.2";
+  version = "0.19.0";
 
   src = fetchFromGitHub {
     owner = "gleam-lang";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-uakZmaIkBgC/FTQ7us58pJT6IzpcF1cQxBfehlB3bWk=";
+    sha256 = "sha256-pJ4RSijuwdKAL24WzcDIQen1RGofN1tUlbAA18zUvBE=";
   };
 
   nativeBuildInputs = [ pkg-config ];
@@ -16,7 +16,7 @@ rustPlatform.buildRustPackage rec {
   buildInputs = [ openssl ] ++
     lib.optionals stdenv.isDarwin [ Security libiconv ];
 
-  cargoSha256 = "sha256-NogDrd7YWl/CV0aCd1jfYWYB9VZG7u890VLEktI3sOQ=";
+  cargoSha256 = "sha256-f/6LdvKRykpBX2GlRuyUcSD719f6XzhbMHzhrGNU0Cg=";
 
   meta = with lib; {
     description = "A statically typed language for the Erlang VM";
diff --git a/nixpkgs/pkgs/development/compilers/glslang/default.nix b/nixpkgs/pkgs/development/compilers/glslang/default.nix
index 0cfb2502a0d9..7295db0d9d38 100644
--- a/nixpkgs/pkgs/development/compilers/glslang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/glslang/default.nix
@@ -6,69 +6,34 @@
 , python3
 , spirv-headers
 , spirv-tools
-, argSpirv-tools ? null
-, argSpirv-headers ? null
 }:
-# glslang requires custom versions of spirv-tools and spirb-headers.
-# The exact versions are taken from:
-# https://github.com/KhronosGroup/glslang/blob/${version}/known_good.json
-
-let
-  localSpirv-tools = if argSpirv-tools == null
-    then spirv-tools.overrideAttrs (_: {
-      src = fetchFromGitHub {
-        owner = "KhronosGroup";
-        repo = "SPIRV-Tools";
-        rev = "b27b1afd12d05bf238ac7368bb49de73cd620a8e";
-        sha256 = "0v26ws6qx23jn4dcpsq6rqmdxgyxpl5pcvfm90wb3nz6iqbqx294";
-      };
-    })
-    else argSpirv-tools;
-
-  localSpirv-headers = if argSpirv-headers == null
-    then spirv-headers.overrideAttrs (_: {
-      src = fetchFromGitHub {
-        owner = "KhronosGroup";
-        repo = "SPIRV-Headers";
-        rev = "f027d53ded7e230e008d37c8b47ede7cd308e19d";
-        sha256 = "12gp2mqcar6jj57jw9isfr62yn72kmvdcl0zga4gvrlyfhnf582q";
-      };
-    })
-    else argSpirv-headers;
-in
-
 stdenv.mkDerivation rec {
   pname = "glslang";
-  version = "11.1.0";
+  version = "1.2.198.0";
 
   src = fetchFromGitHub {
     owner = "KhronosGroup";
     repo = "glslang";
-    rev = version;
-    sha256 = "1j81pghy7whyr8ygk7lx6g6qph61rky7fkkc8xp87c7n695a48rw";
+    rev = "sdk-${version}";
+    sha256 = "sha256-FRiqsfoyjUW2kbbphxcy0Hn0TLVaszatM/nnWBrchRY=";
   };
 
   # These get set at all-packages, keep onto them for child drvs
   passthru = {
-    spirv-tools = localSpirv-tools;
-    spirv-headers = localSpirv-headers;
+    spirv-tools = spirv-tools;
+    spirv-headers = spirv-headers;
   };
 
   nativeBuildInputs = [ cmake python3 bison jq ];
 
   postPatch = ''
-    cp --no-preserve=mode -r "${localSpirv-tools.src}" External/spirv-tools
-    ln -s "${localSpirv-headers.src}" External/spirv-tools/external/spirv-headers
+    cp --no-preserve=mode -r "${spirv-tools.src}" External/spirv-tools
+    ln -s "${spirv-headers.src}" External/spirv-tools/external/spirv-headers
   '';
 
-  # Ensure spirv-headers and spirv-tools match exactly to what is expected
-  preConfigure = ''
-    HEADERS_COMMIT=$(jq -r < known_good.json '.commits|map(select(.name=="spirv-tools/external/spirv-headers"))[0].commit')
-    TOOLS_COMMIT=$(jq -r < known_good.json '.commits|map(select(.name=="spirv-tools"))[0].commit')
-    if [ "$HEADERS_COMMIT" != "${localSpirv-headers.src.rev}" ] || [ "$TOOLS_COMMIT" != "${localSpirv-tools.src.rev}" ]; then
-      echo "ERROR: spirv-tools commits do not match expected versions: expected tools at $TOOLS_COMMIT, headers at $HEADERS_COMMIT";
-      exit 1;
-    fi
+  # This is a dirty fix for lib/cmake/SPIRVTargets.cmake:51 which includes this directory
+  postInstall = ''
+    mkdir $out/include/External
   '';
 
   meta = with lib; {
diff --git a/nixpkgs/pkgs/development/compilers/go/1.16.nix b/nixpkgs/pkgs/development/compilers/go/1.16.nix
index 61d24b0ee0ce..46591d2369dc 100644
--- a/nixpkgs/pkgs/development/compilers/go/1.16.nix
+++ b/nixpkgs/pkgs/development/compilers/go/1.16.nix
@@ -54,11 +54,11 @@ in
 
 stdenv.mkDerivation rec {
   pname = "go";
-  version = "1.16.12";
+  version = "1.16.14";
 
   src = fetchurl {
     url = "https://dl.google.com/go/go${version}.src.tar.gz";
-    sha256 = "sha256-Kv2Dnct20rsILFAsAaClzb/An9YwdXg1NjxP3o4vv+g=";
+    sha256 = "sha256-RniYzTohbeVNy5AU9UHv536beacVTbwf0t13iwxj+1Y=";
   };
 
   # perl is used for testing go vet
diff --git a/nixpkgs/pkgs/development/compilers/go/1.17.nix b/nixpkgs/pkgs/development/compilers/go/1.17.nix
index e16e78d21a35..4b2a3d39a982 100644
--- a/nixpkgs/pkgs/development/compilers/go/1.17.nix
+++ b/nixpkgs/pkgs/development/compilers/go/1.17.nix
@@ -54,11 +54,11 @@ in
 
 stdenv.mkDerivation rec {
   pname = "go";
-  version = "1.17.5";
+  version = "1.17.7";
 
   src = fetchurl {
     url = "https://dl.google.com/go/go${version}.src.tar.gz";
-    sha256 = "sha256-Pe+5oJvtBCQDGV6HLcvIxvrhSFljMyJ5Zo7FLoCpWi0=";
+    sha256 = "sha256-wQjNM7c7GRGgK2l3Qd896kPgGlxOCOQJ6LOg43RdK00=";
   };
 
   # perl is used for testing go vet
diff --git a/nixpkgs/pkgs/development/compilers/go/1.15.nix b/nixpkgs/pkgs/development/compilers/go/1.18.nix
index 5cba6be88999..17c310519995 100644
--- a/nixpkgs/pkgs/development/compilers/go/1.15.nix
+++ b/nixpkgs/pkgs/development/compilers/go/1.18.nix
@@ -13,11 +13,11 @@
 , cacert
 , Security
 , Foundation
+, xcbuild
 , mailcap
 , runtimeShell
 , buildPackages
 , pkgsBuildTarget
-, fetchpatch
 , callPackage
 }:
 
@@ -40,8 +40,11 @@ let
     "armv5tel" = "arm";
     "armv6l" = "arm";
     "armv7l" = "arm";
-    "powerpc64le" = "ppc64le";
     "mips" = "mips";
+    "mipsel" = "mipsle";
+    "riscv64" = "riscv64";
+    "s390x" = "s390x";
+    "powerpc64le" = "ppc64le";
   }.${platform.parsed.cpu.name} or (throw "Unsupported system");
 
   # We need a target compiler which is still runnable at build time,
@@ -51,11 +54,11 @@ in
 
 stdenv.mkDerivation rec {
   pname = "go";
-  version = "1.15.15";
+  version = "1.18rc1";
 
   src = fetchurl {
-    url = "https://dl.google.com/go/go${version}.src.tar.gz";
-    sha256 = "sha256-BmKuOBMzAoDV8al6LuI7vb46Wnz6YAGySphzoZoNx+w=";
+    url = "https://go.dev/dl/go${version}.src.tar.gz";
+    sha256 = "sha256-XOx6ZlMAj6hfiCGzNmXeN74om3oC8X829wWojEOYC7g=";
   };
 
   # perl is used for testing go vet
@@ -64,6 +67,8 @@ stdenv.mkDerivation rec {
     ++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ]
     ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
 
+  propagatedBuildInputs = lib.optionals stdenv.isDarwin [ xcbuild ];
+
   depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ];
 
   hardeningDisable = [ "all" ];
@@ -158,27 +163,14 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./remove-tools-1.11.patch
-    ./ssl-cert-file-1.15.patch
+    ./ssl-cert-file-1.16.patch
     ./remove-test-pie-1.15.patch
     ./creds-test.patch
-    ./go-1.9-skip-flaky-19608.patch
-    ./go-1.9-skip-flaky-20072.patch
-    ./skip-external-network-tests-1.15.patch
+    ./skip-chown-tests-1.16.patch
+    ./skip-external-network-tests-1.16.patch
     ./skip-nohup-tests.patch
     ./skip-cgo-tests-1.15.patch
-    ./go_no_vendor_checks.patch
-
-    # support TZ environment variable starting with colon
-    (fetchpatch {
-      name = "tz-support-colon.patch";
-      url = "https://github.com/golang/go/commit/58fe2cd4022c77946ce4b598cf3e30ccc8367143.patch";
-      sha256 = "0vphwiqrm0qykfj3rfayr65qzk22fksg7qkamvaz0lmf6fqvbd2f";
-    })
-  ] ++ [
-    # breaks under load: https://github.com/golang/go/issues/25628
-    (if stdenv.isAarch32
-    then ./skip-test-extra-files-on-aarch32-1.14.patch
-    else ./skip-test-extra-files-on-386-1.14.patch)
+    ./go_no_vendor_checks-1.16.patch
   ];
 
   postPatch = ''
@@ -207,7 +199,7 @@ stdenv.mkDerivation rec {
       null;
 
   GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]);
-  GO386 = 387; # from Arch: don't assume sse2 on i686
+  GO386 = "softfloat"; # from Arch: don't assume sse2 on i686
   CGO_ENABLED = 1;
   # Hopefully avoids test timeouts on Hydra
   GO_TEST_TIMEOUT_SCALE = 3;
@@ -279,6 +271,5 @@ stdenv.mkDerivation rec {
     license = licenses.bsd3;
     maintainers = teams.golang.members;
     platforms = platforms.linux ++ platforms.darwin;
-    badPlatforms = [ "aarch64-darwin" ];
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/go/go_no_vendor_checks.patch b/nixpkgs/pkgs/development/compilers/go/go_no_vendor_checks.patch
deleted file mode 100644
index 45ff4360f0dd..000000000000
--- a/nixpkgs/pkgs/development/compilers/go/go_no_vendor_checks.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Starting from go1.14, go verifes that vendor/modules.txt matches the requirements
-and replacements listed in the main module go.mod file, and it is a hard failure if
-vendor/modules.txt is missing.
-
-Relax module consistency checks and switch back to pre go1.14 behaviour if
-vendor/modules.txt is missing regardless of go version requirement in go.mod.
-
-This has been ported from FreeBSD: https://reviews.freebsd.org/D24122
-See https://github.com/golang/go/issues/37948 for discussion.
-
-diff --git a/src/cmd/go/internal/modload/vendor.go b/src/cmd/go/internal/modload/vendor.go
-index 71f68efbcc..3c566d04dd 100644
---- a/src/cmd/go/internal/modload/vendor.go
-+++ b/src/cmd/go/internal/modload/vendor.go
-@@ -133,7 +133,7 @@ func checkVendorConsistency() {
- 	readVendorList()
-
- 	pre114 := false
--	if modFile.Go == nil || semver.Compare("v"+modFile.Go.Version, "v1.14") < 0 {
-+	if modFile.Go == nil || semver.Compare("v"+modFile.Go.Version, "v1.14") < 0 || (os.Getenv("GO_NO_VENDOR_CHECKS") == "1" && len(vendorMeta) == 0) {
- 		// Go versions before 1.14 did not include enough information in
- 		// vendor/modules.txt to check for consistency.
- 		// If we know that we're on an earlier version, relax the consistency check.
diff --git a/nixpkgs/pkgs/development/compilers/go/skip-chown-tests-1.16.patch b/nixpkgs/pkgs/development/compilers/go/skip-chown-tests-1.16.patch
new file mode 100644
index 000000000000..783446cdf317
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/go/skip-chown-tests-1.16.patch
@@ -0,0 +1,42 @@
+From 9a6718a6355d89b73011fbd1eb1bba8dcfa021e6 Mon Sep 17 00:00:00 2001
+From: regnat <rg@regnat.ovh>
+Date: Wed, 3 Nov 2021 10:17:28 +0100
+Subject: [PATCH] Disable the chown tests
+
+See https://github.com/golang/go/issues/42525 and
+https://github.com/NixOS/nix/issues/3245
+---
+ os/os_unix_test.go | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/os/os_unix_test.go b/os/os_unix_test.go
+index 51693fd..0936542 100644
+--- a/src/os/os_unix_test.go
++++ b/src/os/os_unix_test.go
+@@ -40,6 +40,7 @@ func checkUidGid(t *testing.T, path string, uid, gid int) {
+ }
+ 
+ func TestChown(t *testing.T) {
++        t.Skipf("https://github.com/golang/go/issues/42525")
+ 	// Use TempDir() to make sure we're on a local file system,
+ 	// so that the group ids returned by Getgroups will be allowed
+ 	// on the file. On NFS, the Getgroups groups are
+@@ -83,6 +84,7 @@ func TestChown(t *testing.T) {
+ }
+ 
+ func TestFileChown(t *testing.T) {
++        t.Skipf("https://github.com/golang/go/issues/42525")
+ 	// Use TempDir() to make sure we're on a local file system,
+ 	// so that the group ids returned by Getgroups will be allowed
+ 	// on the file. On NFS, the Getgroups groups are
+@@ -126,6 +128,7 @@ func TestFileChown(t *testing.T) {
+ }
+ 
+ func TestLchown(t *testing.T) {
++        t.Skipf("https://github.com/golang/go/issues/42525")
+ 	// Use TempDir() to make sure we're on a local file system,
+ 	// so that the group ids returned by Getgroups will be allowed
+ 	// on the file. On NFS, the Getgroups groups are
+-- 
+2.31.1
+
diff --git a/nixpkgs/pkgs/development/compilers/go/skip-external-network-tests-1.15.patch b/nixpkgs/pkgs/development/compilers/go/skip-external-network-tests-1.15.patch
deleted file mode 100644
index 0ea1050cd8e3..000000000000
--- a/nixpkgs/pkgs/development/compilers/go/skip-external-network-tests-1.15.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/net/dial_test.go b/src/net/dial_test.go
-index 01582489de..5b5faa5424 100644
---- a/src/net/dial_test.go
-+++ b/src/net/dial_test.go
-@@ -990,6 +990,8 @@ func TestDialerControl(t *testing.T) {
- // except that it won't skip testing on non-mobile builders.
- func mustHaveExternalNetwork(t *testing.T) {
- 	t.Helper()
-+	t.Skipf("Nix sandbox does not have networking")
-+
- 	mobile := runtime.GOOS == "android" || runtime.GOOS == "darwin" && runtime.GOARCH == "arm64"
- 	if testenv.Builder() == "" || mobile {
- 		testenv.MustHaveExternalNetwork(t)
diff --git a/nixpkgs/pkgs/development/compilers/go/ssl-cert-file-1.15.patch b/nixpkgs/pkgs/development/compilers/go/ssl-cert-file-1.15.patch
deleted file mode 100644
index 1884c681ca30..000000000000
--- a/nixpkgs/pkgs/development/compilers/go/ssl-cert-file-1.15.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/src/crypto/x509/root_darwin_amd64.go b/src/crypto/x509/root_darwin_amd64.go
-index ce88de025e..258ecc45d1 100644
---- a/src/crypto/x509/root_darwin_amd64.go
-+++ b/src/crypto/x509/root_darwin_amd64.go
-@@ -10,6 +10,7 @@ import (
- 	"bytes"
- 	macOS "crypto/x509/internal/macos"
- 	"fmt"
-+	"io/ioutil"
- 	"os"
- 	"strings"
- )
-@@ -25,6 +26,14 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
- var loadSystemRootsWithCgo func() (*CertPool, error)
- 
- func loadSystemRoots() (*CertPool, error) {
-+	if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
-+		data, err := ioutil.ReadFile(file)
-+		if err == nil {
-+			roots := NewCertPool()
-+			roots.AppendCertsFromPEM(data)
-+			return roots, nil
-+		}
-+	}
- 	var trustedRoots []*Certificate
- 	untrustedRoots := make(map[string]bool)
- 
-diff --git a/src/crypto/x509/root_darwin_ios.go b/src/crypto/x509/root_darwin_ios.go
-index 5ecc4911b3..14b4205c00 100644
---- a/src/crypto/x509/root_darwin_ios.go
-+++ b/src/crypto/x509/root_darwin_ios.go
-@@ -6,6 +6,11 @@
- 
- package x509
- 
-+import (
-+	"io/ioutil"
-+	"os"
-+)
-+
- func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
- 	return nil, nil
- }
-@@ -14,6 +19,14 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
- var loadSystemRootsWithCgo func() (*CertPool, error)
- 
- func loadSystemRoots() (*CertPool, error) {
-+	if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
-+		data, err := ioutil.ReadFile(file)
-+		if err == nil {
-+			roots := NewCertPool()
-+			roots.AppendCertsFromPEM(data)
-+			return roots, nil
-+		}
-+	}
- 	p := NewCertPool()
- 	p.AppendCertsFromPEM([]byte(systemRootsPEM))
- 	return p, nil
-diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go
-index b48e618a65..195c1ff25a 100644
---- a/src/crypto/x509/root_unix.go
-+++ b/src/crypto/x509/root_unix.go
-@@ -42,6 +42,13 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
- 
- func loadSystemRoots() (*CertPool, error) {
- 	roots := NewCertPool()
-+	if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
-+		data, err := ioutil.ReadFile(file)
-+		if err == nil {
-+			roots.AppendCertsFromPEM(data)
-+			return roots, nil
-+		}
-+	}
- 
- 	files := certFiles
- 	if f := os.Getenv(certFileEnv); f != "" {
diff --git a/nixpkgs/pkgs/development/compilers/graalvm/community-edition/default.nix b/nixpkgs/pkgs/development/compilers/graalvm/community-edition/default.nix
index 9ce6a98e1cd9..f53e9a038963 100644
--- a/nixpkgs/pkgs/development/compilers/graalvm/community-edition/default.nix
+++ b/nixpkgs/pkgs/development/compilers/graalvm/community-edition/default.nix
@@ -9,7 +9,7 @@ in
   inherit mkGraal;
 
   graalvm11-ce = mkGraal rec {
-    version = "21.3.0";
+    version = "22.0.0.2";
     javaVersion = "11";
     platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
   };
@@ -20,7 +20,7 @@ in
   # directory"/tmp/SVM-4194439592488143713"): error=0, Failed to exec spawn
   # helper: pid: 19865, exit value: 1"
   graalvm17-ce = mkGraal rec {
-    version = "21.3.0";
+    version = "22.0.0.2";
     javaVersion = "17";
     platforms = [ "x86_64-linux" "x86_64-darwin" ];
   };
diff --git a/nixpkgs/pkgs/development/compilers/graalvm/community-edition/hashes.nix b/nixpkgs/pkgs/development/compilers/graalvm/community-edition/hashes.nix
index 98f3b2703c4f..f21fdb252708 100644
--- a/nixpkgs/pkgs/development/compilers/graalvm/community-edition/hashes.nix
+++ b/nixpkgs/pkgs/development/compilers/graalvm/community-edition/hashes.nix
@@ -3,55 +3,55 @@
 [
   {
     sha256 = {
-      "11-linux-aarch64" = "0hsjxp6ly7jsn9k94fddcl7afc5gda66jyppcnfvslishbizqd0i";
-      "17-linux-aarch64" = "09hzl80m7f5ppmcvryz9aq0yw9scdkp5dqhblrqnkzyhvdjl5ycn";
-      "11-linux-amd64" = "1ylk5l933z813k0k1xlayiv8fa0f1gmpr66bma51532iy3mch6rs";
-      "17-linux-amd64" = "1xn3shwkai61vvzsg595k8776a21ds00w2pjlscvfcbs1ag07n0i";
-      "11-darwin-amd64" = "0qpqnnmqxvxzj3mwz05acpg4n8ffqsz0sji8lbl03fgswpvgfavc";
-      "17-darwin-amd64" = "1akpsrd9r2igcls0cvhpqw3jrnh59m8z80knx83lmj0cj836a8v0";
+      "11-linux-aarch64" = "0n1cgd9rn5aw7rzbd45nlzpnqif095zwl3999vddlhpnjlyjdh0w";
+      "17-linux-aarch64" = "1iw27igiyzzl43yfgid1h6h7hd0xnv0rfdkp4r7r8i51sa3q7my7";
+      "11-linux-amd64" = "00vipkrhc7d5xxznm07pjrdjahhfg5s5vxg49xz8qxz2nwxhi1mw";
+      "17-linux-amd64" = "1m4v2s1b2878r6dqpcxvbqpc3s2l8l0xcbna37bbfx6rsc73wx2g";
+      "11-darwin-amd64" = "08v37avg439hywx2yqx0bnfpazwaja2xhyc0kj1imib6iadib042";
+      "17-darwin-amd64" = "16lg3qfx7j8w8cxc3abl7c19nj6jhkni99wmff153lyhyk8zjjnm";
     }.${javaVersionPlatform} or null;
-    url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/graalvm-ce-java${javaVersionPlatform}-21.3.0.tar.gz";
+    url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java${javaVersionPlatform}-22.0.0.2.tar.gz";
   }
   {
     sha256 = {
-      "11-linux-aarch64" = "0qlmg5fwvqsb5ab3irj2hrcd5jc94mibnlz1gvzpnq85rw1zcb6h";
-      "17-linux-aarch64" = "0jmarhwngs6vpbcgsix0dxhj42qj9vnk3vln8fhdxmydwnns8r1m";
-      "11-linux-amd64" = "0kvnjr55rizy53vn0ff9w27z1qh9d1vp3s7r1kdl0wyhrbhd8n49";
-      "17-linux-amd64" = "0h14sml42jda54agjs1prfnyjaxxsc67350fr51n8p20nl28lj6z";
-      "11-darwin-amd64" = "1mg8c8hh8wmbwsisgarmp35jd0dall1fwdv49mggp74hicbc32h3";
-      "17-darwin-amd64" = "0qz0xf2ph9gi45vvri7vphxh35m11nk7sa8nkwxl28l8bza0kb40";
+      "11-linux-aarch64" = "17h0yfw0lxsiblqv1nzpc6i71vh6hbwf1x6lp7kziass1a4ixm2i";
+      "17-linux-aarch64" = "1nvm04smzbis1jy9znac2a4yf9ajqvvmadcf5ffr521rm784g2br";
+      "11-linux-amd64" = "07g7fab0zj1h77a30kiswqm0hvr1m5s6crszcbyvha2v3x2a6145";
+      "17-linux-amd64" = "0c8qi7b63zkjrz3sz01bbmfni7pcz9nq1jv1f34lj9lcsm8gc9cc";
+      "11-darwin-amd64" = "0xn1frj1f4pzrd5gm6xwq31blgvz8l9249c97q3yh7p6rkk7vhh3";
+      "17-darwin-amd64" = "1dr80314fxcklmhi19jn3pqrsz3iivbvcxnphdzl978krm1afzq0";
     }.${javaVersionPlatform} or null;
-    url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/native-image-installable-svm-java${javaVersionPlatform}-21.3.0.jar";
+    url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/native-image-installable-svm-java${javaVersionPlatform}-22.0.0.2.jar";
   }
   {
     sha256 = {
-      "11-linux-aarch64" = "02rvwl1nng8d3qn226rjx5yq2blxs4yz009ab928qanhmb4vhv8b";
-      "17-linux-aarch64" = "13kaxbgfp9pm6s28i5hfyg957iiwzrxf0ibibkv2yndgj64vj8xg";
-      "11-linux-amd64" = "0zz62zr7imjaw9a3j5m66xs7c72cqb1i74ab3rnlh0dgs1mdpljg";
-      "17-linux-amd64" = "1v2iwznlav8dsjj30nlhvsvv7pxmyzkhkp1p7spjjma09d34q4iv";
-      "11-darwin-amd64" = "1wiv0299b2xrc229alczmjfj1bsn90p0wdm64rr39xnyyhbqrr80";
-      "17-darwin-amd64" = "095sii8ibjcvvc6wnxk77ax151c4zgj8bpp81q3kyaazgpzvrk5s";
+      "11-linux-aarch64" = "103d91sz2dmlc5hcbi9v3d3irgb83755hz16vkknfhbbkhm5iyz0";
+      "17-linux-aarch64" = "0vas98knpvpajmv8bkgcf0fh7n5fy361nd47002cpppg6hrp7k9q";
+      "11-linux-amd64" = "0h4s1dgx2wn63pabdckl85s70s1kw97vp0c8z7izihdn2fy7w3z9";
+      "17-linux-amd64" = "1g98ashyvscwyn1k8mamih6qhcbxsk62x6ynd7x81ndy1karlv6q";
+      "11-darwin-amd64" = "1y8d6c2ri7hrvsv3aqbcp49pmxh9yppcsfnx0jcwm88wlach0p52";
+      "17-darwin-amd64" = "13a6rchnaczpmxga6g405z55913ayq5gwihzlvyy6shk6gwbcppw";
     }.${javaVersionPlatform} or null;
-    url = "https://github.com/oracle/truffleruby/releases/download/vm-21.3.0/ruby-installable-svm-java${javaVersionPlatform}-21.3.0.jar";
+    url = "https://github.com/oracle/truffleruby/releases/download/vm-22.0.0.2/ruby-installable-svm-java${javaVersionPlatform}-22.0.0.2.jar";
   }
   {
     sha256 = {
-      "11-linux-aarch64" = "1ck4c1z98h1zn4i6xhh1hb6w2jab6n17ddykb72xxw4vig9nhlc7";
-      "17-linux-aarch64" = "0p9gx5iq730br9wvacxs4403anxnjln6mx8v0dl4w4lhikjxsy8x";
-      "11-linux-amd64" = "0gy8jj9d9msmj0i44sysiwq3j2k2w2g47fhq6y1aq47n3kmwj9kv";
-      "17-linux-amd64" = "0qk8rgbmnk84isnb33x5bbh17bnnmq9yqasfgy5p953min6pbxj7";
-      "11-darwin-amd64" = "0agw6k3jn2jh8wyc9h8rvzlgs96qh4nlj0y8nyzsmidvwq2ahl00";
-      "17-darwin-amd64" = "0l1il0rq48sw6sha9jr0xphjgrm7q0kywy8z94mabm9maqh7l3rn";
+      "11-linux-aarch64" = "135zkpqm8z5nzcyn5h6vdx3c09f9wb6jgzmp0llcnx8w76p71154";
+      "17-linux-aarch64" = "0pij3kh70lxrzmbzx8zw97f9nb0rr492l7x3n13wcr859cr8akas";
+      "11-linux-amd64" = "0ppvsgs216jmm5p8m34lqg2kv0awadh1dlkxb7qzcw2b6x0grzf0";
+      "17-linux-amd64" = "1gf0jfmqy8lp6w7bimjp0j5abzmi0ndsn4hcjvfv7123lbj52zkz";
+      "11-darwin-amd64" = "1mq6013crjmrpf3yvxwv9p4yn0rcdzg5z9hq9l6fpf47i8522k6p";
+      "17-darwin-amd64" = "15l7p48vsca4cvqxbpb9lcmafysmdsxpv6avrpxajz705j3nsvmp";
     }.${javaVersionPlatform} or null;
-    url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/wasm-installable-svm-java${javaVersionPlatform}-21.3.0.jar";
+    url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/wasm-installable-svm-java${javaVersionPlatform}-22.0.0.2.jar";
   }
   {
     sha256 = {
-      "11-linux-amd64" = "1l5av2v459q88zfl83877h7b3426z3d86kp6wqjvz2441brvidi0";
-      "17-linux-amd64" = "100p1cgw0z4yfy4axb3gr32m8jnyx1f8bj6f6kk0mf3l8fv2kb7p";
-      "11-darwin-amd64" = "06694n74dzsfwlli1sjdsrfbj9ngw7bhrcayvy4sgy2va5qpdjs0";
-      "17-darwin-amd64" = "1qwg45q0760lsa62h0nk2zdv0r1npr82bh6p1z3md6pjppm7i025";
+      "11-linux-amd64" = "0m8cqqqdks34b2zv7i6qw9kzqxi1rfqsmknqa9wm0b7dqaxx209g";
+      "17-linux-amd64" = "12nszxp2yv35y8zkm94bnd0mnanah48y41r61ypymd19plaqmdxk";
+      "11-darwin-amd64" = "00g6akpv0gkw8gcxfbgcyipn6gj25yr32k1lb7iqj08bq4f2zvk7";
+      "17-darwin-amd64" = "1hd71qg0nmklyakl4cc29vl10fxalbyd2b5yn7x9iv6m0h1pp25g";
     }.${javaVersionPlatform} or null;
-    url = "https://github.com/graalvm/graalpython/releases/download/vm-21.3.0/python-installable-svm-java${javaVersionPlatform}-21.3.0.jar";
+    url = "https://github.com/graalvm/graalpython/releases/download/vm-22.0.0.2/python-installable-svm-java${javaVersionPlatform}-22.0.0.2.jar";
   }
 ]
diff --git a/nixpkgs/pkgs/development/compilers/hip/default.nix b/nixpkgs/pkgs/development/compilers/hip/default.nix
index 68c6ea39cf7e..5a7e9dd5a529 100644
--- a/nixpkgs/pkgs/development/compilers/hip/default.nix
+++ b/nixpkgs/pkgs/development/compilers/hip/default.nix
@@ -16,7 +16,7 @@
 , makeWrapper
 , numactl
 , perl
-, python
+, python3
 , rocclr
 , rocm-comgr
 , rocm-device-libs
@@ -56,7 +56,7 @@ let
       substituteInPlace bin/hip_embed_pch.sh \
         --replace '$LLVM_DIR/bin/' ""
 
-      sed 's,#!/usr/bin/python,#!${python}/bin/python,' -i hip_prof_gen.py
+      sed 's,#!/usr/bin/python,#!${python3.interpreter},' -i hip_prof_gen.py
 
       sed -e 's,$ROCM_AGENT_ENUM = "''${ROCM_PATH}/bin/rocm_agent_enumerator";,$ROCM_AGENT_ENUM = "${rocminfo}/bin/rocm_agent_enumerator";,' \
           -e 's,^\($DEVICE_LIB_PATH=\).*$,\1"${rocm-device-libs}/amdgcn/bitcode";,' \
@@ -111,7 +111,7 @@ stdenv.mkDerivation rec {
     sha256 = "WvOuQu/EN81Kwcoc3ZtGlhb996edQJ3OWFsmPuqeNXE=";
   };
 
-  nativeBuildInputs = [ cmake python makeWrapper perl ];
+  nativeBuildInputs = [ cmake python3 makeWrapper perl ];
   buildInputs = [ libxml2 numactl libglvnd libX11 ];
   propagatedBuildInputs = [
     clang
diff --git a/nixpkgs/pkgs/development/compilers/idris2/default.nix b/nixpkgs/pkgs/development/compilers/idris2/default.nix
index 4bf8f7e4af6c..9c7a9e53a2e6 100644
--- a/nixpkgs/pkgs/development/compilers/idris2/default.nix
+++ b/nixpkgs/pkgs/development/compilers/idris2/default.nix
@@ -1,18 +1,27 @@
-{ lib
-, stdenv
-, fetchFromGitHub
-, makeWrapper
-, clang
+# Almost 1:1 copy of idris2's nix/platform.nix. Some work done in their flake.nix
+# we do here instead.
+{ stdenv
+, lib
 , chez
+, chez-racket
+, clang
 , gmp
+, fetchFromGitHub
+, makeWrapper
+, gambit
+, nodejs
 , zsh
 , callPackage
 }:
 
 # NOTICE: An `idris2WithPackages` is available at: https://github.com/claymager/idris2-pkgs
 
+let
+  # Taken from Idris2/idris2/flake.nix. Check if the idris2 project does it this
+  # way, still, every now and then.
+  platformChez = if stdenv.system == "x86_64-linux" then chez else chez-racket;
 # Uses scheme to bootstrap the build of idris2
-stdenv.mkDerivation rec {
+in stdenv.mkDerivation rec {
   pname = "idris2";
   version = "0.5.1";
 
@@ -23,14 +32,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-6CTn8o5geWSesXO7vTrrV/2EOQ3f+nPQ2M5cem13ZSY=";
   };
 
-  # We do not add any propagatedNativeBuildInputs because we do not want the
-  # executables idris2 produces to depend on the nix-store. As such, it is left
-  # to the user to guarantee chez (or any other codgen dependency) is available
-  # in the path during compilation of programs with idris2.
   strictDeps = true;
-  nativeBuildInputs = [ makeWrapper clang chez ]
+  nativeBuildInputs = [ makeWrapper clang platformChez ]
     ++ lib.optional stdenv.isDarwin [ zsh ];
-  buildInputs = [ gmp ];
+  buildInputs = [ platformChez gmp ];
 
   prePatch = ''
     patchShebangs --build tests
@@ -43,44 +48,40 @@ stdenv.mkDerivation rec {
   buildFlags = [ "bootstrap" "SCHEME=scheme" ];
 
   checkTarget = "test";
+  checkInputs = [ gambit nodejs ]; # racket ];
+  checkFlags = [ "INTERACTIVE=" ];
 
   # TODO: Move this into its own derivation, such that this can be changed
   #       without having to recompile idris2 every time.
   postInstall = let
-    includedLibs = [ "base" "contrib" "network" "prelude" ];
     name = "${pname}-${version}";
-    packagePaths =
-      builtins.map (l: "$out/${name}/${l}-${version}") includedLibs;
-    additionalIdris2Paths = builtins.concatStringsSep ":" packagePaths;
+    globalLibraries = [
+      "\\$HOME/.nix-profile/lib/${name}"
+      "/run/current-system/sw/lib/${name}"
+      "$out/${name}"
+    ];
+    globalLibrariesPath = builtins.concatStringsSep ":" globalLibraries;
   in ''
     # Remove existing idris2 wrapper that sets incorrect LD_LIBRARY_PATH
     rm $out/bin/idris2
-    # Move actual idris2 binary
+    # The only thing we need from idris2_app is the actual binary
     mv $out/bin/idris2_app/idris2.so $out/bin/idris2
-
-    # After moving the binary, there is nothing left in idris2_app that isn't
-    # either contained in lib/ or is useless to us.
     rm $out/bin/idris2_app/*
     rmdir $out/bin/idris2_app
-
     # idris2 needs to find scheme at runtime to compile
-    # idris2 installs packages with --install into the path given by PREFIX.
-    # Since PREFIX is in nix-store, it is immutable so --install does not work.
-    # If the user redefines PREFIX to be able to install packages, idris2 will
-    # not find the libraries and packages since all paths are relative to
-    # PREFIX by default.
-    # We explicitly make all paths to point to nix-store, such that they are
-    # independent of what IDRIS2_PREFIX is. This allows the user to redefine
-    # IDRIS2_PREFIX and use --install as expected.
+    # idris2 installs packages with --install into the path given by
+    #   IDRIS2_PREFIX. We set that to a default of ~/.idris2, to mirror the
+    #   behaviour of the standard Makefile install.
     # TODO: Make support libraries their own derivation such that
     #       overriding LD_LIBRARY_PATH is unnecessary
-    # TODO: Maybe set IDRIS2_PREFIX to the users home directory
     wrapProgram "$out/bin/idris2" \
-      --set-default CHEZ "${chez}/bin/scheme" \
+      --set-default CHEZ "${platformChez}/bin/scheme" \
+      --run 'export IDRIS2_PREFIX=''${IDRIS2_PREFIX-"$HOME/.idris2"}' \
       --suffix IDRIS2_LIBS ':' "$out/${name}/lib" \
       --suffix IDRIS2_DATA ':' "$out/${name}/support" \
-      --suffix IDRIS2_PATH ':' "${additionalIdris2Paths}" \
-      --suffix ${if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"} ':' "$out/${name}/lib"
+      --suffix IDRIS2_PACKAGE_PATH ':' "${globalLibrariesPath}" \
+      --suffix DYLD_LIBRARY_PATH ':' "$out/${name}/lib" \
+      --suffix LD_LIBRARY_PATH ':' "$out/${name}/lib"
   '';
 
   # Run package tests
diff --git a/nixpkgs/pkgs/development/compilers/idris2/tests.nix b/nixpkgs/pkgs/development/compilers/idris2/tests.nix
index 1e84ca6b77aa..a8d48c26ca6f 100644
--- a/nixpkgs/pkgs/development/compilers/idris2/tests.nix
+++ b/nixpkgs/pkgs/development/compilers/idris2/tests.nix
@@ -50,6 +50,7 @@ in {
   # Data.Vect.Sort is available via --package contrib
   use-contrib = testCompileAndRun {
     testName = "use-contrib";
+    packages = [ "contrib" ];
     code = ''
       module Main
 
diff --git a/nixpkgs/pkgs/development/compilers/inklecate/default.nix b/nixpkgs/pkgs/development/compilers/inklecate/default.nix
index 6ed01d9bbcf6..32b91f5ddfec 100644
--- a/nixpkgs/pkgs/development/compilers/inklecate/default.nix
+++ b/nixpkgs/pkgs/development/compilers/inklecate/default.nix
@@ -1,54 +1,43 @@
-{ lib, stdenv, fetchurl, unzip, makeWrapper }:
-
-stdenv.mkDerivation rec {
+{ lib
+, stdenv
+, autoPatchelfHook
+, buildDotnetModule
+, dotnetCorePackages
+, fetchFromGitHub
+}:
+
+buildDotnetModule rec {
   pname = "inklecate";
   version = "1.0.0";
 
-  src =
-    if stdenv.isLinux then
-      fetchurl {
-        url    = "https://github.com/inkle/ink/releases/download/v${version}/inklecate_linux.zip";
-        sha256 = "6e17db766222998ba0ae5a5da9857e34896e683b9ec42fad528c3f8bea7398ea";
-        name   = "${pname}-${version}";
-      }
-    else if stdenv.isDarwin then
-      fetchurl {
-        url    = "https://github.com/inkle/ink/releases/download/v${version}/inklecate_mac.zip";
-        sha256 = "b6f4dd1f95c180637ce193dbb5fa6d59aeafe49a2121a05b7822e6cbbaa6931f";
-        name   = "${pname}-${version}";
-      }
-    else throw "Not supported on ${stdenv.hostPlatform.system}.";
-
-  # Work around the "unpacker appears to have produced no directories"
-  # case that happens when the archive doesn't have a subdirectory.
-  setSourceRoot = "sourceRoot=$(pwd)";
-
-  nativeBuildInputs = [ unzip makeWrapper ];
-
-  unpackPhase = ''
-    unzip -qq -j $src -d $pname-$version
-
-    rm $pname-$version/ink-engine-runtime.dll
-    rm $pname-$version/ink_compiler.dll
-  '';
+  src = fetchFromGitHub {
+    owner = "inkle";
+    repo = "ink";
+    rev = "v${version}";
+    sha256 = "00lagmwsbxap5mgnw4gndpavmv3xsgincdaq1zvw7fkc3vn3pxqc";
+  };
 
-  installPhase = ''
-    mkdir -p $out/bin/
+  nativeBuildInputs = [ autoPatchelfHook ];
+  buildInputs = [ stdenv.cc.cc.lib ];
 
-    cp $pname-$version/inklecate $out/bin/inklecate
-  '';
+  projectFile = "inklecate/inklecate.csproj";
+  nugetDeps = if stdenv.isDarwin then ./deps-darwin.nix else ./deps-linux.nix;
+  executables = [ "inklecate" ];
 
+  dotnet-runtime = dotnetCorePackages.runtime_3_1;
+  dotnet-sdk = dotnetCorePackages.sdk_6_0;
 
   meta = with lib; {
-    description     = "Compiler for ink, inkle's scripting language";
+    description = "Compiler for ink, inkle's scripting language";
     longDescription = ''
       Inklecate is a command-line compiler for ink, inkle's open source
       scripting language for writing interactive narrative
-      '';
-    homepage        = "https://www.inklestudios.com/ink/";
-    downloadPage    = "https://github.com/inkle/ink/releases";
-    license         = licenses.mit;
-    platforms       = platforms.unix;
-    maintainers     = with maintainers; [ shreerammodi ];
+    '';
+    homepage = "https://www.inklestudios.com/ink/";
+    downloadPage = "https://github.com/inkle/ink/";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    badPlatforms = platforms.aarch64;
+    maintainers = with maintainers; [ shreerammodi ];
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/inklecate/deps-darwin.nix b/nixpkgs/pkgs/development/compilers/inklecate/deps-darwin.nix
new file mode 100644
index 000000000000..b8aaefebc5b5
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/inklecate/deps-darwin.nix
@@ -0,0 +1,31 @@
+{ fetchNuGet }: [
+  (fetchNuGet { pname = "Microsoft.AspNetCore.App.Ref"; version = "3.1.10"; sha256 = "0xn4zh7shvijqlr03fqsmps6gz856isd9bg9rk4z2c4599ggal77"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.App.Host.osx-x64"; version = "3.1.21"; sha256 = "1s5g9gk0hvs268q2zpc32m0my2m2ivlmsmza86797a9vkxr6pzw6"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.App.Ref"; version = "3.1.0"; sha256 = "08svsiilx9spvjamcnjswv0dlpdrgryhr3asdz7cvnl914gjzq4y"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.1.0"; sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.Targets"; version = "1.1.0"; sha256 = "193xwf33fbm0ni3idxzbr5fdq3i2dlfgihsac9jj7whj0gd902nh"; })
+  (fetchNuGet { pname = "NETStandard.Library"; version = "1.6.1"; sha256 = "1z70wvsx2d847a2cjfii7b83pjfs34q05gb037fdjikv5kbagml8"; })
+  (fetchNuGet { pname = "NETStandard.Library"; version = "2.0.3"; sha256 = "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y"; })
+  (fetchNuGet { pname = "System.Collections"; version = "4.3.0"; sha256 = "19r4y64dqyrq6k4706dnyhhw7fs24kpp3awak7whzss39dakpxk9"; })
+  (fetchNuGet { pname = "System.Diagnostics.Debug"; version = "4.3.0"; sha256 = "00yjlf19wjydyr6cfviaph3vsjzg3d5nvnya26i2fvfg53sknh3y"; })
+  (fetchNuGet { pname = "System.Diagnostics.Tools"; version = "4.3.0"; sha256 = "0in3pic3s2ddyibi8cvgl102zmvp9r9mchh82ns9f0ms4basylw1"; })
+  (fetchNuGet { pname = "System.Globalization"; version = "4.3.0"; sha256 = "1cp68vv683n6ic2zqh2s1fn4c2sd87g5hpp6l4d4nj4536jz98ki"; })
+  (fetchNuGet { pname = "System.IO"; version = "4.3.0"; sha256 = "05l9qdrzhm4s5dixmx68kxwif4l99ll5gqmh7rqgw554fx0agv5f"; })
+  (fetchNuGet { pname = "System.Linq.Expressions"; version = "4.3.0"; sha256 = "0ky2nrcvh70rqq88m9a5yqabsl4fyd17bpr63iy2mbivjs2nyypv"; })
+  (fetchNuGet { pname = "System.Linq"; version = "4.3.0"; sha256 = "1w0gmba695rbr80l1k2h4mrwzbzsyfl2z4klmpbsvsg5pm4a56s7"; })
+  (fetchNuGet { pname = "System.Net.Primitives"; version = "4.3.0"; sha256 = "0c87k50rmdgmxx7df2khd9qj7q35j9rzdmm2572cc55dygmdk3ii"; })
+  (fetchNuGet { pname = "System.ObjectModel"; version = "4.3.0"; sha256 = "191p63zy5rpqx7dnrb3h7prvgixmk168fhvvkkvhlazncf8r3nc2"; })
+  (fetchNuGet { pname = "System.Reflection.Extensions"; version = "4.3.0"; sha256 = "02bly8bdc98gs22lqsfx9xicblszr2yan7v2mmw3g7hy6miq5hwq"; })
+  (fetchNuGet { pname = "System.Reflection.Primitives"; version = "4.3.0"; sha256 = "04xqa33bld78yv5r93a8n76shvc8wwcdgr1qvvjh959g3rc31276"; })
+  (fetchNuGet { pname = "System.Reflection"; version = "4.3.0"; sha256 = "0xl55k0mw8cd8ra6dxzh974nxif58s3k1rjv1vbd7gjbjr39j11m"; })
+  (fetchNuGet { pname = "System.Resources.ResourceManager"; version = "4.3.0"; sha256 = "0sjqlzsryb0mg4y4xzf35xi523s4is4hz9q4qgdvlvgivl7qxn49"; })
+  (fetchNuGet { pname = "System.Runtime.Extensions"; version = "4.3.0"; sha256 = "1ykp3dnhwvm48nap8q23893hagf665k0kn3cbgsqpwzbijdcgc60"; })
+  (fetchNuGet { pname = "System.Runtime"; version = "4.3.0"; sha256 = "066ixvgbf2c929kgknshcxqj6539ax7b9m570cp8n179cpfkapz7"; })
+  (fetchNuGet { pname = "System.Text.Encoding.Extensions"; version = "4.3.0"; sha256 = "11q1y8hh5hrp5a3kw25cb6l00v5l5dvirkz8jr3sq00h1xgcgrxy"; })
+  (fetchNuGet { pname = "System.Text.Encoding"; version = "4.3.0"; sha256 = "1f04lkir4iladpp51sdgmis9dj4y8v08cka0mbmsy0frc9a4gjqr"; })
+  (fetchNuGet { pname = "System.Text.RegularExpressions"; version = "4.3.0"; sha256 = "1bgq51k7fwld0njylfn7qc5fmwrk2137gdq7djqdsw347paa9c2l"; })
+  (fetchNuGet { pname = "System.Threading.Tasks"; version = "4.3.0"; sha256 = "134z3v9abw3a6jsw17xl3f6hqjpak5l682k2vz39spj4kmydg6k7"; })
+  (fetchNuGet { pname = "System.Threading"; version = "4.3.0"; sha256 = "0rw9wfamvhayp5zh3j7p1yfmx9b5khbf4q50d8k5rk993rskfd34"; })
+  (fetchNuGet { pname = "System.Xml.ReaderWriter"; version = "4.3.0"; sha256 = "0c47yllxifzmh8gq6rq6l36zzvw4kjvlszkqa9wq3fr59n0hl3s1"; })
+  (fetchNuGet { pname = "System.Xml.XDocument"; version = "4.3.0"; sha256 = "08h8fm4l77n0nd4i4fk2386y809bfbwqb7ih9d7564ifcxr5ssxd"; })
+]
diff --git a/nixpkgs/pkgs/development/compilers/inklecate/deps-linux.nix b/nixpkgs/pkgs/development/compilers/inklecate/deps-linux.nix
new file mode 100644
index 000000000000..8f26b91eeacc
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/inklecate/deps-linux.nix
@@ -0,0 +1,31 @@
+{ fetchNuGet }: [
+  (fetchNuGet { pname = "Microsoft.AspNetCore.App.Ref"; version = "3.1.10"; sha256 = "0xn4zh7shvijqlr03fqsmps6gz856isd9bg9rk4z2c4599ggal77"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.App.Host.linux-x64"; version = "3.1.21"; sha256 = "01kbhi29lhv6mg1zfsyakz3z8hfbxnc0kxy0fczl8xqviik9svx7"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.App.Ref"; version = "3.1.0"; sha256 = "08svsiilx9spvjamcnjswv0dlpdrgryhr3asdz7cvnl914gjzq4y"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.1.0"; sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm"; })
+  (fetchNuGet { pname = "Microsoft.NETCore.Targets"; version = "1.1.0"; sha256 = "193xwf33fbm0ni3idxzbr5fdq3i2dlfgihsac9jj7whj0gd902nh"; })
+  (fetchNuGet { pname = "NETStandard.Library"; version = "1.6.1"; sha256 = "1z70wvsx2d847a2cjfii7b83pjfs34q05gb037fdjikv5kbagml8"; })
+  (fetchNuGet { pname = "NETStandard.Library"; version = "2.0.3"; sha256 = "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y"; })
+  (fetchNuGet { pname = "System.Collections"; version = "4.3.0"; sha256 = "19r4y64dqyrq6k4706dnyhhw7fs24kpp3awak7whzss39dakpxk9"; })
+  (fetchNuGet { pname = "System.Diagnostics.Debug"; version = "4.3.0"; sha256 = "00yjlf19wjydyr6cfviaph3vsjzg3d5nvnya26i2fvfg53sknh3y"; })
+  (fetchNuGet { pname = "System.Diagnostics.Tools"; version = "4.3.0"; sha256 = "0in3pic3s2ddyibi8cvgl102zmvp9r9mchh82ns9f0ms4basylw1"; })
+  (fetchNuGet { pname = "System.Globalization"; version = "4.3.0"; sha256 = "1cp68vv683n6ic2zqh2s1fn4c2sd87g5hpp6l4d4nj4536jz98ki"; })
+  (fetchNuGet { pname = "System.IO"; version = "4.3.0"; sha256 = "05l9qdrzhm4s5dixmx68kxwif4l99ll5gqmh7rqgw554fx0agv5f"; })
+  (fetchNuGet { pname = "System.Linq"; version = "4.3.0"; sha256 = "1w0gmba695rbr80l1k2h4mrwzbzsyfl2z4klmpbsvsg5pm4a56s7"; })
+  (fetchNuGet { pname = "System.Linq.Expressions"; version = "4.3.0"; sha256 = "0ky2nrcvh70rqq88m9a5yqabsl4fyd17bpr63iy2mbivjs2nyypv"; })
+  (fetchNuGet { pname = "System.Net.Primitives"; version = "4.3.0"; sha256 = "0c87k50rmdgmxx7df2khd9qj7q35j9rzdmm2572cc55dygmdk3ii"; })
+  (fetchNuGet { pname = "System.ObjectModel"; version = "4.3.0"; sha256 = "191p63zy5rpqx7dnrb3h7prvgixmk168fhvvkkvhlazncf8r3nc2"; })
+  (fetchNuGet { pname = "System.Reflection"; version = "4.3.0"; sha256 = "0xl55k0mw8cd8ra6dxzh974nxif58s3k1rjv1vbd7gjbjr39j11m"; })
+  (fetchNuGet { pname = "System.Reflection.Extensions"; version = "4.3.0"; sha256 = "02bly8bdc98gs22lqsfx9xicblszr2yan7v2mmw3g7hy6miq5hwq"; })
+  (fetchNuGet { pname = "System.Reflection.Primitives"; version = "4.3.0"; sha256 = "04xqa33bld78yv5r93a8n76shvc8wwcdgr1qvvjh959g3rc31276"; })
+  (fetchNuGet { pname = "System.Resources.ResourceManager"; version = "4.3.0"; sha256 = "0sjqlzsryb0mg4y4xzf35xi523s4is4hz9q4qgdvlvgivl7qxn49"; })
+  (fetchNuGet { pname = "System.Runtime"; version = "4.3.0"; sha256 = "066ixvgbf2c929kgknshcxqj6539ax7b9m570cp8n179cpfkapz7"; })
+  (fetchNuGet { pname = "System.Runtime.Extensions"; version = "4.3.0"; sha256 = "1ykp3dnhwvm48nap8q23893hagf665k0kn3cbgsqpwzbijdcgc60"; })
+  (fetchNuGet { pname = "System.Text.Encoding"; version = "4.3.0"; sha256 = "1f04lkir4iladpp51sdgmis9dj4y8v08cka0mbmsy0frc9a4gjqr"; })
+  (fetchNuGet { pname = "System.Text.Encoding.Extensions"; version = "4.3.0"; sha256 = "11q1y8hh5hrp5a3kw25cb6l00v5l5dvirkz8jr3sq00h1xgcgrxy"; })
+  (fetchNuGet { pname = "System.Text.RegularExpressions"; version = "4.3.0"; sha256 = "1bgq51k7fwld0njylfn7qc5fmwrk2137gdq7djqdsw347paa9c2l"; })
+  (fetchNuGet { pname = "System.Threading"; version = "4.3.0"; sha256 = "0rw9wfamvhayp5zh3j7p1yfmx9b5khbf4q50d8k5rk993rskfd34"; })
+  (fetchNuGet { pname = "System.Threading.Tasks"; version = "4.3.0"; sha256 = "134z3v9abw3a6jsw17xl3f6hqjpak5l682k2vz39spj4kmydg6k7"; })
+  (fetchNuGet { pname = "System.Xml.ReaderWriter"; version = "4.3.0"; sha256 = "0c47yllxifzmh8gq6rq6l36zzvw4kjvlszkqa9wq3fr59n0hl3s1"; })
+  (fetchNuGet { pname = "System.Xml.XDocument"; version = "4.3.0"; sha256 = "08h8fm4l77n0nd4i4fk2386y809bfbwqb7ih9d7564ifcxr5ssxd"; })
+]
diff --git a/nixpkgs/pkgs/development/compilers/intel-graphics-compiler/default.nix b/nixpkgs/pkgs/development/compilers/intel-graphics-compiler/default.nix
index 85332a946450..176affd047c9 100644
--- a/nixpkgs/pkgs/development/compilers/intel-graphics-compiler/default.nix
+++ b/nixpkgs/pkgs/development/compilers/intel-graphics-compiler/default.nix
@@ -77,5 +77,6 @@ stdenv.mkDerivation rec {
     license = licenses.mit;
     platforms = platforms.all;
     maintainers = with maintainers; [ gloaming ];
+    broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/intel-graphics-compiler.x86_64-darwin
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix b/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix
index e36dedf3c875..bfff07aabcb2 100644
--- a/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix
+++ b/nixpkgs/pkgs/development/compilers/jetbrains-jdk/default.nix
@@ -2,12 +2,13 @@
 
 openjdk11.overrideAttrs (oldAttrs: rec {
   pname = "jetbrains-jdk";
-  version = "11_0_11-b1504.13";
+  version = "11_0_13-b1751.25";
+
   src = fetchFromGitHub {
     owner = "JetBrains";
     repo = "JetBrainsRuntime";
     rev = "jb${version}";
-    sha256 = "1xpgsgmmj5jp5qyw98hqmik6a7z3hfwmij023ij3qqymyj3nhm2i";
+    sha256 = "sha256-TPNYZUkAoiZfp7Ci3fslKnRNGY1lnyIhXYUt6J31lwI=";
   };
   patches = [];
   meta = with lib; {
diff --git a/nixpkgs/pkgs/development/compilers/jrsonnet/default.nix b/nixpkgs/pkgs/development/compilers/jrsonnet/default.nix
index 5f99fb10cee2..696f7acb3311 100644
--- a/nixpkgs/pkgs/development/compilers/jrsonnet/default.nix
+++ b/nixpkgs/pkgs/development/compilers/jrsonnet/default.nix
@@ -31,5 +31,6 @@ rustPlatform.buildRustPackage rec {
     maintainers = with lib.maintainers; [ lach ];
     license = lib.licenses.mit;
     homepage = "https://github.com/CertainLach/jrsonnet";
+    broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/jrsonnet.x86_64-darwin
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/jsonnet/default.nix b/nixpkgs/pkgs/development/compilers/jsonnet/default.nix
index e85404c58b55..f85ec0118b94 100644
--- a/nixpkgs/pkgs/development/compilers/jsonnet/default.nix
+++ b/nixpkgs/pkgs/development/compilers/jsonnet/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   pname = "jsonnet";
-  version = "0.17.0";
+  version = "0.18.0";
   outputs = ["out" "doc"];
 
   src = fetchFromGitHub {
     rev = "v${version}";
     owner = "google";
     repo = "jsonnet";
-    sha256 = "1ddz14699v5lqx3dh0mb7hfffr6fk5zhmzn3z8yxkqqvriqnciim";
+    sha256 = "sha256-RmuvpKv9Dg3JcxsdZDBMehJjG5SvrV0spHgxApFeuJo=";
   };
 
   nativeBuildInputs = [ jekyll ];
diff --git a/nixpkgs/pkgs/development/compilers/julia/1.7-bin.nix b/nixpkgs/pkgs/development/compilers/julia/1.7-bin.nix
index dab58674f9d2..788825d90be9 100644
--- a/nixpkgs/pkgs/development/compilers/julia/1.7-bin.nix
+++ b/nixpkgs/pkgs/development/compilers/julia/1.7-bin.nix
@@ -2,12 +2,12 @@
 
 stdenv.mkDerivation rec {
   pname = "julia-bin";
-  version = "1.7.1";
+  version = "1.7.2";
 
   src = {
     x86_64-linux = fetchurl {
       url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz";
-      sha256 = "04czipzai5628v1npa2y2xff0bd4rj8d2fcjnnsvkqj5gff8wra4";
+      sha256 = "15dsfdcxvx0wizkkn85ldz0mg0h7cjziz1lw4kky0b9v9xr48lm7";
     };
   }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
 
diff --git a/nixpkgs/pkgs/development/compilers/ligo/default.nix b/nixpkgs/pkgs/development/compilers/ligo/default.nix
index 9a6764191d63..33a0ad49bd3d 100644
--- a/nixpkgs/pkgs/development/compilers/ligo/default.nix
+++ b/nixpkgs/pkgs/development/compilers/ligo/default.nix
@@ -6,12 +6,12 @@
 
 coq.ocamlPackages.buildDunePackage rec {
   pname = "ligo";
-  version = "0.27.0";
+  version = "0.34.0";
   src = fetchFromGitLab {
     owner = "ligolang";
     repo = "ligo";
     rev = version;
-    sha256 = "sha256-OUrjMlAWxTPs56ltMt0I/XR9GScD6upXU2arT99u8hk=";
+    sha256 = "sha256-MHkIr+XkW/zrRt+Cg48q4fOWTkNGH0hbf+oU7cAivNE=";
   };
 
   # The build picks this up for ligo --version
@@ -31,6 +31,7 @@ coq.ocamlPackages.buildDunePackage rec {
     tezos-base
     tezos-shell-services
     tezos-010-PtGRANAD-test-helpers
+    tezos-011-PtHangz2-test-helpers
     tezos-protocol-010-PtGRANAD-parameters
     tezos-protocol-010-PtGRANAD
     tezos-protocol-environment
@@ -42,6 +43,8 @@ coq.ocamlPackages.buildDunePackage rec {
     data-encoding
     bisect_ppx
     cmdliner
+    core
+    ocaml-recovery-parser
   ];
 
   checkInputs = [
@@ -49,7 +52,7 @@ coq.ocamlPackages.buildDunePackage rec {
     coq.ocamlPackages.ca-certs
   ];
 
-  doCheck = true;
+  doCheck = false; # Tests fail, but could not determine the reason
 
   meta = with lib; {
     homepage = "https://ligolang.org/";
diff --git a/nixpkgs/pkgs/development/compilers/lingua-franca/default.nix b/nixpkgs/pkgs/development/compilers/lingua-franca/default.nix
index b843fd5e850f..bb25853ee36d 100644
--- a/nixpkgs/pkgs/development/compilers/lingua-franca/default.nix
+++ b/nixpkgs/pkgs/development/compilers/lingua-franca/default.nix
@@ -7,8 +7,8 @@ stdenv.mkDerivation {
   src = fetchFromGitHub {
     owner = "revol-xut";
     repo = "lingua-franca-nix-releases";
-    rev = "11c6d5297cd63bf0b365a68c5ca31ec80083bd05";
-    sha256 = "DgxunzC8Ep0WdwChDHWgG5QJbJZ8UgQRXtP1HZqL9Jg=";
+    rev = "d37bbfa530f0189c3e86ce0191134cdf42c6aec7";
+    sha256 = "/qMBOjffvShCPcbh9rJ7aVgdgZQ1hilHakjLyEhSmgs=";
   };
 
   buildInputs = [ jdk11_headless ];
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
index b42f40b96943..5336e4ea35a3 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
@@ -29,7 +29,6 @@ let
       "-DCMAKE_CXX_FLAGS=-std=c++14"
       "-DCLANGD_BUILD_XPC=OFF"
       "-DLLVM_ENABLE_RTTI=ON"
-      "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
     ] ++ lib.optionals enableManpages [
       "-DCLANG_INCLUDE_DOCS=ON"
       "-DLLVM_ENABLE_SPHINX=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/default.nix
index 8bd7e937e7d7..5cb6c278659d 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/10/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/10/default.nix
@@ -89,7 +89,11 @@ let
     #   python3 = pkgs.python3;  # don't use python-boot
     # });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix
index 30a2d016d67c..bb1b90b36a92 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix
@@ -57,6 +57,12 @@ in stdenv.mkDerivation (rec {
   propagatedBuildInputs = [ ncurses zlib ];
 
   patches = [
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
     # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
     (fetchpatch {
@@ -93,11 +99,6 @@ in stdenv.mkDerivation (rec {
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -122,6 +123,32 @@ in stdenv.mkDerivation (rec {
     rm test/ExecutionEngine/frem.ll
   '' + ''
     patchShebangs test/BugPoint/compile-custom.ll.py
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
+      test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
+      test/Transforms/SCCP/preserve-analysis.ll \
+      test/Transforms/SROA/dead-inst.ll \
+      test/tools/gold/X86/new-pm.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -130,18 +157,28 @@ in stdenv.mkDerivation (rec {
     ln -sv $PWD/lib $out
   '';
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -167,7 +204,21 @@ in stdenv.mkDerivation (rec {
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -197,7 +248,8 @@ in stdenv.mkDerivation (rec {
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
index 9eed5269da6b..58439f02a5c9 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
@@ -30,7 +30,7 @@ let
     cmakeFlags = [
       "-DCMAKE_CXX_FLAGS=-std=c++14"
       "-DCLANGD_BUILD_XPC=OFF"
-      "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+      "-DLLVM_ENABLE_RTTI=ON"
     ] ++ lib.optionals enableManpages [
       "-DCLANG_INCLUDE_DOCS=ON"
       "-DLLVM_ENABLE_SPHINX=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/default.nix
index ebd0dc672aa3..82a78af85cac 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/default.nix
@@ -104,7 +104,11 @@ let
     #   python3 = pkgs.python3;  # don't use python-boot
     # });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix
index 81ac4cb1ed08..e8cfd23faa7e 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix
@@ -57,6 +57,12 @@ in stdenv.mkDerivation (rec {
   propagatedBuildInputs = [ ncurses zlib ];
 
   patches = [
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
     # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
     (fetchpatch {
@@ -91,11 +97,6 @@ in stdenv.mkDerivation (rec {
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -120,6 +121,32 @@ in stdenv.mkDerivation (rec {
     rm test/ExecutionEngine/frem.ll
   '' + ''
     patchShebangs test/BugPoint/compile-custom.ll.py
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
+      test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
+      test/Transforms/SCCP/preserve-analysis.ll \
+      test/Transforms/SROA/dead-inst.ll \
+      test/tools/gold/X86/new-pm.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -131,18 +158,38 @@ in stdenv.mkDerivation (rec {
   # E.g. mesa.drivers use the build-id as a cache key (see #93946):
   LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
+  ] ++ optionals stdenv.hostPlatform.isStatic [
+    # Disables building of shared libs, -fPIC is still injected by cc-wrapper
+    "-DLLVM_ENABLE_PIC=OFF"
+    "-DLLVM_BUILD_STATIC=ON"
+    # libxml2 needs to be disabled because the LLVM build system ignores its .la
+    # file and doesn't link zlib as well.
+    # https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
+    "-DLLVM_ENABLE_LIBXML2=OFF"
+    # This is a Shared Library not tied to LLVM_ENABLE_PIC
+    "-DLLVM_TOOL_REMARKS_SHLIB_BUILD=OFF"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -168,7 +215,21 @@ in stdenv.mkDerivation (rec {
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -198,7 +259,8 @@ in stdenv.mkDerivation (rec {
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl) && (!stdenv.hostPlatform.isRiscV);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl) && (!stdenv.hostPlatform.isRiscV)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/11/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/11/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
index d6ee37524415..0f1e160bbce8 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
@@ -31,7 +31,7 @@ let
     cmakeFlags = [
       "-DCMAKE_CXX_FLAGS=-std=c++14"
       "-DCLANGD_BUILD_XPC=OFF"
-      "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+      "-DLLVM_ENABLE_RTTI=ON"
     ] ++ lib.optionals enableManpages [
       "-DCLANG_INCLUDE_DOCS=ON"
       "-DLLVM_ENABLE_SPHINX=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
index 13c611ca8cc6..4b2907ed3078 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
@@ -30,6 +30,7 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_BUILD_XRAY=OFF"
     "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
     "-DCOMPILER_RT_BUILD_PROFILE=OFF"
+    "-DCOMPILER_RT_BUILD_MEMPROF=OFF"
   ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
     "-DCMAKE_C_COMPILER_WORKS=ON"
     "-DCMAKE_CXX_COMPILER_WORKS=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/default.nix
index e68522faea06..4a2a7ee87894 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/default.nix
@@ -92,7 +92,11 @@ let
     #   python3 = pkgs.python3;  # don't use python-boot
     # });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/libcxx/default.nix
index 30dc3f4f206c..3ddcb7997505 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/libcxx/default.nix
@@ -23,12 +23,6 @@ stdenv.mkDerivation {
     ../../libcxx-0001-musl-hacks.patch
   ];
 
-  # Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz"
-  postPatch = ''
-    substituteInPlace include/__config \
-      --replace "#    define _LIBCPP_USE_AVAILABILITY_APPLE" ""
-  '';
-
   preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
     patchShebangs utils/cat_files.py
   '';
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix
index 30a1a7a16df8..2c035ee67a9e 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix
@@ -58,6 +58,15 @@ in stdenv.mkDerivation (rec {
     ++ [ zlib ];
 
   patches = [
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+    # Fix llvm being miscompiled by some gccs. See llvm/llvm-project#49955
+    # Fix llvm being miscompiled by some gccs. See https://github.com/llvm/llvm-project/issues/49955
+    ./fix-llvm-issue-49955.patch
+
     ./gnu-install-dirs.patch
     # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
     (fetchpatch {
@@ -72,11 +81,6 @@ in stdenv.mkDerivation (rec {
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -105,6 +109,33 @@ in stdenv.mkDerivation (rec {
     rm test/ExecutionEngine/frem.ll
   '' + ''
     patchShebangs test/BugPoint/compile-custom.ll.py
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-O0-defaults.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
+      test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
+      test/Transforms/SCCP/preserve-analysis.ll \
+      test/Transforms/SROA/dead-inst.ll \
+      test/tools/gold/X86/new-pm.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -116,18 +147,36 @@ in stdenv.mkDerivation (rec {
   # E.g. mesa.drivers use the build-id as a cache key (see #93946):
   LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
+  ] ++ optionals stdenv.hostPlatform.isStatic [
+    # Disables building of shared libs, -fPIC is still injected by cc-wrapper
+    "-DLLVM_ENABLE_PIC=OFF"
+    "-DLLVM_BUILD_STATIC=ON"
+    # libxml2 needs to be disabled because the LLVM build system ignores its .la
+    # file and doesn't link zlib as well.
+    # https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
+    "-DLLVM_ENABLE_LIBXML2=OFF"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -153,7 +202,21 @@ in stdenv.mkDerivation (rec {
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -183,7 +246,8 @@ in stdenv.mkDerivation (rec {
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch b/nixpkgs/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch
new file mode 100644
index 000000000000..b515583a0c42
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt
+index eb924282..c77c140b 100644
+--- a/lib/CodeGen/AsmPrinter/CMakeLists.txt
++++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt
+@@ -44,3 +44,8 @@ add_llvm_component_library(LLVMAsmPrinter
+   Support
+   Target
+   )
++
++if (CMAKE_COMPILER_IS_GNUCXX)
++  set_source_files_properties(DwarfCompileUnit.cpp PROPERTIES
++                              COMPILE_FLAGS -fno-strict-aliasing)
++endif()
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/12/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/12/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix
index ab826fa31526..6c227f1ae72b 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix
@@ -21,7 +21,7 @@ let
     cmakeFlags = [
       "-DCMAKE_CXX_FLAGS=-std=c++14"
       "-DCLANGD_BUILD_XPC=OFF"
-      "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+      "-DLLVM_ENABLE_RTTI=ON"
     ] ++ lib.optionals enableManpages [
       "-DCLANG_INCLUDE_DOCS=ON"
       "-DLLVM_ENABLE_SPHINX=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
index e30db5fcd954..10b89b91b96f 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
@@ -33,6 +33,8 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
     "-DCOMPILER_RT_BUILD_XRAY=OFF"
     "-DCOMPILER_RT_BUILD_PROFILE=OFF"
+    "-DCOMPILER_RT_BUILD_MEMPROF=OFF"
+    "-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary
   ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
     "-DCMAKE_C_COMPILER_WORKS=ON"
     "-DCMAKE_CXX_COMPILER_WORKS=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/default.nix
index a89c6dabe391..be5e9404cdd4 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/default.nix
@@ -93,7 +93,11 @@ let
     #   python3 = pkgs.python3;  # don't use python-boot
     # });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/libcxx/default.nix
index ddf51d9a2fa4..0ce73ed97af6 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/libcxx/default.nix
@@ -25,12 +25,6 @@ stdenv.mkDerivation rec {
     ../../libcxx-0001-musl-hacks.patch
   ];
 
-  # Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz"
-  postPatch = ''
-    substituteInPlace include/__config \
-      --replace "#    define _LIBCPP_USE_AVAILABILITY_APPLE" ""
-  '';
-
   preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
     patchShebangs utils/cat_files.py
   '';
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix
index 957f29e44994..abfb2b36d18f 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix
@@ -52,6 +52,12 @@ in stdenv.mkDerivation (rec {
   checkInputs = [ which ];
 
   patches = [
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
 
     # Fix random compiler crashes: https://bugs.llvm.org/show_bug.cgi?id=50611
@@ -66,11 +72,6 @@ in stdenv.mkDerivation (rec {
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -109,18 +110,36 @@ in stdenv.mkDerivation (rec {
   # E.g. mesa.drivers use the build-id as a cache key (see #93946):
   LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
+  ] ++ optionals stdenv.hostPlatform.isStatic [
+    # Disables building of shared libs, -fPIC is still injected by cc-wrapper
+    "-DLLVM_ENABLE_PIC=OFF"
+    "-DLLVM_BUILD_STATIC=ON"
+    # libxml2 needs to be disabled because the LLVM build system ignores its .la
+    # file and doesn't link zlib as well.
+    # https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
+    "-DLLVM_ENABLE_LIBXML2=OFF"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -146,7 +165,21 @@ in stdenv.mkDerivation (rec {
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -176,7 +209,8 @@ in stdenv.mkDerivation (rec {
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/13/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/13/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/compiler-rt-5-cstddef.patch b/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/compiler-rt-5-cstddef.patch
new file mode 100644
index 000000000000..e7abf9735b90
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/compiler-rt-5-cstddef.patch
@@ -0,0 +1,10 @@
+--- a/lib/xray/xray_buffer_queue.h
++++ b/lib/xray/xray_buffer_queue.h
+@@ -17,6 +17,7 @@
+ 
+ #include "sanitizer_common/sanitizer_atomic.h"
+ #include "sanitizer_common/sanitizer_mutex.h"
++#include <cstddef>
+ #include <deque>
+ #include <unordered_set>
+ #include <utility>
diff --git a/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/default.nix
index 874540dd8c3b..f6f59bb6d99b 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/5/compiler-rt/default.nix
@@ -58,6 +58,7 @@ stdenv.mkDerivation {
 
     ./sys-ustat.patch
     ../../common/compiler-rt/libsanitizer-no-cyclades-9.patch
+    ./compiler-rt-5-cstddef.patch
   ] ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
 
   # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
diff --git a/nixpkgs/pkgs/development/compilers/llvm/5/default.nix b/nixpkgs/pkgs/development/compilers/llvm/5/default.nix
index 4593580b72fd..ef9886fb5ea7 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/5/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/5/default.nix
@@ -65,7 +65,11 @@ let
       python3 = pkgs.python3;  # don't use python-boot
     });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/5/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/5/llvm/default.nix
index fa99e275a623..cf668cd566a6 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/5/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/5/llvm/default.nix
@@ -27,7 +27,7 @@ let
     imap (i: _: concatStringsSep "." (take i parts)) parts;
 in
 
-stdenv.mkDerivation ({
+stdenv.mkDerivation (rec {
   pname = "llvm";
   inherit version;
 
@@ -65,6 +65,13 @@ stdenv.mkDerivation ({
     #  sha256 = "0injj1hqgrbcbihhwp2nbal88jfykad30r54f2cdcx7gws2fcy8i";
     #  stripLen = 1;
     #})
+
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
 
     # Fix invalid std::string(nullptr) for GCC 12
@@ -80,11 +87,6 @@ stdenv.mkDerivation ({
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -100,6 +102,27 @@ stdenv.mkDerivation ({
     substituteInPlace unittests/Support/CMakeLists.txt \
       --replace "add_subdirectory(DynamicLibrary)" ""
     rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -108,20 +131,30 @@ stdenv.mkDerivation ({
     ln -sv $PWD/lib $out
   '';
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
 
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
   ]
-  ++ lib.optional enableSharedLibraries
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
   ++ lib.optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -148,7 +181,21 @@ stdenv.mkDerivation ({
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -179,7 +226,8 @@ stdenv.mkDerivation ({
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isi686);
+  doCheck = stdenv.isLinux && (!stdenv.isi686)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/5/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/5/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/5/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/6/default.nix b/nixpkgs/pkgs/development/compilers/llvm/6/default.nix
index 9b1caf410bc2..4acfe6cd85d7 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/6/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/6/default.nix
@@ -66,7 +66,11 @@ let
       python3 = pkgs.python3;  # don't use python-boot
     });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/6/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/6/llvm/default.nix
index 5925fab104fa..61f9234274d3 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/6/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/6/llvm/default.nix
@@ -27,7 +27,7 @@ let
     imap (i: _: concatStringsSep "." (take i parts)) parts;
 in
 
-stdenv.mkDerivation ({
+stdenv.mkDerivation (rec {
   pname = "llvm";
   inherit version;
 
@@ -63,6 +63,13 @@ stdenv.mkDerivation ({
       includes = [ "test/tools/gold/X86/common.ll" ];
       sha256 = "0fxgrxmfnjx17w3lcq19rk68b2xksh1bynz3ina784kma7hp4wdb";
     })
+
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
 
     # Fix invalid std::string(nullptr) for GCC 12
@@ -78,11 +85,6 @@ stdenv.mkDerivation ({
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -93,6 +95,29 @@ stdenv.mkDerivation ({
     substituteInPlace unittests/Support/CMakeLists.txt \
       --replace "add_subdirectory(DynamicLibrary)" ""
     rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
+      test/Transforms/SROA/dead-inst.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -101,19 +126,29 @@ stdenv.mkDerivation ({
     ln -sv $PWD/lib $out
   '';
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -139,7 +174,21 @@ stdenv.mkDerivation ({
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -170,7 +219,8 @@ stdenv.mkDerivation ({
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isi686);
+  doCheck = stdenv.isLinux && (!stdenv.isi686)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/6/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/6/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/6/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/default.nix b/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
index d014c043a80d..f0908f30775d 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
@@ -96,7 +96,11 @@ let
       python3 = pkgs.python3;  # don't use python-boot
     });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/7/llvm/default.nix
index e4410bedf917..b324e1a0e4d6 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/llvm/default.nix
@@ -31,7 +31,7 @@ let
     let parts = splitVersion release_version; in
     imap (i: _: concatStringsSep "." (take i parts)) parts;
 
-in stdenv.mkDerivation ({
+in stdenv.mkDerivation (rec {
   pname = "llvm";
   inherit version;
 
@@ -67,6 +67,13 @@ in stdenv.mkDerivation ({
       url = "https://github.com/llvm-mirror/llvm/commit/cc1f2a595ead516812a6c50398f0f3480ebe031f.patch";
       sha256 = "0k6k1p5yisgwx417a67s7sr9930rqh1n0zv5jvply8vjjy4b3kf8";
     })
+
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
 
     # Fix invalid std::string(nullptr) for GCC 12
@@ -82,11 +89,6 @@ in stdenv.mkDerivation ({
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -110,6 +112,31 @@ in stdenv.mkDerivation ({
     rm test/ExecutionEngine/frem.ll
   '' + ''
     patchShebangs test/BugPoint/compile-custom.ll.py
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
+      test/Transforms/SCCP/preserve-analysis.ll \
+      test/Transforms/SROA/dead-inst.ll \
+      test/tools/gold/X86/new-pm.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -118,19 +145,29 @@ in stdenv.mkDerivation ({
     ln -sv $PWD/lib $out
   '';
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -156,7 +193,21 @@ in stdenv.mkDerivation ({
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -187,7 +238,8 @@ in stdenv.mkDerivation ({
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/7/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/7/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
index 5cb7720d026f..1d6a5b7d74df 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
@@ -30,7 +30,6 @@ let
       "-DCMAKE_CXX_FLAGS=-std=c++11"
       "-DCLANGD_BUILD_XPC=OFF"
       "-DLLVM_ENABLE_RTTI=ON"
-      "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
     ] ++ lib.optionals enableManpages [
       "-DCLANG_INCLUDE_DOCS=ON"
       "-DLLVM_ENABLE_SPHINX=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/default.nix
index 7252b75a3397..43050a72b922 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/8/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/8/default.nix
@@ -97,7 +97,11 @@ let
       python3 = pkgs.python3;  # don't use python-boot
     });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix
index 8bb2293f8189..efd1707eb337 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix
@@ -30,7 +30,7 @@ let
   shortVersion = with lib;
     concatStringsSep "." (take 1 (splitVersion release_version));
 
-in stdenv.mkDerivation ({
+in stdenv.mkDerivation (rec {
   pname = "llvm";
   inherit version;
 
@@ -57,6 +57,12 @@ in stdenv.mkDerivation ({
   propagatedBuildInputs = [ ncurses zlib ];
 
   patches = [
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     # Fix missing includes for GCC 10
     (fetchpatch {
       url = "https://bugs.gentoo.org/attachment.cgi?id=612792";
@@ -85,11 +91,6 @@ in stdenv.mkDerivation ({
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -104,6 +105,32 @@ in stdenv.mkDerivation ({
     rm test/CodeGen/AArch64/wineh4.mir
   '' + ''
     patchShebangs test/BugPoint/compile-custom.ll.py
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
+      test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
+      test/Transforms/SCCP/preserve-analysis.ll \
+      test/Transforms/SROA/dead-inst.ll \
+      test/tools/gold/X86/new-pm.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -112,18 +139,28 @@ in stdenv.mkDerivation ({
     ln -sv $PWD/lib $out
   '';
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -149,7 +186,21 @@ in stdenv.mkDerivation ({
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -179,7 +230,8 @@ in stdenv.mkDerivation ({
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
index c98b4a830c42..ee124b43bfce 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
@@ -30,7 +30,6 @@ let
       "-DCMAKE_CXX_FLAGS=-std=c++11"
       "-DCLANGD_BUILD_XPC=OFF"
       "-DLLVM_ENABLE_RTTI=ON"
-      "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
     ] ++ lib.optionals enableManpages [
       "-DCLANG_INCLUDE_DOCS=ON"
       "-DLLVM_ENABLE_SPHINX=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/default.nix
index 9126a614b106..7efe8486a387 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/default.nix
@@ -97,7 +97,11 @@ let
       python3 = pkgs.python3;  # don't use python-boot
     });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix
index f8c474775e48..1dd1455ed6d6 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix
@@ -57,6 +57,12 @@ in stdenv.mkDerivation (rec {
   propagatedBuildInputs = [ ncurses zlib ];
 
   patches = [
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
     # Force a test to evaluate the saved benchmark for a CPU for which LLVM has
     # an execution model. See NixOS/nixpkgs#119673.
@@ -83,11 +89,6 @@ in stdenv.mkDerivation (rec {
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -119,6 +120,32 @@ in stdenv.mkDerivation (rec {
     # Fix x86 gold test on non-x86 platforms
     # (similar fix made to others in this directory previously, FWIW)
     patch -p1 -i  ${./fix-test-on-non-x86-like-others.patch}
+  '' + ''
+    # Tweak tests to ignore namespace part of type to support
+    # gcc-12: https://gcc.gnu.org/PR103598.
+    # The change below mangles strings like:
+    #    CHECK-NEXT: Starting llvm::Function pass manager run.
+    # to:
+    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
+    for f in \
+      test/Other/new-pass-manager.ll \
+      test/Other/new-pm-defaults.ll \
+      test/Other/new-pm-lto-defaults.ll \
+      test/Other/new-pm-thinlto-defaults.ll \
+      test/Other/pass-pipeline-parsing.ll \
+      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
+      test/Transforms/Inline/clear-analyses.ll \
+      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
+      test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
+      test/Transforms/SCCP/preserve-analysis.ll \
+      test/Transforms/SROA/dead-inst.ll \
+      test/tools/gold/X86/new-pm.ll \
+      ; do
+      echo "PATCH: $f"
+      substituteInPlace $f \
+        --replace 'Starting llvm::' 'Starting {{.*}}' \
+        --replace 'Finished llvm::' 'Finished {{.*}}'
+    done
   '';
 
   # hacky fix: created binaries need to be run before installation
@@ -127,18 +154,28 @@ in stdenv.mkDerivation (rec {
     ln -sv $PWD/lib $out
   '';
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -164,7 +201,21 @@ in stdenv.mkDerivation (rec {
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -194,7 +245,8 @@ in stdenv.mkDerivation (rec {
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isRiscV);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isRiscV)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/9/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/9/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix
index a775af3031b7..3873bda2b6d5 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix
@@ -21,7 +21,7 @@ let
     cmakeFlags = [
       "-DCMAKE_CXX_FLAGS=-std=c++14"
       "-DCLANGD_BUILD_XPC=OFF"
-      "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+      "-DLLVM_ENABLE_RTTI=ON"
     ] ++ lib.optionals enableManpages [
       "-DCLANG_INCLUDE_DOCS=ON"
       "-DLLVM_ENABLE_SPHINX=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
index 5874a91e03c8..019148039d17 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
@@ -32,6 +32,8 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_BUILD_XRAY=OFF"
     "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
     "-DCOMPILER_RT_BUILD_PROFILE=OFF"
+    "-DCOMPILER_RT_BUILD_MEMPROF=OFF"
+    "-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary
   ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
     "-DCMAKE_C_COMPILER_WORKS=ON"
     "-DCMAKE_CXX_COMPILER_WORKS=ON"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
index 666e9be3cd89..890270c851db 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
@@ -93,7 +93,11 @@ let
     #   python3 = pkgs.python3;  # don't use python-boot
     # });
 
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
 
     libstdcxxClang = wrapCCWith rec {
       cc = tools.clang-unwrapped;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
index bedfd5afee15..0ddf28909b8e 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
@@ -25,12 +25,6 @@ stdenv.mkDerivation rec {
     ../../libcxx-0001-musl-hacks.patch
   ];
 
-  # Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz"
-  postPatch = ''
-    substituteInPlace include/__config \
-      --replace "#    define _LIBCPP_USE_AVAILABILITY_APPLE" ""
-  '';
-
   preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
     patchShebangs utils/cat_files.py
   '';
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
index daf4cfe808b6..fc7030810c5b 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
@@ -51,6 +51,12 @@ in stdenv.mkDerivation (rec {
   checkInputs = [ which ];
 
   patches = [
+    # When cross-compiling we configure llvm-config-native with an approximation
+    # of the flags used for the normal LLVM build. To avoid the need for building
+    # a native libLLVM.so (which would fail) we force llvm-config to be linked
+    # statically against the necessary LLVM components always.
+    ../../llvm-config-link-static.patch
+
     ./gnu-install-dirs.patch
   ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
 
@@ -58,11 +64,6 @@ in stdenv.mkDerivation (rec {
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
       --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
-  ''
-  # Patch llvm-config to return correct library path based on --link-{shared,static}.
-  + optionalString (enableSharedLibraries) ''
-    substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
-    patch -p1 < ./outputs.patch
   '' + ''
     # FileSystem permissions tests fail with various special bits
     substituteInPlace unittests/Support/CMakeLists.txt \
@@ -101,18 +102,36 @@ in stdenv.mkDerivation (rec {
   # E.g. mesa.drivers use the build-id as a cache key (see #93946):
   LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
 
-  cmakeFlags = with stdenv; [
-    "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
     "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
     "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
+  ] ++ optionals stdenv.hostPlatform.isStatic [
+    # Disables building of shared libs, -fPIC is still injected by cc-wrapper
+    "-DLLVM_ENABLE_PIC=OFF"
+    "-DLLVM_BUILD_STATIC=ON"
+    # libxml2 needs to be disabled because the LLVM build system ignores its .la
+    # file and doesn't link zlib as well.
+    # https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
+    "-DLLVM_ENABLE_LIBXML2=OFF"
   ] ++ optionals enableManpages [
     "-DLLVM_BUILD_DOCS=ON"
     "-DLLVM_ENABLE_SPHINX=ON"
@@ -138,7 +157,21 @@ in stdenv.mkDerivation (rec {
           "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
           "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
         ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
     )
   ];
 
@@ -168,7 +201,8 @@ in stdenv.mkDerivation (rec {
     cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
   '';
 
-  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
 
   checkTarget = "check-all";
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/outputs.patch
deleted file mode 100644
index 40096fa3497f..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/outputs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 94d426b..37f7794 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
-+  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   /// We only use `shared library` mode in cases where the static library form
-   /// of the components provided are not available; note however that this is
-   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/nixpkgs/pkgs/development/compilers/llvm/llvm-config-link-static.patch b/nixpkgs/pkgs/development/compilers/llvm/llvm-config-link-static.patch
new file mode 100644
index 000000000000..3881cc5206e2
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/llvm-config-link-static.patch
@@ -0,0 +1,12 @@
+diff --git llvm/tools/llvm-config/CMakeLists.txt llvm/tools/llvm-config/CMakeLists.txt
+index 16ba54c0cf2f..20b017195e84 100644
+--- llvm/tools/llvm-config/CMakeLists.txt
++++ llvm/tools/llvm-config/CMakeLists.txt
+@@ -6,6 +6,7 @@ set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc)
+ # Add the llvm-config tool.
+ add_llvm_tool(llvm-config
+   llvm-config.cpp
++  DISABLE_LLVM_LINK_LLVM_DYLIB
+   )
+ 
+ # Compute the substitution values for various items.
diff --git a/nixpkgs/pkgs/development/compilers/llvm/rocm/llvm/outputs.patch b/nixpkgs/pkgs/development/compilers/llvm/rocm/llvm/outputs.patch
index 40096fa3497f..878460e05b8a 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/rocm/llvm/outputs.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/rocm/llvm/outputs.patch
@@ -2,23 +2,13 @@ diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.c
 index 94d426b..37f7794 100644
 --- a/tools/llvm-config/llvm-config.cpp
 +++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
+@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
      ActiveIncludeOption = "-I" + ActiveIncludeDir;
    }
  
-+  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
++  /// Nix-specific multiple-output handling: override ActiveLibDir
 +  if (!IsInDevelopmentTree) {
-+    bool WantShared = true;
-+    for (int i = 1; i < argc; ++i) {
-+      StringRef Arg = argv[i];
-+      if (Arg == "--link-shared")
-+        WantShared = true;
-+      else if (Arg == "--link-static")
-+        WantShared = false; // the last one wins
-+    }
-+
-+    if (WantShared)
-+      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
++    ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
 +  }
 +
    /// We only use `shared library` mode in cases where the static library form
diff --git a/nixpkgs/pkgs/development/compilers/mezzo/default.nix b/nixpkgs/pkgs/development/compilers/mezzo/default.nix
index 23c75ae28bb7..4f2b081b4db2 100644
--- a/nixpkgs/pkgs/development/compilers/mezzo/default.nix
+++ b/nixpkgs/pkgs/development/compilers/mezzo/default.nix
@@ -28,6 +28,10 @@ stdenv.mkDerivation {
   prePatch = lib.optionalString (check-ocaml-version "4.02") ''
     substituteInPlace myocamlbuild.pre.ml \
     --replace '@1..3' '@1..2+3'
+  ''
+  # Compatibility with PPrint ≥ 20220103
+  + ''
+    substituteInPlace typing/Fact.ml --replace PPrintOCaml PPrint.OCaml
   '';
 
   createFindlibDestdir = true;
diff --git a/nixpkgs/pkgs/development/compilers/mlton/from-git-source.nix b/nixpkgs/pkgs/development/compilers/mlton/from-git-source.nix
index ec0b96bbf23a..b91e6c7480da 100644
--- a/nixpkgs/pkgs/development/compilers/mlton/from-git-source.nix
+++ b/nixpkgs/pkgs/development/compilers/mlton/from-git-source.nix
@@ -21,6 +21,9 @@ stdenv.mkDerivation {
 
   buildInputs = [mltonBootstrap gmp];
 
+  # build fails otherwise
+  enableParallelBuilding = false;
+
   preBuild = ''
     find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@"
     sed -i "s|/tmp|$TMPDIR|" bin/regression
diff --git a/nixpkgs/pkgs/development/compilers/mosml/default.nix b/nixpkgs/pkgs/development/compilers/mosml/default.nix
index e7dc9ceae6d9..44ed1185fafc 100644
--- a/nixpkgs/pkgs/development/compilers/mosml/default.nix
+++ b/nixpkgs/pkgs/development/compilers/mosml/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, gmp, perl }:
+{ lib, stdenv, fetchFromGitHub, gmp, perl }:
 
 stdenv.mkDerivation rec {
   pname = "mosml";
@@ -8,9 +8,11 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=$(out)" "CC=${stdenv.cc.targetPrefix}cc" ];
 
-  src = fetchurl {
-    url = "https://github.com/kfl/mosml/archive/ver-${version}.tar.gz";
-    sha256 = "13x7wj94p0inn84pzpj52dch5s9lznqrj287bd3nk3dqd0v3kmgy";
+  src = fetchFromGitHub {
+    owner = "kfl";
+    repo = "mosml";
+    rev = "ver-${version}";
+    sha256 = "sha256-GK39WvM7NNhoC5f0Wjy4/5VWT+Rbh2qo+W71hWrbPso=";
   };
 
   setSourceRoot = ''export sourceRoot="$(echo */src)"'';
diff --git a/nixpkgs/pkgs/development/compilers/myrddin/default.nix b/nixpkgs/pkgs/development/compilers/myrddin/default.nix
index 3120426210bf..a7aa84a1aa8d 100644
--- a/nixpkgs/pkgs/development/compilers/myrddin/default.nix
+++ b/nixpkgs/pkgs/development/compilers/myrddin/default.nix
@@ -53,5 +53,6 @@ stdenv.mkDerivation rec {
     license = licenses.mit;
     maintainers = with maintainers; [ luc65r ];
     platforms = platforms.all;
+    broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/myrddin.x86_64-darwin
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/nextpnr/default.nix b/nixpkgs/pkgs/development/compilers/nextpnr/default.nix
index 16f0a8348d1c..e20a25ac8e80 100644
--- a/nixpkgs/pkgs/development/compilers/nextpnr/default.nix
+++ b/nixpkgs/pkgs/development/compilers/nextpnr/default.nix
@@ -14,14 +14,14 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "nextpnr";
-  version = "2021.15.21";
+  version = "2022.01.03";
 
   srcs = [
     (fetchFromGitHub {
       owner = "YosysHQ";
       repo  = "nextpnr";
-      rev   = "d04cfd5f0f6da184f5b8a03f0ce18fbd1d98eca3";
-      hash  = "sha256-gm/+kwIZ/m10+KuCJoK45F56nKZD3tM0myHwbFKIKAs=";
+      rev   = "089ca8258e6f4dc93f8d39594c1109a8578cdc98";
+      hash  = "sha256-N8kX/+fN8Qe+qme8RFlZyYQ/3p1WBkt0ztUwjJIQCIw=";
       name  = "nextpnr";
     })
     (fetchFromGitHub {
diff --git a/nixpkgs/pkgs/development/compilers/open-watcom/v2.nix b/nixpkgs/pkgs/development/compilers/open-watcom/v2.nix
index 6cb5c6dcc105..de2dae156ee6 100644
--- a/nixpkgs/pkgs/development/compilers/open-watcom/v2.nix
+++ b/nixpkgs/pkgs/development/compilers/open-watcom/v2.nix
@@ -12,14 +12,14 @@
 
 stdenv.mkDerivation rec {
   pname = "open-watcom-v2";
-  version = "unstable-2021-12-10";
+  version = "unstable-2022-01-18";
   name = "${pname}-unwrapped-${version}";
 
   src = fetchFromGitHub {
     owner = "open-watcom";
     repo = "open-watcom-v2";
-    rev = "ca685c1b780149f7210426f0bb78dd7b67b19e6d";
-    sha256 = "1nmmj94z5hips2426rcdqdcsm8015jjj51rm9fnx81qagdj52j5d";
+    rev = "f09e0c969c45679c048180f2dc6b3dbbe69e42a0";
+    sha256 = "dEjG4L/VVufSAerKcXPUqZ7esz4m8/210ZshVz4SNAA=";
   };
 
   postPatch = ''
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
index 1d829450a1ed..009802b29234 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
@@ -23,7 +23,7 @@ let
       zuluVersion = "8.54.0.21";
       jdkVersion = "8.0.292";
       sha256 =
-        if enableJavaFX then "1b05b2e40f707a151b063ebba821270fa930ebfc05712bc1f5a8a112395731a6"
+        if enableJavaFX then "8e901075cde2c31f531a34e8321ea4201970936abf54240a232e9389952afe84"
         else "05w89wfjlfbpqfjnv6wisxmaf13qb28b2223f9264jyx30qszw1c";
     };
   }."${stdenv.hostPlatform.system}";
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/openjfx/11.nix b/nixpkgs/pkgs/development/compilers/openjdk/openjfx/11.nix
index e977d2b00203..ff243372b4a5 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/openjfx/11.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/openjfx/11.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, writeText, gradle_4, pkg-config, perl, cmake
-, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib, ffmpeg, python2, ruby
+, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib, ffmpeg_4, python2, ruby
 , openjdk11-bootstrap }:
 
 let
@@ -19,7 +19,7 @@ let
       sha256 = "1h7qsylr7rnwnbimqjyn3whszp9kv4h3gpicsrb3mradxc9yv194";
     };
 
-    buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg ];
+    buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4 ];
     nativeBuildInputs = [ gradle_ perl pkg-config cmake gperf python2 ruby ];
 
     dontUseCmakeConfigure = true;
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/openjfx/15.nix b/nixpkgs/pkgs/development/compilers/openjdk/openjfx/15.nix
index 26c16895c5d4..3feda519b084 100644
--- a/nixpkgs/pkgs/development/compilers/openjdk/openjfx/15.nix
+++ b/nixpkgs/pkgs/development/compilers/openjdk/openjfx/15.nix
@@ -1,6 +1,6 @@
 { stdenv, lib, fetchFromGitHub, writeText, openjdk11_headless, gradle_5
 , pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib
-, ffmpeg, python3, ruby }:
+, ffmpeg_4, python3, ruby }:
 
 let
   major = "15";
@@ -21,7 +21,7 @@ let
       sha256 = "019glq8rhn6amy3n5jc17vi2wpf1pxpmmywvyz1ga8n09w7xscq1";
     };
 
-    buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg ];
+    buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4 ];
     nativeBuildInputs = [ gradle_ perl pkg-config cmake gperf python3 ruby ];
 
     dontUseCmakeConfigure = true;
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/openjfx/17.nix b/nixpkgs/pkgs/development/compilers/openjdk/openjfx/17.nix
new file mode 100644
index 000000000000..12bac4c4d9d8
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/openjfx/17.nix
@@ -0,0 +1,106 @@
+{ stdenv, lib, fetchFromGitHub, writeText, openjdk17_headless, gradle_7
+, pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst, libXxf86vm, glib, alsa-lib
+, ffmpeg, python3, ruby, icu68 }:
+
+let
+  major = "17";
+  update = ".0.0.1";
+  build = "+1";
+  repover = "${major}${update}${build}";
+  gradle_ = (gradle_7.override {
+    java = openjdk17_headless;
+  });
+
+  makePackage = args: stdenv.mkDerivation ({
+    version = "${major}${update}${build}";
+
+    src = fetchFromGitHub {
+      owner = "openjdk";
+      repo = "jfx";
+      rev = repover;
+      sha256 = "sha256-PSiE9KbF/4u9VyBl9PAMLGzKyGFB86/XByeh7vhL6Kw=";
+    };
+
+    buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg icu68 ];
+    nativeBuildInputs = [ gradle_ perl pkg-config cmake gperf python3 ruby ];
+
+    dontUseCmakeConfigure = true;
+
+    config = writeText "gradle.properties" (''
+      CONF = Release
+      JDK_HOME = ${openjdk17_headless.home}
+    '' + args.gradleProperties or "");
+
+    buildPhase = ''
+      runHook preBuild
+
+      export GRADLE_USER_HOME=$(mktemp -d)
+      ln -s $config gradle.properties
+      export NIX_CFLAGS_COMPILE="$(pkg-config --cflags glib-2.0) $NIX_CFLAGS_COMPILE"
+      gradle --no-daemon $gradleFlags sdk
+
+      runHook postBuild
+    '';
+  } // args);
+
+  # Fake build to pre-download deps into fixed-output derivation.
+  # We run nearly full build because I see no other way to download everything that's needed.
+  # Anyone who knows a better way?
+  deps = makePackage {
+    pname = "openjfx-deps";
+
+    # perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
+    installPhase = ''
+      find $GRADLE_USER_HOME -type f -regex '.*/modules.*\.\(jar\|pom\)' \
+        | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
+        | sh
+      rm -rf $out/tmp
+    '';
+
+    outputHashAlgo = "sha256";
+    outputHashMode = "recursive";
+    outputHash = "sha256-dV7/U5GpFxhI13smZ587C6cVE4FRNPY0zexZkYK4Yqo=";
+  };
+
+in makePackage {
+  pname = "openjfx-modular-sdk";
+
+  gradleProperties = ''
+    COMPILE_MEDIA = true
+    COMPILE_WEBKIT = false
+  '';
+
+  preBuild = ''
+    swtJar="$(find ${deps} -name org.eclipse.swt\*.jar)"
+    substituteInPlace build.gradle \
+      --replace 'mavenCentral()' 'mavenLocal(); maven { url uri("${deps}") }' \
+      --replace 'name: SWT_FILE_NAME' "files('$swtJar')"
+  '';
+
+  installPhase = ''
+    cp -r build/modular-sdk $out
+  '';
+
+  stripDebugList = [ "." ];
+
+  postFixup = ''
+    # Remove references to bootstrap.
+    export openjdkOutPath='${openjdk17_headless.outPath}'
+    find "$out" -name \*.so | while read lib; do
+      new_refs="$(patchelf --print-rpath "$lib" | perl -pe 's,:?\Q$ENV{openjdkOutPath}\E[^:]*,,')"
+      patchelf --set-rpath "$new_refs" "$lib"
+    done
+  '';
+
+  disallowedReferences = [ openjdk17_headless ];
+
+  passthru.deps = deps;
+
+  meta = with lib; {
+    homepage = "http://openjdk.java.net/projects/openjfx/";
+    license = licenses.gpl2;
+    description = "The next-generation Java client toolkit";
+    maintainers = with maintainers; [ abbradar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/orc/default.nix b/nixpkgs/pkgs/development/compilers/orc/default.nix
index 2d56d461627a..fa4bf686a2ac 100644
--- a/nixpkgs/pkgs/development/compilers/orc/default.nix
+++ b/nixpkgs/pkgs/development/compilers/orc/default.nix
@@ -15,6 +15,9 @@ in stdenv.mkDerivation rec {
   postPatch = lib.optionalString stdenv.isAarch32 ''
     # https://gitlab.freedesktop.org/gstreamer/orc/-/issues/20
     sed -i '/exec_opcodes_sys/d' testsuite/meson.build
+  '' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
+    # This benchmark times out on Hydra.nixos.org
+    sed -i '/memcpy_speed/d' testsuite/meson.build
   '';
 
   outputs = [ "out" "dev" ]
diff --git a/nixpkgs/pkgs/development/compilers/passerine/default.nix b/nixpkgs/pkgs/development/compilers/passerine/default.nix
index e9427f892e64..e5f88e586746 100644
--- a/nixpkgs/pkgs/development/compilers/passerine/default.nix
+++ b/nixpkgs/pkgs/development/compilers/passerine/default.nix
@@ -2,20 +2,20 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "passerine";
-  version = "0.9.2";
+  version = "0.9.3";
 
   src = fetchFromGitHub {
     owner = "vrtbl";
     repo = "passerine";
-    rev = "dd8a6f5efc5dcb03d45b102f61cc8a50d46e8e98";
-    sha256 = "sha256-/QzqKLkxAVqvTY4Uft1qk7nJat6nozykB/4X1YGqu/I=";
+    rev = "v${version}";
+    hash = "sha256-TrbcULIJ9+DgQ4QsLYD5okxHoIusGJDw1PqJQwq1zu0=";
   };
 
-  cargoSha256 = "sha256-8WiiDLIJ/abXELF8S+4s+BPA/Lr/rpKmC1NWPCLzQWA=";
+  cargoHash = "sha256-A+sOT0rloAktDdVXe2HEPK25euh9T7c0rXybZmZpqC0=";
 
   meta = with lib; {
     description = "A small extensible programming language designed for concise expression with little code";
-    homepage = "https://github.com/vrtbl/passerine";
+    homepage = "https://www.passerine.io/";
     license = licenses.mit;
     maintainers = with maintainers; [ siraben ];
   };
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/default.nix b/nixpkgs/pkgs/development/compilers/ponyc/default.nix
index 086d4d30127e..d0479cb595bb 100644
--- a/nixpkgs/pkgs/development/compilers/ponyc/default.nix
+++ b/nixpkgs/pkgs/development/compilers/ponyc/default.nix
@@ -1,15 +1,15 @@
-{ lib, stdenv, fetchFromGitHub, fetchurl, makeWrapper, pcre2, coreutils, which, openssl, libxml2, cmake, z3, substituteAll,
+{ lib, stdenv, fetchFromGitHub, fetchurl, makeWrapper, pcre2, coreutils, which, openssl, libxml2, cmake, z3, substituteAll, python3,
   cc ? stdenv.cc, lto ? !stdenv.isDarwin }:
 
 stdenv.mkDerivation (rec {
   pname = "ponyc";
-  version = "0.42.0";
+  version = "0.44.0";
 
   src = fetchFromGitHub {
     owner = "ponylang";
     repo = pname;
     rev = version;
-    sha256 = "1s8glmzz0g5lj1fjwwy4m3n660smiq5wl9r1lg686wqh42hcgnsy";
+    sha256 = "0bzdkrrh6lvfqc61kdxvgz573dj32wwzhzwil53jvynhfcwp38ld";
 
 # Due to a bug in LLVM 9.x, ponyc has to include its own vendored patched
 # LLVM.  (The submodule is a specific tag in the LLVM source tree).
@@ -26,22 +26,23 @@ stdenv.mkDerivation (rec {
   ponygbenchmark = fetchFromGitHub {
     owner = "google";
     repo = "benchmark";
-    rev = "v1.5.2";
-    sha256 = "13rxagpzw6bal6ajlmrxlh9kgfvcixn6j734b2bvfqz7lch8n0pa";
+    rev = "v1.5.4";
+    sha256 = "1dbjdjzkpbsq3jl9ksyg8mw759vkac8qzq1557m73ldnavbhz48x";
   };
 
-  nativeBuildInputs = [ cmake makeWrapper which ];
+  nativeBuildInputs = [ cmake makeWrapper which python3 ];
   buildInputs = [ libxml2 z3 ];
 
   # Sandbox disallows network access, so disabling problematic networking tests
   patches = [
     ./disable-tests.patch
-    ./fix-libstdcpp-path.patch
     (substituteAll {
       src = ./make-safe-for-sandbox.patch;
-      googletest = fetchurl {
-        url = "https://github.com/google/googletest/archive/release-1.8.1.tar.gz";
-        sha256 = "17147961i01fl099ygxjx4asvjanwdd446nwbq9v8156h98zxwcv";
+      googletest = fetchFromGitHub {
+        owner = "google";
+        repo = "googletest";
+        rev = "release-1.10.0";
+        sha256 = "1zbmab9295scgg4z2vclgfgjchfjailjnvzc6f5x9jvlsdi3dpwz";
       };
     })
   ];
@@ -57,9 +58,7 @@ stdenv.mkDerivation (rec {
   postPatch = ''
     # Patching Vendor LLVM
     patchShebangs --host build/build_libs/gbenchmark-prefix/src/benchmark/tools/*.py
-    patch -d lib/llvm/src/ -p1 < lib/llvm/patches/2020-09-01-is-trivially-copyable.diff
-    patch -d lib/llvm/src/ -p1 < lib/llvm/patches/2020-01-07-01-c-exports.diff
-    patch -d lib/llvm/src/ -p1 < lib/llvm/patches/2019-12-23-01-jit-eh-frames.diff
+    patch -d lib/llvm/src/ -p1 < lib/llvm/patches/2020-07-28-01-c-exports.diff
     substituteInPlace packages/process/_test.pony \
         --replace '"/bin/' '"${coreutils}/bin/' \
         --replace '=/bin' "${coreutils}/bin"
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/fix-libstdcpp-path.patch b/nixpkgs/pkgs/development/compilers/ponyc/fix-libstdcpp-path.patch
deleted file mode 100644
index 63b0fa699129..000000000000
--- a/nixpkgs/pkgs/development/compilers/ponyc/fix-libstdcpp-path.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/src/libponyc/CMakeLists.txt b/src/libponyc/CMakeLists.txt
-index bf2c385e..11d0d619 100644
---- a/src/libponyc/CMakeLists.txt
-+++ b/src/libponyc/CMakeLists.txt
-@@ -136,7 +136,7 @@ elseif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "DragonFly")
- else()
-     # add a rule to generate the standalone library if needed
-     add_custom_command(OUTPUT libponyc-standalone.a
--        COMMAND cp `find /usr/lib/ -name 'libstdc++.a' -print -quit` libstdcpp.a
-+        COMMAND cp `${CMAKE_CXX_COMPILER} --print-file-name='libstdc++.a'` libstdcpp.a
-         COMMAND echo "create libponyc-standalone.a" > standalone.mri
-         COMMAND echo "addlib ${PROJECT_SOURCE_DIR}/../../build/libs/lib/libblake2.a" >> standalone.mri
-         COMMAND echo "addlib libstdcpp.a" >> standalone.mri
-
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/make-safe-for-sandbox.patch b/nixpkgs/pkgs/development/compilers/ponyc/make-safe-for-sandbox.patch
index 8190cc2ee02e..796bbf81f4d4 100644
--- a/nixpkgs/pkgs/development/compilers/ponyc/make-safe-for-sandbox.patch
+++ b/nixpkgs/pkgs/development/compilers/ponyc/make-safe-for-sandbox.patch
@@ -1,28 +1,28 @@
---- a/lib/CMakeLists.txt.orig	2021-07-07 13:40:20.209410160 -0400
-+++ a/lib/CMakeLists.txt	2021-07-07 13:43:11.886969662 -0400
+--- a/lib/CMakeLists.txt.orig	2021-10-01 13:04:00.867762912 -0400
++++ a/lib/CMakeLists.txt	2021-10-01 13:06:21.220023453 -0400
 @@ -15,12 +15,12 @@
  endif()
  
  ExternalProject_Add(gbenchmark
 -    URL ${PONYC_GBENCHMARK_URL}
-+	SOURCE_DIR gbenchmark-prefix/src/benchmark
++    SOURCE_DIR gbenchmark-prefix/src/benchmark
      CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_CXX_FLAGS=-fpic --no-warn-unused-cli
  )
  
  ExternalProject_Add(googletest
--    URL https://github.com/google/googletest/archive/release-1.8.1.tar.gz
-+	URL @googletest@
+-    URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz
++    URL @googletest@
      CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_CXX_FLAGS=-fpic -Dgtest_force_shared_crt=ON --no-warn-unused-cli
  )
  
-@@ -33,75 +33,6 @@
+@@ -33,82 +33,6 @@
      COMPONENT library
  )
  
 -find_package(Git)
 -
--set(LLVM_DESIRED_HASH "c1a0a213378a458fbea1a5c77b315c7dce08fd05")
--set(PATCHES_DESIRED_HASH "9063f83d727bf042a1232420e168c1ea192bf6a2960d35e57123245b630eb923")
+-set(LLVM_DESIRED_HASH "fed41342a82f5a3a9201819a82bf7a48313e296b")
+-set(PATCHES_DESIRED_HASH "3a655193262fd9b2e87340e096efcbd96726a07fe6dd42a263f3a4fc2dc0192e")
 -
 -if(GIT_FOUND)
 -    if(EXISTS "${PROJECT_SOURCE_DIR}/../.git")
@@ -56,12 +56,19 @@
 -    file(GLOB PONY_LLVM_PATCHES "${PROJECT_SOURCE_DIR}/llvm/patches/*.diff")
 -
 -    # check to see if the patch hashes match
+-    message("Checking patches ${PONY_LLVM_PATCHES}")
 -    set(PATCHES_ACTUAL_HASH "")
 -    foreach (PATCH ${PONY_LLVM_PATCHES})
--        file(SHA256 ${PATCH} patch_file_hash)
--        string(CONCAT PATCHES_ACTUAL_HASH patch_file_hash)
+-        file(STRINGS ${PATCH} patch_file NEWLINE_CONSUME)
+-        string(REPLACE "\n" " " patch_file ${patch_file})
+-        string(SHA256 patch_file_hash ${patch_file})
+-        # message("${PATCH}: '${patch_file_hash}'")
+-        string(CONCAT PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH} ${patch_file_hash})
+-        # message("concat is '${PATCHES_ACTUAL_HASH}'")
 -    endforeach()
 -    string(SHA256 PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH})
+-    # message("Desired hash ${PATCHES_DESIRED_HASH}")
+-    # message("Actual hash  ${PATCHES_ACTUAL_HASH}")
 -    if(NOT PATCHES_ACTUAL_HASH EQUAL "${PATCHES_DESIRED_HASH}")
 -        message(FATAL_ERROR "Patch hash actual ${PATCHES_ACTUAL_HASH} does not match desired ${PATCHES_DESIRED_HASH}")
 -    endif()
@@ -88,6 +95,6 @@
 -    message(FATAL_ERROR "Git not found!")
 -endif()
 -
- if (NOT DEFINED LLVM_TARGETS_TO_BUILD)
-   set(LLVM_TARGETS_TO_BUILD X86)
- endif()
+ message("Building targets: ${LLVM_TARGETS_TO_BUILD}")
+ 
+ set(LLVM_ENABLE_BINDINGS OFF)
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/pony-corral.nix b/nixpkgs/pkgs/development/compilers/ponyc/pony-corral.nix
index 43fe247b79fb..1c8b00c13cfc 100644
--- a/nixpkgs/pkgs/development/compilers/ponyc/pony-corral.nix
+++ b/nixpkgs/pkgs/development/compilers/ponyc/pony-corral.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation ( rec {
   pname = "corral";
-  version = "0.5.3";
+  version = "0.5.4";
 
   src = fetchFromGitHub {
     owner = "ponylang";
     repo = pname;
     rev = version;
-    sha256 = "sha256-27J1Y3+tbZK7RX+63xVV2eaX/LF525vBR3Ff9EYDEl0=";
+    sha256 = "1chw56khx5akjxkq0vwrw9ryjpyc3fzdmksh496llc513l01hpkl";
   };
 
   buildInputs = [ ponyc ];
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix b/nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix
deleted file mode 100644
index 8e5810508971..000000000000
--- a/nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix
+++ /dev/null
@@ -1,25 +0,0 @@
-{lib, stdenv, fetchFromGitHub, ponyc }:
-
-stdenv.mkDerivation rec {
-  pname = "pony-stable";
-  version = "0.2.2";
-
-  src = fetchFromGitHub {
-    owner = "ponylang";
-    repo = "pony-stable";
-    rev = version;
-    sha256 = "0nzvsqvl315brp3yb4j5kl82xnkmib4jk416jjc7yrz4k3jgr278";
-  };
-
-  buildInputs = [ ponyc ];
-
-  installFlags = [ "prefix=${placeholder "out"}" "install" ];
-
-  meta = {
-    description = "A simple dependency manager for the Pony language";
-    homepage = "https://www.ponylang.org";
-    license = lib.licenses.bsd2;
-    maintainers = with lib.maintainers; [ dipinhora kamilchm patternspandemic ];
-    platforms = lib.platforms.unix;
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/qbe/default.nix b/nixpkgs/pkgs/development/compilers/qbe/default.nix
index 1751da3e8f30..52397f78b8a0 100644
--- a/nixpkgs/pkgs/development/compilers/qbe/default.nix
+++ b/nixpkgs/pkgs/development/compilers/qbe/default.nix
@@ -6,12 +6,12 @@
 
 stdenv.mkDerivation rec {
   pname = "qbe";
-  version = "unstable-2021-11-22";
+  version = "unstable-2021-12-05";
 
   src = fetchgit {
     url = "git://c9x.me/qbe.git";
-    rev = "bf153b359e9ce3ebef9bca899eb7ed5bd9045c11";
-    sha256 = "sha256-13Mvq4VWZxlye/kncJibCnfSECx4PeHMYLuX0xMkN3A=";
+    rev = "367c8215d99054892740ad74c690b106c45ebf60";
+    sha256 = "sha256-xhTEiFR1RXMHtxmXlRof3O8monXEjstyWP3GClZmMuU=";
   };
 
   makeFlags = [ "PREFIX=$(out)" ];
diff --git a/nixpkgs/pkgs/development/compilers/rust/1_57.nix b/nixpkgs/pkgs/development/compilers/rust/1_58.nix
index f6b9d3c72a32..c854bfdd37a4 100644
--- a/nixpkgs/pkgs/development/compilers/rust/1_57.nix
+++ b/nixpkgs/pkgs/development/compilers/rust/1_58.nix
@@ -20,8 +20,8 @@
 } @ args:
 
 import ./default.nix {
-  rustcVersion = "1.57.0";
-  rustcSha256 = "06jw8ka2p3kls8p0gd4p0chhhb1ia1mlvj96zn78n7qvp71zjiim";
+  rustcVersion = "1.58.1";
+  rustcSha256 = "1iq7kj16qfpkx8gvw50d8rf7glbm6s0pj2y1qkrz7mi56vfsyfd8";
 
   llvmSharedForBuild = pkgsBuildBuild.llvmPackages_13.libllvm.override { enableSharedLibraries = true; };
   llvmSharedForHost = pkgsBuildHost.llvmPackages_13.libllvm.override { enableSharedLibraries = true; };
@@ -37,24 +37,24 @@ import ./default.nix {
 
   # Note: the version MUST be one version prior to the version we're
   # building
-  bootstrapVersion = "1.56.1";
+  bootstrapVersion = "1.57.0";
 
   # fetch hashes by running `print-hashes.sh ${bootstrapVersion}`
   bootstrapHashes = {
-    i686-unknown-linux-gnu = "84db34603ce22d93312ff8bccd5580fe112e932bbeb0361e7cc37668a9803a27";
-    x86_64-unknown-linux-gnu = "a6be5d045183a0b12dddf0d81633e2a64e63e4c2dfa44eb7593970c1ef93a98f";
-    x86_64-unknown-linux-musl = "3c09058d104d9a88943fb343af1fb70422f9c4a987e6703666ee8a8051211190";
-    arm-unknown-linux-gnueabihf = "c445706d109bb74de4c889687ae08a48af5808676fda15b84b7ef5970a82a5f6";
-    armv7-unknown-linux-gnueabihf = "29ec65af502370c0c1a49faecd7131f1243fe3005b419ead4b40b267af2b2db0";
-    aarch64-unknown-linux-gnu = "69792887357c8dd78c5424f0b4a624578296796d99edf6c30ebe2acc2b939aa3";
-    aarch64-unknown-linux-musl = "971d13d41657e50e3ac54f17f52b4198c3d8bc25ec489a6a9e6d12c18226dda5";
-    x86_64-apple-darwin = "8d65ef02a123c23be00101fb204d28b60498b9145dd2ee8edabf0afde6e01e55";
-    aarch64-apple-darwin = "e71c14c1368048a22e4d1851f301872ac2e6f4c574f04d2a7ae4d64b0e7c7235";
-    powerpc64le-unknown-linux-gnu = "fa78b28fe1ef3cd4add9ec151e5eab756dfc83c8bc3e5a576a6eddd350c4de7a";
-    riscv64gc-unknown-linux-gnu = "5ec327d1bd3ba8d00afbe9be4a1f0fb8ab845063fcf9be479be9493c52a4dbb6";
+    i686-unknown-linux-gnu = "7e4ac8ca2874897099a3ceb89039ceee170f474a98ee247589fd6bca8dda7cfa";
+    x86_64-unknown-linux-gnu = "ea0253784b2e5c22659ff148d492a68d2e11da734491714ebc61cc93896efcda";
+    x86_64-unknown-linux-musl = "56876ebca0e46236208c8bd3c3425dba553abe49639e1040ee8b95bc66a45d33";
+    arm-unknown-linux-gnueabihf = "b4448f7a96da4feee99a2c4b16b5738b99ab7e86e22d284ea6f7dca5921bca9b";
+    armv7-unknown-linux-gnueabihf = "577682b1405e8901f971839407daaad06d8ae68ad370305b75d569ba293c4fb4";
+    aarch64-unknown-linux-gnu = "d66847f7cf7b548ecb328c400ac4f691ee2aea6ff5cd9286ad8733239569556c";
+    aarch64-unknown-linux-musl = "91c8e5171e5715261f7f635142a10a9415a4e5ba55374daf76f0b713c8b08132";
+    x86_64-apple-darwin = "15ceffc4743434c19d08f73fb4edd6642b7fd8162ed7101d3e6ca2c691fcb699";
+    aarch64-apple-darwin = "7511075e28b715e2d9c7ee74221779f8444681a4bb60ac3a0270a5fdf08bdd5a";
+    powerpc64le-unknown-linux-gnu = "3ddc1abed6b7535c4150bf54291901fa856806c948bc21b711e24a3c8d810be7";
+    riscv64gc-unknown-linux-gnu = "f809df1c6ac0adc9bd37eb871dfb0d9809f3ed7f61ba611f9305e9eb8f8c9226";
   };
 
-  selectRustPackage = pkgs: pkgs.rust_1_57;
+  selectRustPackage = pkgs: pkgs.rust_1_58;
 
   rustcPatches = [
   ];
diff --git a/nixpkgs/pkgs/development/compilers/rust/clippy.nix b/nixpkgs/pkgs/development/compilers/rust/clippy.nix
index 7ebdaa474ad6..a3597e9febf7 100644
--- a/nixpkgs/pkgs/development/compilers/rust/clippy.nix
+++ b/nixpkgs/pkgs/development/compilers/rust/clippy.nix
@@ -20,10 +20,6 @@ rustPlatform.buildRustPackage {
   #   (/private/tmp/nix-build-clippy-1.36.0.drv-0/rustc-1.36.0-src/src/librustc_llvm)
   doCheck = false;
 
-  preBuild = ''
-    export CARGO_TARGET_DIR="$(pwd)/target"
-  '';
-
   preFixup = lib.optionalString stdenv.isDarwin ''
     install_name_tool -add_rpath "${rustc}/lib" $out/bin/clippy-driver
   '';
diff --git a/nixpkgs/pkgs/development/compilers/rust/rustc.nix b/nixpkgs/pkgs/development/compilers/rust/rustc.nix
index 187127cfbfb3..1087ac059082 100644
--- a/nixpkgs/pkgs/development/compilers/rust/rustc.nix
+++ b/nixpkgs/pkgs/development/compilers/rust/rustc.nix
@@ -100,6 +100,9 @@ in stdenv.mkDerivation rec {
     "${setHost}.musl-root=${pkgsBuildHost.targetPackages.stdenv.cc.libc}"
   ] ++ optionals stdenv.targetPlatform.isMusl [
     "${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}"
+  ] ++ optionals (stdenv.isDarwin && stdenv.isx86_64) [
+    # https://github.com/rust-lang/rust/issues/92173
+    "--set rust.jemalloc"
   ];
 
   # The bootstrap.py will generated a Makefile that then executes the build.
diff --git a/nixpkgs/pkgs/development/compilers/sbcl/common.nix b/nixpkgs/pkgs/development/compilers/sbcl/common.nix
index 9cfb38109f7b..6a3b40066d99 100644
--- a/nixpkgs/pkgs/development/compilers/sbcl/common.nix
+++ b/nixpkgs/pkgs/development/compilers/sbcl/common.nix
@@ -119,7 +119,5 @@ stdenv.mkDerivation rec {
     }
   '');
 
-  meta = sbclBootstrap.meta // {
-    updateWalker = true;
-  };
+  meta = sbclBootstrap.meta;
 }
diff --git a/nixpkgs/pkgs/development/compilers/scala/2.x.nix b/nixpkgs/pkgs/development/compilers/scala/2.x.nix
index f39ab7ed68b6..bac99fd79ac8 100644
--- a/nixpkgs/pkgs/development/compilers/scala/2.x.nix
+++ b/nixpkgs/pkgs/development/compilers/scala/2.x.nix
@@ -26,8 +26,8 @@ let
     };
 
     "2.13" = {
-      version = "2.13.7";
-      sha256 = "FO8WAIeGvHs3E1soS+YkUHcB9lE5bRb9ikijWkvOqU4=";
+      version = "2.13.8";
+      sha256 = "LLMdhGnGUYOfDpyDehqwZVDQMXJnUvVJBr4bneATFM8=";
       pname = "scala_2_13";
     };
   };
diff --git a/nixpkgs/pkgs/development/compilers/swift/default.nix b/nixpkgs/pkgs/development/compilers/swift/default.nix
index b5009195ba7c..e3a9aa2b486c 100644
--- a/nixpkgs/pkgs/development/compilers/swift/default.nix
+++ b/nixpkgs/pkgs/development/compilers/swift/default.nix
@@ -36,26 +36,50 @@
 }:
 
 let
-  version = "5.4.2";
+  # The Swift toolchain script builds projects with separate repos. By convention, some of them share
+  # the same version with the main Swift compiler project per release. We fetch these with
+  # `fetchSwiftRelease`. The rest have their own versions locked to each Swift release, as defined in the
+  # Swift compiler repo:
+  #   utils/update_checkout/update_checkout-config.json.
+  #
+  # ... among projects listed in that file, we provide our own:
+  # - CMake
+  # - ninja
+  # - icu
+  #
+  # ... we'd like to include the following in the future:
+  # - stress-tester
+  # - integration-tests
+
+  versions = {
+    swift = "5.5.3";
+    yams = "4.0.2";
+    argumentParser = "0.4.3";
+    format = "swift-5.5-branch";
+    crypto = "1.1.5";
+  };
 
-  # These dependency versions can be found in utils/update_checkout/update-checkout-config.json.
-  swiftArgumentParserVersion = "0.3.0";
-  yamsVersion = "3.0.1";
-  swiftFormatVersion = "0.50400.0";
+  fetchAppleRepo = { repo, rev, sha256 }:
+    fetchFromGitHub {
+      owner = "apple";
+      inherit repo rev sha256;
+      name = "${repo}-${rev}-src";
+    };
 
   fetchSwiftRelease = { repo, sha256, fetchSubmodules ? false }:
     fetchFromGitHub {
       owner = "apple";
       inherit repo sha256 fetchSubmodules;
-      rev = "swift-${version}-RELEASE";
-      name = "${repo}-${version}-src";
+      rev = "swift-${versions.swift}-RELEASE";
+      name = "${repo}-${versions.swift}-src";
     };
 
-  # Sources based on utils/update_checkout/update_checkout-config.json.
   sources = {
+    # Projects that share `versions.swift` for each release.
+
     swift = fetchSwiftRelease {
       repo = "swift";
-      sha256 = "0qrkqkwpmk312fi12kwwyihin01qb7sphhdz5c6an8j1rjfd9wbv";
+      sha256 = "0ma96sfvwiv2f4qhzrvcwxi9igzd80930gnaw4r7ra4w190cnag7";
     };
     cmark = fetchSwiftRelease {
       repo = "swift-cmark";
@@ -63,75 +87,73 @@ let
     };
     llbuild = fetchSwiftRelease {
       repo = "swift-llbuild";
-      sha256 = "0d7sj5a9b5c1ry2209cpccic5radf9s48sp1lahqzmd1pdx3n7pi";
-    };
-    argumentParser = fetchFromGitHub {
-      owner = "apple";
-      repo = "swift-argument-parser";
-      rev = swiftArgumentParserVersion;
-      sha256 = "15vv7hnffa84142q97dwjcn196p2bg8nfh89d6nnix0i681n1qfd";
-      name = "swift-argument-parser-${swiftArgumentParserVersion}";
+      sha256 = "1xmiv7yp9r9iscx3fc3zdp25mriz134k9ny2rchxzi4kifz8h0zc";
     };
     driver = fetchSwiftRelease {
       repo = "swift-driver";
-      sha256 = "1j08273haqv7786rkwsmw7g103glfwy1d2807490id9lagq3r66z";
+      sha256 = "1pb7fidgdqxzragqkillkv03vdilrwmcx6x2r4czqvdqj37gy6b6";
     };
     toolsSupportCore = fetchSwiftRelease {
       repo = "swift-tools-support-core";
-      sha256 = "07gm28ki4px7xzrplvk9nd1pp5r9nyi87l21i0rcbb3r6wrikxb4";
+      sha256 = "0a63193nycir4lffvmb3ky8cfly5kdr2libki2gx4fn6fxmb3a2f";
     };
     swiftpm = fetchSwiftRelease {
       repo = "swift-package-manager";
-      sha256 = "05linnzlidxamzl3723zhyrfm24pk2cf1x66a3nk0cxgnajw0vzx";
+      sha256 = "0z90mg837jzwh516pypn48r3wsjf0lqymsyigdhgr7j2sgcckrr1";
     };
     syntax = fetchSwiftRelease {
       repo = "swift-syntax";
-      sha256 = "1y9agx9bg037xjhkwc28xm28kjyqydgv21s4ijgy5l51yg1g0daj";
+      sha256 = "0kdgh9a8n28yh12hj8lbz2j66ag83l0lcfyfdg7zdr614zs6i3p1";
     };
-    # TODO: possibly re-add stress-tester.
     corelibsXctest = fetchSwiftRelease {
       repo = "swift-corelibs-xctest";
-      sha256 = "00c68580yr12yxshl0hxyhp8psm15fls3c7iqp52hignyl4v745r";
+      sha256 = "12fp3xzsqwcrmyc55h91d3dm64wn3wln47x2fl7sj0s8cn7q12b3";
     };
     corelibsFoundation = fetchSwiftRelease {
       repo = "swift-corelibs-foundation";
-      sha256 = "1jyadm2lm7hhik8n8wacfiffpdwqsgnilwmcw22qris5s2drj499";
+      sha256 = "06gkdliihl1l86jx5khzwkjmjk45fq290x033rscramzcdxh7d1b";
     };
     corelibsLibdispatch = fetchSwiftRelease {
       repo = "swift-corelibs-libdispatch";
-      sha256 = "1s46c0hrxi42r43ff5f1pq2imb3hs05adfpwfxkilgqyb5svafsp";
+      sha256 = "1bim5x9z9bqfgs6gdm4nlz1zrwl2x7xh4dn6i5md9ygsplr4ibzf";
       fetchSubmodules = true;
     };
-    # TODO: possibly re-add integration-tests.
-    # Linux does not support Xcode playgrounds.
-    # We provide our own ninja.
-    # We provider our own icu.
-    yams = fetchFromGitHub {
-      owner = "jpsim";
-      repo = "Yams";
-      rev = yamsVersion;
-      sha256 = "13md54y7lalrpynrw1s0w5yw6rrjpw46fml9dsk2m3ph1bnlrqrq";
-      name = "Yams-${yamsVersion}";
-    };
-    # We provide our own CMake.
     indexstoreDb = fetchSwiftRelease {
       repo = "indexstore-db";
-      sha256 = "1ap3hiq2jd3cn10d8d674xysq27by878mvq087a80681r8cdivn3";
+      sha256 = "1l1xlzf5kx7x80kf4b7r36glv0jc64d08d1688kmzjq1cfgn6gm2";
     };
     sourcekitLsp = fetchSwiftRelease {
       repo = "sourcekit-lsp";
-      sha256 = "02m9va0lsn2hnwkmgrbgj452sbyaswwmq14lqvxgnb7gssajv4gc";
-    };
-    format = fetchFromGitHub {
-      owner = "apple";
-      repo = "swift-format";
-      rev = swiftFormatVersion;
-      sha256 = "0skmmggsh31f3rnqcrx43178bc7scrjihibnwn68axagasgbqn4k";
-      name = "swift-format-${swiftFormatVersion}-src";
+      sha256 = "00fcmd7x5v62n6ajsc0dmzwz6nzy2p72mcs9w6p90adcx7pffqkn";
     };
     llvmProject = fetchSwiftRelease {
       repo = "llvm-project";
-      sha256 = "166hd9d2i55zj70xjb1qmbblbfyk8hdb2qv974i07j6cvynn30lm";
+      sha256 = "18rn5xg5hpxxsacs0ygjmjpzpc8pq85898kknzc0s0z5m55h45z8";
+    };
+
+    # Projects that have their own versions during each release
+
+    argumentParser = fetchAppleRepo {
+      repo = "swift-argument-parser";
+      rev = "${versions.argumentParser}";
+      sha256 = "1jkq72fphxzsnynjxk72azp0iz5r2ji7adxrz6w1y2a19pgjdqrp";
+    };
+    format = fetchAppleRepo {
+      repo = "swift-format";
+      rev = "${versions.format}";
+      sha256 = "1hg888ps3fk23q2zf6djkvxyk6zndqvwypmy0s800hmnyf0hzgv4";
+    };
+    crypto = fetchAppleRepo {
+      repo = "swift-crypto";
+      rev = "${versions.crypto}";
+      sha256 = "0918pj3x3wgli3bnrjbvpzck2n6qz5n6f4yc5kljky45wd15f34g";
+    };
+    yams = fetchFromGitHub {
+      owner = "jpsim";
+      repo = "Yams";
+      rev = versions.yams;
+      sha256 = "1nk9b7l6m3wwjkl81npl2l1iwpsxaxb9za53jpwwsbbi1h1h4fbi";
+      name = "Yams-${versions.yams}-src";
     };
   };
 
@@ -160,7 +182,7 @@ let
 
 in
 stdenv.mkDerivation {
-  name = "swift-${version}";
+  name = "swift-${versions.swift}";
 
   nativeBuildInputs = [
     autoconf
@@ -207,15 +229,14 @@ stdenv.mkDerivation {
     cp -r ${sources.toolsSupportCore} swift-tools-support-core
     cp -r ${sources.swiftpm} swiftpm
     cp -r ${sources.syntax} swift-syntax
-    # TODO: possibly re-add stress-tester.
     cp -r ${sources.corelibsXctest} swift-corelibs-xctest
     cp -r ${sources.corelibsFoundation} swift-corelibs-foundation
     cp -r ${sources.corelibsLibdispatch} swift-corelibs-libdispatch
-    # TODO: possibly re-add integration-tests.
     cp -r ${sources.yams} yams
     cp -r ${sources.indexstoreDb} indexstore-db
     cp -r ${sources.sourcekitLsp} sourcekit-lsp
     cp -r ${sources.format} swift-format
+    cp -r ${sources.crypto} swift-crypto
     cp -r ${sources.llvmProject} llvm-project
 
     chmod -R u+w .
@@ -378,7 +399,7 @@ stdenv.mkDerivation {
   meta = with lib; {
     description = "The Swift Programming Language";
     homepage = "https://github.com/apple/swift";
-    maintainers = with maintainers; [ dtzWill trepetti ];
+    maintainers = with maintainers; [ dtzWill trepetti dduan ];
     license = licenses.asl20;
     # Swift doesn't support 32-bit Linux, unknown on other platforms.
     platforms = platforms.linux;
diff --git a/nixpkgs/pkgs/development/compilers/teyjus/default.nix b/nixpkgs/pkgs/development/compilers/teyjus/default.nix
index 74ba1866b555..ac1a2f8abd53 100644
--- a/nixpkgs/pkgs/development/compilers/teyjus/default.nix
+++ b/nixpkgs/pkgs/development/compilers/teyjus/default.nix
@@ -1,16 +1,14 @@
-{ lib, stdenv, fetchurl, omake, ocaml, flex, bison }:
+{ lib, stdenv, fetchFromGitHub, omake, ocaml, flex, bison }:
 
-let
-  version = "2.1";
-in
-
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   pname = "teyjus";
-  inherit version;
+  version = "2.1";
 
-  src = fetchurl {
-    url = "https://github.com/teyjus/teyjus/archive/v${version}.tar.gz";
-    sha256 = "0393wpg8v1vvarqy2xh4fdmrwlrl6jaj960kql7cq79mb9p3m269";
+  src = fetchFromGitHub {
+    owner = "teyjus";
+    repo = "teyjus";
+    rev = "v${version}";
+    sha256 = "sha256-nz7jZ+GdF6mZQPzBrVD9K/RtoeuVRuhfs7vej4zDkhg=";
   };
 
   patches = [ ./fix-lex-to-flex.patch ];
diff --git a/nixpkgs/pkgs/development/compilers/tinycc/default.nix b/nixpkgs/pkgs/development/compilers/tinycc/default.nix
index b46dee899a33..9da506900bcd 100644
--- a/nixpkgs/pkgs/development/compilers/tinycc/default.nix
+++ b/nixpkgs/pkgs/development/compilers/tinycc/default.nix
@@ -1,18 +1,26 @@
-{ stdenv, lib, fetchFromRepoOrCz, perl, texinfo, which }:
+{ lib
+, stdenv
+, fetchFromRepoOrCz
+, perl
+, texinfo
+, which
+}:
 
 stdenv.mkDerivation rec {
   pname = "tcc";
-  version = "unstable-2021-10-09";
+  version = "0.9.27+date=2022-01-11";
 
   src = fetchFromRepoOrCz {
     repo = "tinycc";
-    rev = "ca11849ebb88ef4ff87beda46bf5687e22949bd6";
-    sha256 = "sha256-xnUDyTYZxbxUCblACyX73boBhU073VRqSy1SWlWsvIw=";
+    rev = "4e0e9b8f210d69893b306d6b24d2dd615a22f246";
+    hash = "sha256-0BJ5wXsgDLBIvcbq+rL9UQC4NjLHCI9r6sUWF98APPg=";
   };
 
-  nativeBuildInputs = [ perl texinfo which ];
-
-  hardeningDisable = [ "fortify" ];
+  nativeBuildInputs = [
+    perl
+    texinfo
+    which
+  ];
 
   postPatch = ''
     patchShebangs texi2pod.pl
@@ -46,37 +54,39 @@ stdenv.mkDerivation rec {
     install -Dt $out/lib/pkgconfig libtcc.pc -m 444
   '';
 
+  outputs = [ "out" "info" "man" ];
+
   doCheck = true;
   checkTarget = "test";
 
   meta = with lib; {
+    homepage = "https://repo.or.cz/tinycc.git";
     description = "Small, fast, and embeddable C compiler and interpreter";
     longDescription = ''
-      TinyCC (aka TCC) is a small but hyper fast C compiler.  Unlike
-      other C compilers, it is meant to be self-sufficient: you do not
-      need an external assembler or linker because TCC does that for
-      you.
+      TinyCC (aka TCC) is a small but hyper fast C compiler.  Unlike other C
+      compilers, it is meant to be self-sufficient: you do not need an external
+      assembler or linker because TCC does that for you.
 
-      TCC compiles so fast that even for big projects Makefiles may not
-      be necessary.
+      TCC compiles so fast that even for big projects Makefiles may not be
+      necessary.
 
-      TCC not only supports ANSI C, but also most of the new ISO C99
-      standard and many GNU C extensions.
+      TCC not only supports ANSI C, but also most of the new ISO C99 standard
+      and many GNU C extensions.
 
-      TCC can also be used to make C scripts, i.e. pieces of C source
-      that you run as a Perl or Python script.  Compilation is so fast
-      that your script will be as fast as if it was an executable.
+      TCC can also be used to make C scripts, i.e. pieces of C source that you
+      run as a Perl or Python script.  Compilation is so fast that your script
+      will be as fast as if it was an executable.
 
-      TCC can also automatically generate memory and bound checks while
-      allowing all C pointers operations.  TCC can do these checks even
-      if non patched libraries are used.
+      TCC can also automatically generate memory and bound checks while allowing
+      all C pointers operations.  TCC can do these checks even if non patched
+      libraries are used.
 
-      With libtcc, you can use TCC as a backend for dynamic code
-      generation.
+      With libtcc, you can use TCC as a backend for dynamic code generation.
     '';
-    homepage = "https://repo.or.cz/tinycc.git";
     license = licenses.lgpl21Only;
-    platforms = platforms.linux;
-    maintainers = [ maintainers.joachifm ];
+    maintainers = with maintainers; [ joachifm AndersonTorres ];
+    platforms = platforms.unix;
   };
 }
+# TODO: more multiple outputs
+# TODO: self-compilation
diff --git a/nixpkgs/pkgs/development/compilers/tvm/default.nix b/nixpkgs/pkgs/development/compilers/tvm/default.nix
index 2bb8b9d5be30..c148e522015e 100644
--- a/nixpkgs/pkgs/development/compilers/tvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/tvm/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   pname = "tvm";
-  version = "0.7.0";
+  version = "0.8.0";
 
   src = fetchFromGitHub {
     owner = "apache";
     repo = "incubator-tvm";
     rev = "v${version}";
     fetchSubmodules = true;
-    sha256 = "0qflpd3lw0jslyk5lqpv2v42lkqs8mkvnn6i3fdms32iskdfk6p5";
+    sha256 = "sha256-fv2hhPGbr/AbwuN8rAF9PI/QTTqxNgwjYl9arg5GjKY=";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/nixpkgs/pkgs/development/compilers/uasm/default.nix b/nixpkgs/pkgs/development/compilers/uasm/default.nix
new file mode 100644
index 000000000000..f440208e947b
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/uasm/default.nix
@@ -0,0 +1,50 @@
+{ lib, stdenv, fetchFromGitHub, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  pname = "uasm";
+  version = "2.53";
+
+  src = fetchFromGitHub {
+    owner = "Terraspace";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-Aohwrcb/KTKUFFpfmqVDPNjJh1dMYSNnBJ2eFaP20pM=";
+  };
+
+  # https://github.com/Terraspace/UASM/pull/154
+  patches = [
+    # fix `invalid operands to binary - (have 'char *' and 'uint_8 *' {aka 'unsigned char *'})`
+    (fetchpatch {
+      name = "fix_pointers_compare.patch";
+      url = "https://github.com/clouds56/UASM/commit/9cd3a400990e230571e06d4c758bd3bd35f90ab6.patch";
+      sha256 = "sha256-8mY36dn+g2QNJ1JbWt/y4p0Ha9RSABnOE3vlWANuhsA=";
+    })
+    # fix `dbgcv.c:*:*: fatal error: direct.h: No such file or directory`
+    (fetchpatch {
+      name = "fix_build_dbgcv_c_on_unix.patch";
+      url = "https://github.com/clouds56/UASM/commit/806d54cf778246c96dcbe61a4649bf0aebcb0eba.patch";
+      sha256 = "sha256-uc1LaizdYEh1Ry55Cq+6wrCa1OeBPFo74H5iBpmteAE=";
+    })
+  ];
+
+  enableParallelBuilding = true;
+
+  makefile = "gccLinux64.mak";
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dt "$out/bin" -m0755 GccUnixR/uasm
+    install -Dt "$out/share/doc/${pname}" -m0644 {Readme,History}.txt Doc/*
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "http://www.terraspace.co.uk/uasm.html";
+    description = "A free MASM-compatible assembler based on JWasm";
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ thiagokokada ];
+    license = licenses.watcom;
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/unison/default.nix b/nixpkgs/pkgs/development/compilers/unison/default.nix
index 025fc8c3fa7d..d027898cf9d6 100644
--- a/nixpkgs/pkgs/development/compilers/unison/default.nix
+++ b/nixpkgs/pkgs/development/compilers/unison/default.nix
@@ -42,6 +42,6 @@ stdenv.mkDerivation rec {
     homepage = "https://unisonweb.org/";
     license = with licenses; [ mit bsd3 ];
     maintainers = [ maintainers.virusdave ];
-    platforms = [ "x86_64-darwin" "x86_64-linux" ];
+    platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-darwin" ];
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/vala/default.nix b/nixpkgs/pkgs/development/compilers/vala/default.nix
index f446251fd328..17ba5b14214c 100644
--- a/nixpkgs/pkgs/development/compilers/vala/default.nix
+++ b/nixpkgs/pkgs/development/compilers/vala/default.nix
@@ -15,19 +15,7 @@ let
     # header file isn't available at all, but that patch (./gvc-compat.patch)
     # can be shared between all versions of Vala so far.
     graphvizPatch =
-      let
-        fp = { commit, sha256 }: fetchpatch {
-          url = "https://github.com/openembedded/openembedded-core/raw/${commit}/meta/recipes-devtools/vala/vala/disable-graphviz.patch";
-          inherit sha256;
-        };
-
-      in {
-
-        # NOTE: the openembedded-core project doesn't have a patch for 0.40.12
-        # We've fixed the single merge conflict in the following patch.
-        #     0.40.12: https://github.com/openembedded/openembedded-core/raw/8553c52f174af4c8c433c543f806f5ed5c1ec48c/meta/recipes-devtools/vala/vala/disable-graphviz.patch
-        "0.40" = ./disable-graphviz-0.40.12.patch;
-
+      {
         "0.48" = ./disable-graphviz-0.46.1.patch;
 
         "0.52" = ./disable-graphviz-0.46.1.patch;
@@ -98,24 +86,19 @@ let
   });
 
 in rec {
-  vala_0_40 = generic {
-    version = "0.40.25";
-    sha256 = "1pxpack8rrmywlf47v440hc6rv3vi8q9c6niwqnwikxvb2pwf3w7";
-  };
-
   vala_0_48 = generic {
-    version = "0.48.20";
-    sha256 = "sha256-RrHIF/dIUfvMOV/E+eoRlQLPh7kzPMllbhzczAvTN24=";
+    version = "0.48.22";
+    sha256 = "sha256-27NHjEvjZvCTFkrGHNOu29zz5EQE2eNkFK4VEk525os=";
   };
 
   vala_0_52 = generic {
-    version = "0.52.8";
-    sha256 = "sha256-d3t9HLVnFewyJUXQEw5/9Y2eem0b2WtuKX6eYOgRh5M=";
+    version = "0.52.10";
+    sha256 = "sha256-nCAb+BLZh04hveU/jZwU9lF0ixqBRB/1ySkSJESQEAg=";
   };
 
   vala_0_54 = generic {
-    version = "0.54.3";
-    sha256 = "7R1f5MvAzShF0N5PH/77Fa+waJLSMMfMppV4FnLo+2A=";
+    version = "0.54.6";
+    sha256 = "SdYNlqP99sQoc5dEK8bW2Vv0CqffZ47kkSjEsRum5Gk=";
   };
 
   vala = vala_0_54;
diff --git a/nixpkgs/pkgs/development/compilers/vala/disable-graphviz-0.40.12.patch b/nixpkgs/pkgs/development/compilers/vala/disable-graphviz-0.40.12.patch
deleted file mode 100644
index fdc1eabf513e..000000000000
--- a/nixpkgs/pkgs/development/compilers/vala/disable-graphviz-0.40.12.patch
+++ /dev/null
@@ -1,208 +0,0 @@
-diff --git i/configure.ac w/configure.ac
-index 694ffd200..915062053 100644
---- i/configure.ac
-+++ w/configure.ac
-@@ -112,34 +112,38 @@ PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_REQUIRED)
- AC_SUBST(GMODULE_CFLAGS)
- AC_SUBST(GMODULE_LIBS)
- 
--PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
--AC_MSG_CHECKING([for CGRAPH])
--cgraph_tmp_LIBADD="$LIBADD"
--cgraph_tmp_CFLAGS="$CFLAGS"
--LIBADD="$LIBADD $LIBGVC_LIBS"
--CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
--AC_RUN_IFELSE(
--	[AC_LANG_SOURCE([
--		#include <gvc.h>
--
--		int main(void) {
--			#ifdef WITH_CGRAPH
--				return 0;
--			#else
--				return -1;
--			#endif
--		}
--	])], [
--		AC_MSG_RESULT([yes])
--		VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
--		have_cgraph=yes
--	], [
--		AC_MSG_RESULT([no])
--		have_cgraph=no
--	]
--)
--LIBADD="$cgraph_tmp_LIBADD"
--CFLAGS="$cgraph_tmp_CFLAGS"
-+AC_ARG_ENABLE(graphviz, AS_HELP_STRING([--disable-graphviz], [Disable graphviz usage for valadoc]), enable_graphviz=$enableval, enable_graphviz=yes)
-+if test x$enable_graphviz = xyes; then
-+	PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
-+	AC_MSG_CHECKING([for CGRAPH])
-+	VALAFLAGS="$VALAFLAGS -D HAVE_GRAPHVIZ"
-+	cgraph_tmp_LIBADD="$LIBADD"
-+	cgraph_tmp_CFLAGS="$CFLAGS"
-+	LIBADD="$LIBADD $LIBGVC_LIBS"
-+	CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
-+	AC_RUN_IFELSE(
-+		[AC_LANG_SOURCE([
-+			#include <gvc.h>
-+			int main(void) {
-+				#ifdef WITH_CGRAPH
-+					return 0;
-+				#else
-+					return -1;
-+				#endif
-+			}
-+		])], [
-+			AC_MSG_RESULT([yes])
-+			VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
-+			have_cgraph=yes
-+		], [
-+			AC_MSG_RESULT([no])
-+			have_cgraph=no
-+		]
-+	)
-+	LIBADD="$cgraph_tmp_LIBADD"
-+	CFLAGS="$cgraph_tmp_CFLAGS"
-+fi
-+AM_CONDITIONAL(ENABLE_GRAPHVIZ, test x$enable_graphviz = xyes)
- AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes")
- 
- AC_PATH_PROG([XSLTPROC], [xsltproc], :)
-diff --git i/libvaladoc/Makefile.am w/libvaladoc/Makefile.am
-index f3f790e76..3c5dc4c80 100644
---- i/libvaladoc/Makefile.am
-+++ w/libvaladoc/Makefile.am
-@@ -128,10 +128,6 @@ libvaladoc_la_VALASOURCES = \
- 	content/tablerow.vala \
- 	content/taglet.vala \
- 	content/text.vala \
--	charts/chart.vala \
--	charts/chartfactory.vala \
--	charts/hierarchychart.vala \
--	charts/simplechartfactory.vala \
- 	parser/manyrule.vala \
- 	parser/oneofrule.vala \
- 	parser/optionalrule.vala \
-@@ -158,13 +154,24 @@ libvaladoc_la_VALASOURCES = \
- 	highlighter/codetoken.vala \
- 	highlighter/highlighter.vala \
- 	html/basicdoclet.vala \
--	html/htmlchartfactory.vala \
- 	html/linkhelper.vala \
- 	html/cssclassresolver.vala \
- 	html/htmlmarkupwriter.vala \
- 	html/htmlrenderer.vala \
- 	$(NULL)
- 
-+if ENABLE_GRAPHVIZ
-+libvaladoc_la_VALASOURCES += \
-+	charts/chart.vala \
-+	charts/chartfactory.vala \
-+	charts/hierarchychart.vala \
-+	charts/simplechartfactory.vala \
-+	html/htmlchartfactory.vala \
-+	$(NULL)
-+
-+LIBGVC_PKG = --vapidir $(top_srcdir)/vapi --pkg libgvc
-+endif
-+
- libvaladoc@PACKAGE_SUFFIX@_la_SOURCES = \
- 	libvaladoc.vala.stamp \
- 	$(libvaladoc_la_VALASOURCES:.vala=.c) \
-@@ -184,11 +191,11 @@ libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES)
- 		--library valadoc \
- 		--vapi valadoc@PACKAGE_SUFFIX@.vapi \
- 		--vapidir $(top_srcdir)/vapi --pkg gmodule-2.0 \
--		--vapidir $(top_srcdir)/vapi --pkg libgvc \
- 		--vapidir $(top_srcdir)/gee --pkg gee \
- 		--vapidir $(top_srcdir)/vala --pkg vala \
- 		--vapidir $(top_srcdir)/ccode --pkg ccode \
- 		--vapidir $(top_srcdir)/codegen --pkg codegen \
-+		$(LIBGVC_PKG) \
- 		--pkg config \
- 		$(filter %.vala %.c,$^)
- 	touch $@
-@@ -217,6 +224,9 @@ nodist_pkgconfig_DATA = valadoc@PACKAGE_SUFFIX@.pc
- 
- valadoc@PACKAGE_SUFFIX@.pc: valadoc.pc
- 	cp $< $@
-+if !ENABLE_GRAPHVIZ
-+	sed -i "s/libgvc //g" $@
-+endif
- 
- vapidir = $(datadir)/vala/vapi
- dist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.vapi
-@@ -224,6 +234,9 @@ nodist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.deps
- 
- valadoc@PACKAGE_SUFFIX@.deps: valadoc.deps
- 	cp $< $@
-+if !ENABLE_GRAPHVIZ
-+	sed -i "s/libgvc//g" $@
-+endif
- 
- EXTRA_DIST = \
- 	$(libvaladoc_la_VALASOURCES) \
-diff --git i/libvaladoc/html/basicdoclet.vala w/libvaladoc/html/basicdoclet.vala
-index 192e488cd..ec0960222 100644
---- i/libvaladoc/html/basicdoclet.vala
-+++ w/libvaladoc/html/basicdoclet.vala
-@@ -46,7 +46,11 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
- 	protected HtmlRenderer _renderer;
- 	protected Html.MarkupWriter writer;
- 	protected Html.CssClassResolver cssresolver;
-+#if HAVE_GRAPHVIZ
- 	protected Charts.Factory image_factory;
-+#else
-+	protected void* image_factory;
-+#endif
- 	protected ErrorReporter reporter;
- 	protected string package_list_link = "../index.html";
- 
-@@ -120,7 +124,9 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
- 		this.linker = new LinkHelper ();
- 
- 		_renderer = new HtmlRenderer (settings, this.linker, this.cssresolver);
-+#if HAVE_GRAPHVIZ
- 		this.image_factory = new SimpleChartFactory (settings, linker);
-+#endif
- 	}
- 
- 
-@@ -1026,6 +1032,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
- 	}
- 
- 	protected void write_image_block (Api.Node element) {
-+#if HAVE_GRAPHVIZ
- 		if (element is Class || element is Interface || element is Struct) {
- 			unowned string format = (settings.use_svg_images ? "svg" : "png");
- 			var chart = new Charts.Hierarchy (image_factory, element);
-@@ -1045,6 +1052,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
- 									   this.get_img_path_html (element, format)});
- 			writer.add_usemap (chart);
- 		}
-+#endif
- 	}
- 
- 	public void write_namespace_content (Namespace node, Api.Node? parent) {
-diff --git i/libvaladoc/html/htmlmarkupwriter.vala w/libvaladoc/html/htmlmarkupwriter.vala
-index dcc4dad76..cf9c860b8 100644
---- i/libvaladoc/html/htmlmarkupwriter.vala
-+++ w/libvaladoc/html/htmlmarkupwriter.vala
-@@ -51,12 +51,16 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter {
- 		}
- 	}
- 
-+#if HAVE_GRAPHVIZ
- 	public MarkupWriter add_usemap (Charts.Chart chart) {
- 		string? buf = (string?) chart.write_buffer ("cmapx");
- 		if (buf != null) {
- 			raw_text ("\n");
- 			raw_text ((!) buf);
- 		}
-+#else
-+	public MarkupWriter add_usemap (void* chart) {
-+#endif
- 
- 		return this;
- 	}
diff --git a/nixpkgs/pkgs/development/compilers/vyper/default.nix b/nixpkgs/pkgs/development/compilers/vyper/default.nix
index 4308710717ac..e4ad7fe5f7f9 100644
--- a/nixpkgs/pkgs/development/compilers/vyper/default.nix
+++ b/nixpkgs/pkgs/development/compilers/vyper/default.nix
@@ -1,6 +1,6 @@
 { lib, buildPythonPackage, fetchPypi, writeText, asttokens
 , pycryptodome, pytest-xdist, pytest-cov, recommonmark, semantic-version, sphinx
-, sphinx_rtd_theme, pytest-runner }:
+, sphinx_rtd_theme, pytest-runner, setuptools-scm }:
 
 let
   sample-contract = writeText "example.vy" ''
@@ -14,22 +14,14 @@ in
 
 buildPythonPackage rec {
   pname = "vyper";
-  version = "0.3.0";
+  version = "0.3.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "3e50cd802696ea3f5e6ab1bf4c9a90a39c332591d416c99f3d2fa93d7d7ba394";
+    sha256 = "sha256-fXug5v3zstz19uexMWokHBVsfcl2ZCdIOIXKeLVyh/Q=";
   };
 
-  nativeBuildInputs = [ pytest-runner ];
-
-  # Replace the dynamic commit hash lookup with the hash from the tag
-  postPatch = ''
-    substituteInPlace setup.py \
-      --replace 'asttokens==' 'asttokens>=' \
-      --replace 'subprocess.check_output("git rev-parse HEAD".split())' "' '" \
-      --replace 'commithash.decode("utf-8").strip()' "'6e7dba7a8b5f29762d3470da4f44634b819c808d'"
-  '';
+  nativeBuildInputs = [ pytest-runner setuptools-scm ];
 
   propagatedBuildInputs = [
     asttokens
diff --git a/nixpkgs/pkgs/development/compilers/xa/xa.nix b/nixpkgs/pkgs/development/compilers/xa/xa.nix
index dbeabe97b1aa..08f31148d4c5 100644
--- a/nixpkgs/pkgs/development/compilers/xa/xa.nix
+++ b/nixpkgs/pkgs/development/compilers/xa/xa.nix
@@ -6,14 +6,14 @@
 
 stdenv.mkDerivation rec {
   pname = "xa";
-  version = "2.3.11";
+  version = "2.3.12";
 
   src = fetchurl {
     urls = [
       "https://www.floodgap.com/retrotech/xa/dists/${pname}-${version}.tar.gz"
       "https://www.floodgap.com/retrotech/xa/dists/unsupported/${pname}-${version}.tar.gz"
     ];
-    hash = "sha256-MvIWTJnjBSGOmSlwhW3Y4jCbXLasR1jXsq/jv+vJAS0=";
+    hash = "sha256-+P0VNgEtZ2/Gy/zdapF5PlZMibbvdH+NuPRnwXj7BwQ=";
   };
 
   checkInputs = [ perl ];
diff --git a/nixpkgs/pkgs/development/compilers/yasm/default.nix b/nixpkgs/pkgs/development/compilers/yasm/default.nix
index b770f3b7dfdb..58b8252729a7 100644
--- a/nixpkgs/pkgs/development/compilers/yasm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/yasm/default.nix
@@ -1,4 +1,4 @@
-{lib, stdenv, fetchurl}:
+{lib, stdenv, fetchurl, buildPackages}:
 
 stdenv.mkDerivation rec {
   pname = "yasm";
@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
     sha256 = "0gv0slmm0qpq91za3v2v9glff3il594x5xsrbgab7xcmnh0ndkix";
   };
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
   meta = with lib; {
     homepage = "http://www.tortall.net/projects/yasm/";
     description = "Complete rewrite of the NASM assembler";
diff --git a/nixpkgs/pkgs/development/compilers/yosys/default.nix b/nixpkgs/pkgs/development/compilers/yosys/default.nix
index 9c3d9179f7ba..30b9b8393987 100644
--- a/nixpkgs/pkgs/development/compilers/yosys/default.nix
+++ b/nixpkgs/pkgs/development/compilers/yosys/default.nix
@@ -6,13 +6,19 @@
 , fetchFromGitHub
 , flex
 , libffi
+, makeWrapper
 , pkg-config
 , protobuf
 , python3
 , readline
+, symlinkJoin
 , tcl
 , verilog
 , zlib
+, yosys
+, yosys-bluespec
+, yosys-ghdl
+, yosys-symbiflow
 }:
 
 # NOTE: as of late 2020, yosys has switched to an automation robot that
@@ -32,15 +38,47 @@
 # yosys version number helps users report better bugs upstream, and is
 # ultimately less confusing than using dates.
 
-stdenv.mkDerivation rec {
+let
+
+  # Provides a wrapper for creating a yosys with the specifed plugins preloaded
+  #
+  # Example:
+  #
+  #     my_yosys = yosys.withPlugins (with yosys.allPlugins; [
+  #        fasm
+  #        bluespec
+  #     ]);
+  withPlugins = plugins:
+    let
+      paths = lib.closePropagation plugins;
+      module_flags = with builtins; concatStringsSep " "
+        (map (n: "--add-flags -m --add-flags ${n.plugin}") plugins);
+    in lib.appendToName "with-plugins" ( symlinkJoin {
+      inherit (yosys) name;
+      paths = paths ++ [ yosys ] ;
+      buildInputs = [ makeWrapper ];
+      postBuild = ''
+        wrapProgram $out/bin/yosys \
+          --set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins \
+          ${module_flags}
+      '';
+    });
+
+  allPlugins = {
+    bluespec = yosys-bluespec;
+    ghdl     = yosys-ghdl;
+  } // (yosys-symbiflow);
+
+
+in stdenv.mkDerivation rec {
   pname   = "yosys";
-  version = "0.12+36";
+  version = "0.12+54";
 
   src = fetchFromGitHub {
     owner = "YosysHQ";
     repo  = "yosys";
-    rev   = "60c3ea367c942459a95e610ed98f277ce46c0142";
-    hash  = "sha256-NcfhNUmb3IDG08XgS+NGbRLI8sn4aQkOA7RF7wucDug=";
+    rev   = "59a71503448401d2476cf0872808e0a99c3a4d81";
+    hash  = "sha256-cz4PQymaA9UW91lN+6iniFhbcPRpFNIAeC8ZkwYeg0U=";
   };
 
   enableParallelBuilding = true;
@@ -78,7 +116,7 @@ stdenv.mkDerivation rec {
     fi
 
     if ! grep -q "YOSYS_VER := $version" Makefile; then
-      echo "ERROR: yosys version in Makefile isn't equivalent to version of the nix package (${version}), failing."
+      echo "ERROR: yosys version in Makefile isn't equivalent to version of the nix package (allegedly ${version}), failing."
       exit 1
     fi
   '';
@@ -99,6 +137,10 @@ stdenv.mkDerivation rec {
 
   setupHook = ./setup-hook.sh;
 
+  passthru = {
+    inherit withPlugins allPlugins;
+  };
+
   meta = with lib; {
     description = "Open RTL synthesis framework and tools";
     homepage    = "http://www.clifford.at/yosys/";
diff --git a/nixpkgs/pkgs/development/compilers/yosys/plugins/bluespec.nix b/nixpkgs/pkgs/development/compilers/yosys/plugins/bluespec.nix
index 6e436cd0043b..77d4ad8cf9dc 100644
--- a/nixpkgs/pkgs/development/compilers/yosys/plugins/bluespec.nix
+++ b/nixpkgs/pkgs/development/compilers/yosys/plugins/bluespec.nix
@@ -4,13 +4,14 @@
 
 stdenv.mkDerivation {
   pname = "yosys-bluespec";
-  version = "2021.08.19";
+  version = "2021.09.08";
+  plugin = "bluespec";
 
   src = fetchFromGitHub {
     owner  = "thoughtpolice";
     repo   = "yosys-bluespec";
-    rev    = "bcea1635c97747acd3bcb5b8f1968b3f57ae62bc";
-    sha256 = "0ipx9yjngs3haksdb440wlydviszwqnxgzynpp7yic2x3ai7i8m1";
+    rev    = "f6f4127a4e96e18080fd5362b6769fa3e24c76b1";
+    sha256 = "sha256-3cNFP/k4JsgLyUQHWU10Htl2Rh0staAcA3R4piD6hDE=";
   };
 
   buildInputs = [ yosys readline zlib bluespec ];
diff --git a/nixpkgs/pkgs/development/compilers/yosys/plugins/ghdl.nix b/nixpkgs/pkgs/development/compilers/yosys/plugins/ghdl.nix
index 35f3ef2bcc88..0999f5ab34be 100644
--- a/nixpkgs/pkgs/development/compilers/yosys/plugins/ghdl.nix
+++ b/nixpkgs/pkgs/development/compilers/yosys/plugins/ghdl.nix
@@ -5,6 +5,7 @@
 stdenv.mkDerivation {
   pname = "yosys-ghdl";
   version = "2021.01.25";
+  plugin = "ghdl";
 
   src = fetchFromGitHub {
     owner  = "ghdl";
diff --git a/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch b/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch
new file mode 100644
index 000000000000..8af0f86a89b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch
@@ -0,0 +1,15 @@
+diff --git a/yql-qlf-plugin/Makefile b/ql-qlf-plugin/Makefile
+index 2819055c9fe..0e391581012 100644
+--- a/ql-qlf-plugin/Makefile
++++ b/ql-qlf-plugin/Makefile
+@@ -55,10 +55,6 @@ VERILOG_MODULES = $(COMMON)/cells_sim.v         \
+                   $(PP3_DIR)/mult_sim.v        \
+                   $(PP3_DIR)/qlal3_sim.v       \
+
+-retrieve-pmgen:=$(shell mkdir -p pmgen && wget -nc -O pmgen/pmgen.py https://raw.githubusercontent.com/SymbiFlow/yosys/master%2Bwip/passes/pmgen/pmgen.py)
+-
+-pre-build:=$(shell python3 pmgen/pmgen.py -o pmgen/ql-dsp-pm.h -p ql_dsp ql_dsp.pmg)
+-
+ install_modules: $(VERILOG_MODULES)
+ 	$(foreach f,$^,install -D $(f) $(DATA_DIR)/quicklogic/$(f);)
+
diff --git a/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix b/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix
new file mode 100644
index 000000000000..cecc1bee9219
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix
@@ -0,0 +1,106 @@
+{ fetchFromGitHub
+, gtest
+, lib
+, python3
+, readline
+, stdenv
+, which
+, yosys
+, zlib
+, yosys-symbiflow
+}: let
+
+  src = fetchFromGitHub {
+    owner  = "SymbiFlow";
+    repo   = "yosys-symbiflow-plugins";
+    rev    = "35c6c33811a8de7c80dff6a7bcf7aa6ec9b21233";
+    hash   = "sha256-g5dX9+R+gWt8e7Bhbbg60O9qa+Vi6Ar0M1sHhYlAre8=";
+  };
+
+  version = "2022.01.06";
+
+  # Supported symbiflow plugins.
+  #
+  # The following are disabled:
+  #
+  # "ql-qlf" builds but fails to load the plugin, so is not currently supported.
+  #
+  # "UHDM" doesn't currently build, as the work to package UHDM and surelog has
+  # not (yet) been undertaken.
+  plugins = [
+    "design_introspection"
+    "fasm"
+    "integrateinv"
+    "params"
+    "ql-iob"
+    # "ql-qlf"
+    "sdc"
+    "xdc"
+    # "UHDM"
+  ];
+
+  static_gtest = gtest.dev.overrideAttrs (old: {
+    dontDisableStatic = true;
+    disableHardening = [ "pie" ];
+    cmakeFlags = old.cmakeFlags ++ ["-DBUILD_SHARED_LIBS=OFF"];
+  });
+
+in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec {
+  pname = "yosys-symbiflow-${plugin}-plugin";
+  inherit src version plugin;
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ which python3 ];
+  buildInputs = [ yosys readline zlib ] ;
+
+  # xdc has an incorrect path to a test which has yet to be patched
+  doCheck = plugin != "xdc";
+  checkInputs = [ static_gtest ];
+
+  # ql-qlf tries to fetch a yosys script from github
+  # Run the script in preBuild instead.
+  patches = lib.optional ( plugin == "ql-qlf" ) ./symbiflow-pmgen.patch;
+
+  preBuild = ''
+    mkdir -p ql-qlf-plugin/pmgen
+  ''
+  + lib.optionalString ( plugin == "ql-qlf" ) ''
+    python3 ${yosys.src}/passes/pmgen/pmgen.py -o ql-qlf-plugin/pmgen/ql-dsp-pm.h -p ql_dsp ql-qlf-plugin/ql_dsp.pmg
+  '';
+
+  # Providing a symlink avoids the need for patching the test makefile
+  postUnpack = ''
+    mkdir -p source/third_party/googletest/googletest/build/
+    ln -s ${static_gtest}/lib source/third_party/googletest/googletest/build/lib
+  '';
+
+  makeFlags = [
+    "PLUGIN_LIST=${plugin}"
+  ];
+
+  buildFlags = [
+    "PLUGINS_DIR=\${out}/share/yosys/plugins/"
+    "DATA_DIR=\${out}/share/yosys/"
+  ];
+
+  checkFlags = [
+    "PLUGINS_DIR=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
+    "DATA_DIR=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
+    ( "NIX_YOSYS_PLUGIN_DIRS=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
+      # sdc and xdc plugins use design introspection for their tests
+      + (lib.optionalString ( plugin == "sdc" || plugin == "xdc" )
+        ":${yosys-symbiflow.design_introspection}/share/yosys/plugins/")
+    )
+  ];
+
+  installFlags = buildFlags;
+
+  meta = with lib; {
+    description = "Symbiflow ${plugin} plugin for Yosys";
+    license     = licenses.isc;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ ollieB thoughtpolice ];
+  };
+}))
+
+
diff --git a/nixpkgs/pkgs/development/compilers/zig/default.nix b/nixpkgs/pkgs/development/compilers/zig/default.nix
index d4eb57815a80..a2cd8f44ce28 100644
--- a/nixpkgs/pkgs/development/compilers/zig/default.nix
+++ b/nixpkgs/pkgs/development/compilers/zig/default.nix
@@ -11,19 +11,20 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "zig";
-  version = "0.9.0";
+  version = "0.9.1";
 
   src = fetchFromGitHub {
     owner = "ziglang";
     repo = pname;
     rev = version;
-    hash = "sha256-Hfl1KKtGcopMrn+U9r0/qr/wReWJIgb8+IgwMoguv/0=";
+    hash = "sha256-x2c4c9RSrNWGqEngio4ArW7dJjW0gg+8nqBwPcR721k=";
   };
 
   nativeBuildInputs = [
     cmake
     llvmPackages.llvm.dev
   ];
+
   buildInputs = [
     libxml2
     zlib
diff --git a/nixpkgs/pkgs/development/compilers/zulu/default.nix b/nixpkgs/pkgs/development/compilers/zulu/default.nix
index dee1a4527607..662d997d8828 100644
--- a/nixpkgs/pkgs/development/compilers/zulu/default.nix
+++ b/nixpkgs/pkgs/development/compilers/zulu/default.nix
@@ -22,11 +22,11 @@
 }:
 
 let
-  version = "11.50.19";
-  openjdk = "11.0.12";
+  version = "11.52.13";
+  openjdk = "11.0.13";
 
-  sha256_linux = "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3";
-  sha256_darwin = "9bc6874932f7f88d0a48220d3200449ddf7dc5c0e82af2df2738bc13d21b0e4e";
+  sha256_linux = "77a126669b26b3a89e0117b0f28cddfcd24fcd7699b2c1d35f921487148b9a9f";
+  sha256_darwin = "a96f9f859350f977319ebb5c2a999c182ab6b99b24c60e19d97c54367868a63e";
 
   platform = if stdenv.isDarwin then "macosx" else "linux";
   hash = if stdenv.isDarwin then sha256_darwin else sha256_linux;