- 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
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
5b66a50
b807081
29e30cb
a57d552
3335644
c86ca86
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
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=$(grep -A 20 'pkgs.buildGoModule rec' flake.nix | grep -A 10 'repo = "protobuf-go"' | grep 'rev = "v' | sed 's/.*rev = "\(.*\)".*/\1/') | ||
Contributor
| ||
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!" |
Uh oh!
There was an error while loading.Please reload this page.