Files
nixpkgs/pkgs/by-name/ha/harbor-cli/package.nix
Ethan Carter Edwards 5facb0bd9e harbor-cli: modernize
Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
2026-08-18 23:09:51 -04:00

67 lines
1.6 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
versionCheckHook,
writableTmpDirAsHomeHook,
}:
buildGoModule (finalAttrs: {
pname = "harbor-cli";
version = "0.0.26";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "goharbor";
repo = "harbor-cli";
tag = "v${finalAttrs.version}";
hash = "sha256-xaON2tgF2WvL2yffNS8VfS7AwmUo8J5uyZEWVmZlBLg=";
};
vendorHash = "sha256-HVaWa8LH2jlXPB+wDjRA0r20XiFBNUFD2gPJ5A7yPU4=";
excludedPackages = [
"dagger"
"doc"
];
nativeBuildInputs = [
installShellFiles
writableTmpDirAsHomeHook
];
ldflags = [
"-s"
"-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=${finalAttrs.version}"
];
doCheck = false; # Network required
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd harbor \
--bash <($out/bin/harbor completion bash) \
--fish <($out/bin/harbor completion fish) \
--zsh <($out/bin/harbor completion zsh)
'';
nativeInstallCheckInputs = [
versionCheckHook
writableTmpDirAsHomeHook
];
versionCheckKeepEnvironment = [ "HOME" ];
versionCheckProgramArg = "version";
doInstallCheck = true;
meta = {
homepage = "https://github.com/goharbor/harbor-cli";
description = "Command-line tool facilitates seamless interaction with the Harbor container registry";
changelog = "https://github.com/goharbor/harbor-cli/releases/tag/v${finalAttrs.version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ aaronjheng ];
mainProgram = "harbor";
};
})