about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2024-03-27 01:18:39 +0100
committerGitHub <noreply@github.com>2024-03-27 01:18:39 +0100
commitd3c4cab394c614814e2396fe668e129cc55e52e0 (patch)
tree6672dc40938e1627463a9eee866f0afdc0484202 /pkgs/by-name
parente9200ffef24c072e89036fa55bf2a305354d4cbb (diff)
parent21cdff528339ee4129994c5cf255cb6a556c588e (diff)
Merge pull request #299160 from anthonyroussel/maintainer/steampipe
steampipe: enable tests on darwin
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/st/steampipe/package.nix50
1 files changed, 34 insertions, 16 deletions
diff --git a/pkgs/by-name/st/steampipe/package.nix b/pkgs/by-name/st/steampipe/package.nix
index d14aed0d376d7..beb2b0ddf654f 100644
--- a/pkgs/by-name/st/steampipe/package.nix
+++ b/pkgs/by-name/st/steampipe/package.nix
@@ -3,8 +3,8 @@
   fetchFromGitHub,
   installShellFiles,
   lib,
+  makeWrapper,
   nix-update-script,
-  stdenv,
   steampipe,
   testers,
 }:
@@ -16,30 +16,48 @@ buildGoModule rec {
   src = fetchFromGitHub {
     owner = "turbot";
     repo = "steampipe";
-    rev = "v${version}";
+    rev = "refs/tags/v${version}";
     hash = "sha256-Oz1T9koeXnmHc5oru1apUtmhhvKi/gAtg/Hb7HKkkP0=";
   };
 
   vendorHash = "sha256-U0BeGCRLjL56ZmVKcKqrrPTCXpShJzJq5/wnXDKax6g=";
   proxyVendor = true;
 
-  patchPhase = ''
-    runHook prePatch
+  postPatch = ''
     # 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
+      --replace-fail 'filehelpers "github.com/turbot/go-kit/files"' "" \
+      --replace-fail 'filepaths.SteampipeDir, _ = filehelpers.Tildefy("~/.steampipe")' 'filepaths.SteampipeDir = "~/.steampipe"';
   '';
 
-  nativeBuildInputs = [ installShellFiles ];
+  nativeBuildInputs = [
+    installShellFiles
+    makeWrapper
+  ];
 
-  ldflags = [ "-s" "-w" ];
+  ldflags = [
+    "-s"
+    "-w"
+  ];
 
-  # panic: could not create backups directory: mkdir /var/empty/.steampipe: operation not permitted
-  doCheck = !stdenv.isDarwin;
+  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) \
@@ -56,12 +74,12 @@ buildGoModule rec {
     updateScript = nix-update-script { };
   };
 
-  meta = with lib; {
+  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/";
-    description = "select * from cloud;";
-    license = licenses.agpl3Only;
+    license = lib.licenses.agpl3Only;
     mainProgram = "steampipe";
-    maintainers = with maintainers; [ hardselius ];
-    changelog = "https://github.com/turbot/steampipe/blob/v${version}/CHANGELOG.md";
+    maintainers = with lib.maintainers; [ hardselius anthonyroussel ];
   };
 }