Repository navigation
Description
Nixpkgs version
- Unstable (26.11)
Describe the bug
Since Swift 6.4 (#574002), swift propagates apple-sdk_27 instead of apple-sdk_26. In the 27.0 SDK, SwiftUICore declares State as an external macro as well as the property wrapper:
@attached(accessor, names: named(init), named(get), named(set)) @attached(peer, names: prefixed(`_`), prefixed(__), prefixed(`$`)) public macro State() = #externalMacro(module: "SwiftUIMacros", type: "StateMacro")The SwiftUIMacros plugin comes with Xcode, not with the open-source toolchain, so SwiftUI code that uses @State no longer compiles. The 26.5 SDK only has the property wrapper, so it worked before. Asking for apple-sdk_26 in the package doesn't help, since the build still picks up the propagated 27.0 SDK.
Steps to reproduce
- On aarch64-darwin, build a SwiftUI package that uses
@Statewithswift/swiftpm, e.g.block-catchfrom block-catch: init at 0.5.1 #580909. - It fails on current master and on every unstable eval since the Swift 6.4 staging-next merge.
I narrowed it down with Hydra-built nixpkgs/unstable evals (block-catch callPackage'd from #580909 at each one):
57e9810e4733a7ba99f8885acf98818e81c8b4ea(Swift 6.3.3): builds, 73/73 tests pass5e7788fd2ced82eb31da7f5329b55e49dc1587c8(Swift 6.4.0): fails54020e34612d3905b97ec1ed45953e21d0b4411a,8c9852de0834ee201b5723da4c5fe0bd5bc0afe9and current master: fail the same way
Expected behaviour
SwiftUI code using @State builds with nixpkgs' Swift on Darwin, like it did with 6.3.3 and the 26.5 SDK.
Relevant log output
block-catch> Sources/Catch/Views/MainView.swift:15:24: error: external macro implementation type 'SwiftUIMacros.StateMacro' could not be found for macro 'State()'; plugin for module 'SwiftUIMacros' not found
block-catch> 145: note: 'State()' declared here
block-catch> 1 | @attached(accessor, names: named(init), named(get), named(set)) @attached(peer, names: prefixed(`_`), prefixed(__), prefixed(`$`)) public macro State() = #externalMacro(module: "SwiftUIMacros", type: "StateMacro")Additional context
The builds ran on GitHub's macOS arm64 runners with sandbox = relaxed. Claude Code (claude-fable-5-2 and claude-opus-5-5) helped me bisect this and draft the report; I reviewed it.
System metadata
Not from a local Mac: the builds ran on GitHub Actions macos arm64 runners with Nix, against the nixpkgs revisions above.
Are you using nix-darwin?
No, I am not using nix-darwin.
Notify maintainers
@reckenrode @Samasaur @stephank
I assert that this issue is relevant for Nixpkgs
- I assert that this is a bug and not a support request.
- I assert that this is not a duplicate of an existing issue.
- I assert that I have read the NixOS Code of Conduct and agree to abide by it.
- I assert that I have read the automation/AI policy and that this issue report complies with it.
Activity
reckenrode commentedon Nov 19, 2026
It should be sufficient to add
open-apple-macrosto your package’sbuildInputs, but it’s not working. (The documentation saysdepsBuildBuild, but that doesn’t work either.)I’m looking into why it’s not working. We already have a few packages using these macros, but they’re not using SwiftPM. They use their own build systems, which are manually injecting the correct
-external-plugin-pathfor the macros.reckenrode commentedon Nov 19, 2026
I see why. I’ll comment in the respective PRs.
reckenrode commentedon Nov 19, 2026
I was able to build Berd and Catch with the suggested changes. I opened #590486 to update the documentation.