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

chore(nix): initial flake #1159

Closed
wants to merge 3 commits into from
Closed

chore(nix): initial flake #1159

wants to merge 3 commits into from

Conversation

MrFoxPro
Copy link
Contributor

@MrFoxPro MrFoxPro commented Oct 29, 2023

I was struggling to update nixpkgs's edgedb package, so I decied to nixify this repo instead.
Why you could consider to use Nix:

  1. Declarative configuration of build system and dev shell
  2. Repoducable packages from any machine
  3. Same developer environment for every contributor. For example, share same edgedb version(s), rust toolchain etc.
  4. Make onboarding easier for new contributors, as they will not have problems with setup. All will run with few commands
  5. Attract users from Nix community
  6. Simplify CI setup, as it can use or share configuration from your dev shell: https://determinate.systems/posts/nix-github-actions

Right now it's already possible to build edgedb-cli package via nix build .?submodules=1. Result binary will be located in ./result/bin/edgedb

Current limitations:

  • There is a little inconvinience because of using git submodules. Nix requires to pass ?submodules=1 to handle this. For using in consumer flake.nix, following syntax is required:
edgedb-cli = {
  type = "git";
  url = "https://github.com/mrfoxpro/edgedb-cli.git";
  submodules = true;
  ref = "nix";
};

Related PR: NixOS/nix#7862

I also created draft PR with developer environment setup with edgedb-server (#1160). Related: NixOS/nixpkgs#179635 (comment)

Current used Nix libs:

flake-parts: framework for convinient cross-platform flake shape: https://flake.parts. Allows splitting flake to modules, also provides opportunity to confiure some usefull tools declaratively

fenix: convinient rust toolchain managment: https://github.com/nix-community/fenix. Allows creating single package from multiple toolchains (cargo, rustc, rustc-src, rustfmt, rust-analyzer, clippy and so on)

crane: https://crane.dev. Usefull tool for effecient building of Rust project. Caches cargo artifacts.

I think it would be nice to configure integration with cachix later, so users will download cached result instead of rebuilding themselfs

@edgedb-cla
Copy link

edgedb-cla bot commented Oct 29, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@MrFoxPro MrFoxPro changed the title chore(nix): initial draft chore(nix): initial flake Oct 29, 2023
@MrFoxPro
Copy link
Contributor Author

MrFoxPro commented Dec 4, 2023

Not sure what happened, but now I can only build it via nix build "git+file://$(pwd)?submodules=1" and nix build .?submodules=1 stopped working for me on Nix 2.19.1

@aljazerzen
Copy link
Contributor

@MrFoxPro this looks promising. Can I take over this effort (including #1160), as I also need a dev shell with appropriate tooling?

In my opinion, this PR is good as it is, I would only split the crane modules up a bit, so downstream flakes don't need to run all of the tests (and thus don't need the git submodule).

@MrFoxPro
Copy link
Contributor Author

@MrFoxPro this looks promising. Can I take over this effort (including #1160), as I also need a dev shell with appropriate tooling?

In my opinion, this PR is good as it is, I would only split the crane modules up a bit, so downstream flakes don't need to run all of the tests (and thus don't need the git submodule).

for sure, you can push your changes if you're maintainer

@scotttrinh
Copy link
Contributor

I think this has been superceded by #1160 . Going to close.

@scotttrinh scotttrinh closed this Apr 12, 2024
@aljazerzen
Copy link
Contributor

This flake also contains derivations for building edgedb-cli itself, not just a shell for development.

Although, I'm planning to adapt PR to edgedb/nix-packages, so it can remain closed.

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.

None yet

3 participants