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

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

79 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchFromGitHub, testers, flyctl, installShellFiles, gitUpdater }:
2020-03-08 22:30:29 +00:00
buildGoModule rec {
2020-03-08 22:30:29 +00:00
pname = "flyctl";
2024-05-25 00:17:18 +00:00
version = "0.2.58";
2020-03-08 22:30:29 +00:00
src = fetchFromGitHub {
owner = "superfly";
repo = "flyctl";
rev = "v${version}";
2024-05-25 00:17:18 +00:00
hash = "sha256-aXiBDPl/x/xeu+fNrxs+JejVtSZu8KZKbrSetJj4/Pk=";
2020-03-08 22:30:29 +00:00
};
2024-05-25 00:17:18 +00:00
vendorHash = "sha256-NmogEh3xWQ/opMm9UarpfuH3MJzJ9+qb0KX/O+i/pcA=";
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"
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.buildVersion=${version}"
2022-04-17 15:37:19 +00:00
];
tags = ["production"];
2020-03-08 22:30:29 +00:00
2022-07-07 14:54:50 +00:00
nativeBuildInputs = [ installShellFiles ];
2023-07-21 07:24:38 +00:00
patches = [ ./disable-auto-update.patch ];
2022-04-17 15:37:19 +00:00
preBuild = ''
go generate ./...
'';
preCheck = ''
HOME=$(mktemp -d)
'';
2024-05-20 14:53:09 +00:00
# We override checkPhase to be able to test ./... while using subPackages
checkPhase = ''
runHook preCheck
# We do not set trimpath for tests, in case they reference test assets
export GOFLAGS=''${GOFLAGS//-trimpath/}
buildGoDir test ./...
runHook postCheck
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
'';
2024-05-20 15:01:20 +00:00
# Upstream tags every PR merged with release tags like
# v2024.5.20-pr3545.4. We ignore all revisions containing a '-'
# to skip these releases.
passthru.updateScript = gitUpdater {
rev-prefix = "v";
ignoredVersions = "-";
};
passthru.tests.version = testers.testVersion {
package = flyctl;
command = "HOME=$(mktemp -d) flyctl version";
version = "v${flyctl.version}";
};
2024-05-01 19:46:52 +00:00
meta = {
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/";
2024-05-01 19:46:52 +00:00
license = lib.licenses.asl20;
2024-06-01 13:46:37 +00:00
maintainers = with lib.maintainers; [ adtya jsierles techknowlogick RaghavSood teutat3s ];
2023-09-15 19:35:59 +00:00
mainProgram = "flyctl";
2020-03-08 22:30:29 +00:00
};
}