2022-07-14 12:49:19 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, testers, flyctl, installShellFiles }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "flyctl";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "0.1.117";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "superfly";
|
|
|
|
repo = "flyctl";
|
|
|
|
rev = "v${version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-cB1t7TKAqHuzbvrXkOMJPXtNXTqNB/TBDS3OHYX96ko=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
vendorHash = "sha256-+mCOSgRmvfAXHwtLup3vYhLY0zTtXIJeOtYD69B4/7o=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
subPackages = [ "." ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
2022-05-18 14:49:53 +00:00
|
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z"
|
2023-11-16 04:20:00 +00:00
|
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.buildVersion=${version}"
|
2022-04-27 09:35:20 +00:00
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
tags = ["production"];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
patches = [ ./disable-auto-update.patch ];
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
preBuild = ''
|
|
|
|
go generate ./...
|
|
|
|
'';
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
HOME=$(mktemp -d)
|
|
|
|
'';
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
postCheck = ''
|
2022-05-18 14:49:53 +00:00
|
|
|
go test ./... -ldflags="-X 'github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z'"
|
2022-04-27 09:35:20 +00:00
|
|
|
'';
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd flyctl \
|
|
|
|
--bash <($out/bin/flyctl completion bash) \
|
|
|
|
--fish <($out/bin/flyctl completion fish) \
|
|
|
|
--zsh <($out/bin/flyctl completion zsh)
|
2022-08-21 13:32:41 +00:00
|
|
|
ln -s $out/bin/flyctl $out/bin/fly
|
2022-07-14 12:49:19 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = flyctl;
|
|
|
|
command = "HOME=$(mktemp -d) flyctl version";
|
|
|
|
version = "v${flyctl.version}";
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Command line tools for fly.io services";
|
2022-04-27 09:35:20 +00:00
|
|
|
downloadPage = "https://github.com/superfly/flyctl";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://fly.io/";
|
|
|
|
license = licenses.asl20;
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = with maintainers; [ aaronjanse adtya jsierles techknowlogick viraptor ];
|
|
|
|
mainProgram = "flyctl";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-08-20 17:08:02 +00:00
|
|
|
}
|