nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ buildGoModule, fetchFromGitHub, lib, testers, flyctl }:
2
3buildGoModule rec {
4 pname = "flyctl";
5 version = "0.0.328";
6
7 src = fetchFromGitHub {
8 owner = "superfly";
9 repo = "flyctl";
10 rev = "v${version}";
11 sha256 = "sha256-hcRdFkYZ3IqrxdGMdLWwHvJgGNkXfxsCQMHgPfy8cOk=";
12 };
13
14 vendorSha256 = "sha256-5mYa41bUOnBQgbaPv7/9BjpaN+/MXIPrieJQL2M58gw=";
15
16 subPackages = [ "." ];
17
18 ldflags = [
19 "-s" "-w"
20 "-X github.com/superfly/flyctl/internal/buildinfo.commit=${src.rev}"
21 "-X github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z"
22 "-X github.com/superfly/flyctl/internal/buildinfo.environment=production"
23 "-X github.com/superfly/flyctl/internal/buildinfo.version=${version}"
24 ];
25
26 preBuild = ''
27 go generate ./...
28 '';
29
30 preCheck = ''
31 HOME=$(mktemp -d)
32 '';
33
34 postCheck = ''
35 go test ./... -ldflags="-X 'github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z'"
36 '';
37
38 passthru.tests.version = testers.testVersion {
39 package = flyctl;
40 command = "HOME=$(mktemp -d) flyctl version";
41 version = "v${flyctl.version}";
42 };
43
44 meta = with lib; {
45 description = "Command line tools for fly.io services";
46 downloadPage = "https://github.com/superfly/flyctl";
47 homepage = "https://fly.io/";
48 license = licenses.asl20;
49 maintainers = with maintainers; [ aaronjanse jsierles techknowlogick ];
50 };
51}