nixpkgs/pkgs/development/tools/confluent-cli/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

55 lines
2.3 KiB
Nix

{ stdenv, autoPatchelfHook, fetchurl, lib }:
stdenv.mkDerivation rec {
pname = "confluent-cli";
version = "3.60.0";
# To get the latest version:
# curl -L https://cnfl.io/cli | sh -s -- -l | grep -v latest | sort -V | tail -n1
src = {
x86_64-linux = fetchurl {
url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_linux_amd64.tar.gz";
hash = "sha256-GYA7T2yRcSNStvd9ZqI2iTJC3d6ymH9Dg5FVkIsM1f0=";
};
aarch64-linux = fetchurl {
url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_linux_arm64.tar.gz";
hash = "sha256-BJJaZtRInKT6S0W22f96RCM8H18dIpOTP5lu357zh18=";
};
x86_64-darwin = fetchurl {
url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_darwin_amd64.tar.gz";
hash = "sha256-94ur/FXxQWL4EOkEI1FSoWduRaMaY7DCNMiucpNC0B0=";
};
aarch64-darwin = fetchurl {
url = "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/${version}/confluent_${version}_darwin_arm64.tar.gz";
hash = "sha256-aEIKSrO0/6dJCAyzwBH2ZDAmwvURugx6jTzaepbRvH8=";
};
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
dontStrip = stdenv.hostPlatform.isDarwin;
installPhase = ''
mkdir -p $out/{bin,share/doc/confluent-cli}
cp confluent $out/bin/
cp LICENSE $out/share/doc/confluent-cli/
cp -r legal $out/share/doc/confluent-cli/
'';
meta = with lib; {
description = "Confluent CLI";
homepage = "https://docs.confluent.io/confluent-cli/current/overview.html";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = with maintainers; [ rguevara84 autophagy ];
# TODO: There's support for i686 systems but I do not have any such system
# to build it locally on, it's also unfree so I cannot rely on ofborg to
# build it. Get the list of supported system by looking at the list of
# files in the S3 bucket:
#
# https://s3-us-west-2.amazonaws.com/confluent.cloud?prefix=confluent-cli/archives/1.25.0/&delimiter=/%27
platforms = platforms.unix;
};
}