Unverified Commit d4b3be98 authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

conduktor-ctl: init at 0.4.0 (#355458)

parents 007fabe5 b5e8ee3b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -4966,6 +4966,12 @@
    githubId = 6487079;
    name = "Dane Rieber";
  };
  conduktorbot = {
    email = "automation@conduktor.io";
    github = "conduktorbot";
    githubId = 96434751;
    name = "Conduktor Bot";
  };
  confus = {
    email = "con-f-use@gmx.net";
    github = "con-f-use";
@@ -15056,6 +15062,12 @@
    githubId = 1709273;
    name = "Robin Hack";
  };
  marnas = {
    email = "marco@santonastaso.com";
    name = "Marco Santonastaso";
    github = "marnas";
    githubId = 39352252;
  };
  marnym = {
    email = "markus@nyman.dev";
    github = "marnym";
+60 −0
Original line number Diff line number Diff line
{
  lib,
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  stdenv,
  versionCheckHook,
}:
buildGoModule rec {
  pname = "conduktor-ctl";
  version = "0.4.0";

  src = fetchFromGitHub {
    owner = "conduktor";
    repo = "ctl";
    rev = "refs/tags/v${version}";
    hash = "sha256-NNhaYBhLCCVXBbZKKefPRk1CD8GQm98FvChgeHvPDKs=";
  };

  vendorHash = "sha256-kPCBzLU6aH6MNlKZcKKFcli99ZmdOtPV5+5gxPs5GH4=";

  nativeBuildInputs = [ installShellFiles ];

  ldflags = [ "-X github.com/conduktor/ctl/utils.version=${version}" ];

  checkPhase = ''
    go test ./...
  '';

  postInstall =
    ''
      mv $out/bin/ctl $out/bin/conduktor
    ''
    + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
      installShellCompletion --cmd conduktor \
        --bash <($out/bin/conduktor completion bash) \
        --fish <($out/bin/conduktor completion fish) \
        --zsh <($out/bin/conduktor completion zsh)
    '';

  doInstallCheck = true;

  nativeInstallCheckInputs = [ versionCheckHook ];

  versionCheckProgram = "${placeholder "out"}/bin/conduktor";

  versionCheckProgramArg = "version";

  meta = {
    description = "CLI tool to interact with the Conduktor Console and Gateway";
    mainProgram = "conduktor";
    homepage = "https://github.com/conduktor/ctl";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      conduktorbot
      marnas
    ];
    platforms = lib.platforms.linux ++ lib.platforms.darwin;
  };
}