-
Notifications
You must be signed in to change notification settings - Fork 741
[testing] Replace script-based tool installation with nix #3691
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
Conversation
b22db15
to
827d7ea
Compare
Previously, binary tools like promtail and prometheus (enabling log and metrics collection) and kube and kind (enabling local kube clusters) were installed using bash scripts. A script-based approach, while simple, requires tedious and error-prone copying and committing to other repos (e.g. subnet-evm and hypersdk) that need the same functionality. Possible to rewrite the scripts to golang which allows usage via `go run` or `go install`. Simple enough if the versions never change, but still requires retrieving binaries, verifying their hashes for security, and potentially dealing with tar archives. Still more complicated if it becomes necessary to ensure the desired version is the one in the path. Switching to [nix](https://nixos.org/), on the other hand, is an established way of solving the problem that doesn't involve maintaining code. Installing nix is a one-time operation not too different from homebrew, except that the result has more guarantees of reproducibility across linux and macos.
@@ -51,6 +51,11 @@ jobs: | |||
steps: | |||
- uses: actions/checkout@v4 | |||
- uses: ./.github/actions/setup-go-for-project | |||
- uses: cachix/install-nix-action@v30 | |||
with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this github token is needed while it was not needed in the previous version of this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous version of this file was not installing tools with nix. Provision of a github token is common in github actions where things will be downloaded, and avoids the possibility of being rate-limited that is common to anonymous usage of a given installation action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is what I should have led with: https://github.com/cachix/install-nix-action?tab=readme-ov-file#inputs-specify-using-with
tl;dr specifying a github token allows the cachix action to download from github without fear of being rate-limited.
Why this should be merged
Previously, binary tools like promtail and prometheus (enabling log and metrics collection) and kube and kind (enabling local kube clusters) were installed using bash scripts. A script-based approach, while simple, requires tedious and error-prone copying and committing to other repos (e.g. subnet-evm and hypersdk) that needed the same functionality.
Possible to rewrite the scripts to golang which allows usage via
go run
orgo install
. Simple enough if the versions never change, but still requires retrieving binaries, verifying their hashes for security, potentially dealing with tar archives. Still more complication if it becomes necessary to ensure the desired version is the one in the path.Switching to nix, on the other hand, is an established way of solving the problem that doesn't involve maintaining code. Installing nix is a one-time operation not too different from homebrew, except that the result has more guarantees of reproducibility across linux and macos.
How this works
How this was tested
CI, manually for direnv usage
Need to be documented in RELEASES.md?
N/A