blob: 6527ce2cd014e7410a7540f867d58e7dfc96ccb6 (
plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
|
{
lib,
stdenv,
fetchurl,
installShellFiles,
writableTmpDirAsHomeHook,
}:
let
arch =
with stdenv.hostPlatform;
if isx86_64 then
"amd64"
else if isAarch64 then
"arm64"
else if isi686 then
"386"
else if isPower64 && isLittleEndian then
"ppc64le"
else if isS390x then
"s390x"
else
throw "Unsupported arch: ${stdenv.hostPlatform.system}";
platform =
if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then
"macos_arm64"
else if stdenv.hostPlatform.isDarwin then
"macos"
else
"linux_${arch}";
in
stdenv.mkDerivation (finalAttrs: {
pname = "ibmcloud-cli";
version = "2.37.1";
src = fetchurl {
url = "https://download.clis.cloud.ibm.com/ibm-cloud-cli/${finalAttrs.version}/binaries/IBM_Cloud_CLI_${finalAttrs.version}_${platform}.tgz";
hash =
{
"x86_64-darwin" = "sha256-NqohbUj+FcReQr3ouq7QNdZOREk0nyCTug2bC4G2kOw=";
"aarch64-darwin" = "sha256-SYGela1vfxohcqPzk2DtqBNGaubHFoIgK14L/jwX0gc=";
"x86_64-linux" = "sha256-8W3QMLNcDDgb0V8j2HH0iNO+XqVHUsFw7Mmw7WCHsVY=";
"aarch64-linux" = "sha256-VtXLIPqDDovptQ83fjxQ4Ggk6WjTN18Z4hWwPuaY/dU=";
"i686-linux" = "sha256-qqlumSDuhD9G7dpVx9BCrA1wK96tqGvxDAvgtb4fW1o=";
"powerpc64le-linux" = "sha256-oyX2j55ywJdR4lOGSjfI/OcISGJXO7g2t1LI5/89y9w=";
"s390x-linux" = "sha256-XC8bMrDlR3dFFpMx/zjjMZz3d37jr9sNRWJEe56IqjE=";
}
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
nativeBuildInputs = [
installShellFiles
writableTmpDirAsHomeHook
];
installPhase = ''
runHook preInstall
install -Dm755 ibmcloud $out/bin/ibmcloud
mkdir -p $out/share/ibmcloud
cp LICENSE NOTICE $out/share/ibmcloud
installShellCompletion --cmd ibmcloud --bash <($out/bin/ibmcloud --generate-bash-completion)
runHook postInstall
'';
passthru.updateScript = ./update.sh;
meta = {
description = "Command line client for IBM Cloud";
homepage = "https://cloud.ibm.com/docs/cli";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ emilytrau ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"i686-linux"
"powerpc64le-linux"
"s390x-linux"
]
++ lib.platforms.darwin;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
mainProgram = "ibmcloud";
};
})
|