1{ lib, stdenv, buildGoModule, fetchFromGitHub, installShellFiles }:
2
3buildGoModule rec {
4 pname = "vultr-cli";
5 version = "3.3.0";
6
7 src = fetchFromGitHub {
8 owner = "vultr";
9 repo = pname;
10 rev = "v${version}";
11 hash = "sha256-Gn2N/v3qFqxI2ZU94GNuzpHoXgPeJaAO+ODjb5ff1aI=";
12 };
13
14 vendorHash = "sha256-kglG6Mhe1XUqblt+0ZR8FPPTrBKjxb1xG8bPXQrrzxE=";
15
16 nativeBuildInputs = [ installShellFiles ];
17
18 ldflags = [ "-s" "-w" ];
19
20 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
21 installShellCompletion --cmd vultr-cli \
22 --bash <($out/bin/vultr-cli completion bash) \
23 --fish <($out/bin/vultr-cli completion fish) \
24 --zsh <($out/bin/vultr-cli completion zsh)
25 '';
26
27 meta = with lib; {
28 description = "Official command line tool for Vultr services";
29 homepage = "https://github.com/vultr/vultr-cli";
30 changelog = "https://github.com/vultr/vultr-cli/blob/v${version}/CHANGELOG.md";
31 license = licenses.asl20;
32 maintainers = with maintainers; [ Br1ght0ne ];
33 mainProgram = "vultr-cli";
34 };
35}