1{ stdenv, autoPatchelfHook, fetchurl, lib }:
2
3stdenv.mkDerivation rec {
4 pname = "confluent-cli";
5 version = "3.37.0";
6
7 # To get the latest version:
8 # curl -L https://cnfl.io/cli | sh -s -- -l | grep -v latest | sort -V | tail -n1
9 src = {
10 x86_64-linux = fetchurl {
11 url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_linux_amd64.tar.gz";
12 hash = "sha256-vJB/0odVA86fZtRh/Cg5KPD8q8CQFENlRzjpI41UOc8=";
13 };
14 aarch64-linux = fetchurl {
15 url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_linux_arm64.tar.gz";
16 hash = "sha256-lj7i7oQzX1AfhYfrXDiOjz1/EV4y3/CI4MyPKzNGcss=";
17 };
18 x86_64-darwin = fetchurl {
19 url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_darwin_amd64.tar.gz";
20 hash = "sha256-gEQBxChsM5CXFRsWBVVcQ88xQ2N4lqkIxHfZKPEMlOY";
21 };
22 aarch64-darwin = fetchurl {
23 url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_darwin_arm64.tar.gz";
24 hash = "sha256-6i5Z3m0gMzPuqWm/SJOuxjO3ioh/Uhk3A9uykksYfPo=";
25 };
26 }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
27
28 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
29
30 dontStrip = stdenv.isDarwin;
31
32 installPhase = ''
33 mkdir -p $out/{bin,share/doc/confluent-cli}
34 cp confluent $out/bin/
35 cp LICENSE $out/share/doc/confluent-cli/
36 cp -r legal $out/share/doc/confluent-cli/
37 '';
38
39 meta = with lib; {
40 description = "Confluent CLI";
41 homepage = "https://docs.confluent.io/confluent-cli/current/overview.html";
42 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
43 license = licenses.unfree;
44 maintainers = with maintainers; [ rguevara84 autophagy ];
45
46 # TODO: There's support for i686 systems but I do not have any such system
47 # to build it locally on, it's also unfree so I cannot rely on ofborg to
48 # build it. Get the list of supported system by looking at the list of
49 # files in the S3 bucket:
50 #
51 # https://s3-us-west-2.amazonaws.com/confluent.cloud?prefix=confluent-cli/archives/1.25.0/&delimiter=/%27
52 platforms = platforms.unix;
53 };
54}