1{ stdenv, autoPatchelfHook, fetchurl, lib }:
2
3stdenv.mkDerivation rec {
4 pname = "ccloud-cli";
5 version = "1.39.0";
6
7 # To get the latest version:
8 # curl -L https://cnfl.io/ccloud-cli | sh -s -- -l | grep -v latest | sort -V | tail -n1
9 src = fetchurl (if stdenv.hostPlatform.isDarwin then {
10 url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/ccloud-cli/archives/${version}/ccloud_v${version}_darwin_amd64.tar.gz";
11 sha256 = "0jqpmnx3izl4gv02zpx03z6ayi3cb5if4rnyl1374yaclx44k1gd";
12 } else {
13 url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/ccloud-cli/archives/${version}/ccloud_v${version}_linux_amd64.tar.gz";
14 sha256 = "0936hipcl37w4mzzsnjlz4q1z4j9094i4irigzqwg14gdbs7p11s";
15 });
16
17 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
18
19 dontStrip = stdenv.isDarwin;
20
21 installPhase = ''
22 mkdir -p $out/{bin,share/doc/ccloud-cli}
23 cp ccloud $out/bin/
24 cp LICENSE $out/share/doc/ccloud-cli/
25 cp -r legal $out/share/doc/ccloud-cli/
26 '';
27
28 meta = with lib; {
29 description = "Confluent Cloud CLI";
30 homepage = "https://docs.confluent.io/current/cloud/cli/index.html";
31 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
32 license = licenses.unfree;
33 maintainers = with maintainers; [ kalbasit ];
34
35 # TODO: There's support for i686 systems but I do not have any such system
36 # to build it locally on, it's also unfree so I cannot rely on ofborg to
37 # build it. Get the list of supported system by looking at the list of
38 # files in the S3 bucket:
39 #
40 # https://s3-us-west-2.amazonaws.com/confluent.cloud?prefix=ccloud-cli/archives/1.25.0/&delimiter=/%27
41 platforms = [ "x86_64-linux" "x86_64-darwin" ];
42 };
43}