about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/st/steampipe/package.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-04-10 20:43:08 +0200
committerAlyssa Ross <hi@alyssa.is>2024-04-10 20:43:08 +0200
commit69bfdf2484041b9d242840c4e5017b4703383bb0 (patch)
treed8bdaa69e7990d7d6f09b594b3c425f742acd2d0 /nixpkgs/pkgs/by-name/st/steampipe/package.nix
parentc8aee4b4363b6bf905a521b05b7476960e8286c8 (diff)
parentd8fe5e6c92d0d190646fb9f1056741a229980089 (diff)
downloadnixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.gz
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.bz2
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.lz
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.xz
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.zst
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.zip
Merge commit 'd8fe5e6c'
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/by-name/st/steampipe/package.nix')
-rw-r--r--nixpkgs/pkgs/by-name/st/steampipe/package.nix85
1 files changed, 85 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/st/steampipe/package.nix b/nixpkgs/pkgs/by-name/st/steampipe/package.nix
new file mode 100644
index 000000000000..beb2b0ddf654
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/st/steampipe/package.nix
@@ -0,0 +1,85 @@
+{
+  buildGoModule,
+  fetchFromGitHub,
+  installShellFiles,
+  lib,
+  makeWrapper,
+  nix-update-script,
+  steampipe,
+  testers,
+}:
+
+buildGoModule rec {
+  pname = "steampipe";
+  version = "0.22.1";
+
+  src = fetchFromGitHub {
+    owner = "turbot";
+    repo = "steampipe";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-Oz1T9koeXnmHc5oru1apUtmhhvKi/gAtg/Hb7HKkkP0=";
+  };
+
+  vendorHash = "sha256-U0BeGCRLjL56ZmVKcKqrrPTCXpShJzJq5/wnXDKax6g=";
+  proxyVendor = true;
+
+  postPatch = ''
+    # Patch test that relies on looking up homedir in user struct to prefer ~
+    substituteInPlace pkg/steampipeconfig/shared_test.go \
+      --replace-fail 'filehelpers "github.com/turbot/go-kit/files"' "" \
+      --replace-fail 'filepaths.SteampipeDir, _ = filehelpers.Tildefy("~/.steampipe")' 'filepaths.SteampipeDir = "~/.steampipe"';
+  '';
+
+  nativeBuildInputs = [
+    installShellFiles
+    makeWrapper
+  ];
+
+  ldflags = [
+    "-s"
+    "-w"
+  ];
+
+  doCheck = true;
+
+  checkFlags =
+    let
+      skippedTests = [
+        # panic: could not create backups directory: mkdir /var/empty/.steampipe: operation not permitted
+        "TestTrimBackups"
+        # Skip tests that require network access
+        "TestIsPortBindable"
+      ];
+    in
+    [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
+
+  postInstall = ''
+    wrapProgram $out/bin/steampipe \
+      --set-default STEAMPIPE_UPDATE_CHECK false \
+      --set-default STEAMPIPE_TELEMETRY none
+
+    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)
+  '';
+
+  passthru = {
+    tests.version = testers.testVersion {
+      command = "${lib.getExe steampipe} --version";
+      package = steampipe;
+      version = "v${version}";
+    };
+    updateScript = nix-update-script { };
+  };
+
+  meta = {
+    changelog = "https://github.com/turbot/steampipe/blob/v${version}/CHANGELOG.md";
+    description = "Dynamically query your cloud, code, logs & more with SQL";
+    homepage = "https://steampipe.io/";
+    license = lib.licenses.agpl3Only;
+    mainProgram = "steampipe";
+    maintainers = with lib.maintainers; [ hardselius anthonyroussel ];
+  };
+}