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

build: add a simple nix dev shell #6739

Closed

Conversation

vincenzopalazzo
Copy link
Collaborator

I've had these changes on a branch for some time and have been considering preparing a patch and pushing it.

Essentially, this enables any NixOS or Nix package manager user to launch a development shell with all the necessary dependencies. This allows CLN users to contribute, compile, and install CLN. The process can be a bit intricate due to our use of shared libraries. This update might also enhance the OSX build, though I haven't been able to test it currently.

The documentation has been updated as well, as it previously didn't work on a fresh NixOS machine. In the latest commit, I've added myself as the code owner to assist in maintaining this configuration.

This approach differs from #6650. Their method offers a more intricate Nix configuration that employs Nix to execute the make target. While I might be oversimplifying, I believe their approach is excessive for our needs.

@vincenzopalazzo vincenzopalazzo force-pushed the macros/nix-shell branch 2 times, most recently from f095798 to da7c008 Compare October 2, 2023 12:06
@vincenzopalazzo vincenzopalazzo added this to the v23.11 milestone Oct 2, 2023
@vincenzopalazzo vincenzopalazzo self-assigned this Oct 2, 2023
@vincenzopalazzo vincenzopalazzo force-pushed the macros/nix-shell branch 2 times, most recently from da7fcc1 to 9199c38 Compare October 5, 2023 08:04
@vincenzopalazzo vincenzopalazzo force-pushed the macros/nix-shell branch 4 times, most recently from 1eefc12 to 482df12 Compare October 5, 2023 09:12
@vincenzopalazzo vincenzopalazzo marked this pull request as draft October 5, 2023 16:51
@vincenzopalazzo

This comment was marked as outdated.

@vincenzopalazzo vincenzopalazzo force-pushed the macros/nix-shell branch 2 times, most recently from aebc8f5 to 851c172 Compare October 12, 2023 17:42
@vincenzopalazzo vincenzopalazzo marked this pull request as ready for review October 12, 2023 17:43
@vincenzopalazzo vincenzopalazzo force-pushed the macros/nix-shell branch 6 times, most recently from c9d9462 to f6dd1cd Compare October 13, 2023 13:09
@cdecker
Copy link
Member

cdecker commented Oct 17, 2023

I wonder if we should rather build a flake rather than an env or a shell. That'd allow us to pull in other flakes from arbitrary sources, and more importantly pull CLN in as a flake themselves.

@vincenzopalazzo
Copy link
Collaborator Author

I wonder if we should rather build a flake rather than an env or a shell. That'd allow us to pull in other flakes from arbitrary sources, and more importantly, pull CLN in as a flake themselves.

This is a good point, I can move to Nix Flake or maybe we can just adapt the nix-shell into a nix flake. However, I am having a hard time resolving the Python Nix bundle.

I will make some experiments, thanks for the suggestion

@cdecker
Copy link
Member

cdecker commented Oct 18, 2023

Discussing somewhere else about the complexity of getting the python dependencies in, I was wondering if it'd make sense to have nix manage poetry as the only python dependency, and then we put the python dependency download as a pre-shell command. This way we'd stay in nix for everything except python dependencies and we can then slowly pull them in as more and more of our dependencies get nixified.

@vincenzopalazzo
Copy link
Collaborator Author

Discussing somewhere else about the complexity of getting the python dependencies in, I was wondering if it'd make sense to have nix manage poetry as the only python dependency, and then we put the python dependency download as a pre-shell command. This way we'd stay in nix for everything except python dependencies and we can then slowly pull them in as more and more of our dependencies get nixified.

This is a good things to do IMHO, and I think also the only one because there is a bug on nix. I was testing it but I do not remember why I changed maybe due the nix env variable, but I can play with it after the release is over.

@nepet
Copy link
Collaborator

nepet commented Oct 20, 2023

I am tempted to move this to the next release (or between releases as it does not touch core-lightning itself).

@vincenzopalazzo
Copy link
Collaborator Author

I am tempted to move this to the next release (or between releases as it does not touch core-lightning itself).

Yeah currently there is no way to build a nix-shell with poetry2nix because there is a bug and we should wait for a fix.

Happy to move it

@nepet nepet modified the milestones: v23.11, v24.02 Oct 26, 2023
@cdecker cdecker removed this from the v24.02 milestone Jan 15, 2024
@cdecker
Copy link
Member

cdecker commented Jan 15, 2024

Removed the milestone as this PR is not ready to be merged in its current state.

Signed-off-by: Vincenzo Palazzo <[email protected]>
Introducing the nix-shell configuration file. There is
also a new experimental feature in nix/nixos
that is nix flake [1].

The reason that this commit is including a default.nix
that is the normal nix-shell [2] is that it is the most
well known and also what we need in cln.

In fact, in cln we need just a way to have an env shell with all
the dependencies, and then allow the user/developer to
work with the normal workflow documented inside our docs.

[1] https://nixos.wiki/wiki/Flakes
[2] https://nixos.org/manual/nix/stable/command-ref/nix-shell
Signed-off-by: Vincenzo Palazzo <[email protected]>
@vincenzopalazzo
Copy link
Collaborator Author

This nix to be reworked

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

Successfully merging this pull request may close these issues.

4 participants