- Notifications
You must be signed in to change notification settings - Fork927
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
5b66a50
feat: ability to add custom protoc-gen-go dependency to nix flake
joobisbb807081
chore: update the naming
joobisb29e30cb
updated flake script
joobisba57d552
refactor flake.nix parser
joobisb3335644
make fmt
dannykoppingc86ca86
Update hash
dannykoppingFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
26 changes: 24 additions & 2 deletionsflake.nix
This file contains hidden or 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
24 changes: 24 additions & 0 deletionsscripts/update-flake.sh
This file contains hidden or 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 |
---|---|---|
@@ -5,6 +5,20 @@ set -eu | ||
cd "$(dirname "${BASH_SOURCE[0]}")/.." | ||
check_and_install() { | ||
if ! command -v "$1" &>/dev/null; then | ||
echo "$1 is not installed. Attempting to install..." | ||
if ! nix-env -iA nixpkgs."$1"; then | ||
echo "Failed to install $1. Please install it manually and try again." | ||
exit 1 | ||
fi | ||
echo "$1 has been installed successfully." | ||
fi | ||
} | ||
check_and_install jq | ||
check_and_install nix-prefetch-git | ||
OUT=$(mktemp -d -t nar-hash-XXXXXX) | ||
echo "Downloading Go modules..." | ||
@@ -13,4 +27,14 @@ echo "Calculating SRI hash..." | ||
HASH=$(go run tailscale.com/cmd/nardump --sri "$OUT/pkg/mod/cache/download") | ||
sudo rm -rf "$OUT" | ||
echo "Updating go.mod vendorHash" | ||
sed -i "s#\(vendorHash = \"\)[^\"]*#\1${HASH}#" ./flake.nix | ||
# Update protoc-gen-go sha256 | ||
echo "Updating protoc-gen-go sha256..." | ||
PROTOC_GEN_GO_REV=$(nix eval --extra-experimental-features nix-command --extra-experimental-features flakes --raw .#proto_gen_go.rev) | ||
echo "protoc-gen-go version: $PROTOC_GEN_GO_REV" | ||
PROTOC_GEN_GO_SHA256=$(nix-prefetch-git https://github.com/protocolbuffers/protobuf-go --rev "$PROTOC_GEN_GO_REV" | jq -r .hash) | ||
dannykopping marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
sed -i "s#\(sha256 = \"\)[^\"]*#\1${PROTOC_GEN_GO_SHA256}#" ./flake.nix | ||
echo "Flake updated successfully!" |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.