Files
nixpkgs/pkgs/development/compilers/swift/default.nix
Emily 997d97b109 swiftPackages.stdenv: use the default standard environment
Swift now works fine with standard environments using GCC or other
versions of LLVM. Some packages, like components of Swift itself or
others that combine Swift with features like C++ modules or C blocks,
may still need to use an LLVM‐based standard environment, but we
do not need to enforce a uniform `swiftPackages.stdenv` any more.
2025-09-02 05:52:52 +01:00

86 lines
1.9 KiB
Nix

{
lib,
newScope,
stdenv,
llvmPackages,
darwin,
}:
let
self = rec {
callPackage = newScope self;
# Provided for backwards compatibility.
inherit stdenv;
swift-unwrapped = callPackage ./compiler {
inherit (llvmPackages) stdenv;
inherit (darwin) DarwinTools sigtool;
};
swiftNoSwiftDriver = callPackage ./wrapper {
swift = swift-unwrapped;
useSwiftDriver = false;
};
Dispatch =
if stdenv.hostPlatform.isDarwin then
null # part of apple-sdk
else
callPackage ./libdispatch {
inherit (llvmPackages) stdenv;
swift = swiftNoSwiftDriver;
};
Foundation =
if stdenv.hostPlatform.isDarwin then
null # part of apple-sdk
else
callPackage ./foundation {
inherit (llvmPackages) stdenv;
swift = swiftNoSwiftDriver;
};
# TODO: Apple distributes a binary XCTest with Xcode, but it is not part of
# CLTools (or SUS), so would have to figure out how to fetch it. The binary
# version has several extra features, like a test runner and ObjC support.
XCTest = callPackage ./xctest {
inherit (darwin) DarwinTools;
swift = swiftNoSwiftDriver;
};
swiftpm = callPackage ./swiftpm {
inherit (llvmPackages) stdenv;
inherit (darwin) DarwinTools;
swift = swiftNoSwiftDriver;
};
swift-driver = callPackage ./swift-driver {
inherit (llvmPackages) stdenv;
swift = swiftNoSwiftDriver;
};
swift = callPackage ./wrapper {
swift = swift-unwrapped;
};
sourcekit-lsp = callPackage ./sourcekit-lsp {
inherit (llvmPackages) stdenv;
};
swift-docc = callPackage ./swift-docc {
inherit (llvmPackages) stdenv;
};
swift-format = callPackage ./swift-format {
inherit (llvmPackages) stdenv;
};
swiftpm2nix = callPackage ./swiftpm2nix { };
};
in
self