about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/steampipe
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/steampipe')
-rw-r--r--nixpkgs/pkgs/tools/misc/steampipe/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/misc/steampipe/default.nix b/nixpkgs/pkgs/tools/misc/steampipe/default.nix
new file mode 100644
index 000000000000..ecfa780cc532
--- /dev/null
+++ b/nixpkgs/pkgs/tools/misc/steampipe/default.nix
@@ -0,0 +1,48 @@
+{ lib, stdenv, buildGoModule, fetchFromGitHub, installShellFiles }:
+
+buildGoModule rec {
+  pname = "steampipe";
+  version = "0.21.7";
+
+  src = fetchFromGitHub {
+    owner = "turbot";
+    repo = "steampipe";
+    rev = "v${version}";
+    hash = "sha256-puaqAMUnlQNOQmxhJCKQKTBypTjdModijtIpPBZsIXY=";
+  };
+
+  vendorHash = "sha256-yS2FiTnK65LAY3tGSlMy0LMg6691tS/9yQ4w7HrW/pw=";
+  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 'filehelpers "github.com/turbot/go-kit/files"' "" \
+      --replace 'filepaths.SteampipeDir, _ = filehelpers.Tildefy("~/.steampipe")' 'filepaths.SteampipeDir = "~/.steampipe"';
+    runHook postPatch
+  '';
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  ldflags = [ "-s" "-w" ];
+
+  # panic: could not create backups directory: mkdir /var/empty/.steampipe: operation not permitted
+  doCheck = !stdenv.isDarwin;
+
+  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";
+  };
+}