Commit Graph

215 Commits

Author SHA1 Message Date
nixpkgs-ci[bot]
32933b021a Merge staging-next into staging 2026-04-05 00:28:24 +00:00
Aaron Jheng
a8e4970af6 swift-format: add shell completions support
Add shell completions for bash, zsh, and fish using
swift-format's built-in --generate-completion-script flag.
2026-04-03 10:46:54 +08:00
Victor Engmark
c4f5dfad0d treewide: Remove continuation escape at end of commands
To avoid confusion and spurious newlines in the output.

Found by searching for a backslash followed by a newline, some
indentation, and then the end of multi-line string marker, using the
following extended regex:

```regex
\\\n +'';
```
2026-03-17 16:47:55 +01:00
David McFarland
20a48f24b4 swiftpm: fix linux build 2026-02-10 23:26:07 -04:00
David McFarland
0650c7b316 swift.swift: fix linux build 2026-02-10 23:26:07 -04:00
David McFarland
845d7f8f0f swift: fix darwin build
Fixes: #483584
2026-01-30 09:48:40 -04:00
Sam
5b123afb9a swiftPackages.swift: prefix unguarded-availability flag with -Xcc
The Swift wrapper uses a hook directly from cc-wrapper to set the
`-target` flag appropriately. This works because Clang and Swift use the
same syntax for `-target`, but there was never a guarantee that this
compatibility would be true for every option set in the hook. Indeed,
commit 369cc5c66b (PR #445119) made
availability warnings into errors by setting the
`-Werror=unguarded-availability` flag in this hook, which Swift doesn't
accept at the top level. This caused all invocations of Swift to fail
with the error `unknown argument: '-Werror=unguarded-availability'` -
including the bootstrap Swift, which meant that `swiftPackages.swift`
would fail.

This commit adds all `-Werror` flags to the list of flags that need to
be prefixed with `-Xcc`. I could have just dropped the flag, since Swift
already makes this an error, but you can have C/C++ targets in Swift
packages and we'd want to pass this flag on to them. (I'm not sure
whether the clang used for those targets is already wrapped, but if it
is there is no harm done.)
2025-11-09 00:00:27 -07:00
Sam
89f7581b9e swiftPackages.swift: ignore unguarded-availability error
I couldn't figure out how to get CMake to set the correct target, as it
insisted on using OS X 10.9 no matter what I set.
2025-11-08 23:38:55 -07:00
Sam
e3f5990dd5 swiftPackages.swift: fix patchPhase indentation 2025-10-11 14:47:33 -07:00
Sam
19d240b619 swiftPackages.{sourcekit-lsp,swift-format}: link libdispatch.so
In my experience this solution seems to be necessary on almost all if
not all Swift packages on Linux
2025-10-11 14:47:33 -07:00
Sam
d8754b1b0a swiftPackages.{sourcekit-lsp,swift-format}: drop upstreamed patches
I'm grouping this together because it's the same patch
2025-10-11 14:47:33 -07:00
Sam
6e1a464f82 swiftPackages.swiftpm: patch swift-crypto as needed 2025-10-11 14:47:33 -07:00
Sam
0800438fcd swiftPackages.swiftpm: use newer swift-crypto to fix missing symbols
This is 3.0.0 -> 3.15.1, so it's even semver compatible
2025-10-11 14:47:25 -07:00
Sam
4744337c52 swiftPackages.swiftpm: add bootstrap derivations for new dependencies 2025-10-11 14:44:18 -07:00
Sam
d18cfb1058 swiftPackages.swiftpm: drop upstreamed patches
Some of these were not technically upstreamed but all have been fixed
2025-10-11 14:44:18 -07:00
Sam
483fd74afc swiftPackages.swiftpm: fix patches that no longer apply cleanly 2025-10-11 14:44:17 -07:00
Sam
f6fe95f1fe swiftPackages.swift-driver: fix patches that no longer apply cleanly 2025-10-11 14:44:17 -07:00
Sam
873ea654ac swiftPackages.swift-corelibs-foundation: drop upstreamed patches
Technically the first of these wasn't upstreamed and was instead
superceded by
8d1a679420
but that's close enough.
2025-10-11 14:44:17 -07:00
Sam
f3ea847829 swiftPackages.swift{,-corelibs-libdispatch}: fix build with modern clang
We apply this patch to the copy of libdispatch that's copied into Swift
and to the standalone build.
2025-10-11 14:44:17 -07:00
Sam
60a9738efa swiftPackages.swift: drop SysRoot replacements that fail to apply
These replacements didn't apply cleanly to Swift 5.8 anyway, we just
didn't notice. They don't appear to cause any problems and regardless,
the goal is "no more broken than before"
2025-10-11 14:44:17 -07:00
Sam
8e4a990997 swiftPackages.*: swap from replace to replace-fail 2025-10-11 14:44:17 -07:00
Sam
470ee5bfaf swiftPackages.swift: enable remaining compiler features
There are remaining features that are not enabled, but they depend on a
host Swift with which to compile.
2025-10-11 14:44:17 -07:00
Sam
12231abbaf swiftPackages.swift: fix patches that no longer apply cleanly 2025-10-11 14:44:11 -07:00
Sam
a156f5fda3 swiftPackages.swift: patch CMake to import missing module 2025-10-10 20:10:52 -07:00
Sam
374682d81a swiftPackages.swift: drop upstreamed patches 2025-10-10 20:10:30 -07:00
Sam
8aff8a38bc swiftPackages.swift: clang 15 -> 16 2025-10-10 19:57:21 -07:00
Sam
e5aaa8c8e9 swiftPackages.swift: update cxx-interop-test 2025-10-10 19:51:06 -07:00
Sam
b2e971ac41 swiftPackages.swift: check for modern CXX interop flag in wrapper
This check is what determines whether the appropriate CFLAGS are set so
that Swift can find the C++ headers it needs for interop
2025-10-10 19:51:06 -07:00
Sam
c221712e43 swiftPackages.*: update generated SwiftPM dependencies
This includes adding new dependencies when appropriate
2025-10-10 19:51:06 -07:00
Sam
11a5bac33b swiftPackages.*: bump SDK to 14 2025-10-10 19:51:06 -07:00
Sam
1d8df27dd7 swiftPackages.*: update sources from 5.8 to 5.10.1 2025-10-10 19:51:06 -07:00
Emily
c9f171a0bb cmake: drop fixCmakeFiles hook
This regularly broke things – as can be seen from the number
of packages that were opting out of it – while providing only a
dubious and partial benefit to purity that other build systems did
not “enjoy”.

It has become associated with Darwin, but was actually introduced
in 2007 as part of 67d41efde1,
a work‐in‐progress commit for KDE 4 that introduced the CMake
setup hook. It has haunted us ever since, and will presumably become
even better at doing so now that it is a dead ghost.

Of course, it is possible and even likely that more impure paths will
leak into Darwin builds from third‐party CMake modules included
in packages. However, considering it already disregarded many of the
most common macOS system paths, it will be better overall to address
these in a targeted manner than dealing with the effects of this
brute‐force hook. In the long run, a good sandbox is going to be
the solution for reliable build reproducibility on the platform.
2025-09-19 18:34:06 +01:00
Emily
f7a0510047 swift: don’t build LLVM tools
These aren’t required by the build, and fail to compile with the
LLVM 21 / Darwin system libc++ changes.
2025-09-15 22:46:21 +01:00
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
Emily
2153141b51 swiftPackages.*: build with the default LLVM version 2025-09-02 04:14:28 +01:00
Emily
37cad5dfd5 swiftPackages.swift{,-unwrapped}: get libc++ headers from Swift’s LLVM
libc++ only supports a limited range of Clang versions, so this was
relying on the LLVM version corresponding to the one used in Swift’s
fork. Since Swift builds its own LLVM 15 anyway, we can simply install
the required libc++ headers along with it.
2025-09-02 04:14:28 +01:00
Emily
809f7d037c swiftPackages.swift{,-unwrapped,-driver}: ignore $NIX_CC
Swift needs Clang to link with. The linker patch breaks linking
when using Swift with a GCC‐based standard environment.

Similarly, the internal Clang headers in the resource directory are
coupled to the corresponding version of Clang. The resource root patch
caused Swift’s Clang to use the resource directory from the version
of Clang used in the build environment, which is only compatible if
the versions match.

Instead, hard‐code the Clang path in the patches and wrappers.
2025-09-02 04:09:46 +01:00
Emily
1884f3de79 swiftPackages.swift-docc: add patch for modern LLVM 2025-09-02 04:09:46 +01:00
Emily
1474a620e6 swiftPackages.sourcekit-lsp: backport patch for modern LLVM 2025-09-02 04:09:46 +01:00
Emily
828d2d79fe swiftPackages.Foundation: backport patches for modern LLVM 2025-09-02 04:09:46 +01:00
Emily
3b773c7bae swiftPackages.Dispatch: backport patch for modern LLVM 2025-09-02 04:09:46 +01:00
Emily
e0d9c9386f swiftPackages.swift-unwrapped: backport patches for modern LLVM 2025-09-02 04:09:46 +01:00
Emily
810bed0854 swiftPackages.swift-unwrapped: vendor Clang patch
The versions of `llvmPackages` that require this patch are going
away soon.
2025-09-02 04:09:46 +01:00
Emily
efde96d9be swiftPackages.swift-unwrapped: drop unnecessary mkdir
Honestly I did this in the middle of trying things and then forgot
about it, and I just don’t feel like bootstrapping the whole thing
again to drop this commit.
2025-09-02 04:09:46 +01:00
Emily
0ec026a14a swift.tests.cxx-interop-test: init
I used this to verify the libc++ changes.
2025-09-02 04:09:46 +01:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Charlotte 🦝 Deleńkec
61593a72a0 swift: throw on unsupported arch 2025-07-11 22:09:01 -05:00
Olivér Falvai
024f70f64d swift: use Python 3.12
https://hydra.nixos.org/build/299109156

Per the release notes: https://docs.python.org/3/whatsnew/3.13.html

> Remove the PyEval_ThreadsInitialized() function, deprecated in Python 3.9. Since Python 3.7, Py_Initialize() always creates the GIL: calling PyEval_InitThreads() does nothing and PyEval_ThreadsInitialized() always returns non-zero.
2025-06-03 18:43:25 +02:00
Jörg Thalheim
d8c42f6f2f swift: use aarch64 instead of arm64 on Linux (#404263) 2025-05-05 12:33:28 +02:00
Michael Hoang
e3895dafc9 swift: use aarch64 instead of arm64 on Linux 2025-05-05 13:06:42 +10:00