5e9e1146e1
GitOrigin-RevId: 18036c0be90f4e308ae3ebcab0e14aae0336fe42
63 lines
1.7 KiB
Nix
63 lines
1.7 KiB
Nix
{ lib, buildGoModule, fetchFromGitHub, testers, flyctl, installShellFiles }:
|
|
|
|
buildGoModule rec {
|
|
pname = "flyctl";
|
|
version = "0.1.62";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "superfly";
|
|
repo = "flyctl";
|
|
rev = "v${version}";
|
|
hash = "sha256-/IIHe3OG/r/cZ4PaYZazv/aPBzyxNBCWbgkzFbJMpvc=";
|
|
};
|
|
|
|
vendorHash = "sha256-bjlNwhhhvwrw5GtWO8+1HV2IauqexKSb+O9WGX06qGA=";
|
|
|
|
subPackages = [ "." ];
|
|
|
|
ldflags = [
|
|
"-s" "-w"
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.commit=${src.rev}"
|
|
"-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}"
|
|
];
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
patches = [ ./disable-auto-update.patch ];
|
|
|
|
preBuild = ''
|
|
go generate ./...
|
|
'';
|
|
|
|
preCheck = ''
|
|
HOME=$(mktemp -d)
|
|
'';
|
|
|
|
postCheck = ''
|
|
go test ./... -ldflags="-X 'github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z'"
|
|
'';
|
|
|
|
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
|
|
'';
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
package = flyctl;
|
|
command = "HOME=$(mktemp -d) flyctl version";
|
|
version = "v${flyctl.version}";
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Command line tools for fly.io services";
|
|
downloadPage = "https://github.com/superfly/flyctl";
|
|
homepage = "https://fly.io/";
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [ aaronjanse jsierles techknowlogick viraptor ];
|
|
};
|
|
}
|