mobile-nixos
mobile-nixos copied to clipboard
Would fairphone support be practical for NixOS?
For the record I have very little experience with NixOS so far and zero with Mobile Linux, so I unfortunately probably won't be able to help much with regards to supporting any new devices. With that said, I have been keeping an eye on mobile linux for a while now and remembered that some mobile linux distros had been able to support the fairphone 4 so I started looking into it and found this page that details how to create "the version of the Linux kernel used in the Fairphone 5". (and 4)
The only mention of Fairphone devices at all I can see is issue #69 and as far as I can tell it hasn't been looked into at all since that one passing mention.
While I do definitely see why there is a stronger focus on the Pinephone and Librem since they're definitely more open and linux focussed, if the Fairphone linux kernels are usable for NixOS it could be a much more solid option hardware-wise. (I don't really think it's all that debated that linux-first phones like the pinephone or librem are pretty weak hardware wise)
To be clear here, this isn't a support request - I have no idea how easy or hard it would be to support these devices and I don't even own one (though if they do end up being supportable by NixOS they'd definitely skyrocket in the runnings for my next phone) but they are pretty decent hardware wise and at least the Fairphone 4 has extremely good support from/for Ubuntu Touch. (though as far as I can tell the Fairphone 5 currently has zero support for Ubuntu Touch, you're free to interpret that however because I don't know what it does or doesn't imply) Given their combination of competent hardware, more open software, available documentation, historical linux support and the fact that they even "have an official agreement" working with Ubuntu Touch/UBports (indicating they're open and willing to work to try to improve linux support) it makes Fairphones seem quite promising in terms of being supportable on NixOS. The point of this issue is just to prompt the discussion a bit since, as far as I can tell, Fairphones haven't even really been looked at in terms of support despite seeming fairly promising from an outsider's perspective.
Going by the porting guide the steps to make a port for a new device are 1 : find a way to unlock the bootloader, which is done, 2 : finding the appropriate sources, (mainly the kernel, also there is a typo in this one) also done assuming that the link at the top of this issue is what it looks like, and 3 : writing the expressions to build said sources, which is not done, but I don't think would be a huge barrier. (again, 100% talking out my ass here, I could be completely wrong)
With that said, I can find very little in terms of linux support for the Fairphone 5 in particular so that one may be more complicated than the others for some reason I'm not aware of.
Oops, those notes should be amended. Since #643, using a mainline or mainline-adjacent is required.
There is no way forward with vendor sources.
So yeah, to make any phone practical, just like on any other non-android Linux distro, it needs mainline Linux support.
Note that for all intents and purposes, UBPorts is way closer to Android than to classic Linux distros.
I hope this helps understand parts of the (new) requirements :).
It's unfortunately super hard to find good sources on this, (the fairphone is pretty niche as is and wanting to run linux on it narrows that niche even further) but I've found scattered mentions of the mainline kernel working or being WIP for some prior Fairphone versions. I still can't find much on the 5, but this post on phoronix implies that the 4 does support the mainline kernel directly, or at least support is in-progress. In this post there is more talk about mainline support that indicate that it was a focus and more progress may have been made, though there haven't been any significant progress updates posted to the thread since then as far as I can tell.
As of September 2022 "The kernel isn’t close to being mainlined yet, so no (custom) ROM is using / benefitting from this at the moment." but that's the only real update I can find on it since then and it's not very recent so if it got the focus that's implied from lines like "I personally want to see how far you can push mainline in 2022 (or in coming years), and this of course also enables mobile Linux distros like postmarketOS and Mobian to run on the device." a lot could have changed.
Also, (and this is well outside of what I know regarding mobile linux now) the page for the Fairphone 5 on the PostmarketOS wiki calls the provided kernel 'close to mainline' and it has the "Mainline : Works" rating both on it's own page and the Fairphone overview page. (the FP5 page was lasted edited on the 6th of this month too so that should be uptodate.)
On a side note, what 'promises' are are being referred to in 643 and why would using a first-party vendor supplied kernel be breaking them? If there is a build process for a version of the kernel that works is there some reason that it'd be less compatible or functional than a directly/purely mainline version?
On a side note, what 'promises' are are being referred to in 643 and why would using a first-party vendor supplied kernel be breaking them? If there is a build process for a version of the kernel that works is there some reason that it'd be less compatible or functional than a directly/purely mainline version?
The "promise" is the implication that the phones may work using the vendor-based ecosystem, with Mobile NixOS. I don't think it will happen. If it does, it would be after this is truly and well understood for the overall non-android distros on android phones.
Also, (and this is well outside of what I know regarding mobile linux now) the page for the Fairphone 5 on the PostmarketOS wiki calls the provided kernel 'close to mainline' and it has the "Mainline : Works" rating both on it's own page and the Fairphone overview page. (the FP5 page was lasted edited on the 6th of this month too so that should be uptodate.)
The "close to mainline" kernel here (I verified) is mainline-adjacent enough that it is a good basis for at least attempting to use it, and probably for inclusion in Mobile NixOS.
Note that you might want to first validate the expected support level of stuff on the phone, and try postmarketOS. Otherwise you might think something that isn't working is expected to be working.