2022-07-07 16:54:50 +02:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, testers, flyctl, installShellFiles }:
|
2020-03-08 23:30:29 +01:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "flyctl";
|
2023-01-18 21:52:41 +01:00
|
|
|
version = "0.0.450";
|
2020-03-08 23:30:29 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "superfly";
|
|
|
|
repo = "flyctl";
|
|
|
|
rev = "v${version}";
|
2023-01-18 21:52:41 +01:00
|
|
|
sha256 = "sha256-UfqjrWzpi1axud4MkrJxIwq1vzqHZ0qAvI1kNh/tywY=";
|
2020-03-08 23:30:29 +01:00
|
|
|
};
|
|
|
|
|
2023-01-18 21:52:41 +01:00
|
|
|
vendorHash = "sha256-ljyaF6Yz3bz5vjwZfDgYBb3o2l90YnV5DgolaDH3B9o=";
|
2020-03-08 23:30:29 +01:00
|
|
|
|
2020-05-19 11:20:00 +02:00
|
|
|
subPackages = [ "." ];
|
2020-03-08 23:30:29 +01:00
|
|
|
|
2022-04-17 17:37:19 +02:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
2022-05-06 17:18:41 +02:00
|
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.commit=${src.rev}"
|
2022-05-09 23:02:34 +02:00
|
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z"
|
2022-05-06 17:18:41 +02:00
|
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.environment=production"
|
|
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.version=${version}"
|
2022-04-17 17:37:19 +02:00
|
|
|
];
|
2020-03-08 23:30:29 +01:00
|
|
|
|
2022-07-07 16:54:50 +02:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2022-04-17 17:37:19 +02:00
|
|
|
preBuild = ''
|
|
|
|
go generate ./...
|
|
|
|
'';
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
HOME=$(mktemp -d)
|
|
|
|
'';
|
2020-08-04 02:26:27 +02:00
|
|
|
|
2022-04-17 17:37:19 +02:00
|
|
|
postCheck = ''
|
2022-05-11 03:05:27 +02:00
|
|
|
go test ./... -ldflags="-X 'github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z'"
|
2022-04-17 17:37:19 +02:00
|
|
|
'';
|
2020-05-19 11:20:00 +02:00
|
|
|
|
2022-07-07 16:54:50 +02: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-18 12:39:39 +02:00
|
|
|
ln -s $out/bin/flyctl $out/bin/fly
|
2022-07-07 16:54:50 +02:00
|
|
|
'';
|
|
|
|
|
2022-05-11 03:05:27 +02:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = flyctl;
|
|
|
|
command = "HOME=$(mktemp -d) flyctl version";
|
|
|
|
version = "v${flyctl.version}";
|
|
|
|
};
|
|
|
|
|
2020-03-27 08:33:21 +01:00
|
|
|
meta = with lib; {
|
2020-03-08 23:30:29 +01:00
|
|
|
description = "Command line tools for fly.io services";
|
2022-04-17 17:37:19 +02:00
|
|
|
downloadPage = "https://github.com/superfly/flyctl";
|
2020-03-08 23:30:29 +01:00
|
|
|
homepage = "https://fly.io/";
|
|
|
|
license = licenses.asl20;
|
2022-07-02 04:42:04 +02:00
|
|
|
maintainers = with maintainers; [ aaronjanse jsierles techknowlogick viraptor ];
|
2020-03-08 23:30:29 +01:00
|
|
|
};
|
2020-07-31 05:58:04 +02:00
|
|
|
}
|