depot/third_party/nixpkgs/pkgs/applications/networking/gnmic/default.nix
Default email d5f4a57cbf Project import generated by Copybara.
GitOrigin-RevId: ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e
2023-08-10 09:59:29 +02:00

45 lines
1.3 KiB
Nix

{ stdenv
, lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, buildPackages
}:
buildGoModule rec {
pname = "gnmic";
version = "0.31.7";
src = fetchFromGitHub {
owner = "openconfig";
repo = pname;
rev = "v${version}";
hash = "sha256-bX8oZk0psPqoXFU8b2JQmfFaPz18yiuSVXDmhoOnpFg=";
};
vendorHash = "sha256-hIG3kG2e9Y2hnHJ+96cPLgnlp5ParsLgWQY0HZTDggY=";
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 ];
};
}