2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "metal-cli";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "0.15.0";
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "equinix";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-O/SO4cHcENiecbZoMLNTnT4uQR8NF0N9Xq0pBCwbdy8=";
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
vendorHash = "sha256-cq0OH+YeEvflpEfMu3PGumhtbDSmLjAkTYas4m4UVfA=";
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
ldflags = [
|
2022-12-17 10:02:37 +00:00
|
|
|
"-s"
|
|
|
|
"-w"
|
2022-02-20 05:27:41 +00:00
|
|
|
"-X github.com/equinix/metal-cli/cmd.Version=${version}"
|
|
|
|
];
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
2022-09-22 12:36:57 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd metal \
|
|
|
|
--bash <($out/bin/metal completion bash) \
|
|
|
|
--fish <($out/bin/metal completion fish) \
|
|
|
|
--zsh <($out/bin/metal completion zsh)
|
|
|
|
'';
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
doInstallCheck = true;
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/metal --version | grep ${version}
|
|
|
|
'';
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Official Equinix Metal CLI";
|
|
|
|
homepage = "https://github.com/equinix/metal-cli/";
|
2022-12-17 10:02:37 +00:00
|
|
|
changelog = "https://github.com/equinix/metal-cli/releases/tag/v${version}";
|
2021-10-28 06:52:43 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ Br1ght0ne nshalman ];
|
2022-04-27 09:35:20 +00:00
|
|
|
mainProgram = "metal";
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
}
|