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

Feature: Turn this repo into a Nix flake #97

Closed
2 tasks done
rushmorem opened this issue Sep 2, 2022 · 5 comments
Closed
2 tasks done

Feature: Turn this repo into a Nix flake #97

rushmorem opened this issue Sep 2, 2022 · 5 comments
Labels
feature New feature or request

Comments

@rushmorem
Copy link
Collaborator

Is your feature request related to a problem?

Building this repo from source is a bit of challenge right now, even for Rust developers. This is especially true if one wants to use TiKV as their KV store.

Describe the solution

Nix flakes are the easiest way of distributing software from source, that I know of. If someone has a flake-enabled (flakes are currently still an experimental feature) Nix package manager, all they will need to do to install surreal on their system is nix profile install github:surrealdb/surrealdb. This will download, compile and install the latest commit along with all its dependencies. One can target specific versions, branches or even commits. They don't need install it in their environment either. nix run github:surrealdb/surrealdb is equivalent to cargo run except it will download not only this repo but also all its dependencies.

To turn the repo into a Nix flake, all we need to do is add to files to the root, flake.nix and flake.lock.

Alternative methods

Keep installing dependencies manually.

SurrealDB version

surreal 1.0.0-beta.7 for linux on x86_64

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

Ok this sounds interesting @rushmorem .

Out of interest, how does the build process work from a dependency point of view? (as you know tikv-client builds fine in Github Actions CI, but is tricky to build outside of that environment).

Does it work with Github Releases, or build from source?

Either way, definitely interested in investigating this...

@rushmorem
Copy link
Collaborator Author

Out of interest, how does the build process work from a dependency point of view? (as you know tikv-client builds fine in Github > Actions CI, but is tricky to build outside of that environment).

From NixOS' homepage:

Nix builds packages in isolation from each other. This ensures that they are reproducible and don't have undeclared dependencies, so if a package works on one machine, it will also work on another.

Does it work with Github Releases, or build from source?

It works with either. It can also work with binaries too. The preferred way of packaging in the Nix community, though, is to package from source.

Either way, definitely interested in investigating this...

You don't need to spend any time on this. I have been using NixOS since 2014. I already have a working flake I packaged using Naersk but I want to first convert it to Crane because it comes with some interesting features I think will be very helpful with our development environments.

@tobiemh
Copy link
Member

tobiemh commented Sep 2, 2022

Ok awesome @rushmorem . A musl build for Alpine Linux should also be on our roadmap at some point. Presumably statically-build binaries would be more suitable for the Nix packages?

@rushmorem
Copy link
Collaborator Author

Presumably statically-build binaries would be more suitable for the Nix packages?

Not really. Nix saves its packages inside /nix/store inside paths like /nix/store/0ignl03zfg6mvs50z4n929b6pyx3rhqj-rustc-1.61.0-x86_64-unknown-linux-gnu/. That's how it's able to have packages of different versions on the same system. The dependencies are dynamically linked by default.

@tobiemh tobiemh added the feature New feature or request label Sep 2, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 3, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 3, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 3, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 3, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 3, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 5, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 5, 2022
rushmorem added a commit to rushmorem/surrealdb that referenced this issue Sep 5, 2022
@rushmorem
Copy link
Collaborator Author

Implemented in #100.

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

No branches or pull requests

2 participants