1{ stdenv, buildGoPackage, fetchFromGitHub }:
2
3buildGoPackage rec {
4 name = "hcloud-${version}";
5 version = "1.11.0";
6
7 goPackagePath = "github.com/hetznercloud/cli";
8
9 src = fetchFromGitHub {
10 owner = "hetznercloud";
11 repo = "cli";
12 rev = "v${version}";
13 sha256 = "0iknw14728l2mynrvb3fiqm7y893ppp22gbb3mppi6iy3as94f1f";
14 };
15
16 goDeps = ./deps.nix;
17
18 buildFlagsArray = [ "-ldflags=" "-w -X github.com/hetznercloud/cli/cli.Version=${version}" ];
19
20 postInstall = ''
21 mkdir -p \
22 $bin/etc/bash_completion.d \
23 $bin/share/zsh/vendor-completions
24
25 # Add bash completions
26 $bin/bin/hcloud completion bash > "$bin/etc/bash_completion.d/hcloud"
27
28 # Add zsh completions
29 echo "#compdef hcloud" > "$bin/share/zsh/vendor-completions/_hcloud"
30 $bin/bin/hcloud completion zsh >> "$bin/share/zsh/vendor-completions/_hcloud"
31 '';
32
33 meta = {
34 description = "A command-line interface for Hetzner Cloud, a provider for cloud virtual private servers";
35 homepage = https://github.com/hetznercloud/cli;
36 license = stdenv.lib.licenses.mit;
37 platforms = stdenv.lib.platforms.all;
38 maintainers = [ stdenv.lib.maintainers.zauberpony ];
39 };
40}