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

Add experimental Nix Flake support #472

Merged
merged 4 commits into from
Jul 13, 2023
Merged

Add experimental Nix Flake support #472

merged 4 commits into from
Jul 13, 2023

Conversation

Lorak-mmk
Copy link
Contributor

Nix is, citing their GH repo, 'a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible.'
See here for a more detailed description: https://serokell.io/blog/what-is-nix

We want to use Nix in drivers (starting with Java driver) to create reproducible, easy to use development environments, and later to extend this to CI and release process.
In order to do that, we need to create Nix package for CCM, as it's used by many drivers in integration tests. This PR accomplishes experimental version of it.

PR introduces Nix flake that can be used to add CCM as a dependency somewhere or to quickly enter a development environment where you can run and test CCM (with caveats due to Scylla using absolute paths when searching for Java - see commit messages / README / flake.nix).
There is also a CI pipeline running tests in Nix environment - marked with continue-on-error in order to not affect CCM's development process if something breaks in Nix. When we are sure everything is correct and stable, this parameter can be removed.

Copy link
Contributor

@fruch fruch left a comment

Choose a reason for hiding this comment

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

LGTM
as long as driver team is taking ownership on it (and it works)

@avelanarius
Copy link

LGTM as long as driver team is taking ownership on it (and it works)

Yes, we are taking ownership on it. We'll experiment with it as a base of more approachable dev environments of all drivers (as each driver is written in a different language and requires different toolchain).

@Lorak-mmk
Copy link
Contributor Author

Drafting, @avelanarius found some issues

@Lorak-mmk Lorak-mmk marked this pull request as draft July 4, 2023 09:31
@Lorak-mmk Lorak-mmk marked this pull request as ready for review July 5, 2023 12:26
This commit adds Nix flake which can be used to add ccm as a dependency
in other Nix projects or to quickly enter development environment with
all dependencies required to run and test ccm.
Direnv has good support for flakes - it's easy to activate it, it
retains your current shell, and it works properly (unloads dev env when
leaving the folder). This commit enables direnv flake support for this
project.
As the whole Nix flake in this repo is experimental, this workflow
has `continue-on-error` set to true in order to avoid potential problems
with Nix stalling CCM development. We can make it required, or even
completely switch to it, after some time, to be sure Nix really works
here.
@Lorak-mmk
Copy link
Contributor Author

Fixed issues found by @avelanarius . While fixing them, I found out that ccm respects JAVA_HOME - it doesn't call JMX's select-java at all if JAVA_HOME is present. This allowed me to get rid of buildFHSUserEnv, which got rid of previous documented limitations and simplified code a bit.

Copy link

@avelanarius avelanarius left a comment

Choose a reason for hiding this comment

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

LGTM. Tested it on my computer, starting Scylla 5.1.0 and 2022.1.7 (different relocatable versions) and it all now works correctly.

@fruch I think you can merge it now.

This will make it easier to use CCM without having to worry about having correct Java/Python/etc. on the system: nix shell github:scylladb/scylla-ccm and everything will work after that single command. The source itself is very small (57 lines of flake.nix) so maintaining it won't be a huge burden for me and @Lorak-mmk.

@Lorak-mmk
Copy link
Contributor Author

@fruch ping

@fruch fruch merged commit 2ad44c1 into scylladb:next Jul 13, 2023
2 checks passed
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