Swift packaging in nixos

Hi there, i like to build a package for the container tool from apple for myself (maybe public later).

the problem: nixpkgs only have swift 5.10.1 available and i need a higher version, and like to use the system-whide swiftlang on macos natively.

ma its possible to include the system-whide swift for nix-build?

thanks for help :slight_smile:

1 Like

swift is not well supported on nix, swift and dependencies have been broken since october

see:

swift is a pain for a number of reasons, it’s difficult to boostrap, it uses it’s own fork of llvm which has to be built from scratch: Packaging Swift · Issue #11463 · NixOS/nixpkgs · GitHub

2 Likes

So thanks a lot for the information and your point of view.

I heard about these issues before, so maybe it will be better son???

So i´m not as god as a professional programmer, so i am not able to fix the issues, but maybe i can help in the Future :joy:.

Have a nice Day.

That’s only on Linux tbf, it was broken for a short time on macOS and has been fixed there.

But yes, the swift 6 upgrade has been pending for years, and no one appears to be taking that on anytime soon.

1 Like

OK, so we have to wait for the future.
Idk how to build it, and i am relatively new to nix and programming.

So but thanks for the help :slight_smile:

That’s not true; @reckenrode has been working on it actively for months and has posted updates on this forum, GitHub, and Matrix.

2 Likes

Thanks, @emily!

Yes, I’ve been working on it. There have been some challenges with bootstrapping. Prior to Swift 6.2, a working toolchain was needed. Swift 6.2 restored support for building a C++-only bootstrap compiler, but it’s a bit buggy (and probably not meant to be used on Darwin).

I’ve created a Matrix room for Nixpkgs Swift. I’m working to get an alias under nixos.org, but one can join that room in the meantime. I have the status of both Darwin and Linux as well as a link to my WIP branch for those who want to test set as the topic.

3 Likes