Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nix shell #16359

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft

Use nix shell #16359

wants to merge 15 commits into from

Conversation

yakimant
Copy link
Member

@yakimant yakimant commented Sep 18, 2024

After making a nix shell to build a Linux binary:
#9350

It was running as a part of CI:
https://ci.status.im/job/status-desktop/job/systems/job/linux/job/x86_64/job/package-nix/

Now it's time to switch developers to use it and eventually cleanup non-Nix shell related code.

What does the PR do

  1. Swiches to Nix flakes to run Nix shell faster (nix develop)
  2. Adds direnv setup (`nix-direnv)
  3. Adds check-nix-shell Makefile target to block further run make

How to test

  • Setup local tools: nix, direnv
  • enter shell by (one of the ways):
    • direnv allow
    • nix develop
    • nix-shell
  • run the usual Linux targets

Useful Links

TODO

  • Issues running an app with export FLAG_DAPPS_ENABLED=1
  • Document to setup environment - nix/README.md
  • Script to setup environment - ubuntu_build_setup.sh (used in Ansible CI fleet)
  • nix develop issue: unsupported tarball input attribute 'lastModified'. Maybe wrong nix version
  • make sure nix.conf is loaded in each case (direnv, develop, shell)
  • make run fails to run in nix shell
  • Appimage takes QtWebEngineProccess from /nix/store if present, it is not patched, so breaks
  • Try run-storybook-tests in Nix shell
  • Try run-statusq-tests in Nix shell
  • Test running the app on Wayland
  • Opt-out of nix shell (using system libs/tools for both building and running)

@status-im-auto
Copy link
Member

status-im-auto commented Sep 18, 2024

Jenkins Builds

Click to see older builds (142)
Commit #️⃣ Finished (UTC) Duration Platform Result
f073852 #1 2024-09-18 14:54:30 ~2 min linux-nix/x86_64 📄log
f073852 #1 2024-09-18 14:58:38 ~6 min linux/x86_64 📄log
✔️ f073852 #1 2024-09-18 14:58:46 ~6 min tests/nim 📄log
✔️ f073852 #1 2024-09-18 15:00:16 ~8 min macos/aarch64 🍎dmg
✔️ f073852 #1 2024-09-18 15:02:43 ~10 min macos/x86_64 🍎dmg
f073852 #1 2024-09-18 15:03:40 ~11 min tests/ui 📄log
6c4a30c #2 2024-09-19 10:50:01 ~2 min linux-nix/x86_64 📄log
✔️ 6c4a30c #2 2024-09-19 10:52:00 ~4 min macos/aarch64 🍎dmg
✔️ 3a21cc3 #3 2024-09-19 10:57:32 ~3 min macos/aarch64 🍎dmg
3a21cc3 #3 2024-09-19 10:58:09 ~4 min linux/x86_64 📄log
3a21cc3 #3 2024-09-19 10:58:22 ~4 min linux-nix/x86_64 📄log
✔️ 3a21cc3 #3 2024-09-19 11:00:45 ~7 min tests/nim 📄log
✔️ 3a21cc3 #3 2024-09-19 11:01:06 ~7 min macos/x86_64 🍎dmg
✔️ 3a21cc3 #3 2024-09-19 11:05:28 ~11 min tests/ui 📄log
240b436 #4 2024-09-19 12:48:45 ~4 min linux/x86_64 📄log
✔️ 240b436 #4 2024-09-19 12:49:27 ~5 min macos/aarch64 🍎dmg
✔️ 240b436 #4 2024-09-19 12:50:55 ~6 min tests/nim 📄log
✔️ 240b436 #4 2024-09-19 12:56:00 ~11 min macos/x86_64 🍎dmg
✔️ 240b436 #4 2024-09-19 12:56:26 ~12 min tests/ui 📄log
✔️ 240b436 #4 2024-09-19 12:57:00 ~13 min linux-nix/x86_64 📦tgz
✔️ 630d599 #5 2024-09-25 08:40:18 ~5 min macos/aarch64 🍎dmg
✔️ 630d599 #5 2024-09-25 08:41:45 ~6 min tests/nim 📄log
✔️ 630d599 #5 2024-09-25 08:47:04 ~12 min tests/ui 📄log
✔️ 630d599 #5 2024-09-25 08:48:00 ~12 min macos/x86_64 🍎dmg
✔️ 630d599 #5 2024-09-25 08:49:48 ~14 min linux/x86_64 📦tgz
✔️ efb7ee4 #6 2024-09-25 10:44:28 ~4 min macos/aarch64 🍎dmg
✔️ efb7ee4 #6 2024-09-25 10:46:25 ~6 min tests/nim 📄log
✔️ efb7ee4 #6 2024-09-25 10:51:47 ~11 min tests/ui 📄log
✔️ efb7ee4 #6 2024-09-25 10:51:57 ~11 min macos/x86_64 🍎dmg
✔️ efb7ee4 #6 2024-09-25 10:52:39 ~12 min linux/x86_64 📦tgz
✔️ 56b0e91 #7 2024-09-25 13:19:59 ~4 min macos/aarch64 🍎dmg
✔️ 56b0e91 #7 2024-09-25 13:22:26 ~6 min tests/nim 📄log
56b0e91 #7 2024-09-25 13:23:51 ~8 min linux/x86_64 📄log
✔️ 56b0e91 #7 2024-09-25 13:26:11 ~10 min macos/x86_64 🍎dmg
✔️ 56b0e91 #7 2024-09-25 13:27:13 ~11 min tests/ui 📄log
✔️ 6e708fc #8 2024-09-25 13:36:47 ~5 min macos/aarch64 🍎dmg
✔️ 6e708fc #8 2024-09-25 13:37:58 ~6 min tests/nim 📄log
✔️ 6e708fc #8 2024-09-25 13:41:49 ~10 min macos/x86_64 🍎dmg
✔️ 6e708fc #8 2024-09-25 13:43:06 ~11 min tests/ui 📄log
✔️ 6e708fc #8 2024-09-25 13:47:43 ~16 min linux/x86_64 📦tgz
✔️ 2f95cd9 #9 2024-09-26 11:06:33 ~4 min macos/aarch64 🍎dmg
✔️ 2f95cd9 #9 2024-09-26 11:08:57 ~6 min tests/nim 📄log
✔️ 2f95cd9 #9 2024-09-26 11:13:41 ~11 min macos/x86_64 🍎dmg
✔️ 2f95cd9 #9 2024-09-26 11:14:10 ~12 min tests/ui 📄log
✔️ 2f95cd9 #9 2024-09-26 11:14:18 ~12 min linux/x86_64 📦tgz
✔️ 195a1cc #10 2024-09-26 11:28:35 ~4 min macos/aarch64 🍎dmg
✔️ 195a1cc #10 2024-09-26 11:30:57 ~6 min tests/nim 📄log
✔️ 195a1cc #10 2024-09-26 11:35:20 ~10 min macos/x86_64 🍎dmg
✔️ 195a1cc #10 2024-09-26 11:36:21 ~11 min linux/x86_64 📦tgz
✔️ 195a1cc #10 2024-09-26 11:37:13 ~12 min tests/ui 📄log
✔️ 87ef476 #11 2024-09-26 14:30:33 ~4 min macos/aarch64 🍎dmg
✔️ 87ef476 #11 2024-09-26 14:32:36 ~6 min tests/nim 📄log
87ef476 #11 2024-09-26 14:33:49 ~7 min linux/x86_64 📄log
✔️ 87ef476 #11 2024-09-26 14:37:40 ~11 min macos/x86_64 🍎dmg
✔️ 87ef476 #11 2024-09-26 14:38:22 ~12 min tests/ui 📄log
✔️ 945b2f4 #12 2024-09-26 14:43:11 ~4 min macos/aarch64 🍎dmg
✔️ 945b2f4 #12 2024-09-26 14:45:30 ~6 min tests/nim 📄log
✔️ 945b2f4 #12 2024-09-26 14:49:54 ~10 min macos/x86_64 🍎dmg
✔️ 945b2f4 #12 2024-09-26 14:50:54 ~11 min tests/ui 📄log
✔️ 945b2f4 #12 2024-09-26 14:54:55 ~15 min linux/x86_64 📦tgz
✔️ 6e973dd #13 2024-09-27 09:33:36 ~6 min tests/nim 📄log
✔️ 6e973dd #13 2024-09-27 09:35:06 ~8 min macos/aarch64 🍎dmg
6e973dd #13 2024-09-27 09:38:41 ~11 min tests/ui 📄log
✔️ 6e973dd #13 2024-09-27 09:39:07 ~12 min macos/x86_64 🍎dmg
✔️ 6e973dd #13 2024-09-27 09:40:53 ~14 min linux/x86_64 📦tgz
✔️ 158b11f #14 2024-09-27 12:45:21 ~3 min macos/aarch64 🍎dmg
✔️ 158b11f #14 2024-09-27 12:47:47 ~6 min tests/nim 📄log
✔️ 158b11f #14 2024-09-27 12:52:25 ~10 min macos/x86_64 🍎dmg
✔️ 158b11f #14 2024-09-27 12:53:15 ~11 min tests/ui 📄log
✔️ 158b11f #14 2024-09-27 12:54:52 ~13 min linux/x86_64 📦tgz
✔️ 4458bc2 #15 2024-09-27 13:02:46 ~4 min macos/aarch64 🍎dmg
✔️ 4458bc2 #15 2024-09-27 13:05:23 ~6 min tests/nim 📄log
✔️ 4458bc2 #15 2024-09-27 13:09:30 ~10 min macos/x86_64 🍎dmg
4458bc2 #15 2024-09-27 13:10:05 ~11 min tests/ui 📄log
✔️ 4458bc2 #15 2024-09-27 13:10:50 ~12 min linux/x86_64 📦tgz
✔️ 749feac #16 2024-10-02 10:10:17 ~4 min macos/aarch64 🍎dmg
✔️ 749feac #16 2024-10-02 10:12:23 ~6 min tests/nim 📄log
749feac #16 2024-10-02 10:17:08 ~11 min tests/ui 📄log
✔️ 749feac #16 2024-10-02 10:17:39 ~11 min macos/x86_64 🍎dmg
✔️ 749feac #16 2024-10-02 10:20:45 ~15 min linux/x86_64 📦tgz
✔️ 3ce5594 #17 2024-10-02 10:58:41 ~3 min macos/aarch64 🍎dmg
✔️ 3ce5594 #17 2024-10-02 11:01:02 ~6 min tests/nim 📄log
✔️ 3ce5594 #17 2024-10-02 11:05:49 ~11 min macos/x86_64 🍎dmg
3ce5594 #17 2024-10-02 11:06:07 ~11 min tests/ui 📄log
✔️ 3ce5594 #17 2024-10-02 11:07:01 ~12 min linux/x86_64 📦tgz
dc490e5 #18 2024-10-02 11:36:40 ~3 min macos/aarch64 📄log
✖️ dc490e5 #18 2024-10-02 11:39:39 ~6 min tests/nim 📄log
dc490e5 #18 2024-10-02 11:40:25 ~6 min linux/x86_64 📄log
dc490e5 #18 2024-10-02 11:40:56 ~7 min macos/x86_64 📄log
dc490e5 #18 2024-10-02 11:44:53 ~11 min tests/ui 📄log
✔️ 2f81475 #19 2024-10-02 13:18:33 ~5 min macos/aarch64 🍎dmg
✔️ 2f81475 #19 2024-10-02 13:19:41 ~6 min tests/nim 📄log
2f81475 #19 2024-10-02 13:24:26 ~11 min tests/ui 📄log
✔️ 2f81475 #19 2024-10-02 13:25:57 ~12 min linux/x86_64 📦tgz
✔️ 2f81475 #19 2024-10-02 13:27:02 ~13 min macos/x86_64 🍎dmg
✔️ 2f81475 #19 2024-10-02 13:33:42 ~20 min windows/x86_64 💿exe
✔️ c56b36c #20 2024-10-02 14:14:42 ~4 min macos/aarch64 🍎dmg
✔️ c56b36c #20 2024-10-02 14:16:43 ~6 min tests/nim 📄log
✔️ c56b36c #20 2024-10-02 14:19:56 ~9 min macos/x86_64 🍎dmg
✔️ c56b36c #20 2024-10-02 14:24:28 ~14 min tests/ui 📄log
✔️ c56b36c #20 2024-10-02 14:25:22 ~15 min linux/x86_64 📦tgz
✔️ 4469a6b #21 2024-10-09 14:58:12 ~6 min tests/nim 📄log
✔️ 4469a6b #21 2024-10-09 14:58:22 ~7 min macos/aarch64 🍎dmg
4469a6b #21 2024-10-09 15:03:59 ~12 min tests/ui 📄log
✔️ 4469a6b #21 2024-10-09 15:05:34 ~14 min linux/x86_64 📦tgz
✔️ 4469a6b #21 2024-10-09 15:06:59 ~15 min macos/x86_64 🍎dmg
✔️ 4469a6b #21 2024-10-09 15:17:21 ~25 min windows/x86_64 💿exe
✔️ 2c0f63e #22 2024-10-10 09:42:01 ~4 min macos/aarch64 🍎dmg
✔️ 2c0f63e #22 2024-10-10 09:44:04 ~6 min tests/nim 📄log
✔️ 2c0f63e #22 2024-10-10 09:49:02 ~11 min macos/x86_64 🍎dmg
✔️ 2c0f63e #22 2024-10-10 09:49:21 ~11 min tests/ui 📄log
✔️ 2c0f63e #22 2024-10-10 09:50:11 ~12 min linux/x86_64 📦tgz
✔️ 2c0f63e #22 2024-10-10 10:02:06 ~24 min windows/x86_64 💿exe
c35a8a8 #23 2024-10-10 10:43:11 ~4 min linux/x86_64 📄log
✔️ c35a8a8 #23 2024-10-10 10:43:19 ~4 min macos/aarch64 🍎dmg
✔️ c35a8a8 #23 2024-10-10 10:45:25 ~6 min tests/nim 📄log
c35a8a8 #23 2024-10-10 10:49:53 ~11 min tests/ui 📄log
✔️ c35a8a8 #23 2024-10-10 10:51:43 ~13 min macos/x86_64 🍎dmg
✔️ c35a8a8 #23 2024-10-10 11:04:30 ~25 min windows/x86_64 💿exe
✔️ 3166dc5 #24 2024-10-10 11:17:04 ~4 min macos/aarch64 🍎dmg
✔️ 3166dc5 #24 2024-10-10 11:19:15 ~6 min tests/nim 📄log
✔️ 3166dc5 #24 2024-10-10 11:24:23 ~11 min macos/x86_64 🍎dmg
✔️ 3166dc5 #24 2024-10-10 11:24:30 ~11 min tests/ui 📄log
✔️ 3166dc5 #24 2024-10-10 11:25:33 ~13 min linux/x86_64 📦tgz
✔️ 3166dc5 #24 2024-10-10 11:36:41 ~24 min windows/x86_64 💿exe
cb5e201 #25 2024-10-10 12:08:21 ~16 sec linux/x86_64 📄log
✔️ cb5e201 #25 2024-10-10 12:12:32 ~4 min macos/aarch64 🍎dmg
✔️ cb5e201 #25 2024-10-10 12:14:55 ~6 min tests/nim 📄log
cb5e201 #25 2024-10-10 12:19:24 ~11 min tests/ui 📄log
✔️ cb5e201 #25 2024-10-10 12:19:46 ~11 min macos/x86_64 🍎dmg
✔️ 298b92f #26 2024-10-10 12:29:19 ~4 min macos/aarch64 🍎dmg
✔️ 298b92f #26 2024-10-10 12:31:11 ~6 min tests/nim 📄log
✔️ 298b92f #26 2024-10-10 12:35:57 ~11 min macos/x86_64 🍎dmg
✔️ 298b92f #26 2024-10-10 12:36:03 ~11 min tests/ui 📄log
✔️ 298b92f #26 2024-10-10 12:37:21 ~12 min linux/x86_64 📦tgz
✔️ 298b92f #26 2024-10-10 12:49:24 ~24 min windows/x86_64 💿exe
✔️ ebbaf5a #27 2024-10-17 13:20:17 ~5 min macos/aarch64 🍎dmg
✔️ ebbaf5a #27 2024-10-17 13:22:12 ~7 min tests/nim 📄log
ebbaf5a #27 2024-10-17 13:27:09 ~12 min tests/ui 📄log
✔️ ebbaf5a #27 2024-10-17 13:27:55 ~12 min macos/x86_64 🍎dmg
✔️ ebbaf5a #27 2024-10-17 13:29:42 ~14 min linux/x86_64 📦tgz
✔️ ebbaf5a #27 2024-10-17 13:40:23 ~25 min windows/x86_64 💿exe
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a588c4b #28 2024-10-17 14:40:00 ~4 min macos/aarch64 🍎dmg
✔️ a588c4b #28 2024-10-17 14:41:37 ~6 min tests/nim 📄log
✔️ a588c4b #28 2024-10-17 14:47:05 ~11 min macos/x86_64 🍎dmg
✔️ a588c4b #28 2024-10-17 14:49:01 ~13 min linux/x86_64 📦tgz
✔️ a588c4b #28 2024-10-17 15:02:52 ~27 min windows/x86_64 💿exe
✔️ 1eac8df #29 2024-10-18 09:35:08 ~4 min macos/aarch64 🍎dmg
✔️ 1eac8df #29 2024-10-18 09:36:42 ~6 min tests/nim 📄log
✔️ 1eac8df #29 2024-10-18 09:42:12 ~11 min macos/x86_64 🍎dmg
✔️ 1eac8df #29 2024-10-18 09:42:47 ~12 min linux/x86_64 📦tgz
✔️ 1eac8df #29 2024-10-18 09:44:53 ~14 min tests/ui 📄log
✔️ 1eac8df #29 2024-10-18 09:56:21 ~25 min windows/x86_64 💿exe

@yakimant yakimant marked this pull request as draft September 18, 2024 14:56
@status-im-auto
Copy link
Member

@status-im-auto
Copy link
Member

@status-im-auto
Copy link
Member

@yakimant
Copy link
Member Author

yakimant commented Sep 19, 2024

@igor-sirotin, @alexjba, @caybro, @micieslak,
guys, I need feedback from developers about this approach.

This PR is enforcing Nix environment for Linux builds.
You will need to have Nix and direnv installed.

As a benefit you will have:

  • Fully reproducable and managed dev environment (no need to install system tools, no different versions)
  • Newer Qt version - 5.15.8 now, 5.15.15 easily achivable

FYI @anastasiyaig

Copy link
Member

@jakubgs jakubgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I'm a fan of this flake-compat stuff, but other than that this looks good.

flake.nix Outdated Show resolved Hide resolved
Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to see this change! 🍻

@anastasiyaig
Copy link
Contributor

@yakimant @siddarthkay we need to tell tests to use another artefact :)

@status-im-auto
Copy link
Member

@status-im-auto
Copy link
Member

@status-im-auto
Copy link
Member

@yakimant
Copy link
Member Author

yakimant commented Sep 25, 2024

Need to sort out the locations of:

  • QtWebEngineProcess
  • qtwebengine_locales
  • resources (eg qtwebengine_resources.pak)
  • icudtl.dat

Possible places:

  • bin
  • libexec
  • resources
  • translations

Links:

Env vars (5.15.8):

  • QT_WEBENGINE_ICU_DATA_DIR
  • QTWEBENGINE_DICTIONARIES_PATH
  • QTWEBENGINEPROCESS_PATH

Copy link
Member

@jakubgs jakubgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.

ci/Jenkinsfile.linux Outdated Show resolved Hide resolved
ci/Jenkinsfile.linux Show resolved Hide resolved
@alexjba
Copy link
Contributor

alexjba commented Sep 26, 2024

@yakimant could you please give me some instructions on how to build and run the app using the nix shell? I have a new linux environment with just a bare minimum of packages installed: build-essential, git, nix, direnv.

If I understand it correctly it's all I should have to get me started, right?

@alexjba
Copy link
Contributor

alexjba commented Sep 26, 2024

One other note: would it be a good chance to update the ubuntu_build_setup.sh and add a function that configures the new dependencies?

@yakimant
Copy link
Member Author

yakimant commented Sep 26, 2024

@alexjba There are 2 options:

  1. Setup direnv: direnv allow. Nix shell will start automatically every time you enter the work dir.
  2. If you want to start the shell manualy: nix develop. If you forger make will fail with a notice to run a Nix shell.

In regards of ubuntu_build_setup.sh - yes, good idea. No so much will be left though (nix, direnv).

@status-im-auto
Copy link
Member

@alexjba
Copy link
Contributor

alexjba commented Sep 26, 2024

@alexjba There are 2 options:

  1. Setup direnv: direnv allow. Nix shell will start automatically every time you enter the work dir.
  2. If you want to start the shell manualy: nix develop. If you forger make will fail with a notice to run a Nix shell.

In regards of ubuntu_build_setup.sh - yes, good idea. No so much will be left though (nix, direnv).

Thank you! I've followed the steps and this is my result:

  1. Running nix develop results in experimental flags error for nix-command and flakes
  2. nix develop --extra-experimental-features "nix-command flakes" results in cannot connect to socket at '/nix/var/nix/daemon-socket/socket': Permission denied
  3. sudo nix develop --extra-experimental-features "nix-command flakes" results in
error: unsupported tarball input attribute 'lastModified'

       … while updating the lock file of flake 'git+file:///home/alex/repo/status-desktop?ref=use_nix_shell&rev=6e708fc8dade82f549a0124ef2aed8e43ce8bf11'

@status-im-auto
Copy link
Member

@alexjba
Copy link
Contributor

alexjba commented Sep 27, 2024

@yakimant I think we'll need to find a way to share the nix packages. I've been naive enough to give it a spin in a linux VM and 15h later it's still compiling chromium.

I'm really a nix noob, but I see lots of resources on sharing the pre-compiled packages.
E.g. https://www.tweag.io/blog/2019-11-21-untrusted-ci/

@yakimant
Copy link
Member Author

We have it setup already:
08d8c9e

So you need to run

export NIX_USER_CONF_FILES := $(PWD)/nix/nix.conf

before entering the nix shell.

I will make sure it is set for all the cases, added to TODO.

@alexjba
Copy link
Contributor

alexjba commented Oct 10, 2024

nixGL issue, when used with 20.09 nixpkgs: nix-community/nixGL#183
bisected nixGL to find the last working commit and it works! 4469a6b
@alexjba, please try make run, I will test run-storybook and run-linux-gdb meanwhile.

I'm getting

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

SIGABRT: Abnormal termination.
make[1]: *** [Makefile:864: run-linux] Aborted (core dumped)

NVM! Had an issue with the display and all graphical apps would fail to find the display.

@yakimant Works nicely!

Copy link
Member

@jakubgs jakubgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice. Good work.

check-nix-shell:
ifeq ($(detected_OS),Linux)
ifndef IN_NIX_SHELL
$(error Running outside of Nix shell is not supported)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harsh :D.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't say it wasn't necessary.

Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
}:

let
qtCustom = (with pkgs.qt515_8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another point in case, the latest released Qt version is 5.15.15, why do we have to use sth that's years old?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was originally requested by:
#9350

Switching to newer version will not be a problem. It's a next step.

Copy link
Member

@caybro caybro Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be great, and since this PR is still WIP and has many TODOs, how hard would be to make the switch now and not later? ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If with switching to Qt 5.15.15 I will not need to implement and opt-out logic (to build and run with system libs) - I would certainly prefer this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deal ;) I can test this locally on my machine next week, and provide patches/PR on top of this PR if needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, nice middle ground! 😆 Can't wait for the next iteration, on windows this time.😄

nix/shell.nix Show resolved Hide resolved
@caybro
Copy link
Member

caybro commented Oct 11, 2024

To summarize my concerns here; the usecase is pretty simple, I as a developer want to be able to:

  • build/link the application natively, that is using the OS's toolchain
  • run it natively, either directly or via gdb
  • be able to use these under any IDE

The compatibility changes I'd like to propose are pretty simple, touching just the Makefile, and not disrupting this NIX effort at all:

  • introduce a new set of makefile compat targets that continue doing what they are now in master
  • the "native" compat targets would continue using the system Qt version via the existing check-qt-dir

For (a simple) example, the new run-storybook is using NIX >= add a compat target called run-storybook-native, and copy the old code there.

Similarly, old run-linux becomes run-linux-native, run-linux-gdb => run-linux-gdb-native, and so on with also defining nim_status_client-native w/o the NIX checks

@jakubgs
Copy link
Member

jakubgs commented Oct 14, 2024

introduce a new set of makefile compat targets that continue doing what they are now in master

I think that's a bad idea that will just introduce more complexity. We should support only one way of doing things and that's using Nix for the platforms that have been made to work with it, Linux first. If someone wants to not use it and have fun with dependency issues that's their problem and they can have fun with that.

Mobile and status-go already are essentially built using only tools provided via Nix(aside from Xcode for iOS builds), and it has improved stability of both local and CI builds. We want to achieve this in desktop as well. I can understand finding a middle ground while Nix setup is being stabilized, but ultimately we should support only one way of building things.

The only snag in this plan for Desktop is Windows platform.

@caybro
Copy link
Member

caybro commented Oct 14, 2024

introduce a new set of makefile compat targets that continue doing what they are now in master

I think that's a bad idea that will just introduce more complexity. We should support only one way of doing things and that's using Nix for the platforms that have been made to work with it, Linux first. If someone wants to not use it and have fun with dependency issues that's their problem and they can have fun with that.

Mobile and status-go already are essentially built using only tools provided via Nix(aside from Xcode for iOS builds), and it has improved stability of both local and CI builds. We want to achieve this in desktop as well. I can understand finding a middle ground while Nix setup is being stabilized, but ultimately we should support only one way of building things.

The only snag in this plan for Desktop is Windows platform.

Do you think it's feasible to use NIX on Windows? Because if not, we'll need what I roughly described above anyway

@jakubgs
Copy link
Member

jakubgs commented Oct 14, 2024

It's possible to use Nix on Windows using WSL. People do do it, it's just not something we've done before, so it will require more research and work.

@yakimant
Copy link
Member Author

@anastasiyaig, did you (and CI e2e tests) were using X11 or Wayland?

We need to make sure AppImage runs well on both.

To check (this is Wayland):

$ printnv XDG_SESSION_TYPE WAYLAND_DISPLAY
wayland
wayland-1

@yakimant
Copy link
Member Author

yakimant commented Oct 16, 2024

Testing make run on Wayland.

@micieslak reported this issue (output is mine reproduced):

Running: bin/nim_status_client
INFO [10-17|12:15:06.218] Status backend initialized               backend=geth version=3.0.0-7-g0017567ed commit=0017567ed IpfsGatewayURL=https://ipfs.status.im/
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

(process:11556): Gtk-WARNING **: 14:15:06.950: Locale not supported by C library.
        Using the fallback 'C' locale.

(nim_status_client:11556): GLib-GIO-ERROR **: 14:15:07.064: Settings schema 'org.gnome.settings-daemon.plugins.xsettings' does not contain a key named 'antialiasing'
make[1]: *** [Makefile:869: run-linux] Trace/breakpoint trap (core dumped)
make[1]: Leaving directory '/home/s/work/status-desktop'

and related issue:
cypress-io/cypress#30160
Suggested solutions:

  • GDK_BACKEND=x11 helped

I tried to reproduced it, but faces a different issue:

...
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
...
WRN 2024-10-16 10:36:08.352Z qt warning                                 topics="qt" tid=71966 text="QQmlApplicationEngine failed to load component" file=:0 category=default                    
WRN 2024-10-16 10:36:08.359Z qt warning                                 topics="qt" tid=71966 text="module \"StatusQ.Core.Theme\" is not installed" file=qrc:/main.qml:20 category=default      
...                                                                                   
WRN 2024-10-16 10:36:08.412Z qt warning                                 topics="qt" tid=71966 text="Error while loading QML: QUrl(\"qrc:/main.qml\")" file=:0 category=default                  
...
ERROR[10-16|10:36:08.418|github.com/status-im/status-go/mobile/status.go:865] error in makeJSONResponse                error="there is no running node"

That's a non-issue. Had is due to status-go leftowers.

Interesting, looks like we don't support wayland and run in x11 compatibility (need to check this):

@yakimant
Copy link
Member Author

yakimant commented Oct 17, 2024

Tests don't work well:

$ make run-storybook-tests
make[1]: Entering directory '/home/s/work/status-desktop'
Building: Storybook
gmake[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
Running: Storybook Tests
UpdateCTestConfiguration  from :/home/s/work/status-desktop/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/s/work/status-desktop/DartConfiguration.tcl
Test project /home/s/work/status-desktop
Constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
No tests were found!!!
make[1]: Leaving directory '/home/s/work/status-desktop'
$ make run-statusq-tests
make[1]: Entering directory '/home/s/work/status-desktop'
Configuring: StatusQ Unit Tests
Building: StatusQ Unit Tests
gmake[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
Running: StatusQ Unit Tests
UpdateCTestConfiguration  from :/home/s/work/status-desktop/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/s/work/status-desktop/DartConfiguration.tcl
Test project /home/s/work/status-desktop
Constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
No tests were found!!!
make[1]: Leaving directory '/home/s/work/status-desktop'

Our version of ctest doesn't support --test-dir, so we just cd instead.

@yakimant
Copy link
Member Author

yakimant commented Oct 17, 2024

Failing test:

test 1
      Start  1: QmlTests

1: Test command: /home/s/work/status-desktop/ui/StatusQ/build/bin/QmlTests "-input" "/home/s/work/status-desktop/ui/StatusQ/tests"
...
1: qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
1: qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
1: Could not initialize GLX
 1/16 Test  #1: QmlTests .........................Subprocess aborted***Exception:   1.72 sec

Fixed by using nixGL

@yakimant
Copy link
Member Author

@micieslak reported another issue:

Building: DOtherSide
gmake[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
In file included from /home/michalc/workspace/status-desktop/vendor/qzxing/src/zxing/zxing/ResultIO.cpp:22:
/home/michalc/workspace/status-desktop/vendor/qzxing/src/zxing/zxing/Result.h:57:24: note: only here as a ‘friend’
   57 |   friend std::ostream& operator<<(std::ostream &out, Result& result);
      |                        ^~~~~~~~
/nix/store/vfqlryhvm8063hs7ax9k2vb8wmch5v0v-binutils-2.31.1/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so: error loading plugin: /nix/store/0c7c96gikmzv87i7lv3vq5s1cmfjd6zf-glibc-2.31-74/lib/libc.so.6: version `GLIBC_2.33' not found (required by /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so)
collect2: error: ld returned 1 exit status

looks like non-nix and nix build were mixed. make clean && make clean-git helped.

@yakimant
Copy link
Member Author

yakimant commented Oct 18, 2024

New issues from @micieslak:

Running: bin/nim_status_client
INFO [10-18|09:38:02.810] Status backend initialized               backend=geth version=3.0.0-7-g0017567ed-dirty commit=0017567ed IpfsGatewayURL=https://ipfs.status.im/
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

(process:433482): Gtk-WARNING **: 11:38:02.907: Locale not supported by C library.
    Using the fallback 'C' locale.
Gtk-Message: 11:38:02.955: Failed to load module "canberra-gtk-module"
Gtk-Message: 11:38:02.956: Failed to load module "canberra-gtk-module"
Driver does not support the 0x46a6 PCI ID.
libGL error: failed to create dri screen
libGL error: failed to load driver: iris
INF 2024-10-18 09:38:03.180Z Terminating the app as the second instance topics="status-app" tid=433482 file=nim_status_client.nim:233

From internet:

We have iris, but maybe it's missing this specific device:

$ nixGL env | grep '/dri'
LIBGL_DRIVERS_PATH=/nix/store/wdsb7dljc8299yjsij1np4pial06d8z4-mesa-20.1.10-drivers/lib/dri:/nix/store/qq52q6j5jxhxxpmy44say11djsn2w75n-mesa-20.1.10-drivers/lib/dri
...
$ ls /nix/store/wdsb7dljc8299yjsij1np4pial06d8z4-mesa-20.1.10-drivers/lib/dri /nix/store/qq52q6j5jxhxxpmy44say11djsn2w75n-mesa-20.1.10-drivers/lib/dri
/nix/store/qq52q6j5jxhxxpmy44say11djsn2w75n-mesa-20.1.10-drivers/lib/dri:
i915_dri.so        nouveau_dri.so        r300_dri.so        radeonsi_dri.so        vmwgfx_dri.so
i965_dri.so        nouveau_drv_video.so  r600_dri.so        radeonsi_drv_video.so
iris_dri.so        nouveau_vieux_dri.so  r600_drv_video.so  swrast_dri.so
kms_swrast_dri.so  r200_dri.so           radeon_dri.so      virtio_gpu_dri.so

/nix/store/wdsb7dljc8299yjsij1np4pial06d8z4-mesa-20.1.10-drivers/lib/dri:
i915_dri.so        nouveau_dri.so        r300_dri.so        radeonsi_dri.so        vmwgfx_dri.so
i965_dri.so        nouveau_drv_video.so  r600_dri.so        radeonsi_drv_video.so
iris_dri.so        nouveau_vieux_dri.so  r600_drv_video.so  swrast_dri.so
kms_swrast_dri.so  r200_dri.so           radeon_dri.so      virtio_gpu_dri.so

0x46a6 is for "Intel(R) Iris(R) Xe Graphics"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants