Approaches
I want to take a pragmatic approach that favors the project actually getting built, and actually having a meaningful impact rather than a pure Swift science experiment. It's not that expanding swift or a pure swift implementation is not important, but I don't believe it's the only thing that matters here.
I hope this doesn't rub anyone the wrong way in this community, that's not my intent. Also it's not that Iâm against radical thinking or the joy of a pure Swift code base or building from scratch, I just want to be practical about it to maximize our chances of success and to prevent burnout rather than live and die based on unnecessary programming language dogma.
To this end, maybe it should be renamed âSwift + C + Mojo OSâ or "AgentOS" but, alas, SwiftOS has a nice ring to it. I think any 3 of these languages (or C++) should feel at home in this OS. As Swift matures, we can replace more and more C code where it makes the most impact, but letâs not let it block us from moving forward.
- What about Rust? Iâm not against Rust, in fact I hope we learn from that community as much as possible, but without clear Swift - Rust interopt I donât know if it makes sense to write code in Rust for this project. (same for Zig)
- As for mojo, if youâre not familiar, take a look Mojo đ„: Programming language for all of AI seems like a safe bet to me, as the worst case if it doesn't take off it just means we have python support which is not a bad thing
The way I see it, there are 4 possible approaches to achieve the 3 goals above, each one has tradeoffs and may favor one goal over another.
These will be ordered in least difficulty to most complicated, at least as I understand it.
- Make a new linux distro
- Build on top of FreeBSD
- Build on top of XNU (Darwin)
- Build from scratch
Make a new linux distro, rather than a completely new OS
- Just focus on the first experience above, get to market as quickly as possible as an âAgent AIâ distro
- My preference would be to fork Fedora (or Asahi Fedora https://asahilinux.org for Apple Silicon) and GNOME, of the research Iâve done they stand out as good Linux foundations both technically and aesthetically. (FWIF: I am particular to the default GNOME look since its more like macOS, I donât like KDE Plasma since it looks like Windows to me; I realize this is all highly subjective, also though utilizing GTK seems like a win)
- add AnyType, Mojo, and Max, alter the window compositor, add Llama 3.2 1b deep in the system, and see what we get
- contribute Swift to the Linux kernel or other parts of the Linux stack
Pros
- move fast to market
- compatible with lots of software and hardware already
- Swift runs on GNOME already with the adwaita library Adwaita - Aparoksha
- Max already runs on Linux
- focus on the LLM UX and inference with Max
Cons
- not really âSwiftOSâ
- lots of legacy and potentially complicated code to deal with, including traditional apps
- will the Linux community accept Swift contributions?
- It only achieves goal 1 above, not really 2 or 3
Build on top of FreeBSD
- FreeBSD stood out as a middle ground between some of Appleâs technologies and the broader open source community while having some benefits over Linux. Its also what recent PlayStations and Nintendo Switch OS is built on
- This is the approach of RavynOS https://ravynos.com and Hello System hello â helloSystem documentation
- I would prefer to keep things simple as Hello System does rather than trying to get Linux and AppKit compatibility as RayvnOS is attempting
- However, I would prefer to be forward thinking as RavynOS is rather than focus on legacy compatibility with xorg as HelloSystem is
- We should use the Hyprland Wayland https://hyprland.org compositor, it already has FreeBSD support, we can alter it to meet our experience goals
- fork and contribute Swift as necessary, add the above AI inference at a deep level.
Pros
- blend of moving fast but more control, building what we need
- still has a lot of existing compatible software
- focus on the experience, but also work with exiting platforms that have more room for customization
Cons
- still not really âSwiftOSâ
- FreeBSD is still more Linux like than it is macOS like, monolithic kernel, etc.
- Will the FreeBSD community accept Swift contributions?
- It may or may not be able to achieve all 3 goals above
- Hello System and RayvnOS have made some progress, but relatively slow adoption overall
Build on top of XNU (Darwin)
- Appleâs latest kernel in all their systems is still open source, we could start modifying it and porting it to swift. Appleâs license should allow this work so long as the kernel remains open source. https://www.gnu.org/philosophy/apsl.en.html
- Probably contributing to and expanding PureDarwin would be a good start https://www.puredarwin.org
- I would suggest getting it to work with Wayland and use the Hyprland compositor, and ZFS file system rather than HFS+.
- There are PureDarwin attempts at these endeavors as well, but they did not seem to make much progress.
- Letâs take the time to make it more of a micro kernel, but I still see the value of a hybrid kernel approach, I may be nostalgic, but can we recapture the magic of OS X Snow Leopard?
- It should run Vulkan, RayLib https://www.raylib.com, and Clay Clay - UI Layout Library for rendering and UI; and of course add Max, mojo, LLMs, custom widget experience etc.
Pros
- More control, more Apple like system. We might be able to get compatibilty with apple apps easier.
- Since we will need to go deeper anyway to make it work, more room to innovate and add Swift to the core of the system, and rethink certain design decisions
- Still leverage existing C code instead of starting from scratch, get to making meaningful improvements quicker
- we can forge a new path forward with a new kind of LLM based widget, instead of traditional apps
Cons
-
Risk: Would Apple support this work or try to stop it?
-
Are they working on this already?
-
See, âwith a new operating system: a hardened subset of the foundations of iOS and macOS tailored to support Large Language Model (LLM) inference workloadsâ Blog - Private Cloud Compute: A new frontier for AI privacy in the cloud - Apple Security Research
-
no compatible apps from the linux or apple ecosystem will work without significant work
-
Thereâs no Quartz, Quicktime, or Metal, we have to fill in all those gaps ourselves
-
Can XNU, ZFS, Vulkan, and Wayland work together or will it be a huge headache? Are we still inviting too much legacy code?
-
PureDarwin has been working at this for some time with little success
Build from scratch, following RedoxOS as a guide
- Start over completely in Swift, using the Rust Redox OS https://www.redox-os.org as a guide
- perhaps use Oxide Hubris, Minix 3 or seL4 as a starting point
- They have several influences of the above platforms which we also admire, and have opted for a micro kernel approach
- they have their own filesystem and window compositor
- We would start just porting the rust code to swift, and make design changes as needed, including influence from XNU as appropriate
- If there is better Swift - Rust interopt I donât mind mixing code, but otherwise just observing Rust patterns and porting to Swift and C seems better for the Swift ecosystem.
Pros
- Completely fresh start, free to pursue all the goals above
- Redox as a guide gives us a head start
- No legacy code or documentation to deal with
- Can build a kernel that leverages the strengths of Swift
Cons
- Risk: Will we make meaningful improvements, or reinvent the wheel?
- Risk: Is Redox a sound guide to follow? e.g. is their file system as solid as ZFS? Is it meaningfully better than FreeBSD?
- Lots of work, long time to market. Potential open source project burnout.
- No app compatibility with existing sytems, starting with nothing
- Lots of design decisions to make
Summary
I have an empty repo setup, if you find this vision compelling, please reach out. GitHub - boldflight/swiftos: An intelligent OS for digital sovereignty
So with all that, what's the best path forward?
EDIT: I was intentionally not voting, because while I have my thoughts I wanted to hear what the community thinks, however, I now strongly believe there is a 5th way forward which I would advocate for: Build on top of FuchsiaOS. https://fuchsia.dev I think its still practical to look at Redox as inspiration, but I think Fuchsia is even more forward thinking, and has the support of Google.
I think this project should start as a desktop environment for Fuchsia, and it could expand further, as I detail in subsequent posts. Of course still happy to see how the vote goes and hear alternative perspectives. IMO "build from scratch" includes building on top of Fuchsia now. (I can't edit the poll)
SwiftOS Approach
- Make a new linux distro
- Build on top of FreeBSD
- Build on top of XNU (Darwin)
- Build from scratch