Sailfish Community News, 14th December, Nix

Sailfish OS update from Jolla

It is that time of year again! On behalf of Jolla, let me extend warm and heartfelt greetings to each and every member of the Sailfish OS Community.

In this season of joy and reflection, I find myself grateful for the incredible community that surrounds Sailfish OS. Your passion, dedication, and collaborative spirit have made Sailfish OS more than just an operating system — it’s a shared journey filled with innovation, friendship and passion. Let’s make Sailfish OS flourish together.

May the holiday season bring you moments of joy, peace, and connection with loved ones. As we sail through the year-end waters and approach a new chapter, let’s reflect on the achievements, challenges overcome, and the friendships forged within our community. Your contributions have been the wind in our sails, propelling Sailfish OS to new horizons.

Looking back at what we have accomplished, in the form of Sailfish OS releases, there were five: one major release (4.5.0) in the beginning of the year, followed by four smaller ones. While those smaller releases focused on bugfixes, they still added new features, e.g. CLAT, which makes mobile data work on IPv6 networks.

May the upcoming year be filled with exciting developments and fruitful collaborations! Together, let’s navigate the seas of technology, curiosity, and creativity. Wishing you all a festive holiday season and a New Year filled with prosperity, good health, and the boundless possibilities that lie ahead.

Once again big thanks to David Llewellyn-Jones (flypig) on discussing with community member Yann Büchau (nobodyinperson) and sharing community energy! It goes without saying that Damien Caliste (dcaliste) did a great job with this year’s last repository roundup. We’re happy to say Merry Christmas to everybody. Please enjoy whilst reading this fortnight!

Energy from the Community

NixOS is an interesting Linux distribution that’s been around for a while but seems to have picked up a lot of momentum recently. The twelth law of tech states that all aspiring software ecosystems must define themselves in three words. In the case of NixOS these three words are: reproducible, declarative, reliable. But it’s also a Linux distribution with both standard and mobile variants.

But readers of this newsletter are interested in Sailfish OS, so why would I be writing about NixOS? Apart from being a fully fledged Linux distribution, NixOS is built around a versatile package management system — the Nix Package Manager — that can be installed on other distributions. And that’s exactly what Yann Büchau (nobodyinperson) did recently on his Sailfish OS phone. He then went on to write about his experiences here on the forum.

So we thought we’d do our usual thing and ask Yann a few questions, hopefully get to understand what the Nix Package Manager is and why others might be interested in installing it on their phones as well.

Yann is a FOSS enthusiast and atmospheric scientist (a meteorologist) currently doing a PhD in environmental science about quantifying natural CO2 emissions from non-volcanic sources. As part of this he’s developing a low-cost sensor network and so knows all about integrating software and hardware together.

Here’s a picture that shows the sort of devices Yann builds. You can read more about his work in a couple of his publications that look at the Wireless Sensor Network he’s developing (link temporarily down at the time or writing) and their application to quantifying gas emitted from holes in the earth.

(from Büchau et. al (2022) (link temporarily down at the time or writing), licensed under CC-BY-NC)

I start by asking Yann to explain a little about his journey to Sailfish OS

I never had an Android, Windows or Apple phone. My first smartphone was a Samsung Wave II, after which I entered the mobile Linux space with a Nokia N9 (what a beautiful device!). I was already a Linux user in school, so having a Linux on my phone just felt good. After the N9’s end became clear, I bought a Jolla phone and was happy for many years with it. It died eventually and I got a Sony Xperia X and put Sailfish OS on it. At some point the old Android compatibility layer added too much friction, so I briefly used a Sony Xperia 10 where the experience was not so great, so I eventually switched to a Sony Xperia 10 III with Sailfish OS and am very happy until now.

Python is my main programming language, so being able to use that for Sailfish OS app development was a big motivation for me. Over time I developed some apps, notably OpenSenseFish, a rather basic client for your OpenSenseMap account and Hasher for deriving hashes/digests from text and files. I put those on OpenRepos along with their Python dependencies - a tedious process.

The tedious process of making his apps available also feeds in to his route to using NixOS. We’ll come back to that, but first let’s look at why Nix is important outside of Sailfish OS. Although Nix is already over 20 years old, it’s been gaining a lot of traction recently in scientific circles as a way to achieve reproducible research. I ask Yann why that’s important.

Reproducible research is a sustainable way forward in science, as for Free and Open Source Software. Humanity is not helped by monopolising knowledge such as the exact steps and materials needed to build something, be it software or a science chart. Especially for publicly funded research.

From a work-efficiency point of view, designing your (digital) research in a reproducible way helps you to work on different machines. I frequently switch machines (desktop, laptop, server, etc.) and without a system in place that keeps your working environment idential across those, you spend more time debugging reproducibility issues than doing actual research.

So how does Nix actually help with this? Probably it’s the “reproducible” part of that three word description, right? Everything in Nix is built from declarative .nix configuration files which define not just how to build something, but also exactly what to build it from. Packages can be reproduced down to their last byte, because everything in the Nix stack is hashed. You can install multiple versions of the same executable on a device, but when building another packages, only the exact same ones that it was originally built with will be used. Yann explains.

Nix is also a programming language; it’s like JSON but with functions basically. The entirety of NixOS and all Nix packages are defined in that declarative language.

Because these nix expressions are declarative it means they’re pure functional without side-effects. In other words, they always evaluate to the same thing no matter what.

One can do everything in plain nix. But that’s not very interoperable so they’re still developing a standard for these nix expressions (”flakes”) so people can reuse them somewhere else. An output from one of these can be a program, a script, a shell environment with certain programs available, even an entire NixOS configuration, or even a Raspberry Pi image to burn on an SD card.

Yann shares an example of a nix flake he made to run a Python script (or open a shell with that script available) with a pinned Python version:

{
  description = "LaTeX Reference Order Checker";
  # importing other nix dependencies, versions are pinned
  # in a flake.lock file
  inputs = {
    # all nix packages
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    # utilities
    flake-utils.url = "github:numtide/flake-utils";
  };
  # define what this flake produces as output
  outputs = { self, flake-utils, nixpkgs, ... }:
    # make it work for all nix-known architectures
    flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
      let
        pkgs = nixpkgs.legacyPackages."${system}";
        launcherName = "latex-check-refs";
        # A launcher using nix' Python which calls
        # a Python script in this folder
        launcher = pkgs.writeScriptBin launcherName
          ''${pkgs.python3}/bin/python ${./latex-check-refs} "$@"'';
      in {
        # > nix run gitlab:nobodyinperson/latex-check-refs
        # will run that script with all its pinned dependencies
        apps.default = {
          type = "app";
          program = "${launcher}/bin/${launcherName}";
        };
        # > nix develop gitlab:nobodyinperson/latex-check-refs
        # will drop you into a shell with that script
        # 'latex-check-refs' available
        # Other arbitrary software that should be available can
        # be specified here as well
        devShells.default =
          pkgs.mkShell { buildInputs = with pkgs; [ launcher ]; };
      });
}

So Nix allows you to define environments with specific versions of specific executables that can build themselves from the ground up and which will give you exactly the same environment whenever and whereever you use them.

Now if that’s something that interests you, then it’s quite likely it will interest you on Sailfish OS. If you’re reading this and thinking “that’s not something that’s ever been a problem for me” then it could be that Nix isn’t the tool you’re looking for. For Yann, when he heard about it he immediately decided it was something that could be useful for him.

When I heard about NixOS this summer, I already eyeballed it and then there was the Tübix Linux day in my city here with a talk about it, and then I made the jump on my work PC to NixOS. It’s very different, but also very powerful; especially well suited for reproducible research, which I am interested in.

Then I noticed you can also use nix on non-NixOS machines (my laptop for example) and then it occurred to me, why not also have that on my phone? I was struggling really hard keeping the same CLI utilities available on my Xperia 10 III with Sailfish OS. GPG was outdated, I couldn’t use my keyring. I couldn’t use my password manager pass . I had to compile tmux and timewarrior myself, and do some weird downloading for git-annex . And and and. Nix seemed like the ideal way out of this. Nix’s whole point is to provide the exact same version every time. This smoothes my workflows immensely. I use my Sailfish OS as an extension to my laptops and desktops. Having the identical toolset available is crucial. With Nix, this works!

Maybe this has piqued your interest? If it has, you’ll be pleased to hear that trying out the Nix Package Manager on Sailfish OS is surprisingly straightforward. Yann has detailed the process on the forum. The process follows the official instructions but with some additional steps that are needed to mount a file to the /nix path to work around the intentionally constrained root partition on Sailfish OS.

When I worked through the steps myself I ran into some difficulties and ended up installing the multi-user version, which also required me to install bash . None of the steps were particularly challenging, but I’m not sure how easy it would be to reverse the multi-user install.

Once installed it’s possible to drop to a Nix shell from inside the Sailfish OS command line. This will give you a specific environment populated with a specific set of tools, all down to the specific versions in use. It’s all very straightforward and seamlessly integrated.

Yann highlights the fact that the Nix shell won’t interact with any of your existing Sailfish OS software unless you explicitly ask it to.

Nix packages are completely isolated from Sailfish OS and bring their own libraries. Sailfish OS doesn’t even know about the Nix-installed packages as they reside in non-standard locations. No danger here.

Unlike the sandboxing on Sailfish OS, Nix doesn’t use sandboxing for this, it’s all done by essentially setting up environment variables — $PATH for example — so that only the Nix executables are used in a Nix shell, and with the Sailfish shell using all of the things it’s always used. But that means that you can also potentially get them all to interact with each other if you want to.

I haven’t tested it yet, but in theory there should be no problem setting a GUI app’s PATH to include the Nix path. The programs should just work. This could be used to use a more recent Python in an app or any other program, really.

GUI apps are also possible with Nix. For example, OpenSCAD (a 3D CAD program) from Nix does launch without any further config (using nix-shell -p openscad --run openscad ). Touch input works and even the file selection dialog opens. Not in the Silica theme of course. Unfortunately, one does not get past that, I guess it’s some 3D graphics problem here. Some other programs I tried mostly complain about the compositor. I wonder why OpenSCAD doesn’t, but there is some potential here for bringing normal GUI apps to Sailfish OS. I could get Okular — the PDF viewer — to launch from an Apptainer once, and so does Okular from Nix. Touch works, scrolling, pinch-to-zoom works. No menu bar though and other small quirks, but hey!

Yann suggests this as something to try if you want to get a quick feel for the power of Nix. After running through the setup steps you can then run Okular just with the following.

nix-shell -p okular --run 'QT_SCALE_FACTOR=2 okular'

Are there other things Yann finds useful on his Nix empowered phone?

I find it pretty cool to get pass to work on Sailfish OS.

If this all sounds like fun to you, or could ease up your workflow, not just on your phone but across all your devices, then why not give Nix a try? For me, this highlights not just the power of Nix, but also the power of Sailfish OS. Because it’s a glibc Linux distribution with a fully working shell and root access for users who want it, we have access to this immense ecosystem of useful tools. All of this is accessible just by running a few commands on your phone. You won’t find such a usable mobile user interface underpinned by such a powerful open ecosystem, with the user in full control, in many other places.

Thanks to Yann for walking me thorugh Nix and NixOS on his Sailfish OS device. My plan for the Christmas break is to spend some time exploring Nix and all of the tools it provides, and maybe it’ll end up being a new fixture on my phone for 2024 as well.

Repository roundup

With the administrative situation of Jolla sorted out, the activity in the public repositories of Sailfish OS increased significantly in the last 15 days. pvuorela took care of long standing pull requests, closing old ones and accepting many of the Qt6 upgrades from neochapay and jmlich. mal also continued his large work of keeping the software stack up-to-date and is also testing an upgrade of GCC, fixing in advance what will break in other packages.

Communication services

  • libqofono, Qt bindings for Ofono, neochapay updated the build system for Qt6.

  • libconnman-qt, QML bindings for the connection manager, mariuszmaximus proposed to add a cmake build system in parallel to the current qmake one.

  • libqofonoext, Qt bindings for specific Sailfish OS extension to Ofono, jmlich proposed to fix a broken value in an enumeration, using a 64 bits value while the specifications is clear that enumerations are using plain integers.

  • bluez5, the Bluetooth stack, acfbhytuiltyghrth partially backported a fix for the two recent CVEs. mal commented that a general update of Bluez should be preferable and may happen before the next Sailfish OS release.

  • commhistory-daemon, the daemon handling call and message history, pvuorela changed the reply method for SMS, switching to a inline text one.

Multimedia

  • nemo-qml-plugin-thumbnailer, the QML bindings to get image thumbnails, jmlich updated the build system to support Qt6.

User interface

Low level libraries

Developer’s corner

Please feed us your news

This time we will not be pushing out a newsletter between Christmas and New Year. Instead you can expect the next newsletter to be published on the first week of 2024. If there are topics you would like to hear about then, please write a comment below! And please join the community IRC meeting next week.

Happy Holidays and Sail On!

42 Likes

Happy Holidays to all you sailors!

19 Likes

Happy Holidays and a BIG THANK YOU for sailing on (into the next decades, I hope)

10 Likes

This was an interesting read about *nix on SailfishOS devices. I’ve heard previously (if you don’t live under a rock) about *nix but never got interested in that kind of tech. Now that this can be used on SailfishOS makes thing a lot more interesting to me.

Other that that I wish all of you guys at Jollyboys a very Merry Christmas and all the best for the next year(s) to come. Keep on sailing, we’ll follow you even if there is a storm on the horizon.

Cheers,
Nek

4 Likes

Which supports PinePhone and PinePhone Pro but not PinePhone Tab and none of the device from Sony on which SailFish OS runs.

However, once a boot image with recovering tools are running based on Sony Open Device Program AOSP can boot a Sony device included in that program, then any GNU/Linux distribution could also be installed on it and run on it. The next two steps to complete the job is to integrate one mobile UI among many available and develop a system configuration manager.

This is also true for the PinePhone Tab which recently has been ported on Sailfish OS.

Because it has a system configuration manager natively as a pillar of its architecture:

Nix is a tool that takes a unique approach to package management and system configuration.

Unfortunately, about SFOS applications - making his apps available - it is not the only tedious task for a modern mobile OS which aims to privacy and security. Therefore porting Nix Package Manager on Sailfish OS is not enough and move the SailFish UI to the mobile NixOS would kill all the apps ecosystem which requires SFOS binary compatibility.

In other words Nix Package Manager on SFOS lose its best feature being a system configuration manager. In fact, he wrote:

Which means that now SFOS limitations are working on another device instead of the beauty of NIX is fully working on SFOS.

Ok, I accept that TRANSITION times are hard and sometimes messy but I cannot still see any system architecture design here that would bring anywhere in a reasonable time with a reasonable effort.

Just let me ask a question.

All these independent attempts puzzled together like a patchwork blanket to avoid accepting the sad true that the only valuable part of SFOS is its UI which cannot run on a modern and secure [1] Linux distro even if that distro might be installed on a Sony device and the only way to fulfill this gap is to release that UI under open-source license and publish its code?

Conclusion

Advancing slowly for an open-source community is fine not for a business. As long as, there is a clearly and precise direction to go forward. Here, I do not see anything like that but I accept that it can be my fault. A system redesign (because refactoring word has been just taken) plan has been published somewhere?

Moreover, SFOS is not open-source and that is its main problem: SFOS evolution is limited by the Jollyboy Oy team best effort [2]. NIX package manager will not solve any of the SFOS issues but just allow some technically skilled people to have their Linux application running effortlessly on their SFOS smartphone [3].

Another question, for @nobodyinperson

Which is great but then why SFOS apart its UI?

Notes

[1] because the best choice here is CentOS 8 which does not fit into the “modern and secure” Linux distro definition because its support is ceased and moving on a CentOS 9 is required at the expense that every SFOS might need to be rebuild. Nix package manger on SFOS would solve this? Nope.

[2] all the effort included into the Repository roundup is meaningless because it could - then it should - be avoided adopting a community driven Linux Distribution which can be CentOS because binary convergence with 8 to upgrade to 9 or NixOS mobile because its configuration manager but in this latter case say “goodby” to the SFOS app ecosystem unless rebuilding all the apps and moving into NixOS which NixOS people might will to do, but only if the SFOS UI will be published open-source.

[3] In fact, after having check the related post my guess was right:

Dude, the point isn’t to run the sailfish interface on Nix.

1 Like

Why not?

[20 characters]

Nix would be good for extra packages.

Fine. I agree. Adopting the mobile NixOS, the apps on OpenRepo should be recompiled with a new SDK otherwise they would not run on the mobile version of NixOS.

  • Q1 - Or are suggesting that Nix packages will replace the current apps deployment system?

  • Q2 - In that case the SailJail will need to be ported to the new paradigm. Because the Nix extra packages are separated by SFOS but they can access to all the resources exposed by the Linux kernel and all resources on the network interfaces included 127.0.0.1 therefore all network IPCs. Isn’t right?

  • Q3 - Anyway, what about the same question “Why not?” but with s/NixOS/CentOS 8/, instead?

CentOS 8 has the binary run-time compatibility with SFOS and can be upgrade to 9 in a second stage in 2024. The CentOS community will be at FOSDEM in Brussels, in May 2024.

CentOs 8 upstream EOF is cheduled for the May 31st, 2024. In fact.

@robang74 you don’t seem to understand the post.

Let me introduce you to summarizing. Something you don’t seem to be good at.

• Nix is a package manager.
• Nix will allow more programs to run on Sailfish that aren’t on the official sailfish package repository.
• This Nix port isn’t meant to get people to put their sailfish apps on Nix, or Sailfish moving to NixOS.

4 Likes

Fine. I agree. As wrote before:

Now that we reach an agreement about Nix role - which, BTW, is much more than a packet manager like RPM - open your mind and answer these three questions {Q1, Q2, Q3} instead of debating with me.

Debating is about opinions. Instead, If reality is a consistent and quantifiable kind of thing then we can reach another agreement about our PoVs.

Feel free to ignore this reply. :wink:

I do not even know what you are answering to because this entity is on my ignore list but I am afraid you might be feeding a troll still ruining a lot of otherwise meaningful discussions with WoTs and meaningless gibberish.

I might be wrong and I am sorry should you consider my words rude. But I am afraid you might be wasting your time.

6 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.