diff --git a/pkgs/development/compilers/swift/compiler/default.nix b/pkgs/development/compilers/swift/compiler/default.nix index 8e8cf798db4f24..8bd570b6450a6b 100644 --- a/pkgs/development/compilers/swift/compiler/default.nix +++ b/pkgs/development/compilers/swift/compiler/default.nix @@ -47,6 +47,8 @@ let else targetPlatform.darwinMinVersion; + targetDarwinPlatform = if (targetPlatform.darwinPlatform != null) then targetPlatform.darwinPlatform else "null"; + python3 = python3Packages.python.withPackages (p: [ p.setuptools ]); # python 3.12 compat. inherit (stdenv) hostPlatform targetPlatform; @@ -64,8 +66,8 @@ let #appletvsimulator #watchos #watchsimulator - }.${targetPlatform.darwinPlatform} - or (throw "Cannot build Swift for target Darwin platform '${targetPlatform.darwinPlatform}'") + }.${targetDarwinPlatform} + or (throw "Cannot build Swift for target Darwin platform '${targetDarwinPlatform}'") else targetPlatform.parsed.kernel.name; # Apple Silicon uses a different CPU name in the target triple. @@ -504,7 +506,7 @@ in stdenv.mkDerivation { " buildProject swift - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' + '' + lib.optionalString stdenv.targetPlatform.isDarwin '' # Restore search paths to remove appleSwiftCore. export NIX_SWIFTFLAGS_COMPILE="$OLD_NIX_SWIFTFLAGS_COMPILE" export NIX_LDFLAGS="$OLD_NIX_LDFLAGS" @@ -583,7 +585,7 @@ in stdenv.mkDerivation { #TVOS_SIMULATOR #WATCHOS #WATCHOS_SIMULATOR - }.${targetPlatform.darwinPlatform}} + }.${targetDarwinPlatform} or (throw "Cannot build Swift for target Darwin platform '${targetDarwinPlatform}'")} -DLLVM_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/llvm