Skip to content

chore(nix): initial flake#1159

Closed
0x241F31 wants to merge 3 commits intogeldata:masterfrom
0x241F31:nix
Closed

chore(nix): initial flake#1159
0x241F31 wants to merge 3 commits intogeldata:masterfrom
0x241F31:nix

Conversation

@0x241F31
Copy link
Copy Markdown
Contributor

@0x241F31 0x241F31 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

@gel-data-cla
Copy link
Copy Markdown

gel-data-cla bot commented Oct 29, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

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

0x241F31 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
Copy Markdown
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).

@0x241F31
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@scotttrinh scotttrinh closed this Apr 12, 2024
@aljazerzen
Copy link
Copy Markdown
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.

3 participants