mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 03:10:19 +00:00
56 lines
1.3 KiB
Nix
56 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
installShellFiles,
|
|
stdenv,
|
|
versionCheckHook,
|
|
}:
|
|
|
|
buildGoModule (finalAttrs: {
|
|
pname = "gcx";
|
|
version = "1.0.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "grafana";
|
|
repo = "gcx";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-VBYYlPzuZ9iQMXUJdxu9YBPs2Ize6vWBzhMK94E3beY=";
|
|
};
|
|
|
|
vendorHash = "sha256-PevzovryzpNap8dzruYWdk07M5g9jlA8QPQcrXnO7xk=";
|
|
|
|
subPackages = [ "cmd/gcx" ];
|
|
|
|
ldflags = [
|
|
"-w"
|
|
"-X=main.version=${finalAttrs.version}"
|
|
"-X=main.commit=${finalAttrs.src.rev}"
|
|
"-X=main.date=1970-01-01T00:00:00Z"
|
|
];
|
|
|
|
__structuredAttrs = true;
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd gcx \
|
|
--bash <($out/bin/gcx completion bash) \
|
|
--fish <($out/bin/gcx completion fish) \
|
|
--zsh <($out/bin/gcx completion zsh)
|
|
'';
|
|
|
|
nativeInstallCheckInputs = [ versionCheckHook ];
|
|
doInstallCheck = true;
|
|
|
|
meta = {
|
|
description = "Grafana Cloud CLI";
|
|
homepage = "https://github.com/grafana/gcx";
|
|
changelog = "https://github.com/grafana/gcx/releases/tag/${finalAttrs.src.tag}";
|
|
license = lib.licenses.asl20;
|
|
mainProgram = "gcx";
|
|
platforms = lib.platforms.unix;
|
|
maintainers = with lib.maintainers; [ asimpson ];
|
|
};
|
|
})
|