-
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
Package Gaia #8
Conversation
This is effectively ready for review, but depends on some changes in #5 so I will leave in draft until that is merged and I can rebase! |
Closes #13 |
e22e1d0
to
2e6bfc7
Compare
syncGoModulesInputs = with builtins; concatStringsSep " " | ||
(attrValues (builtins.mapAttrs (name: value: "${name}${value}") goProjectSrcs)); | ||
syncGoModulesScript = pkgs.writeShellScriptBin "syncGoModules" '' | ||
echo "${syncGoModulesInputs}" | ./syncGoModules.hs |
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, call gomod2nix
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 our gomod2nix
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 the flake.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 run syncGoModules
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.
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 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
No description provided.