nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildGoModule,
3 fetchFromGitHub,
4 installShellFiles,
5 lib,
6 makeWrapper,
7 nix-update-script,
8 steampipe,
9 testers,
10}:
11
12buildGoModule rec {
13 pname = "steampipe";
14 version = "2.3.4";
15
16 env.CGO_ENABLED = 0;
17
18 src = fetchFromGitHub {
19 owner = "turbot";
20 repo = "steampipe";
21 tag = "v${version}";
22 hash = "sha256-6p3GbPQ60DK4V565ipZq3OZDB6Tu/5tynhka8EQQUf4=";
23 };
24
25 vendorHash = "sha256-A4STD+EaUoYNgLwvD8B6IySE+wu+OsTydTukEnvWKjw=";
26 proxyVendor = true;
27
28 postPatch = ''
29 # Patch test that relies on looking up homedir in user struct to prefer ~
30 substituteInPlace pkg/steampipeconfig/shared_test.go \
31 --replace-fail 'filehelpers "github.com/turbot/go-kit/files"' "" \
32 --replace-fail 'app_specific.InstallDir, _ = filehelpers.Tildefy("~/.steampipe")' 'app_specific.InstallDir = "~/.steampipe"';
33 '';
34
35 nativeBuildInputs = [
36 installShellFiles
37 makeWrapper
38 ];
39
40 ldflags = [
41 "-s"
42 "-w"
43 "-X main.version=${version}"
44 "-X main.commit=${src.rev}"
45 "-X main.date=unknown"
46 "-X main.builtBy=nixpkgs"
47 ];
48
49 doCheck = true;
50
51 checkFlags =
52 let
53 skippedTests = [
54 # panic: could not create backups directory: mkdir /var/empty/.steampipe: operation not permitted
55 "TestTrimBackups"
56 # Requires network access
57 "TestVersionCheckerBodyReadFailure"
58 "TestVersionCheckerNetworkFailures"
59 "TestVersionCheckerTimeout"
60 ];
61 in
62 [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
63
64 postInstall = ''
65 wrapProgram $out/bin/steampipe \
66 --set-default STEAMPIPE_UPDATE_CHECK false \
67 --set-default STEAMPIPE_TELEMETRY none
68
69 INSTALL_DIR=$(mktemp -d)
70 installShellCompletion --cmd steampipe \
71 --bash <($out/bin/steampipe --install-dir $INSTALL_DIR completion bash) \
72 --fish <($out/bin/steampipe --install-dir $INSTALL_DIR completion fish) \
73 --zsh <($out/bin/steampipe --install-dir $INSTALL_DIR completion zsh)
74 '';
75
76 passthru = {
77 tests.version = testers.testVersion {
78 command = "${lib.getExe steampipe} --version";
79 package = steampipe;
80 version = "v${version}";
81 };
82 updateScript = nix-update-script { };
83 };
84
85 meta = {
86 changelog = "https://github.com/turbot/steampipe/blob/v${version}/CHANGELOG.md";
87 description = "Dynamically query your cloud, code, logs & more with SQL";
88 homepage = "https://steampipe.io/";
89 license = lib.licenses.agpl3Only;
90 mainProgram = "steampipe";
91 maintainers = with lib.maintainers; [
92 hardselius
93 anthonyroussel
94 ];
95 };
96}