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

Switch Linux local development to Nix #16281

Open
yakimant opened this issue Sep 6, 2024 · 6 comments
Open

Switch Linux local development to Nix #16281

yakimant opened this issue Sep 6, 2024 · 6 comments
Assignees
Labels

Comments

@yakimant
Copy link
Member

yakimant commented Sep 6, 2024

Description

After creating a Nix build configuration and CI job (see #9350) - developers continue to build locally without Nix.

We need to change that. The benefits are:

  • Qt 5 upgrades (original goal)
  • Out of the box development environment (no buid deps requirements, no docker,..), shared with CI
  • Potentially - shared Linux, macOS, Windows environment

Acceptance Criteria

  • Make sure developers build locally with Nix
  • Make sure all the Linux Makefile tasks continue to work (original PR was only tested on update, deps, status-go, tgz-linux targets)
@yakimant
Copy link
Member Author

yakimant commented Sep 6, 2024

Trying the SHELL env var approach issues:

  1. Option 1: global
  2. Option 2: per target

Option3: require to run nix-shell before make:

  • break certain make targets if not in Nix shell
  • easy way to install Nix
  • easy way to run Nix shell
  • documentation, announcement
  • maybe using direnv + flakes

Issues:

Option 1:

  • SHELL applies to each $(shell) run and each target command - so nix-shell gets invokes many times
  • targets.mk - update-common: invokes + "$(MAKE)", which probably runs make outside of nix - breaks

Option 2:

  • $(shell): need to use global SHELL or rewrite ifeq and setting vars logic

Option 3:

@yakimant
Copy link
Member Author

yakimant commented Sep 6, 2024

Solution for running nix-shell for each $(shell) invocation:

Use non-nix sh funciton where possible: https://github.com/status-im/status-go/blob/557c4f7e8fb2fb5572d9dc0754c6e7a3243f4d48/Makefile#L97-L102

Another solution to switch to flakes, so nix develop will run much faster (due to derivation caching).
Problem with flakes is secrets storing in case of derivation, which will require injection. But it's not related to shells.

@yakimant
Copy link
Member Author

yakimant commented Sep 6, 2024

Need to talk to Nimbus and Desktop teams:

  • switch from nimbus-build-system for Nim compile.
  • why do we build Nim compiler?
  • nimble instead? nixpkgs instead?
  • Desktop Makefile guide
    • targets
    • nimbus-build-system
    • removing make targets
    • move long code to separate script file
    • documentation, comments, sections, help target

@yakimant
Copy link
Member Author

nimbus-build-system doc:
https://github.com/status-im/nimbus-build-system

@yakimant
Copy link
Member Author

yakimant commented Sep 11, 2024

Meeting with Igor on Desktop Makefile:

  • nimbus-build-system used for Nim and Nim dependencies compilation, added through vendor submodules. It's not pleasant to work with, devs would be happy to get rid of it. Maybe Nimble to replace?
  • targets are split into groups
    • run: building and running the apps
    • nim_status_client: build app and deps
    • nim_status_client deps: split into dep specific buckets
    • packages: exe, appimage, dmg
    • storybook: separate app to test UI
    • Nim tests
  • developers are 50/50 on Linux/macOS
  • status-go issue: not being rebuilt if source code changed

Options to improve the Makefile:

  • Separate big target groups into separate imported makfiles
  • Separate longer targets to shell script files
  • Would be great to smth Mobile has - annotating each target with description and help target to list all

Option to improve make&nix-shell experience - switch to flake devShell, which runs much faster.

@yakimant
Copy link
Member Author

yakimant commented Sep 25, 2024

Trying to switch Linux builds to Nix shell completely:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

1 participant