nixpkgs/pkgs/development/web/flyctl/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.7 KiB
Nix
Raw Normal View History

2022-07-07 14:54:50 +00:00
{ lib, buildGoModule, fetchFromGitHub, testers, flyctl, installShellFiles }:
2020-03-08 22:30:29 +00:00
buildGoModule rec {
pname = "flyctl";
2022-08-28 10:33:29 +00:00
version = "0.0.383";
2020-03-08 22:30:29 +00:00
src = fetchFromGitHub {
owner = "superfly";
repo = "flyctl";
rev = "v${version}";
2022-08-28 10:33:29 +00:00
sha256 = "sha256-SI+Xm4TUn4HmfbTG0YQuwQhCSVcean8PsOx5SowI/eU=";
2020-03-08 22:30:29 +00:00
};
2022-08-28 10:33:29 +00:00
vendorSha256 = "sha256-swbQOLW3NMVDbD1hJh7iFKAFWlQhWSY2KHQGj5NSdqw=";
2020-03-08 22:30:29 +00:00
2020-05-19 09:20:00 +00:00
subPackages = [ "." ];
2020-03-08 22:30:29 +00:00
2022-04-17 15:37:19 +00:00
ldflags = [
"-s" "-w"
"-X github.com/superfly/flyctl/internal/buildinfo.commit=${src.rev}"
2022-05-09 21:02:34 +00:00
"-X github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z"
"-X github.com/superfly/flyctl/internal/buildinfo.environment=production"
"-X github.com/superfly/flyctl/internal/buildinfo.version=${version}"
2022-04-17 15:37:19 +00:00
];
2020-03-08 22:30:29 +00:00
2022-07-07 14:54:50 +00:00
nativeBuildInputs = [ installShellFiles ];
2022-04-17 15:37:19 +00:00
preBuild = ''
go generate ./...
'';
preCheck = ''
HOME=$(mktemp -d)
'';
2022-04-17 15:37:19 +00:00
postCheck = ''
go test ./... -ldflags="-X 'github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z'"
2022-04-17 15:37:19 +00:00
'';
2020-05-19 09:20:00 +00:00
2022-07-07 14:54:50 +00:00
postInstall = ''
installShellCompletion --cmd flyctl \
--bash <($out/bin/flyctl completion bash) \
--fish <($out/bin/flyctl completion fish) \
--zsh <($out/bin/flyctl completion zsh)
ln -s $out/bin/flyctl $out/bin/fly
2022-07-07 14:54:50 +00:00
'';
passthru.tests.version = testers.testVersion {
package = flyctl;
command = "HOME=$(mktemp -d) flyctl version";
version = "v${flyctl.version}";
};
meta = with lib; {
2020-03-08 22:30:29 +00:00
description = "Command line tools for fly.io services";
2022-04-17 15:37:19 +00:00
downloadPage = "https://github.com/superfly/flyctl";
2020-03-08 22:30:29 +00:00
homepage = "https://fly.io/";
license = licenses.asl20;
maintainers = with maintainers; [ aaronjanse jsierles techknowlogick viraptor ];
2020-03-08 22:30:29 +00:00
};
}