2023-07-23 04:37:06 -06:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, buildPackages
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "gnmic";
|
2024-11-07 22:20:33 -07:00
|
|
|
version = "0.39.0";
|
2023-07-23 04:37:06 -06:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openconfig";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-11-07 22:20:33 -07:00
|
|
|
hash = "sha256-xS2TLYA/9Xb4UJ8yCpqDBQbHTE1p2OlBpp8R2BTXwyk=";
|
2023-07-23 04:37:06 -06:00
|
|
|
};
|
|
|
|
|
2024-11-07 22:20:33 -07:00
|
|
|
vendorHash = "sha256-9A/ZcamCMUpNxG3taHrqI4JChjpSjSuwx0ZUyGAuGXo=";
|
2023-07-23 04:37:06 -06:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
|
|
|
"-X" "github.com/openconfig/gnmic/app.version=${version}"
|
|
|
|
"-X" "github.com/openconfig/gnmic/app.commit=${src.rev}"
|
|
|
|
"-X" "github.com/openconfig/gnmic/app.date=1970-01-01T00:00:00Z"
|
|
|
|
];
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in ''
|
|
|
|
installShellCompletion --cmd gnmic \
|
|
|
|
--bash <(${emulator} $out/bin/gnmic completion bash) \
|
|
|
|
--fish <(${emulator} $out/bin/gnmic completion fish) \
|
|
|
|
--zsh <(${emulator} $out/bin/gnmic completion zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "gNMI CLI client and collector";
|
|
|
|
homepage = "https://gnmic.openconfig.net/";
|
|
|
|
changelog = "https://github.com/openconfig/gnmic/releases/tag/${src.rev}";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ vincentbernat ];
|
2023-11-26 18:17:53 -07:00
|
|
|
mainProgram = "gnmic";
|
2023-07-23 04:37:06 -06:00
|
|
|
};
|
|
|
|
}
|