depot/third_party/nixpkgs/pkgs/development/web/flyctl/default.nix
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +02:00

63 lines
1.6 KiB
Nix

{ lib, buildGo122Module, fetchFromGitHub, testers, flyctl, installShellFiles }:
buildGo122Module rec {
pname = "flyctl";
version = "0.2.52";
src = fetchFromGitHub {
owner = "superfly";
repo = "flyctl";
rev = "v${version}";
hash = "sha256-BCnMXyS94tuD+Un1DLqs3mdGi7XrVBoZGJ/XkpACOQI";
};
vendorHash = "sha256-eTiY65VGFBgGzCOrnp/WbOo9Lbdk4PYwT7CppjsZ4WE=";
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)
'';
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 = {
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 ];
mainProgram = "flyctl";
};
}