btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / de / deepsource / package.nix
blob10d48b0fc4ceb8b16229fefae82b94dd8435aad3
2   lib,
3   stdenv,
4   installShellFiles,
5   buildGoModule,
6   fetchFromGitHub,
7   versionCheckHook,
8 }:
10 buildGoModule rec {
11   pname = "deepsource";
12   version = "0.8.6";
14   src = fetchFromGitHub {
15     owner = "DeepSourceCorp";
16     repo = "cli";
17     rev = "v${version}";
18     hash = "sha256-6uNb4cQVerrlW/eUkjmlO1i1YKYX3qaVdo0i5cczt+I=";
19   };
21   nativeBuildInputs = [ installShellFiles ];
23   doCheck = true;
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}$" ];
36   vendorHash = "sha256-SsMq4ngq3sSOL28ysHTxTF4CT9sIcCIW7yIhBxIPrNs=";
38   ldflags = [
39     "-s"
40     "-w"
41     "-X=main.version=${version}"
42   ];
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   '';
51   nativeInstallCheckInputs = [
52     versionCheckHook
53   ];
55   meta = {
56     description = "Command line interface to DeepSource, the code health platform";
57     mainProgram = "deepsource";
58     homepage = "https://github.com/DeepSourceCorp/cli";
59     license = lib.licenses.bsd2;
60     maintainers = with lib.maintainers; [ nipeharefa ];
61   };