depot/third_party/nixpkgs/pkgs/applications/networking/gnmic/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

46 lines
1.3 KiB
Nix

{ stdenv
, lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, buildPackages
}:
buildGoModule rec {
pname = "gnmic";
version = "0.33.0";
src = fetchFromGitHub {
owner = "openconfig";
repo = pname;
rev = "v${version}";
hash = "sha256-7jykosmVG+oJ6/27x+VtlVVxq/OQIctcjB1Wjs1DcRU=";
};
vendorHash = "sha256-VjeOSnCAdG+RlIg9uIyyQ8wKUqyX5uc2RXG75q84vm4=";
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";
};
}