Skip to content

Commit 5b66a50

Browse files
committed
feat: ability to add custom protoc-gen-go dependency to nix flake
1 parent 1e5438e commit 5b66a50

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

flake.nix

+23-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@
4040
# From https://nixos.wiki/wiki/Google_Cloud_SDK
4141
gdk = pkgs.google-cloud-sdk.withExtraComponents ([ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ]);
4242

43+
customProtocGenGo = pkgs.buildGoModule rec {
44+
name = "protoc-gen-go";
45+
owner = "protocolbuffers";
46+
repo = "protobuf-go";
47+
rev = "v1.30.0";
48+
src = pkgs.fetchFromGitHub {
49+
owner = "protocolbuffers";
50+
repo = "protobuf-go";
51+
rev = rev;
52+
# This should be updated whenever rev changes!
53+
# To update, set to "", run nix-shell, insert new hash
54+
sha256 = "sha256-GTZQ40uoi62Im2F4YvlZWiSNNJ4fEAkRojYa0EYz9HU=";
55+
};
56+
subPackages = [ "cmd/protoc-gen-go" ];
57+
vendorHash = null;
58+
proxyVendor = true;
59+
preBuild = ''
60+
export GOPROXY=https://proxy.golang.org,direct
61+
go mod download
62+
'';
63+
};
64+
4365
# The minimal set of packages to build Coder.
4466
devShellPackages = with pkgs; [
4567
# google-chrome is not available on OSX and aarch64 linux
@@ -80,7 +102,7 @@
80102
playwright-driver.browsers
81103
postgresql_16
82104
protobuf
83-
protoc-gen-go
105+
customProtocGenGo
84106
ripgrep
85107
# This doesn't build on latest nixpkgs (July 10 2024)
86108
(pinnedPkgs.sapling)

0 commit comments

Comments
 (0)