this post was submitted on 19 Dec 2023
104 points (95.6% liked)

Linux

48078 readers
805 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

My biggest blog post yet, and it's about running (almost) vanilla NixOS on a (formerly) Android phone! This was 50% fun and 50% exhausting... you solve one issue and another one crops up right away... it was certainly an interesting educational experience.

I'm not explaining any basic technical concepts here, as I'm not a complete noob in phone ROMs and Linux.

Ask me any questions if you have them!

top 17 comments
sorted by: hot top controversial new old
[–] GustavoM@lemmy.world 20 points 10 months ago (1 children)

Why do you hate yourself this much?

j/k. nicely done. I'd feel like a hacker if I could do this on my phone, but I'm too scared to brick it.

[–] chayleaf@lemmy.ml 8 points 10 months ago* (last edited 10 months ago) (1 children)

Most phones have no mainline Linux support, and require something like ubports, which can use an unholy hack to run Linux userspace based on Android drivers and kernel. I think this one can be installed to just about any Android phone (worst case you can use the generic GSI image, which should work but be slow). Personally, I've never once bricked a phone by flashing it, and I've been doing it since ~2015 (don't remember the year, but it was a Lenovo S660).

OnePlus 6 is a 5 year old phone with a SoC that has comparatively high development velocity (SDM845), which is why it's finally getting close to full mainline support for basic features like calls/SMS/camera/sensors (still not fully there, and yes sensors are needed, they make stuff like autorotate and turning touchscreen off when you put your phone to your ear during a call work). If you want to tinker with Linux, I recommend a Pinephone; though Mobian did mention how frustrating its ecosystem is in their blog. Maybe Pinephone Pro or Librem are better, but they're way way way more expensive. If you want a daily driver, I recommend a OnePlus 6/6T as explained in the article, or some other SDM845 phone, and maybe don't DIY if you don't have the basic experience in working with ARM SBCs and Android ROMs like me lol.

postmarketOS is probably the smoothest experience you'll get on a wide range of devices, and I highly recommend it. Most other mobile Linux distros are often more or less piggy backing off their work (though of course other distros create cool stuff too).

[–] caseyweederman@lemmy.ca 6 points 10 months ago (2 children)
[–] Euphoma@lemmy.ml 6 points 10 months ago (1 children)

ubports has been completely community maintained and separate from Canonical for longer than it was actually under Canonical.

[–] caseyweederman@lemmy.ca 1 points 10 months ago (1 children)

Why not rebrand? Why continue to use Ubuntu and Canonical trademarks?

[–] Euphoma@lemmy.ml 6 points 10 months ago

I'm not them so idk. Also I think Canonical uses a slightly different ubuntu logo these days.

[–] AI_toothbrush@lemmy.zip 2 points 10 months ago* (last edited 10 months ago) (1 children)

I think its based on ubuntu mobile or what but its not (~~oracles~~) canonicals project anymore

[–] chayleaf@lemmy.ml 3 points 10 months ago (2 children)

Okay Ubuntu is bad but it doesn't have anything to do with Oracle... Did you confuse them with Canonical?

But yes, this hasn't been an official Canonical project for a long time... afaik

[–] AI_toothbrush@lemmy.zip 2 points 10 months ago

Sorry i had a brain poop moment

[–] caseyweederman@lemmy.ca 1 points 10 months ago

I'm glad. The trademark usage makes that a little unclear.

[–] lupec@lemm.ee 7 points 10 months ago

That was one of the most unhinged rabbit holes I've been to in a hot second, and I absolutely mean that in the best of ways. Well done and congrats on getting there after everything was said and done!

I've been meaning to experiment with mobile NixOS myself but it's all but impossible to get my hands on a supported device around here. Then again, maybe fumbling around and trying to get it to work at all on an old phone might be fun 🤔

[–] blashork@hexbear.net 4 points 10 months ago

Jesus fucking christ this is a hell of a project, Ill finish reading when I get home today.

Hats off to you for pulling it off. Why is it that every time I read something by a NixOS person I get the inpressiom that they are very smart but are completely mad.

[–] Strit@lemmy.linuxuserspace.show 3 points 10 months ago (1 children)

I didn't know NixOS had official aarch64 repositories. 😜

[–] chayleaf@lemmy.ml 13 points 10 months ago (1 children)

strictly speaking, NixOS doesn't have repositories.

NixOS has "derivations" (rules are written in the Nix language to generate a script that builds a package, which is called a derivation - yes, everything is built from source to the extent possible/reasonable) and "platforms" (the system that builds the derivation OR the system the derivation is built for). A "platform" is e.g. the CPU architecture, the libc used, the target kernel (there's most support for Linux and Darwin, which is the macOS kernel, but e.g. FreeBSD is supported to some extent too). The derivation code may well be shared across platforms, though often platform-specific workarounds are required.

Of course, different platforms have different support. Some platforms have derivations from nixpkgs (the NixOS git repo) regularly built for them and put into the official binary cache (which stores the derivation outputs, i.e. ready-built packages for a certain set of inputs, which generally match what you would've built from source because Nix strives for reproducibility, you're still free to override a package's inputs and build it from source). linux-aarch64 is one of such platforms. Other platforms may only have a small set of core packages like gcc built for them, or simply require building absolutely everything from source.

The reason nixpkgs is not a repository (though I guess you could call it one) is because it only provides rules to build a package, but not the package itself. Some derivations (e.g. for Gog games) even require you to add some non-redistributable files to the Nix store manually. The derivations may or may not build correctly for each platform they're supposed to work on.

The reason the binary cache is not a repository is because it's just a cache for nixpkgs - it stores every derivation's output (if the build doesn't fail), even if that derivation is one that downloads a package's source code (yes, that's a derivation too), even if the derivation is from many years ago (which has historical value, as you can revert nixpkgs to an old version and still be able to download prebuilt versions of packages).

Together, they form something like a repository, but it's still way too different. For example, unlike on Arch, I can stay on the same nixpkgs version for a long time without updating, which I really prefer because I have to build 3 kernels on each update, since I'm syncing the nixpkgs version of my 4 NixOS devices, only 1 of which doesn't require a custom kernel config. Or I can always revert back to an older version of nixpkgs if a new one breaks something and it will still work. Or I can fork nixpkgs and change some stuff, and the stuff with changed inputs will have to be rebuilt locally, with stuff that didn't change still available from the binary cache.

[–] Strit@lemmy.linuxuserspace.show 2 points 10 months ago (1 children)

Thanks for the detailed response.

So nixpkgs is more akin to the AUR, then a binary repository? The AUR is also just build scripts.

[–] chayleaf@lemmy.ml 3 points 10 months ago* (last edited 10 months ago)

yes, if that AUR was in a centralized git repository, and kept track of inter-package compatibility, and centrally cached prebuilt versions of the packages for every single update, and you could also easily modify any of the packages, and there was a way to autogenerate build scripts, and and and...

[–] huojtkeg@lemmy.world 1 points 10 months ago

Nice read. I did similar hacks in the past but I have less time lately.