-
Notifications
You must be signed in to change notification settings - Fork 13
WIP: feat: hermetic build for enola #1730 (dumb build) #1795
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @dotdoom, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the build process for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request makes the Nix build for enola hermetic by pinning the Bazel Central Registry and using a fixed-output hash for the derivation. This is a great step towards fully reproducible builds. My review includes a couple of suggestions to improve the maintainability and align the changes with Nix Flakes best practices. Specifically, I recommend declaring the Bazel registry as a flake input and adding a comment to explain the maintenance of the outputHash.
| bazel-central-registry = pkgs.fetchFromGitHub { | ||
| owner = "bazelbuild"; | ||
| repo = "bazel-central-registry"; | ||
| rev = "4fcc47180cfe24915dae5705074c3994c60dc6b7"; | ||
| hash = "sha256-Th7gamXEzJnoA65VKVfARCDnLup5URJT0R1g2Jw3S/0="; | ||
| }; |
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.
While using fetchFromGitHub works, a more idiomatic approach with Nix Flakes is to declare this dependency as a flake input. This improves clarity by centralizing external dependencies in the inputs section and leverages the flake.lock file for pinning.
You could achieve this by:
- Adding
bazel-central-registryto yourinputsinflake.nix:inputs = { # ... other inputs bazel-central-registry.url = "github:bazelbuild/bazel-central-registry/4fcc47180cfe24915dae5705074c3994c60dc6b7"; };
- Passing
bazel-central-registryas an argument to theoutputsfunction. - Removing this
letbinding and using thebazel-central-registryvariable from the function arguments directly in yourbazel buildcommand.
This change would make your flake's dependency management more robust and easier to follow.
| --add-flags "-jar $out/share/java/enola_deploy.jar" | ||
| ''; | ||
|
|
||
| outputHash = "sha256-hHa+tqNDxe3+Tl190xPWiNiCq0HWU5qcc52rjo3Ncl0="; |
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.
Using a fixed outputHash is a correct way to ensure a reproducible build for a derivation that has network access (like Bazel fetching dependencies). However, it can be a maintenance hurdle, as any change affecting the output requires manually updating this hash.
To improve maintainability for future contributors, it would be very helpful to add a comment explaining why this hash is necessary and how to update it. This will save others time when they encounter a hash mismatch error.
# This is a fixed-output derivation. Bazel's dependency fetching is considered
# an impurity by Nix, so we lock the output hash to ensure reproducibility.
# If you change dependencies or source code and the build fails with a hash
# mismatch, update this value to the 'got' hash from the Nix error message.
outputHash = "sha256-hHa+tqNDxe3+Tl190xPWiNiCq0HWU5qcc52rjo3Ncl0=";
Relates to #1730.