diff options
Diffstat (limited to 'pkgs/servers/redpanda/default.nix')
-rw-r--r-- | pkgs/servers/redpanda/default.nix | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/pkgs/servers/redpanda/default.nix b/pkgs/servers/redpanda/default.nix index e2a265c0f5ef5..c59aa621cc4d6 100644 --- a/pkgs/servers/redpanda/default.nix +++ b/pkgs/servers/redpanda/default.nix @@ -1,48 +1,52 @@ -{ lib, stdenv, fetchzip }: - +{ buildGoModule +, callPackage +, doCheck ? !stdenv.isDarwin # Can't start localhost test server in MacOS sandbox. +, fetchFromGitHub +, installShellFiles +, lib +, stdenv +}: let - version = "22.3.11"; - platform = if stdenv.isLinux then "linux" else "darwin"; - arch = if stdenv.isAarch64 then "arm" else "amd"; - sha256s = { - darwin.amd = "sha256-kwAKxFg7BSNInvsQvFqgtpq8EEwSnmDeDyaF5b8L8SQ="; - darwin.arm = "sha256-kH5Ii672SeAIiRcWuAO3oVJVSBWp+r78RmTiR3BaDbg="; - linux.amd = "sha256-EKgkRKBrM4+X2YGoP2LpWRHL+fdHu44LYwCZ+O+c5ZY="; - linux.arm = "sha256-9b4oerRXjUVUYoswJWtnMBJSQDoCKClf673VjDQFUAw="; - }; -in stdenv.mkDerivation rec { - pname = "redpanda"; - inherit version; - - src = fetchzip { - url = "https://github.com/redpanda-data/redpanda/releases/download/v${version}/rpk-${platform}-${arch}64.zip"; - sha256 = sha256s.${platform}.${arch}; + version = "22.3.13"; + src = fetchFromGitHub { + owner = "redpanda-data"; + repo = "redpanda"; + rev = "v${version}"; + sha256 = "sha256-cUQFDXWnQYSLcfKFYg6BLrxF77iX+Yx3hcul4tMxdoc="; }; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin - cp rpk $out/bin - - ${lib.optionalString stdenv.isLinux '' - patchelf \ - --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - $out/bin/rpk - ''} - - runHook postInstall + server = callPackage ./server.nix { inherit src version; }; +in +buildGoModule rec { + pname = "redpanda-rpk"; + inherit doCheck src version; + modRoot = "./src/go/rpk"; + runVend = false; + vendorSha256 = "sha256-JVZuHRh3gavIGArxDkqUQsL5oBjz35EKGsC75Sy+cMo="; + + 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 ''; - # stripping somehow completely breaks it - dontStrip = true; + passthru = { + inherit server; + }; meta = with lib; { - description = "Redpanda is a streaming data platform for developers. Kafka API compatible. 10x faster. No ZooKeeper. No JVM! "; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - license = licenses.bsl11; + description = "Redpanda client"; homepage = "https://redpanda.com/"; - maintainers = with maintainers; [ happysalada ]; + license = licenses.bsl11; + maintainers = with maintainers; [ avakhrenev happysalada ]; platforms = platforms.all; }; } |