summary refs log tree commit diff
path: root/pkgs/development/tools/buf/default.nix
diff options
context:
space:
mode:
author06kellyjac <dev@j-k.io>2021-06-19 09:43:46 +0100
committer06kellyjac <dev@j-k.io>2021-06-19 09:43:46 +0100
commita178aba8cab65dfba5eee23b6ef69c24f74328a5 (patch)
tree429259f3ddbd983cda656cc979d5d42414c31a43 /pkgs/development/tools/buf/default.nix
parent0e3229d628b3a1c56cc9279c39e6a40720794773 (diff)
downloadnixpkgs-a178aba8cab65dfba5eee23b6ef69c24f74328a5.tar
nixpkgs-a178aba8cab65dfba5eee23b6ef69c24f74328a5.tar.gz
nixpkgs-a178aba8cab65dfba5eee23b6ef69c24f74328a5.tar.bz2
nixpkgs-a178aba8cab65dfba5eee23b6ef69c24f74328a5.tar.lz
nixpkgs-a178aba8cab65dfba5eee23b6ef69c24f74328a5.tar.xz
nixpkgs-a178aba8cab65dfba5eee23b6ef69c24f74328a5.tar.zst
nixpkgs-a178aba8cab65dfba5eee23b6ef69c24f74328a5.zip
buf: 0.41.0 -> 0.43.2
Fix new git tests
Add ldflags to slightly reduce binary size
Only install required binaries
Diffstat (limited to 'pkgs/development/tools/buf/default.nix')
-rw-r--r--pkgs/development/tools/buf/default.nix32
1 files changed, 28 insertions, 4 deletions
diff --git a/pkgs/development/tools/buf/default.nix b/pkgs/development/tools/buf/default.nix
index 8d76b8925dc..c1060744f44 100644
--- a/pkgs/development/tools/buf/default.nix
+++ b/pkgs/development/tools/buf/default.nix
@@ -2,30 +2,54 @@
 , buildGoModule
 , fetchFromGitHub
 , protobuf
+, git
 }:
 
 buildGoModule rec {
   pname = "buf";
-  version = "0.41.0";
+  version = "0.43.2";
 
   src = fetchFromGitHub {
     owner = "bufbuild";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-f1UcvsXWW+fMAgTRtHkEXmUN/DTrJ/Xd+9HbR2FjFog=";
+    sha256 = "sha256-Go0wLcJrxMgB67WlAI7TwX2UU2sQ/yfmC0h2igOkjc4=";
+    leaveDotGit = true; # Required by TestWorkspaceGit
   };
+  vendorSha256 = "sha256-HT0dsGniBoQW2Y7MhahDeFvE0nCASoPdzHETju0JuRY=";
 
   patches = [
     ./skip_test_requiring_network.patch
   ];
 
+  nativeBuildInputs = [ protobuf ];
+  checkInputs = [ git ];
+
+  ldflags = [ "-s" "-w" ];
+
   preCheck = ''
     export PATH=$PATH:$GOPATH/bin
+    # To skip TestCloneBranchAndRefToBucket
+    export CI=true
   '';
 
-  nativeBuildInputs = [ protobuf ];
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p "$out/bin"
+    dir="$GOPATH/bin"
+    # Only install required binaries, don't install testing binaries
+    for file in \
+      "buf" \
+      "protoc-gen-buf-breaking" \
+      "protoc-gen-buf-lint" \
+      "protoc-gen-buf-check-breaking" \
+      "protoc-gen-buf-check-lint"; do
+      cp "$dir/$file" "$out/bin/"
+    done
 
-  vendorSha256 = "sha256-XMGXVsSLEzuzujX5Fg3LLkgzyJY+nIBJEO9iI2t9eGc=";
+    runHook postInstall
+  '';
 
   meta = with lib; {
     description = "Create consistent Protobuf APIs that preserve compatibility and comply with design best-practices";