Unbork journals audit logs and introduce audit option (#379629)
[NixPkgs.git] / pkgs / by-name / fl / flyctl / package.nix
blob1821b5f6286a91fa58f2bfd87799825f0fbde470
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   testers,
6   flyctl,
7   installShellFiles,
8 }:
10 buildGoModule rec {
11   pname = "flyctl";
12   version = "0.3.75";
14   src = fetchFromGitHub {
15     owner = "superfly";
16     repo = "flyctl";
17     rev = "v${version}";
18     hash = "sha256-uNJzJpeJpDNDgnBIzveK2dKVdRpEWFW912c/vZgeXQo=";
19   };
21   vendorHash = "sha256-ylz8O/HW1rtOCI6/YzIT/byYmSdMkSrF0AX7nIzALTU=";
23   subPackages = [ "." ];
25   ldflags = [
26     "-s"
27     "-w"
28     "-X github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z"
29     "-X github.com/superfly/flyctl/internal/buildinfo.buildVersion=${version}"
30   ];
31   tags = [ "production" ];
33   nativeBuildInputs = [ installShellFiles ];
35   patches = [ ./disable-auto-update.patch ];
37   preBuild = ''
38     GOOS= GOARCH= CGO_ENABLED=0 go generate ./...
39   '';
41   preCheck = ''
42     HOME=$(mktemp -d)
43   '';
45   # We override checkPhase to be able to test ./... while using subPackages
46   checkPhase = ''
47     runHook preCheck
48     # We do not set trimpath for tests, in case they reference test assets
49     export GOFLAGS=''${GOFLAGS//-trimpath/}
51     buildGoDir test ./...
53     runHook postCheck
54   '';
56   postInstall = ''
57     installShellCompletion --cmd flyctl \
58       --bash <($out/bin/flyctl completion bash) \
59       --fish <($out/bin/flyctl completion fish) \
60       --zsh <($out/bin/flyctl completion zsh)
61     ln -s $out/bin/flyctl $out/bin/fly
62   '';
64   passthru.tests.version = testers.testVersion {
65     package = flyctl;
66     command = "HOME=$(mktemp -d) flyctl version";
67     version = "v${flyctl.version}";
68   };
70   meta = {
71     description = "Command line tools for fly.io services";
72     downloadPage = "https://github.com/superfly/flyctl";
73     homepage = "https://fly.io/";
74     license = lib.licenses.asl20;
75     maintainers = with lib.maintainers; [
76       adtya
77       jsierles
78       techknowlogick
79       RaghavSood
80       teutat3s
81     ];
82     mainProgram = "flyctl";
83   };