nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 versionCheckHook,
7}:
8
9buildGoModule (finalAttrs: {
10 pname = "metal-cli";
11 version = "0.25.0";
12
13 src = fetchFromGitHub {
14 owner = "equinix";
15 repo = "metal-cli";
16 tag = "v${finalAttrs.version}";
17 hash = "sha256-+hpsGFZHuVhh+fKVcap0vhoUmRs3xPgUwW8SD56m6uI=";
18 };
19
20 vendorHash = "sha256-X+GfM73LAWk2pT4ZOPT2pg8YaKyT+SNjQ14LgB+C7Wo=";
21
22 ldflags = [
23 "-s"
24 "-w"
25 "-X github.com/equinix/metal-cli/cmd.Version=${finalAttrs.version}"
26 ];
27
28 nativeBuildInputs = [
29 installShellFiles
30 ];
31
32 postInstall = ''
33 installShellCompletion --cmd metal \
34 --bash <($out/bin/metal completion bash) \
35 --fish <($out/bin/metal completion fish) \
36 --zsh <($out/bin/metal completion zsh)
37 '';
38
39 doCheck = false;
40
41 doInstallCheck = true;
42 nativeInstallCheckInputs = [ versionCheckHook ];
43 versionCheckProgram = "${placeholder "out"}/bin/metal";
44 versionCheckProgramArg = "--version";
45
46 meta = {
47 description = "Official Equinix Metal CLI";
48 homepage = "https://github.com/equinix/metal-cli/";
49 changelog = "https://github.com/equinix/metal-cli/releases/tag/v${finalAttrs.version}";
50 license = lib.licenses.mit;
51 maintainers = with lib.maintainers; [
52 Br1ght0ne
53 nshalman
54 teutat3s
55 ];
56 mainProgram = "metal";
57 };
58})