mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 11:53:27 +00:00
73 lines
1.9 KiB
Nix
73 lines
1.9 KiB
Nix
{ lib, buildGoModule, fetchFromGitHub, testers, flyctl, installShellFiles }:
|
|
|
|
buildGoModule rec {
|
|
pname = "flyctl";
|
|
version = "0.2.71";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "superfly";
|
|
repo = "flyctl";
|
|
rev = "v${version}";
|
|
hash = "sha256-d2qoTRWuUh7Kn0uqT3fIlB8BbFJmyVEIlfInS3m+etc=";
|
|
};
|
|
|
|
vendorHash = "sha256-iRZrjkWQxuUW/YM5TygFt+g8suM5iLGsWsCt4QQOX3M=";
|
|
|
|
subPackages = [ "." ];
|
|
|
|
ldflags = [
|
|
"-s" "-w"
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z"
|
|
"-X github.com/superfly/flyctl/internal/buildinfo.buildVersion=${version}"
|
|
];
|
|
tags = ["production"];
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
patches = [ ./disable-auto-update.patch ];
|
|
|
|
preBuild = ''
|
|
go generate ./...
|
|
'';
|
|
|
|
preCheck = ''
|
|
HOME=$(mktemp -d)
|
|
'';
|
|
|
|
# We override checkPhase to be able to test ./... while using subPackages
|
|
# Temporary fix for https://github.com/superfly/flyctl/issues/3642. We
|
|
# should go back to buildGoDir instead of go test once that is resolved.
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
# We do not set trimpath for tests, in case they reference test assets
|
|
export GOFLAGS=''${GOFLAGS//-trimpath/}
|
|
|
|
go test ./...
|
|
|
|
runHook postCheck
|
|
'';
|
|
|
|
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 = {
|
|
description = "Command line tools for fly.io services";
|
|
downloadPage = "https://github.com/superfly/flyctl";
|
|
homepage = "https://fly.io/";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ adtya jsierles techknowlogick RaghavSood teutat3s ];
|
|
mainProgram = "flyctl";
|
|
};
|
|
}
|