571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
47 lines
1.3 KiB
Nix
47 lines
1.3 KiB
Nix
{ stdenv
|
|
, lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, buildPackages
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "gnmic";
|
|
version = "0.39.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "openconfig";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-xS2TLYA/9Xb4UJ8yCpqDBQbHTE1p2OlBpp8R2BTXwyk=";
|
|
};
|
|
|
|
vendorHash = "sha256-9A/ZcamCMUpNxG3taHrqI4JChjpSjSuwx0ZUyGAuGXo=";
|
|
|
|
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";
|
|
};
|
|
}
|