The road to Nix, a functional package manager to rule them all

Daily progress update:

  • First successful Nix build! (iOS, not tested yet);
  • Linux and Windows builds break on CI, most likely cause is that nixos Docker image is based on Alpine, @jakubgs will make an image based on Ubuntu to work around this;
  • linuxdeployqt is still leaving some references to /nix folders on executable, will need to write code to manually fix up references.

Update: Windows, macOS, and Android platform builds are now also passing!

3 Likes

Daily progress update:

  • Look into why CI server cannot build Linux app when it passes locally;
    • Update: Although the Linux build is passing locally, our CI Docker image is Ubuntu 16.04 (which only has glibc 2.23, whereas 18.04 has 2.27). Will need to investigate possible solutions to this issue, assuming we want to keep supporting 16.04;
2 Likes

This issue is seriously annoying. Trying to fix linking issues when we are:

  • Building in a separate environment from the OS(Nix) while in Docker container, both using different glibc
  • Packaging that build into an AppImage that doesn’t contain everything necessary(glibc)
  • Packaging using an AppImageKit that wasn’t created with Nix

Lovecraft wishes he had enough imagination to come up with this kind of nightmare.

I wish we had metrics for how many people still use 16.04, or just linux distros with glibc older than 2.27.

2 Likes

Added a question in their Discourse forum, fwiw.

1 Like

Daily progress:

  • try to get app to run on Ubuntu 16.04 by patching and copying all glibc 2.27-depending libraries, to determine if it’s a viable approach

Relevant: Will a new AppImage run on older distributions? - #2 by probono - Using AppImages - AppImage

2 Likes

Victory! I wrote a script that traverses/copies/patches all the dependencies of the Status executable and that way the output AppImage (generated on Ubuntu 18.04) was able to run directly on Ubuntu 16.04 (we should be able to run even on lower versions that than now).

4 Likes

As a note to @jakubgs when he’s back from vacations, the current state is:

  • if we run the build on 16.04 with the AppImage version of linuxdeployqt, it fails due to a missing library when extracting (--appimage-extract-and-run). It might be possible to complete successfully if we use a version compiled in Nix and doesn’t resort to that;
  • currently the way I’m able to run on 16.04 is to bundle all dependencies down to glibc 2.27, running the whole bundling process under nix-shell on 18.04 except the last step (appimagetool), which is run on 16.04. I’m going to dig deeper into this to see if we can run the whole process in 16.04 to keep the process simple.
2 Likes

Interestingly I was contacted by a non-Core dev on Status who was trying to build the app on Android but failing, he tried the feature/nix branch and was able to build it successfully at the first attempt, which is encouraging. He’s still having issues with the iOS build, but that looks like it’s due to some stuff prefixed on his PATH environment variable.

1 Like

@jarradhope @rachel @vitaliy @anna I’d like to get your thoughts on the feasibility of merging the Nix branch with support for Ubuntu 18.04 and above only (so we’d lose support for 16.04, at least temporarily). Out of the box at least, the apps generated with the toolchain provided by Nix only run on 18.04 and above. I’ve been able to make it run on Ubuntu 16.04 by packaging all dependencies down to the lowest level, but it was more of a PoC that still requires quite a bit more work to productize (e.g. it requires handing off a CI build from 18.04 to a 16.04 job that will package things into an AppImage, and the logic to search for Qt plugins instead of packaging the whole shebang still needs to be written).

Keeping the branch going will risk slowing us down by forcing me to rebase as work happens on develop (e.g. there’s a new ongoing branch that’ll update the Android NDK to a new version, and that is work that will need to be redone on the Nix branch).

Another idea is to simply postpone further support for 16.04. As @jakubgs said, by the time the release version comes out, this might not even be an issue anymore (having to support 16.04). Until then, we could simply add the minimum requirements for Linux on the download page.

WDYT?

2 Likes

Shame that we don’t have a sense for how many developers use lower Ubuntu versions.

Assuming we are certain about moving ahead with Nix—and it sounds like it will help a lot of people—I’d say, let’s merge and deal with Ubuntu 16.04 later if necessary? Although it blocks some, it seems we’ll still be alienating way fewer developers overall if we merge it.

1 Like

Daily progress report:

  • Fixed the mobile debug build by patching the runIOS.js script of react-native-cli to force it to use the legacy build system and not installing Nix’s version of the compiler;
  • Continue playing the whack-a-mole game by fixing the Desktop debug build which got broken by previous step.
1 Like

Daily progress report:

  • Fixed the Desktop debug build by setting QT_XCB_GL_INTEGRATION=none when starting the debug app;
  • Will try to build NSIS from source so that the package is accepted upstream.
1 Like

Created a testing matrix for the Nix branch, please fill in if you’ve successfully tested a missing/unmarked configuration/distro: Nix branch test coverage - Google Spreadsheets

@jakubgs Figured out that you have to do nix-build -A env.all if you want it to build all expressions, otherwise it’ll only build the first. That’s why our caches weren’t fully populated, and make setup wasn’t downloading everything.

that is a serious success!

Daily progress update:

  • Not much happening in this area today other than testing for Nix branch test coverage - Google Spreadsheets
  • Improved detection logic in make setup and make shell;
  • The NSIS package was merged upstream and the Conan package was fixed, so they were both removed from the status-react codebase and referenced from upstream.
1 Like

Just for sake of transparency, I replied to this in DM, totally fine to drop 16.04 support imo :slight_smile:

Really awesome work and love the logs on this, happy to build and test this as much as needed.

3 Likes

Thanks Jarrad!

As for today and probably tomorrow, there won’t be much work done on the Nix branch as we’re quickly switching focus to the Chaos Unicorn Day before the feature freeze on Wednesday. The current state is as follows:

  • most issues revolve around running react-native run-desktop. On some platforms it is not able to fetch the sources, and on Ubuntu 18.04 it is not able to decrypt the data while inside the nix-shell (this is also an issue seen when building the AppImage, but in that case we can exit the nix-shell and run the AppImage just fine);
  • missing icons in MacOS: this is a known issue due to a bug in the macdeployqt which we’ll need to work around in our deployment script. Should be at most a day’s work, and we’ll do that before merging to develop so as to avoid a perceived broken nightly.
1 Like

Daily update:

  • Added script to manually copy/patch dependencies that macdeployqt was missing and were causing missing icons on macOS.

Daily update:

  • will try to fix Status Desktop running in debug mode in Nix;
  • noticed that https://nix-cache.status.im is not being used when building on NixOS, added note to PR.