btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / at / atlas / package.nix
blob22250150de5cb9d6ea29b9a9cbc0f1c982f1cb49
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   installShellFiles,
6   testers,
7   atlas,
8 }:
10 buildGoModule rec {
11   pname = "atlas";
12   version = "0.28.1";
14   src = fetchFromGitHub {
15     owner = "ariga";
16     repo = "atlas";
17     rev = "v${version}";
18     hash = "sha256-OPGPYCp878nYYujR1jiMpOg1cdLSwa3OZEIxL6JltD4=";
19   };
21   modRoot = "cmd/atlas";
23   proxyVendor = true;
24   vendorHash = "sha256-SFG//hc5vLQXC3SeEn4YRcc82PItYZy+TNqzq19sRnI=";
26   nativeBuildInputs = [ installShellFiles ];
28   ldflags = [
29     "-s"
30     "-w"
31     "-X ariga.io/atlas/cmd/atlas/internal/cmdapi.version=v${version}"
32   ];
34   subPackages = [ "." ];
36   postInstall = ''
37     installShellCompletion --cmd atlas \
38       --bash <($out/bin/atlas completion bash) \
39       --fish <($out/bin/atlas completion fish) \
40       --zsh <($out/bin/atlas completion zsh)
41   '';
43   passthru.tests.version = testers.testVersion {
44     package = atlas;
45     command = "atlas version";
46     version = "v${version}";
47   };
49   meta = with lib; {
50     description = "Modern tool for managing database schemas";
51     homepage = "https://atlasgo.io/";
52     changelog = "https://github.com/ariga/atlas/releases/tag/v${version}";
53     license = licenses.asl20;
54     maintainers = with maintainers; [ aaronjheng ];
55     mainProgram = "atlas";
56   };