Unverified Commit 2e778285 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #307971 from weitzj/fix/307970-add-powerpipe

powerpipe: init at 0.2.0
parents 31b67eb2 dd5115d0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21710,6 +21710,12 @@
    github = "wegank";
    githubId = 9713184;
  };
  weitzj = {
    name = "Jan Weitz";
    email = "nixpkgs@janweitz.de";
    github = "weitzj";
    githubId = 829277;
  };
  welteki = {
    email = "welteki@pm.me";
    github = "welteki";
+71 −0
Original line number Diff line number Diff line
{
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  lib,
  makeWrapper,
  nix-update-script,
  powerpipe,
  testers,
}:

buildGoModule rec {
  pname = "powerpipe";
  version = "0.2.0";

  src = fetchFromGitHub {
    owner = "turbot";
    repo = "powerpipe";
    rev = "refs/tags/v${version}";
    hash = "sha256-UvtPtH68Y1hY+3GeVJVgW/za+c568A9th8boSAnhw1A=";
  };

  vendorHash = "sha256-vX7V2iGu1Jlv+OlCa/TRNTql+1H9kPl92zQVwI1e9sU=";
  proxyVendor = true;

  nativeBuildInputs = [
    installShellFiles
    makeWrapper
  ];

  ldflags = [
    "-s"
    "-w"
    "-X main.version=${version}"
  ];

  doCheck = true;

  checkFlags =
    let
      skippedTests = [
        # test fails in the original github.com/turbot/powerpipe project as well
        "TestGetAsSnapshotPropertyMap/card"
      ];
    in
    [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];

  postInstall = ''
    wrapProgram $out/bin/powerpipe \
      --set-default POWERPIPE_UPDATE_CHECK false \
      --set-default POWERPIPE_TELEMETRY none
  '';

  passthru = {
    tests.version = testers.testVersion {
      command = "${lib.getExe powerpipe} --version";
      package = powerpipe;
      version = "v${version}";
    };
    updateScript = nix-update-script { };
  };

  meta = {
    changelog = "https://github.com/turbot/powerpipe/blob/v${version}/CHANGELOG.md";
    description = "Dynamically query your cloud, code, logs & more with SQL";
    homepage = "https://powerpipe.io/";
    license = lib.licenses.agpl3Only;
    mainProgram = "powerpipe";
    maintainers = with lib.maintainers; [ weitzj ];
  };
}