-
Notifications
You must be signed in to change notification settings - Fork 11
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
Package Gaia #8
Merged
soareschen
merged 7 commits into
informalsystems:master
from
JonathanLorimer:jonathan/gaia
Aug 17, 2021
Merged
Package Gaia #8
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0f82cc5
add syncGoModules functionality
JonathanLorimer 267d110
cleanup syncGoModules.hs
JonathanLorimer 73aa94f
more cleanup
JonathanLorimer 8eced66
fix failing check phase
JonathanLorimer 2c0668a
change .nar to .narHash
JonathanLorimer 7d6739d
add check phase back
JonathanLorimer 2e6bfc7
add exePath to gaia app
JonathanLorimer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ pkgs, gaia-src }: | ||
pkgs.buildGoApplication { | ||
name = "gaia"; | ||
src = "${gaia-src}"; | ||
modules = ./go-modules.toml; | ||
|
||
# NOTE: we need to create a tmp home directory for gaia's tests | ||
preCheck = '' | ||
export HOME="$(mktemp -d)" | ||
''; | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is the purpose of syncing the narHash?
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.
Yeah, so this is a bit complicated, but
gomod2nix
does not provide any tooling for generating dependency information dynamically from within nix. So we need to clone the go repo, callgomod2nix
from the command line, and then use the generated go-modules.toml. So I wrote a script that does that for us, this way if we add more go repos or have to update the dependencies we can update ourgomod2nix
file as well. However, this would be pretty easy to forget to do, so when my script generates the go-modules.toml, it also spits out the narHash from theflake.lock
file, this allows us to keep track of when we last synced the go modules.Once I am done packaging all the software I want to add a flake check that will go into each go package's subdirectory and check to see if the narHash matches the one in
flake.lock
this way we can get a CI failure if someone updates the flake input but forgets to runsyncGoModules
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.
Thanks for the explanation. I didn't look too much into it, but I guess this is similar to the hashes generated by Haskell.nix which needs to be checked in to source control. I think a potential issue is that users may encounter hash mismatch if they update the source code for Gaia to a different version and didn't execute the sync script.
This should work for now until we find a better solution.
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.
This is absolutely correct. That's why I want to either set up an assertion in the flake as a pre-commit hook that will fail if the hash is different, or setup a check that will fail in CI if the hashes are different. I will probably do both actually