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

61 lines
1.5 KiB
Nix
Raw Permalink Normal View History

2024-09-20 05:01:15 +00:00
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
testers,
installShellFiles,
}:
2025-04-09 21:50:23 +08:00
buildGoModule (finalAttrs: {
2024-09-20 05:01:15 +00:00
pname = "harbor-cli";
2025-08-12 14:17:39 +00:00
version = "0.0.9";
2024-09-20 05:01:15 +00:00
src = fetchFromGitHub {
owner = "goharbor";
repo = "harbor-cli";
2025-08-05 15:12:15 +08:00
tag = "v${finalAttrs.version}";
2025-08-12 14:17:39 +00:00
hash = "sha256-3LgFhSG/k4cnpxiYaXTPr52n1cntIG2qfLkYaOyaqGw=";
2024-09-20 05:01:15 +00:00
};
2025-08-12 14:17:39 +00:00
vendorHash = "sha256-QnKSzWa/XTrA83d/DXcS5PE59CL4wD2sISNDV5pBIfM=";
2024-12-04 16:37:06 +08:00
2025-04-09 21:50:23 +08:00
excludedPackages = [
"dagger"
"doc"
];
2024-09-20 05:01:15 +00:00
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-s"
"-w"
2025-04-09 21:50:23 +08:00
"-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=${finalAttrs.version}"
2024-09-20 05:01:15 +00:00
];
2024-12-04 16:37:06 +08:00
doCheck = false; # Network required
2024-09-20 05:01:15 +00:00
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
2024-12-04 16:37:06 +08:00
export HOME="$(mktemp -d)"
2024-09-20 05:01:15 +00:00
installShellCompletion --cmd harbor \
--bash <($out/bin/harbor completion bash) \
--fish <($out/bin/harbor completion fish) \
--zsh <($out/bin/harbor completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
2024-12-04 16:37:06 +08:00
command = "HOME=\"$(mktemp -d)\" harbor version";
2024-09-20 05:01:15 +00:00
};
meta = {
homepage = "https://github.com/goharbor/harbor-cli";
description = "Command-line tool facilitates seamless interaction with the Harbor container registry";
2025-04-09 21:50:23 +08:00
changelog = "https://github.com/goharbor/harbor-cli/releases/tag/v${finalAttrs.version}";
2024-09-20 05:01:15 +00:00
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ aaronjheng ];
mainProgram = "harbor";
};
2025-04-09 21:50:23 +08:00
})