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

nix: add Nix flake to build node and library #483

Merged
merged 1 commit into from
Mar 6, 2023
Merged

nix: add Nix flake to build node and library #483

merged 1 commit into from
Mar 6, 2023

Conversation

jakubgs
Copy link
Contributor

@jakubgs jakubgs commented Mar 5, 2023

This way we can build stuff locally using:

nix build
nix build .#node
nix build .#library

Or just start a shell with Go 1.19.x using:

nix develop

Which simply has the same environment as the build shell for the node.

One known snag is that there is currently no simple way to keep vendorSha256 updated to match the contents of go.mod and go.sum. For more details see:
https://discourse.nixos.org/t/how-should-i-build-a-go-package-from-local-source/19490/8

One way around this would be to have our own vendor folder, but that's also a pretty ugly solution that requires manual updating.

Resolves:

@jakubgs jakubgs added the infra Infra, devops, CI and related tasks label Mar 5, 2023
@jakubgs jakubgs requested a review from richard-ramos March 5, 2023 12:52
@jakubgs jakubgs self-assigned this Mar 5, 2023
@status-im-auto
Copy link

status-im-auto commented Mar 5, 2023

Jenkins Builds

Click to see older builds (35)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f8606ee #1 2023-03-05 12:53:57 ~1 min linux 📦deb
✔️ f8606ee #1 2023-03-05 12:56:43 ~3 min ios 📦tgz
✔️ f8606ee #1 2023-03-05 12:57:15 ~4 min android 📦tgz
✔️ f572d92 #2 2023-03-05 12:58:01 ~1 min linux 📦deb
✔️ f572d92 #1 2023-03-05 12:58:21 ~1 min linux 📦deb
✔️ f572d92 #2 2023-03-05 12:59:32 ~2 min ios 📦tgz
✔️ f572d92 #2 2023-03-05 13:00:48 ~3 min android 📦tgz
✔️ 062a139 #3 2023-03-05 12:59:53 ~1 min linux 📦deb
⁉️ 062a139 #2 2023-03-05 13:00:42 ~1 min nix 📄log
✔️ 062a139 #3 2023-03-05 13:04:15 ~3 min android 📦tgz
✔️ 062a139 #3 2023-03-05 13:06:58 ~8 min ios 📦tgz
✖️ 84c2f39 #3 2023-03-05 13:04:27 ~10 sec nix 📄log
✔️ 84c2f39 #4 2023-03-05 13:05:16 ~59 sec linux 📦deb
✔️ 84c2f39 #4 2023-03-05 13:07:42 ~3 min ios 📦tgz
✔️ 84c2f39 #4 2023-03-05 13:07:51 ~3 min android 📦tgz
✔️ 2c2d037 #5 2023-03-05 13:11:16 ~59 sec linux 📦deb
✖️ 2c2d037 #4 2023-03-05 13:12:08 ~1 min nix 📄log
✔️ 2c2d037 #5 2023-03-05 13:12:43 ~2 min ios 📦tgz
✔️ 2c2d037 #5 2023-03-05 13:13:25 ~3 min android 📦tgz
✔️ 01c3520 #6 2023-03-05 13:35:27 ~1 min linux 📦deb
✖️ 01c3520 #5 2023-03-05 13:36:43 ~2 min nix 📄log
✔️ 01c3520 #6 2023-03-05 13:37:02 ~2 min ios 📦tgz
✔️ 01c3520 #6 2023-03-05 13:38:00 ~3 min android 📦tgz
✔️ ed8657a #7 2023-03-05 13:41:53 ~1 min linux 📦deb
✖️ ed8657a #6 2023-03-05 13:42:36 ~1 min nix 📄log
✔️ ed8657a #7 2023-03-05 13:43:21 ~2 min ios 📦tgz
✔️ ed8657a #7 2023-03-05 13:44:13 ~3 min android 📦tgz
✔️ ee759d6 #8 2023-03-05 13:44:51 ~1 min linux 📦deb
✔️ ee759d6 #7 2023-03-05 13:46:04 ~2 min nix 📄log
✔️ ee759d6 #8 2023-03-05 13:46:15 ~2 min ios 📦tgz
✔️ ee759d6 #8 2023-03-05 13:47:53 ~3 min android 📦tgz
✔️ 0229d23 #9 2023-03-05 13:48:08 ~1 min linux 📦deb
✔️ 0229d23 #8 2023-03-05 13:48:50 ~1 min nix-flake 📄log
✔️ 0229d23 #9 2023-03-05 13:49:58 ~2 min ios 📦tgz
✔️ 0229d23 #9 2023-03-05 13:51:20 ~3 min android 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 78dbc1a #9 2023-03-05 13:51:28 ~7.6 sec nix-flake 📄log
✔️ 78dbc1a #10 2023-03-05 13:52:30 ~1 min linux 📦deb
✔️ 78dbc1a #10 2023-03-05 13:54:14 ~2 min ios 📦tgz
✔️ 78dbc1a #10 2023-03-05 13:54:45 ~3 min android 📦tgz
✔️ 349e22b #11 2023-03-05 14:06:43 ~1 min linux 📦deb
✔️ 349e22b #10 2023-03-05 14:07:41 ~2 min nix-flake 📄log
✔️ 349e22b #11 2023-03-05 14:08:26 ~2 min ios 📦tgz
✔️ 349e22b #11 2023-03-05 14:09:02 ~3 min android 📦tgz

@jakubgs jakubgs force-pushed the nix-flake branch 9 times, most recently from 0229d23 to 78dbc1a Compare March 5, 2023 13:51
This way we can build node or the library locally using:
```sh
nix build
nix build .#node
nix build .#library
```
Or just start a shell with Go `1.19.x` using:
```
nix develop
```
Which simply has the same environment as the build shell for the node.

One known snag is that there is currently no simple way to keep `vendorSha256`
updated to match the contents of `go.mod` and `go.sum`. For more details see:
https://discourse.nixos.org/t/how-should-i-build-a-go-package-from-local-source/19490/8

One way around this would be to have our own `vendor` folder, but that's
also a pretty ugly solution that requires manual updating.

Resolves:
#256

Signed-off-by: Jakub Sokołowski <jakub@status.im>
Copy link
Member

@richard-ramos richard-ramos left a comment

Choose a reason for hiding this comment

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

Very cool!

@jakubgs
Copy link
Contributor Author

jakubgs commented Mar 6, 2023

We still can't build mobile versions, but as I updated in the issue, this seems like a bigger problem.

And it's good to have this boilerplate in place anyway.

@jakubgs jakubgs merged commit 349e22b into master Mar 6, 2023
@jakubgs jakubgs deleted the nix-flake branch March 6, 2023 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra Infra, devops, CI and related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants