about summary refs log tree commit diff
path: root/pkgs/development/compilers/swift/default.nix
diff options
context:
space:
mode:
authorStéphan Kochen <git@stephank.nl>2023-04-01 21:43:12 +0200
committerStéphan Kochen <git@stephank.nl>2023-04-30 15:03:20 +0200
commitf85d12198f4a4201d763cc481ccaf7025f0ec6ff (patch)
tree434cd0d8c08d00f9dc897536d0c743b0fc8735fe /pkgs/development/compilers/swift/default.nix
parent88be91f08c8fcf6a5912b83dea31fcee090e0dab (diff)
swift: 5.7.3 -> 5.8
Diffstat (limited to 'pkgs/development/compilers/swift/default.nix')
-rw-r--r--pkgs/development/compilers/swift/default.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix
index e8eb4d738ca93..3012c9a2f177c 100644
--- a/pkgs/development/compilers/swift/default.nix
+++ b/pkgs/development/compilers/swift/default.nix
@@ -2,7 +2,7 @@
 , pkgs
 , newScope
 , darwin
-, llvmPackages_latest
+, llvmPackages_15
 , overrideCC
 }:
 
@@ -15,20 +15,21 @@ let
     # Re-export this so we can rely on the minimum Swift SDK elsewhere.
     apple_sdk = pkgs.darwin.apple_sdk_11_0;
 
-    # Our current Clang on Darwin is v11, but we need at least v12. The
-    # following applies the newer Clang with the same libc overrides as
-    # `apple_sdk.stdenv`.
+    # Swift builds its own Clang for internal use. We wrap that clang with a
+    # cc-wrapper derived from the clang configured below. Because cc-wrapper
+    # applies a specific resource-root, the two versions are best matched, or
+    # we'll often run into compilation errors.
     #
-    # If 'latest' becomes an issue, recommend replacing it with v14, which is
-    # currently closest to the official Swift builds.
+    # The following selects the correct Clang version, matching the version
+    # used in Swift, and applies the same libc overrides as `apple_sdk.stdenv`.
     clang = if pkgs.stdenv.isDarwin
       then
-        llvmPackages_latest.clang.override rec {
+        llvmPackages_15.clang.override rec {
           libc = apple_sdk.Libsystem;
           bintools = pkgs.bintools.override { inherit libc; };
         }
       else
-        llvmPackages_latest.clang;
+        llvmPackages_15.clang;
 
     # Overrides that create a useful environment for swift packages, allowing
     # packaging with `swiftPackages.callPackage`. These are similar to