blob: 14c88a8fa494fdced5d17a3575d89ffc384d69ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, makeWrapper
, less
, xdg-utils
, testers
, runCommand
, stackit-cli
}:
buildGoModule rec {
pname = "stackit-cli";
version = "0.2.3";
src = fetchFromGitHub {
owner = "stackitcloud";
repo = "stackit-cli";
rev = "v${version}";
hash = "sha256-ci7P0VbIuYoIzaiNhUCNRFa3YxYxBsat5U46DwGq6WY=";
};
vendorHash = "sha256-ecf/7BoCvybga8RVRiXvrAf2a5uLvIOFk4qNJiguSpo=";
subPackages = [ "." ];
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];
nativeBuildInputs = [ installShellFiles makeWrapper ];
postInstall = ''
mv $out/bin/{${pname},stackit} # rename the binary
installShellCompletion --cmd stackit \
--bash <($out/bin/stackit completion bash) \
--zsh <($out/bin/stackit completion zsh) \
--fish <($out/bin/stackit completion fish)
# Ensure that all 3 completion scripts exist AND have content (should be kept for regression testing)
[ $(find $out/share -not -empty -type f | wc -l) -eq 3 ]
'';
postFixup = ''
wrapProgram $out/bin/stackit \
--suffix PATH : ${lib.makeBinPath [ less xdg-utils ]}
'';
nativeCheckInputs = [ less ];
passthru.tests = {
version = testers.testVersion {
package = stackit-cli;
command = "stackit --version";
};
};
meta = with lib; {
description = "CLI to manage STACKIT cloud services";
homepage = "https://github.com/stackitcloud/stackit-cli";
changelog = "https://github.com/stackitcloud/stackit-cli/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ DerRockWolf ];
mainProgram = "stackit";
};
}
|