mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 11:53:27 +00:00
e0464e4788
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" ```
48 lines
1.3 KiB
Nix
48 lines
1.3 KiB
Nix
{ buildGoModule
|
|
, doCheck ? !stdenv.hostPlatform.isDarwin # Can't start localhost test server in MacOS sandbox.
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, lib
|
|
, stdenv
|
|
}:
|
|
let
|
|
version = "24.2.5";
|
|
src = fetchFromGitHub {
|
|
owner = "redpanda-data";
|
|
repo = "redpanda";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-25ijVHEcj0AXLxC1rSbp3Xyv+SMQRRkRq+qgRJgSnAI=";
|
|
};
|
|
in
|
|
buildGoModule rec {
|
|
pname = "redpanda-rpk";
|
|
inherit doCheck src version;
|
|
modRoot = "./src/go/rpk";
|
|
runVend = false;
|
|
vendorHash = "sha256-JEbIC33J+uUzPN04EtO5XoC0MIkYRXKYNCsFsirJfhY=";
|
|
|
|
ldflags = [
|
|
''-X "github.com/redpanda-data/redpanda/src/go/rpk/pkg/cli/cmd/version.version=${version}"''
|
|
''-X "github.com/redpanda-data/redpanda/src/go/rpk/pkg/cli/cmd/version.rev=v${version}"''
|
|
''-X "github.com/redpanda-data/redpanda/src/go/rpk/pkg/cli/cmd/container/common.tag=v${version}"''
|
|
];
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
postInstall = ''
|
|
for shell in bash fish zsh; do
|
|
$out/bin/rpk generate shell-completion $shell > rpk.$shell
|
|
installShellCompletion rpk.$shell
|
|
done
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Redpanda client";
|
|
homepage = "https://redpanda.com/";
|
|
license = licenses.bsl11;
|
|
maintainers = with maintainers; [ avakhrenev happysalada ];
|
|
platforms = platforms.all;
|
|
mainProgram = "rpk";
|
|
};
|
|
}
|