about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/ccl/default.nix2
-rw-r--r--pkgs/development/compilers/cmucl/binary.nix80
-rw-r--r--pkgs/development/compilers/dmd/default.nix2
-rw-r--r--pkgs/development/compilers/edk2/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/10/default.nix9
-rw-r--r--pkgs/development/compilers/gcc/11/default.nix9
-rw-r--r--pkgs/development/compilers/gcc/12/default.nix10
-rw-r--r--pkgs/development/compilers/gforth/boot-forth.nix2
-rw-r--r--pkgs/development/compilers/ghdl/default.nix2
-rw-r--r--pkgs/development/compilers/go/1.18.nix4
-rw-r--r--pkgs/development/compilers/idris2/default.nix2
-rw-r--r--pkgs/development/compilers/idris2/tests.nix2
-rw-r--r--pkgs/development/compilers/llvm/10/compiler-rt/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/10/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/10/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/11/compiler-rt/default.nix14
-rw-r--r--pkgs/development/compilers/llvm/11/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/11/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/12/compiler-rt/default.nix13
-rw-r--r--pkgs/development/compilers/llvm/12/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/12/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/13/compiler-rt/default.nix17
-rw-r--r--pkgs/development/compilers/llvm/13/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/14/clang/add-nostdlibinc-flag.patch18
-rw-r--r--pkgs/development/compilers/llvm/14/clang/default.nix5
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/default.nix17
-rw-r--r--pkgs/development/compilers/llvm/14/libcxxabi/default.nix13
-rw-r--r--pkgs/development/compilers/llvm/5/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/6/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/7/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/8/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/8/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/9/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/9/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/common/compiler-rt/darwin-plistbuddy-workaround.patch25
-rw-r--r--pkgs/development/compilers/llvm/git/clang/add-nostdlibinc-flag.patch18
-rw-r--r--pkgs/development/compilers/llvm/git/clang/default.nix5
-rw-r--r--pkgs/development/compilers/llvm/git/compiler-rt/default.nix15
-rw-r--r--pkgs/development/compilers/llvm/git/libcxxabi/default.nix12
-rw-r--r--pkgs/development/compilers/llvm/rocm/llvm.nix3
-rw-r--r--pkgs/development/compilers/manticore/default.nix2
-rw-r--r--pkgs/development/compilers/mkcl/default.nix2
-rw-r--r--pkgs/development/compilers/nim/default.nix3
-rw-r--r--pkgs/development/compilers/ocaml/5.0.nix9
-rw-r--r--pkgs/development/compilers/ocaml/generic.nix1
-rw-r--r--pkgs/development/compilers/orc/default.nix2
-rw-r--r--pkgs/development/compilers/p4c/default.nix4
-rw-r--r--pkgs/development/compilers/rust/binary.nix6
-rw-r--r--pkgs/development/compilers/sbcl/2.0.8.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.0.9.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.1.1.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.1.10.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.1.11.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.1.2.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.1.9.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.2.4.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.2.6.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.x.nix (renamed from pkgs/development/compilers/sbcl/common.nix)54
-rw-r--r--pkgs/development/compilers/sbcl/bootstrap.nix6
-rw-r--r--pkgs/development/compilers/swi-prolog/default.nix4
-rw-r--r--pkgs/development/compilers/swift/default.nix2
61 files changed, 396 insertions, 158 deletions
diff --git a/pkgs/development/compilers/ccl/default.nix b/pkgs/development/compilers/ccl/default.nix
index a17088e015daf..89c6b784b4589 100644
--- a/pkgs/development/compilers/ccl/default.nix
+++ b/pkgs/development/compilers/ccl/default.nix
@@ -119,7 +119,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Clozure Common Lisp";
     homepage    = "https://ccl.clozure.com/";
-    maintainers = with maintainers; [ raskin tohl ];
+    maintainers = with maintainers; [ raskin ];
     platforms   = attrNames options;
     # assembler failures during build, x86_64-darwin broken since 2020-10-14
     broken      = (stdenv.isDarwin && stdenv.isx86_64);
diff --git a/pkgs/development/compilers/cmucl/binary.nix b/pkgs/development/compilers/cmucl/binary.nix
index b09f5f41b67a5..fb0f8b2ce2c8a 100644
--- a/pkgs/development/compilers/cmucl/binary.nix
+++ b/pkgs/development/compilers/cmucl/binary.nix
@@ -1,44 +1,62 @@
-{lib, stdenv, fetchurl}:
-
-let
-  inherit (stdenv.hostPlatform) system;
-  version = "21b";
-  downloadUrl = arch:
-    "http://common-lisp.net/project/cmucl/downloads/release/" +
-    "${version}/cmucl-${version}-${arch}.tar.bz2";
-  fetchDist = {arch, sha256}: fetchurl {
-    url = downloadUrl arch;
-    inherit sha256;
-  };
-  dist =
-    if system == "i686-linux" then fetchDist {
-        arch = "x86-linux";
-        sha256 = "13k3b5ygnbsq6n2i3r5i4ljw3r1qlskn2p5f4x9hrx6vfvbb3k7a";
-      }
-    else throw "Unsupported platform for cmucl.";
-in
-
-stdenv.mkDerivation {
+{ lib
+, stdenv
+, fetchurl
+, installShellFiles
+}:
+
+stdenv.mkDerivation (finalAttrs: {
   pname = "cmucl-binary";
-  inherit version;
+  version = "21d";
+
+  srcs = [
+    (fetchurl {
+      url = "http://common-lisp.net/project/cmucl/downloads/release/"
+            + finalAttrs.version + "/cmucl-${finalAttrs.version}-x86-linux.tar.bz2";
+      hash = "sha256-RdctcqPTtQh1Yb3BrpQ8jtRFQn85OcwOt1l90H6xDZs=";
+    })
+    (fetchurl {
+      url = "http://common-lisp.net/project/cmucl/downloads/release/"
+            + finalAttrs.version + "/cmucl-${finalAttrs.version}-x86-linux.extra.tar.bz2";
+      hash = "sha256-zEmiW3m5VPpFgPxV1WJNCqgYRlHMovtaMXcgXyNukls=";
+    })];
+
+  sourceRoot = ".";
+
+  outputs = [ "out" "doc" "man" ];
+
+  nativeBuildInputs = [
+    installShellFiles
+  ];
+
+  dontConfigure = true;
+  dontBuild = true;
 
-  buildCommand = ''
-    mkdir -p $out
-    tar -C $out -xjf ${dist}
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -pv $out $doc/share $man
+    mv bin lib -t $out
+    mv -v doc -t $doc/share
+    installManPage man/man1/*
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
     patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
       $out/bin/lisp
   '';
 
-  meta = {
+  meta = with lib; {
+    homepage = "http://www.cons.org/cmucl/";
     description = "The CMU implementation of Common Lisp";
     longDescription = ''
       CMUCL is a free implementation of the Common Lisp programming language
       which runs on most major Unix platforms.  It mainly conforms to the
       ANSI Common Lisp standard.
     '';
-    license = lib.licenses.free;		# public domain
-    homepage = "http://www.cons.org/cmucl/";
-    maintainers = [lib.maintainers.tohl];
-    platforms = lib.platforms.linux;
+    license = licenses.publicDomain;
+    maintainers = [ ];
+    platforms = [ "i686-linux" "x86_64-linux" ];
   };
-}
+})
diff --git a/pkgs/development/compilers/dmd/default.nix b/pkgs/development/compilers/dmd/default.nix
index 1c15e8b970b70..b29190b9b8342 100644
--- a/pkgs/development/compilers/dmd/default.nix
+++ b/pkgs/development/compilers/dmd/default.nix
@@ -129,7 +129,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ makeWrapper unzip which git ];
 
   buildInputs = [ gdb curl tzdata ]
-    ++ lib.optional stdenv.isDarwin [ Foundation gdb ];
+    ++ lib.optionals stdenv.isDarwin [ Foundation gdb ];
 
 
   osname = if stdenv.isDarwin then
diff --git a/pkgs/development/compilers/edk2/default.nix b/pkgs/development/compilers/edk2/default.nix
index 90e570f7da408..d516014048684 100644
--- a/pkgs/development/compilers/edk2/default.nix
+++ b/pkgs/development/compilers/edk2/default.nix
@@ -61,7 +61,7 @@ edk2 = buildStdenv.mkDerivation {
   ${"GCC5_${targetArch}_PREFIX"}=stdenv.cc.targetPrefix;
 
   makeFlags = [ "-C BaseTools" ]
-    ++ lib.optional (stdenv.cc.isClang) [ "BUILD_CC=clang BUILD_CXX=clang++ BUILD_AS=clang" ];
+    ++ lib.optionals (stdenv.cc.isClang) [ "BUILD_CC=clang BUILD_CXX=clang++ BUILD_AS=clang" ];
 
   NIX_CFLAGS_COMPILE = "-Wno-return-type" + lib.optionalString (stdenv.cc.isGNU) " -Wno-error=stringop-truncation";
 
diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix
index 78728c3c592b0..207860b90c0ec 100644
--- a/pkgs/development/compilers/gcc/10/default.nix
+++ b/pkgs/development/compilers/gcc/10/default.nix
@@ -26,6 +26,7 @@
 , gnused ? null
 , cloog # unused; just for compat with gcc4, as we override the parameter on some places
 , buildPackages
+, libxcrypt
 }:
 
 # Make sure we get GNU sed.
@@ -172,7 +173,7 @@ stdenv.mkDerivation ({
     ++ optional targetPlatform.isLinux patchelf;
 
   buildInputs = [
-    gmp mpfr libmpc
+    gmp mpfr libmpc libxcrypt
     targetPackages.stdenv.cc.bintools # For linking code at run-time
   ] ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
@@ -182,10 +183,12 @@ stdenv.mkDerivation ({
 
   NIX_LDFLAGS = lib.optionalString  hostPlatform.isSunOS "-lm -ldl";
 
-  preConfigure = import ../common/pre-configure.nix {
+  preConfigure = (import ../common/pre-configure.nix {
     inherit lib;
     inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
-  };
+  }) + ''
+    ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
+  '';
 
   dontDisableStatic = true;
 
diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix
index 3a61c5820b111..3b03e185dd86f 100644
--- a/pkgs/development/compilers/gcc/11/default.nix
+++ b/pkgs/development/compilers/gcc/11/default.nix
@@ -26,6 +26,7 @@
 , gnused ? null
 , cloog # unused; just for compat with gcc4, as we override the parameter on some places
 , buildPackages
+, libxcrypt
 }:
 
 # Make sure we get GNU sed.
@@ -180,7 +181,7 @@ stdenv.mkDerivation ({
     ++ optional targetPlatform.isLinux patchelf;
 
   buildInputs = [
-    gmp mpfr libmpc
+    gmp mpfr libmpc libxcrypt
     targetPackages.stdenv.cc.bintools # For linking code at run-time
   ] ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
@@ -190,10 +191,12 @@ stdenv.mkDerivation ({
 
   NIX_LDFLAGS = lib.optionalString  hostPlatform.isSunOS "-lm -ldl";
 
-  preConfigure = import ../common/pre-configure.nix {
+  preConfigure = (import ../common/pre-configure.nix {
     inherit lib;
     inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
-  };
+  }) + ''
+    ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
+  '';
 
   dontDisableStatic = true;
 
diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix
index 10ce704382a79..c7fcd5475ade6 100644
--- a/pkgs/development/compilers/gcc/12/default.nix
+++ b/pkgs/development/compilers/gcc/12/default.nix
@@ -26,6 +26,7 @@
 , gnused ? null
 , cloog # unused; just for compat with gcc4, as we override the parameter on some places
 , buildPackages
+, libxcrypt
 }:
 
 # Make sure we get GNU sed.
@@ -173,7 +174,7 @@ stdenv.mkDerivation ({
     ++ optional targetPlatform.isLinux patchelf;
 
   buildInputs = [
-    gmp mpfr libmpc
+    gmp mpfr libmpc libxcrypt
     targetPackages.stdenv.cc.bintools # For linking code at run-time
   ] ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
@@ -183,10 +184,13 @@ stdenv.mkDerivation ({
 
   NIX_LDFLAGS = lib.optionalString  hostPlatform.isSunOS "-lm -ldl";
 
-  preConfigure = import ../common/pre-configure.nix {
+
+  preConfigure = (import ../common/pre-configure.nix {
     inherit lib;
     inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
-  };
+  }) + ''
+    ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
+  '';
 
   dontDisableStatic = true;
 
diff --git a/pkgs/development/compilers/gforth/boot-forth.nix b/pkgs/development/compilers/gforth/boot-forth.nix
index fc7b5ffa982d7..74a267687b8f2 100644
--- a/pkgs/development/compilers/gforth/boot-forth.nix
+++ b/pkgs/development/compilers/gforth/boot-forth.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ m4 ];
 
-  configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ];
+  configureFlags = lib.optionals stdenv.isDarwin [ "--build=x86_64-apple-darwin" ];
 
   meta = {
     description = "The Forth implementation of the GNU project (outdated version used to bootstrap)";
diff --git a/pkgs/development/compilers/ghdl/default.nix b/pkgs/development/compilers/ghdl/default.nix
index 383fec786b916..0e11c703d7b6c 100644
--- a/pkgs/development/compilers/ghdl/default.nix
+++ b/pkgs/development/compilers/ghdl/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
   ];
   buildInputs = [
     zlib
-  ] ++ lib.optional (backend == "llvm") [
+  ] ++ lib.optionals (backend == "llvm") [
     llvm
   ];
   propagatedBuildInputs = [
diff --git a/pkgs/development/compilers/go/1.18.nix b/pkgs/development/compilers/go/1.18.nix
index c3ec8ceac009d..7490aa8a2484e 100644
--- a/pkgs/development/compilers/go/1.18.nix
+++ b/pkgs/development/compilers/go/1.18.nix
@@ -45,11 +45,11 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "go";
-  version = "1.18.6";
+  version = "1.18.7";
 
   src = fetchurl {
     url = "https://go.dev/dl/go${version}.src.tar.gz";
-    sha256 = "sha256-p/HVBCQ1XavOZtERKxyuQ5tu5eTxXtum8QTApLFz6JU=";
+    sha256 = "sha256-lGfjO4Gfcb67IfsO4d1nlP0iRK6UkHqYQoZxL5g5qUQ=";
   };
 
   strictDeps = true;
diff --git a/pkgs/development/compilers/idris2/default.nix b/pkgs/development/compilers/idris2/default.nix
index 9c7a9e53a2e6a..bb7d7a7a131c8 100644
--- a/pkgs/development/compilers/idris2/default.nix
+++ b/pkgs/development/compilers/idris2/default.nix
@@ -34,7 +34,7 @@ in stdenv.mkDerivation rec {
 
   strictDeps = true;
   nativeBuildInputs = [ makeWrapper clang platformChez ]
-    ++ lib.optional stdenv.isDarwin [ zsh ];
+    ++ lib.optionals stdenv.isDarwin [ zsh ];
   buildInputs = [ platformChez gmp ];
 
   prePatch = ''
diff --git a/pkgs/development/compilers/idris2/tests.nix b/pkgs/development/compilers/idris2/tests.nix
index a8d48c26ca6f5..54bb6d29eeef0 100644
--- a/pkgs/development/compilers/idris2/tests.nix
+++ b/pkgs/development/compilers/idris2/tests.nix
@@ -11,7 +11,7 @@ let
       # is not the case with pure nix environments. Thus, we need to include zsh
       # when we build for darwin in tests. While this is impure, this is also what
       # we find in real darwin hosts.
-      nativeBuildInputs = lib.optional stdenv.isDarwin [ zsh ];
+      nativeBuildInputs = lib.optionals stdenv.isDarwin [ zsh ];
 
       buildCommand = ''
         set -eo pipefail
diff --git a/pkgs/development/compilers/llvm/10/compiler-rt/default.nix b/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
index d74aa519b769e..4ae59a4317705 100644
--- a/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
+{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt }:
 
 let
 
@@ -25,6 +25,8 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
     "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
     "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
+  ] ++ lib.optionals (haveLibc && !isMusl) [
+    "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include"
   ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
     "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
     "-DCOMPILER_RT_BUILD_XRAY=OFF"
diff --git a/pkgs/development/compilers/llvm/10/libcxx/default.nix b/pkgs/development/compilers/llvm/10/libcxx/default.nix
index d438294bdd0b6..6a4e645bb3004 100644
--- a/pkgs/development/compilers/llvm/10/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/10/libcxx/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
index 482ced8e0c3fc..c61f48485580f 100644
--- a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
@@ -42,11 +42,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/11/compiler-rt/default.nix b/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
index 4968c8bcfbd8e..6790910ee8304 100644
--- a/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
+{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }:
 
 let
 
@@ -15,7 +15,8 @@ stdenv.mkDerivation {
   inherit version;
   src = fetch "compiler-rt" "0x1j8ngf1zj63wlnns9vlibafq48qcm72p4jpaxkmkb4qw0grwfy";
 
-  nativeBuildInputs = [ cmake python3 libllvm.dev ];
+  nativeBuildInputs = [ cmake python3 libllvm.dev ]
+     ++ lib.optional stdenv.isDarwin xcbuild.xcrun;
 
   NIX_CFLAGS_COMPILE = [
     "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
@@ -25,6 +26,8 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
     "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
     "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
+  ] ++ lib.optionals (haveLibc && !isMusl) [
+    "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include"
   ] ++ lib.optionals (useLLVM || bareMetal || isMusl || isNewDarwinBootstrap) [
     "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
     "-DCOMPILER_RT_BUILD_XRAY=OFF"
@@ -59,8 +62,9 @@ stdenv.mkDerivation {
     # extra `/`.
     ./normalize-var.patch
     ../../common/compiler-rt/libsanitizer-no-cyclades-11.patch
-  ] ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
-
+    ../../common/compiler-rt/darwin-plistbuddy-workaround.patch
+    ./armv7l.patch
+  ];
 
   preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
     cmakeFlagsArray+=("-DCMAKE_LIPO=$(command -v ${stdenv.cc.targetPrefix}lipo)")
@@ -75,8 +79,6 @@ stdenv.mkDerivation {
     substituteInPlace cmake/builtin-config-ix.cmake \
       --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
   '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/builtin-config-ix.cmake \
-      --replace 'foreach(arch ''${ARM64})' 'foreach(arch)'
     substituteInPlace cmake/config-ix.cmake \
       --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   '' + lib.optionalString (useLLVM) ''
diff --git a/pkgs/development/compilers/llvm/11/libcxx/default.nix b/pkgs/development/compilers/llvm/11/libcxx/default.nix
index 9aa49c9a009e6..2a83b36fc4252 100644
--- a/pkgs/development/compilers/llvm/11/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/11/libcxx/default.nix
@@ -48,7 +48,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix
index 6c4ca925ab116..2359820dddecd 100644
--- a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix
@@ -46,11 +46,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
index d1497e6db1e34..ed34d06ed9861 100644
--- a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
+{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }:
 
 let
 
@@ -14,7 +14,8 @@ stdenv.mkDerivation {
   inherit version;
   src = fetch "compiler-rt" "1950rg294izdwkaasi7yjrmadc9mzdd5paf0q63jjcq2m3rdbj5l";
 
-  nativeBuildInputs = [ cmake python3 libllvm.dev ];
+  nativeBuildInputs = [ cmake python3 libllvm.dev ]
+    ++ lib.optional stdenv.isDarwin xcbuild.xcrun;
   buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
@@ -25,6 +26,8 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
     "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
     "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
+  ] ++ lib.optionals (haveLibc && !isMusl) [
+    "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include"
   ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
     "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
     "-DCOMPILER_RT_BUILD_XRAY=OFF"
@@ -59,7 +62,9 @@ stdenv.mkDerivation {
     # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
     # extra `/`.
     ./normalize-var.patch
-  ] ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
+    ../../common/compiler-rt/darwin-plistbuddy-workaround.patch
+    ./armv7l.patch
+  ];
 
   # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
   # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
@@ -70,8 +75,6 @@ stdenv.mkDerivation {
     substituteInPlace cmake/builtin-config-ix.cmake \
       --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
   '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/builtin-config-ix.cmake \
-      --replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
     substituteInPlace cmake/config-ix.cmake \
       --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   '' + lib.optionalString (useLLVM) ''
diff --git a/pkgs/development/compilers/llvm/12/libcxx/default.nix b/pkgs/development/compilers/llvm/12/libcxx/default.nix
index 3ddcb79975050..1386d3680f916 100644
--- a/pkgs/development/compilers/llvm/12/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/12/libcxx/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
index 89b56ad230d85..c130a6c1c3115 100644
--- a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
@@ -44,11 +44,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/13/compiler-rt/default.nix b/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
index 7b9312eecf247..9124686705ae7 100644
--- a/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, version, src, cmake, python3, libllvm, libcxxabi }:
+{ lib, stdenv, llvm_meta, version, src, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }:
 
 let
 
@@ -16,7 +16,8 @@ stdenv.mkDerivation {
   inherit src;
   sourceRoot = "source/compiler-rt";
 
-  nativeBuildInputs = [ cmake python3 libllvm.dev ];
+  nativeBuildInputs = [ cmake python3 libllvm.dev ]
+    ++ lib.optional stdenv.isDarwin xcbuild.xcrun;
   buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
@@ -27,6 +28,8 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
     "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
     "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
+  ] ++ lib.optionals (haveLibc && !isMusl) [
+    "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include"
   ] ++ lib.optionals (useLLVM || bareMetal || isMusl || isAarch64) [
     "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
   ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
@@ -62,9 +65,11 @@ stdenv.mkDerivation {
     # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
     # extra `/`.
     ./normalize-var.patch
-  ] # Prevent a compilation error on darwin
-    ++ lib.optional stdenv.hostPlatform.isDarwin ./darwin-targetconditionals.patch
-    ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
+    # Prevent a compilation error on darwin
+    ./darwin-targetconditionals.patch
+    ../../common/compiler-rt/darwin-plistbuddy-workaround.patch
+    ./armv7l.patch
+  ];
 
   # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
   # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
@@ -75,8 +80,6 @@ stdenv.mkDerivation {
     substituteInPlace cmake/builtin-config-ix.cmake \
       --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
   '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/builtin-config-ix.cmake \
-      --replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
     substituteInPlace cmake/config-ix.cmake \
       --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   '' + lib.optionalString (useLLVM) ''
diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix
index 16ea0b113c754..5da86b96d5a72 100644
--- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix
@@ -41,11 +41,21 @@ stdenv.mkDerivation rec {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/14/clang/add-nostdlibinc-flag.patch b/pkgs/development/compilers/llvm/14/clang/add-nostdlibinc-flag.patch
new file mode 100644
index 0000000000000..b73cd0185eb6c
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/clang/add-nostdlibinc-flag.patch
@@ -0,0 +1,18 @@
+diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
+index 3bfddeefc7b2..05b11d9e562d 100644
+--- a/lib/Driver/Driver.cpp
++++ b/lib/Driver/Driver.cpp
+@@ -482,6 +482,13 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
+   }
+ #endif
+ 
++  {
++    Arg *A = DAL->MakeFlagArg(/*BaseArg=*/nullptr,
++                              Opts.getOption(options::OPT_nostdlibinc));
++    A->claim();
++    DAL->append(A);
++  }
++
+   return DAL;
+ }
+ 
diff --git a/pkgs/development/compilers/llvm/14/clang/default.nix b/pkgs/development/compilers/llvm/14/clang/default.nix
index 5ff02d68de426..6b775efcc039d 100644
--- a/pkgs/development/compilers/llvm/14/clang/default.nix
+++ b/pkgs/development/compilers/llvm/14/clang/default.nix
@@ -45,6 +45,7 @@ let
       ./purity.patch
       # https://reviews.llvm.org/D51899
       ./gnu-install-dirs.patch
+      ./add-nostdlibinc-flag.patch
       (substituteAll {
         src = ../../clang-11-12-LLVMgold-path.patch;
         libllvmLibdir = "${libllvm.lib}/lib";
@@ -54,10 +55,6 @@ let
     postPatch = ''
       (cd tools && ln -s ../../clang-tools-extra extra)
 
-      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-             -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
-             lib/Driver/ToolChains/*.cpp
-
       # Patch for standalone doc building
       sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
     '' + lib.optionalString stdenv.hostPlatform.isMusl ''
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/default.nix b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
index 28c77d5ffb39f..ef2495714e451 100644
--- a/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
@@ -1,6 +1,6 @@
 { lib, stdenv, llvm_meta, version
 , monorepoSrc, runCommand
-, cmake, python3, libllvm, libcxxabi
+, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt
 }:
 
 let
@@ -26,7 +26,8 @@ stdenv.mkDerivation {
   inherit src;
   sourceRoot = "${src.name}/${baseName}";
 
-  nativeBuildInputs = [ cmake python3 libllvm.dev ];
+  nativeBuildInputs = [ cmake python3 libllvm.dev ]
+    ++ lib.optional stdenv.isDarwin xcbuild.xcrun;
   buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
@@ -37,6 +38,8 @@ stdenv.mkDerivation {
     "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
     "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
     "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
+  ] ++ lib.optionals (haveLibc && !isMusl) [
+    "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include"
   ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
     "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
     "-DCOMPILER_RT_BUILD_XRAY=OFF"
@@ -73,9 +76,11 @@ stdenv.mkDerivation {
     # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
     # extra `/`.
     ./normalize-var.patch
-  ] # Prevent a compilation error on darwin
-    ++ lib.optional stdenv.hostPlatform.isDarwin ./darwin-targetconditionals.patch
-    ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
+    # Prevent a compilation error on darwin
+    ./darwin-targetconditionals.patch
+    ../../common/compiler-rt/darwin-plistbuddy-workaround.patch
+    ./armv7l.patch
+  ];
 
   # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
   # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
@@ -86,8 +91,6 @@ stdenv.mkDerivation {
     substituteInPlace cmake/builtin-config-ix.cmake \
       --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
   '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/builtin-config-ix.cmake \
-      --replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
     substituteInPlace cmake/config-ix.cmake \
       --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   '' + lib.optionalString (useLLVM) ''
diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
index d64708ab040ae..0487f1d0de83c 100644
--- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
@@ -52,12 +52,23 @@ stdenv.mkDerivation rec {
   installPhase = if stdenv.isDarwin
     then ''
       for file in lib/*.dylib; do
+        # Fix up the install name. Preserve the basename, just replace the path.
+        installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
         # this should be done in CMake, but having trouble figuring out
         # the magic combination of necessary CMake variables
         # if you fancy a try, take a look at
         # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-        install_name_tool -id $out/$file $file
+        ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+        # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+        # libcxxabi to sometimes link against a different version of itself.
+        # Here we simply make that second reference point to ourselves.
+        for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+          ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+        done
       done
+
       make install
       install -d 755 $out/include
       install -m 644 ../include/*.h $out/include
diff --git a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix
index 60a41ab2d8303..f2f707ec445d0 100644
--- a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix
@@ -27,11 +27,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix b/pkgs/development/compilers/llvm/6/libcxxabi/default.nix
index d7de130fbaaf6..63e6eee6f596c 100644
--- a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/6/libcxxabi/default.nix
@@ -27,11 +27,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix
index 1bc9444feda11..721200136a57b 100644
--- a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix
@@ -46,11 +46,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/8/libcxx/default.nix b/pkgs/development/compilers/llvm/8/libcxx/default.nix
index 87cd734899fa2..5368011292186 100644
--- a/pkgs/development/compilers/llvm/8/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/8/libcxx/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
index 50a5eabc17039..5ade8a5ae66f9 100644
--- a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
@@ -42,11 +42,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/9/libcxx/default.nix b/pkgs/development/compilers/llvm/9/libcxx/default.nix
index 2719711031070..31a00ba548591 100644
--- a/pkgs/development/compilers/llvm/9/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/9/libcxx/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix
index ee6834affbcd3..4a235f5c2ef70 100644
--- a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix
@@ -42,11 +42,21 @@ stdenv.mkDerivation {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/darwin-plistbuddy-workaround.patch b/pkgs/development/compilers/llvm/common/compiler-rt/darwin-plistbuddy-workaround.patch
new file mode 100644
index 0000000000000..dae8b3a690ac3
--- /dev/null
+++ b/pkgs/development/compilers/llvm/common/compiler-rt/darwin-plistbuddy-workaround.patch
@@ -0,0 +1,25 @@
+CMake tries to read a list field from SDKSettings.plist, but the output of
+xcbuild PlistBuddy is incompatible with Apple's. (Plus we don't want it in our
+dependencies.)
+
+Simply assume ARM64 is supported by the SDK. We already limit the actual archs
+we build for by setting DARWIN_osx_BUILTIN_ARCHS explicitely.
+
+--- a/cmake/builtin-config-ix.cmake
++++ b/cmake/builtin-config-ix.cmake
+@@ -97,14 +97,7 @@ if(APPLE)
+   set(DARWIN_osx_BUILTIN_MIN_VER 10.5)
+   set(DARWIN_osx_BUILTIN_MIN_VER_FLAG
+       -mmacosx-version-min=${DARWIN_osx_BUILTIN_MIN_VER})
+-  set(DARWIN_osx_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64})
+-  # Add support for arm64 macOS if available in SDK.
+-  foreach(arch ${ARM64})
+-    sdk_has_arch_support(${DARWIN_osx_SYSROOT} macosx ${arch} MACOS_ARM_SUPPORT)
+-    if (MACOS_ARM_SUPPORT)
+-     list(APPEND DARWIN_osx_BUILTIN_ALL_POSSIBLE_ARCHS ${arch})
+-    endif()
+-  endforeach(arch)
++  set(DARWIN_osx_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64} ${ARM64})
+ 
+   if(COMPILER_RT_ENABLE_IOS)
+     list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
diff --git a/pkgs/development/compilers/llvm/git/clang/add-nostdlibinc-flag.patch b/pkgs/development/compilers/llvm/git/clang/add-nostdlibinc-flag.patch
new file mode 100644
index 0000000000000..80c2eb3623832
--- /dev/null
+++ b/pkgs/development/compilers/llvm/git/clang/add-nostdlibinc-flag.patch
@@ -0,0 +1,18 @@
+diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
+index 3f29afd35971..223d2769cdfc 100644
+--- a/lib/Driver/Driver.cpp
++++ b/lib/Driver/Driver.cpp
+@@ -491,6 +491,13 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
+   }
+ #endif
+ 
++  {
++    Arg *A = DAL->MakeFlagArg(/*BaseArg=*/nullptr,
++                              Opts.getOption(options::OPT_nostdlibinc));
++    A->claim();
++    DAL->append(A);
++  }
++
+   return DAL;
+ }
+ 
diff --git a/pkgs/development/compilers/llvm/git/clang/default.nix b/pkgs/development/compilers/llvm/git/clang/default.nix
index 3110bef09e969..3df0e5042b8dc 100644
--- a/pkgs/development/compilers/llvm/git/clang/default.nix
+++ b/pkgs/development/compilers/llvm/git/clang/default.nix
@@ -46,6 +46,7 @@ let
       ./purity.patch
       # https://reviews.llvm.org/D51899
       ./gnu-install-dirs.patch
+      ./add-nostdlibinc-flag.patch
       (substituteAll {
         src = ../../clang-11-12-LLVMgold-path.patch;
         libllvmLibdir = "${libllvm.lib}/lib";
@@ -55,10 +56,6 @@ let
     postPatch = ''
       (cd tools && ln -s ../../clang-tools-extra extra)
 
-      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-             -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
-             lib/Driver/ToolChains/*.cpp
-
       # Patch for standalone doc building
       sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
     '' + lib.optionalString stdenv.hostPlatform.isMusl ''
diff --git a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
index 7ac3e3801ffb9..9fabce1895a8c 100644
--- a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
@@ -1,6 +1,6 @@
 { lib, stdenv, llvm_meta, version
 , monorepoSrc, runCommand
-, cmake, python3, libllvm, libcxxabi
+, cmake, python3, xcbuild, libllvm, libcxxabi
 }:
 
 let
@@ -26,7 +26,8 @@ stdenv.mkDerivation {
   inherit src;
   sourceRoot = "${src.name}/${baseName}";
 
-  nativeBuildInputs = [ cmake python3 libllvm.dev ];
+  nativeBuildInputs = [ cmake python3 libllvm.dev ]
+    ++ lib.optional stdenv.isDarwin xcbuild.xcrun;
   buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
@@ -71,9 +72,11 @@ stdenv.mkDerivation {
     # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
     # extra `/`.
     ./normalize-var.patch
-  ] # Prevent a compilation error on darwin
-    ++ lib.optional stdenv.hostPlatform.isDarwin ./darwin-targetconditionals.patch
-    ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
+    # Prevent a compilation error on darwin
+    ./darwin-targetconditionals.patch
+    ../../common/compiler-rt/darwin-plistbuddy-workaround.patch
+    ./armv7l.patch
+  ];
 
   # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
   # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
@@ -84,8 +87,6 @@ stdenv.mkDerivation {
     substituteInPlace cmake/builtin-config-ix.cmake \
       --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
   '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/builtin-config-ix.cmake \
-      --replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
     substituteInPlace cmake/config-ix.cmake \
       --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   '' + lib.optionalString (useLLVM) ''
diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
index 2d4fe974c016b..b478668ebded9 100644
--- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
@@ -70,11 +70,21 @@ stdenv.mkDerivation rec {
 
   preInstall = lib.optionalString stdenv.isDarwin ''
     for file in lib/*.dylib; do
+      # Fix up the install name. Preserve the basename, just replace the path.
+      installName="$out/lib/$(basename $(otool -D $file | tail -n 1))"
+
       # this should be done in CMake, but having trouble figuring out
       # the magic combination of necessary CMake variables
       # if you fancy a try, take a look at
       # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      install_name_tool -id $out/$file $file
+      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
+
+      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
+      # libcxxabi to sometimes link against a different version of itself.
+      # Here we simply make that second reference point to ourselves.
+      for other in $(otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
+        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
+      done
     done
   '';
 
diff --git a/pkgs/development/compilers/llvm/rocm/llvm.nix b/pkgs/development/compilers/llvm/rocm/llvm.nix
index 557d194668606..c5ad96a6a1892 100644
--- a/pkgs/development/compilers/llvm/rocm/llvm.nix
+++ b/pkgs/development/compilers/llvm/rocm/llvm.nix
@@ -9,6 +9,7 @@
 , libxml2
 , libffi
 , libbfd
+, libxcrypt
 , ncurses
 , zlib
 , debugVersion ? false
@@ -32,7 +33,7 @@ in stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ninja python3 ];
 
-  buildInputs = [ libxml2 ];
+  buildInputs = [ libxml2 libxcrypt ];
 
   propagatedBuildInputs = [ ncurses zlib ];
 
diff --git a/pkgs/development/compilers/manticore/default.nix b/pkgs/development/compilers/manticore/default.nix
index 1919f99980586..b767ccf150a69 100644
--- a/pkgs/development/compilers/manticore/default.nix
+++ b/pkgs/development/compilers/manticore/default.nix
@@ -19,7 +19,7 @@ in stdenv.mkDerivation {
 
   buildInputs = [ coreutils smlnj ];
 
-  autoreconfFlags = "-Iconfig -vfi";
+  autoreconfFlags = [ "-Iconfig" "-vfi" ];
 
   unpackPhase = ''
     mkdir -p $out
diff --git a/pkgs/development/compilers/mkcl/default.nix b/pkgs/development/compilers/mkcl/default.nix
index dc89fa6036675..786a271c78982 100644
--- a/pkgs/development/compilers/mkcl/default.nix
+++ b/pkgs/development/compilers/mkcl/default.nix
@@ -60,6 +60,6 @@ stdenv.mkDerivation rec {
     homepage = "https://common-lisp.net/project/mkcl/";
     license = licenses.lgpl2Plus;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ tohl ];
+    maintainers = with maintainers; [ ];
   };
 }
diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix
index 4fe8db4d2977d..7673bb2279bed 100644
--- a/pkgs/development/compilers/nim/default.nix
+++ b/pkgs/development/compilers/nim/default.nix
@@ -109,6 +109,9 @@ in {
     buildPhase = ''
       runHook preBuild
       local HOME=$TMPDIR
+    '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
+      sed -i "s/aarch64/arm64/g" makefile
+    '' + ''
       make -j$NIX_BUILD_CORES
       ./bin/nim c --parallelBuild:$NIX_BUILD_CORES koch
       ./koch boot $kochArgs --parallelBuild:$NIX_BUILD_CORES
diff --git a/pkgs/development/compilers/ocaml/5.0.nix b/pkgs/development/compilers/ocaml/5.0.nix
new file mode 100644
index 0000000000000..a36b3e31a427f
--- /dev/null
+++ b/pkgs/development/compilers/ocaml/5.0.nix
@@ -0,0 +1,9 @@
+import ./generic.nix {
+  major_version = "5";
+  minor_version = "0";
+  patch_version = "0-beta1";
+  src = fetchTarball {
+    url = "https://caml.inria.fr/pub/distrib/ocaml-5.0/ocaml-5.0.0~beta1.tar.xz";
+    sha256 = "sha256:1kwb53ra5qbwiiyrx5da7l5mqkjf0fr3rqgkrm3wr83l25scimj4";
+  };
+}
diff --git a/pkgs/development/compilers/ocaml/generic.nix b/pkgs/development/compilers/ocaml/generic.nix
index 2c6045c13a627..7db0eca0ee4dd 100644
--- a/pkgs/development/compilers/ocaml/generic.nix
+++ b/pkgs/development/compilers/ocaml/generic.nix
@@ -73,6 +73,7 @@ stdenv.mkDerivation (args // {
   configurePlatforms = lib.optionals (lib.versionAtLeast version "4.08" && !(stdenv.isDarwin && stdenv.isAarch64)) [ "host" "target" ];
   # x86_64-unknown-linux-musl-ld: -r and -pie may not be used together
   hardeningDisable = lib.optional (lib.versionAtLeast version "4.09" && stdenv.hostPlatform.isMusl) "pie"
+    ++ lib.optional (lib.versionAtLeast version "5.0" && stdenv.cc.isClang) "strictoverflow"
     ++ lib.optionals (args ? hardeningDisable) args.hardeningDisable;
 
   # Older versions have some race:
diff --git a/pkgs/development/compilers/orc/default.nix b/pkgs/development/compilers/orc/default.nix
index fa4bf686a2aca..5ea72781e41f8 100644
--- a/pkgs/development/compilers/orc/default.nix
+++ b/pkgs/development/compilers/orc/default.nix
@@ -26,7 +26,7 @@ in stdenv.mkDerivation rec {
   outputBin = "dev"; # compilation tools
 
   mesonFlags =
-    optional (!buildDevDoc) [ "-Dgtk_doc=disabled" ]
+    optionals (!buildDevDoc) [ "-Dgtk_doc=disabled" ]
   ;
 
   nativeBuildInputs = [ meson ninja ]
diff --git a/pkgs/development/compilers/p4c/default.nix b/pkgs/development/compilers/p4c/default.nix
index 9233489b06aeb..cf02a656b770b 100644
--- a/pkgs/development/compilers/p4c/default.nix
+++ b/pkgs/development/compilers/p4c/default.nix
@@ -66,8 +66,8 @@ stdenv.mkDerivation rec {
     flex
     cmake
   ]
-  ++ lib.optional enableDocumentation [ doxygen graphviz ]
-  ++ lib.optional enableBPF [ libllvm libbpf ];
+  ++ lib.optionals enableDocumentation [ doxygen graphviz ]
+  ++ lib.optionals enableBPF [ libllvm libbpf ];
 
   buildInputs = [
     protobuf
diff --git a/pkgs/development/compilers/rust/binary.nix b/pkgs/development/compilers/rust/binary.nix
index 6c3751cbb5757..1de90cdddacfc 100644
--- a/pkgs/development/compilers/rust/binary.nix
+++ b/pkgs/development/compilers/rust/binary.nix
@@ -52,6 +52,12 @@ rec {
       # https://github.com/rust-lang/rust/issues/34722#issuecomment-232164943
     '';
 
+    # The strip tool in cctools 973.0.1 and up appears to break rlibs in the
+    # binaries. The lib.rmeta object inside the ar archive should contain an
+    # .rmeta section, but it is removed. Luckily, this doesn't appear to be an
+    # issue for Rust builds produced by Nix.
+    dontStrip = stdenv.isDarwin;
+
     setupHooks = ./setup-hook.sh;
   };
 
diff --git a/pkgs/development/compilers/sbcl/2.0.8.nix b/pkgs/development/compilers/sbcl/2.0.8.nix
deleted file mode 100644
index bbc171a8d9863..0000000000000
--- a/pkgs/development/compilers/sbcl/2.0.8.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.0.8";
-  sha256 = "1xwrwvps7drrpyw3wg5h3g2qajmkwqs9gz0fdw1ns9adp7vld390";
-}
diff --git a/pkgs/development/compilers/sbcl/2.0.9.nix b/pkgs/development/compilers/sbcl/2.0.9.nix
deleted file mode 100644
index 80b30ec87f487..0000000000000
--- a/pkgs/development/compilers/sbcl/2.0.9.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.0.9";
-  sha256 = "17wvrcwgp45z9b6arik31fjnz7908qhr5ackxq1y0gqi1hsh1xy4";
-}
diff --git a/pkgs/development/compilers/sbcl/2.1.1.nix b/pkgs/development/compilers/sbcl/2.1.1.nix
deleted file mode 100644
index a32f8a4a28b38..0000000000000
--- a/pkgs/development/compilers/sbcl/2.1.1.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.1.1";
-  sha256 = "15wa66sachhzgvg5n35vihmkpasg100lh561c1d1bdrql0p8kbd9";
-}
diff --git a/pkgs/development/compilers/sbcl/2.1.10.nix b/pkgs/development/compilers/sbcl/2.1.10.nix
deleted file mode 100644
index 8cf6f50b5869b..0000000000000
--- a/pkgs/development/compilers/sbcl/2.1.10.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.1.10";
-  sha256 = "0f5ihj486m7ghh3nc0jlnqa656sbqcmhdv32syz2rjx5b47ky67b";
-}
diff --git a/pkgs/development/compilers/sbcl/2.1.11.nix b/pkgs/development/compilers/sbcl/2.1.11.nix
deleted file mode 100644
index abe48953a5736..0000000000000
--- a/pkgs/development/compilers/sbcl/2.1.11.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.1.11";
-  sha256 = "1zgypmn19c58pv7j33ga7m1l7lzghj70w3xbybpgmggxwwflihdz";
-}
diff --git a/pkgs/development/compilers/sbcl/2.1.2.nix b/pkgs/development/compilers/sbcl/2.1.2.nix
deleted file mode 100644
index 4f4c85b286c7e..0000000000000
--- a/pkgs/development/compilers/sbcl/2.1.2.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.1.2";
-  sha256 = "sha256:02scrqyp2izsd8xjm2k5j5lhn4pdhd202jlcb54ysmcqjd80awdp";
-}
diff --git a/pkgs/development/compilers/sbcl/2.1.9.nix b/pkgs/development/compilers/sbcl/2.1.9.nix
deleted file mode 100644
index da26a9aeffb70..0000000000000
--- a/pkgs/development/compilers/sbcl/2.1.9.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.1.9";
-  sha256 = "189gjqzdz10xh3ybiy4ch1r98bsmkcb4hpnrmggd4y2g5kqnyx4y";
-}
diff --git a/pkgs/development/compilers/sbcl/2.2.4.nix b/pkgs/development/compilers/sbcl/2.2.4.nix
deleted file mode 100644
index 1be043f112eef..0000000000000
--- a/pkgs/development/compilers/sbcl/2.2.4.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.2.4";
-  sha256 = "sha256-/N0lHLxl9/gI7QrXckaEjRvhZqppoX90mWABhLelcgI=";
-}
diff --git a/pkgs/development/compilers/sbcl/2.2.6.nix b/pkgs/development/compilers/sbcl/2.2.6.nix
deleted file mode 100644
index 6fb24da6abe5f..0000000000000
--- a/pkgs/development/compilers/sbcl/2.2.6.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-import ./common.nix {
-  version = "2.2.6";
-  sha256 = "sha256-PiMEjI+oJvuRMiC+sqw2l9vFwM3y6J/tjbOe0XEjBKA=";
-}
diff --git a/pkgs/development/compilers/sbcl/common.nix b/pkgs/development/compilers/sbcl/2.x.nix
index 05fa6b390897d..ec12ccf17b722 100644
--- a/pkgs/development/compilers/sbcl/common.nix
+++ b/pkgs/development/compilers/sbcl/2.x.nix
@@ -1,5 +1,3 @@
-{ version, sha256 }:
-
 { lib, stdenv, fetchurl, fetchpatch, writeText, sbclBootstrap, zstd
 , sbclBootstrapHost ? "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit"
 , threadSupport ? (stdenv.hostPlatform.isx86 || "aarch64-linux" == stdenv.hostPlatform.system || "aarch64-darwin" == stdenv.hostPlatform.system)
@@ -11,8 +9,54 @@
 , purgeNixReferences ? false
 , coreCompression ? lib.versionAtLeast version "2.2.6"
 , texinfo
+, version
 }:
 
+let
+  versionMap = {
+    "2.0.8" = {
+      sha256 = "1xwrwvps7drrpyw3wg5h3g2qajmkwqs9gz0fdw1ns9adp7vld390";
+    };
+
+    "2.0.9" = {
+      sha256 = "17wvrcwgp45z9b6arik31fjnz7908qhr5ackxq1y0gqi1hsh1xy4";
+    };
+
+    "2.1.1" = {
+      sha256 = "15wa66sachhzgvg5n35vihmkpasg100lh561c1d1bdrql0p8kbd9";
+    };
+
+    "2.1.2" = {
+      sha256 = "sha256:02scrqyp2izsd8xjm2k5j5lhn4pdhd202jlcb54ysmcqjd80awdp";
+    };
+
+    "2.1.9" = {
+      sha256 = "189gjqzdz10xh3ybiy4ch1r98bsmkcb4hpnrmggd4y2g5kqnyx4y";
+    };
+
+    "2.1.10" = {
+      sha256 = "0f5ihj486m7ghh3nc0jlnqa656sbqcmhdv32syz2rjx5b47ky67b";
+    };
+
+    "2.1.11" = {
+      sha256 = "1zgypmn19c58pv7j33ga7m1l7lzghj70w3xbybpgmggxwwflihdz";
+    };
+
+    "2.2.4" = {
+      sha256 = "sha256-/N0lHLxl9/gI7QrXckaEjRvhZqppoX90mWABhLelcgI=";
+    };
+
+    "2.2.6" = {
+      sha256 = "sha256-PiMEjI+oJvuRMiC+sqw2l9vFwM3y6J/tjbOe0XEjBKA=";
+    };
+
+    "2.2.9" = {
+      sha256 = "sha256-fr69bSAj//cHewNy+hFx+IBSm97GEE8gmDKXwv63wXI=";
+    };
+  };
+
+in with versionMap.${version};
+
 stdenv.mkDerivation rec {
   pname = "sbcl";
   inherit version;
@@ -32,8 +76,8 @@ stdenv.mkDerivation rec {
       url = "https://github.com/sbcl/sbcl/commit/8fa3f76fba2e8572e86ac6fc5754e6b2954fc774.patch";
       sha256 = "1ic531pjnws1k3xd03a5ixbq8cn10dlh2nfln59k0vbm0253g3lv";
     })
-  ++ lib.optionals (lib.versionAtLeast version "2.1.10") [
-      # Fix pending upstream inclusion on -fno-common toolchains:
+  ++ lib.optionals (lib.versionAtLeast version "2.1.10" && lib.versionOlder version "2.2.9") [
+      # Fix included in SBCL trunk since 2.2.9:
       #   https://bugs.launchpad.net/sbcl/+bug/1980570
       (fetchpatch {
         name = "darwin-fno-common.patch";
@@ -109,7 +153,7 @@ stdenv.mkDerivation rec {
     optional (!threadSupport) "sb-thread" ++
     optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ];
 
-  NIX_CFLAGS_COMPILE = lib.optional (lib.versionOlder version "2.1.10") [
+  NIX_CFLAGS_COMPILE = lib.optionals (lib.versionOlder version "2.1.10") [
     # Workaround build failure on -fno-common toolchains like upstream
     # clang-13. Without the change build fails as:
     #   duplicate symbol '_static_code_space_free_pointer' in: alloc.o traceroot.o
diff --git a/pkgs/development/compilers/sbcl/bootstrap.nix b/pkgs/development/compilers/sbcl/bootstrap.nix
index eaf1ff24d3e7a..8a9d69cd4a9e0 100644
--- a/pkgs/development/compilers/sbcl/bootstrap.nix
+++ b/pkgs/development/compilers/sbcl/bootstrap.nix
@@ -8,9 +8,9 @@ let
       sha256 = "sha256-H0ALigXcWIypdA+fTf7jERscwbb7QIAfcoxCtGDh0RU=";
     };
     x86_64-darwin = {
-      version = "1.2.11";
+      version = "2.2.9";
       system = "x86-64-darwin";
-      sha256 = "0lh4gpvi8hl6g6b9321g5pwh8sk3218i7h4lx7p3vd9z0cf3lz85";
+      sha256 = "sha256-b1BLkoLIOELAYBYA9eBmMgm1OxMxJewzNP96C9ADfKY=";
     };
     x86_64-linux = {
       version = "1.3.16";
@@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
     description = "Lisp compiler";
     homepage = "http://www.sbcl.org";
     license = licenses.publicDomain; # and FreeBSD
-    maintainers = [maintainers.raskin maintainers.tohl];
+    maintainers = [ maintainers.raskin ];
     platforms = attrNames options;
   };
 }
diff --git a/pkgs/development/compilers/swi-prolog/default.nix b/pkgs/development/compilers/swi-prolog/default.nix
index d53d1426a94b2..a1eb060d6bab6 100644
--- a/pkgs/development/compilers/swi-prolog/default.nix
+++ b/pkgs/development/compilers/swi-prolog/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, fetchFromGitHub, jdk, gmp, readline, openssl, unixODBC, zlib
-, libarchive, db, pcre, libedit, libossp_uuid, libXpm
+, libarchive, db, pcre, libedit, libossp_uuid, libxcrypt,libXpm
 , libSM, libXt, freetype, pkg-config, fontconfig
 , cmake, libyaml, Security
 , libjpeg, libX11, libXext, libXft, libXinerama
@@ -59,7 +59,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake pkg-config ];
 
   buildInputs = [ gmp readline openssl
-    libarchive libyaml db pcre libedit libossp_uuid
+    libarchive libyaml db pcre libedit libossp_uuid libxcrypt
     zlib ]
   ++ lib.optionals (withGui && !stdenv.isDarwin) [ libXpm libX11 libXext libXft libXinerama libjpeg ]
   ++ extraLibraries
diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix
index 4109d6ee6dac6..0ea6e7b075969 100644
--- a/pkgs/development/compilers/swift/default.nix
+++ b/pkgs/development/compilers/swift/default.nix
@@ -14,6 +14,7 @@
 , python3
 , ncurses
 , libuuid
+, libxcrypt
 , icu
 , libgcc
 , libblocksruntime
@@ -195,6 +196,7 @@ let
     libedit
     libgcc
     libuuid
+    libxcrypt
     libxml2
     ncurses
     sqlite