nixpkgs/pkgs/tools/misc/steampipe/default.nix
2022-10-01 20:52:57 +02:00

46 lines
1.4 KiB
Nix

{ stdenv, lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "steampipe";
version = "0.16.4";
src = fetchFromGitHub {
owner = "turbot";
repo = "steampipe";
rev = "v${version}";
sha256 = "sha256-awZlA02lKYpFdvCsGUC8Blv8FHek5XskkljseDGjDmk=";
};
vendorSha256 = "sha256-6l3bBxGhdZGIXmdzgF44TGZQqT6gSUHSwOAE2SlgLgg=";
proxyVendor = true;
patchPhase = ''
runHook prePatch
# Patch test that relies on looking up homedir in user struct to prefer ~
substituteInPlace pkg/steampipeconfig/shared_test.go \
--replace '"github.com/turbot/go-kit/helpers"' "" \
--replace 'filepaths.SteampipeDir, _ = helpers.Tildefy("~/.steampipe")' 'filepaths.SteampipeDir = "~/.steampipe"';
runHook postPatch
'';
nativeBuildInputs = [ installShellFiles ];
ldflags = [ "-s" "-w" ];
postInstall = ''
INSTALL_DIR=$(mktemp -d)
installShellCompletion --cmd steampipe \
--bash <($out/bin/steampipe --install-dir $INSTALL_DIR completion bash) \
--fish <($out/bin/steampipe --install-dir $INSTALL_DIR completion fish) \
--zsh <($out/bin/steampipe --install-dir $INSTALL_DIR completion zsh)
'';
meta = with lib; {
homepage = "https://steampipe.io/";
description = "select * from cloud;";
license = licenses.agpl3;
maintainers = with maintainers; [ hardselius ];
changelog = "https://github.com/turbot/steampipe/blob/v${version}/CHANGELOG.md";
};
}