-
Notifications
You must be signed in to change notification settings - Fork 887
chore: add ability to include custom protoc-gen-go dependency in nix flake #14728
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
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 contribution!
flake.nix
Outdated
repo = "protobuf-go"; | ||
rev = rev; | ||
# This should be updated whenever rev changes! | ||
# To update, set to "", run nix-shell, insert new hash |
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.
Where does the new hash come from?
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.
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.
Can you rather integrate this into scripts/update-flake.sh
pls?
The less we make folks think, the more likely they are to do the right thing.
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 that would be better, I will do that
@dannykopping i've addressed the comments, please have a look |
08ad06a
to
b807081
Compare
I agree with the resolution to align nix and CI. But I am afraid in long run this will become a resistance to easily upgrade dev tools and packages. Why we can't update the version in CI in to match with nix? Or best use nix to run our CI. |
CI is the only one with a pinned version; either way we'd have to do what @joobisb has implemented.
That's the dream, but it'll take some time. In the interim, we can start by aligning versions IMHO. |
@joobisb please avoid rebasing once a review has begun. There's no need to maintain a clean history, since we squash-merge anyway. |
@dannykopping I've updated the script |
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!
scripts/update-flake.sh
Outdated
|
||
# Update protoc-gen-go sha256 | ||
echo "Updating protoc-gen-go sha256..." | ||
PROTOC_GEN_GO_REV=$(grep -A 20 'pkgs.buildGoModule rec' flake.nix | grep -A 10 'repo = "protobuf-go"' | grep 'rev = "v' | sed 's/.*rev = "\(.*\)".*/\1/') |
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 flimsy (and possibly not portable across Linux/Mac/Windows); is there a more robust way we can get this?
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.
@dannykopping
found a way to do this using nix eval
, please have a look
Refer: https://discourse.nixos.org/t/how-to-evaluate-a-nix-value-from-a-shell-script/24296/3
@dannykopping I've addressed the comments, could you please have a look |
@joobisb sure thing, I'm on PTO since yesterday but back tomorrow. |
It should be called a |
Signed-off-by: Danny Kopping <danny@coder.com>
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 much for your contribution @joobisb!
@joobisb I'm seeing the following failure on my NixOS machine
On Linux, nix builds restrict network access. I was able to fix by deleting the following lines: subPackages = [ "cmd/protoc-gen-go" ];
vendorHash = null;
- proxyVendor = true;
- preBuild = ''
- export GOPROXY=https://proxy.golang.org,direct
- go mod download
- '';
- Is there a reason this |
This PR can be a starting point to fix #14343