5c370c0b2a
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{ stdenv
|
|
, lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, buildPackages
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "gnmic";
|
|
version = "0.37.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "openconfig";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-PktDdwtdCHLgLVpCRLi+Rna7dO2JeAAT6myFesIhpYc=";
|
|
};
|
|
|
|
vendorHash = "sha256-gxtVvh39VqJgS5VetnLpUyKJE8DcUZgn4MA8zdD/ccU=";
|
|
|
|
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 ];
|
|
mainProgram = "gnmic";
|
|
};
|
|
}
|