1{
2 lib,
3 stdenv,
4 installShellFiles,
5 buildGoModule,
6 fetchFromGitHub,
7 versionCheckHook,
8}:
9
10buildGoModule rec {
11 pname = "deepsource";
12 version = "0.10.1";
13
14 src = fetchFromGitHub {
15 owner = "DeepSourceCorp";
16 repo = "cli";
17 rev = "v${version}";
18 hash = "sha256-eJRoy/mgcdYgUV9covQbWwn5sk1hJB1UkKnNd/hjuEY=";
19 };
20
21 nativeBuildInputs = [ installShellFiles ];
22
23 doCheck = true;
24
25 checkFlags =
26 let
27 # Skip tests that require network access
28 skippedTests = [
29 "TestReportKeyValueWorkflow"
30 "TestReportAnalyzerTypeWorkflow"
31 "TestReportKeyValueFileWorkflow"
32 ];
33 in
34 [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
35
36 vendorHash = "sha256-SsMq4ngq3sSOL28ysHTxTF4CT9sIcCIW7yIhBxIPrNs=";
37
38 ldflags = [
39 "-s"
40 "-w"
41 "-X=main.version=${version}"
42 ];
43
44 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
45 installShellCompletion --cmd deepsource \
46 --bash <($out/bin/deepsource completion bash) \
47 --fish <($out/bin/deepsource completion fish) \
48 --zsh <($out/bin/deepsource completion zsh)
49 '';
50
51 doInstallCheck = true;
52 versionCheckProgramArg = "version";
53 nativeInstallCheckInputs = [
54 versionCheckHook
55 ];
56
57 meta = {
58 description = "Command line interface to DeepSource, the code health platform";
59 mainProgram = "deepsource";
60 homepage = "https://github.com/DeepSourceCorp/cli";
61 license = lib.licenses.bsd2;
62 maintainers = with lib.maintainers; [ nipeharefa ];
63 };
64}