forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / ha / harbor-cli / package.nix
blobc47f50ecc2aad7306cb44079e1f55c5fbd7c3d14
2   lib,
3   stdenv,
4   buildGoModule,
5   fetchFromGitHub,
6   testers,
7   harbor-cli,
8   installShellFiles,
9 }:
11 buildGoModule rec {
12   pname = "harbor-cli";
13   version = "0.0.1";
15   src = fetchFromGitHub {
16     owner = "goharbor";
17     repo = "harbor-cli";
18     rev = "v${version}";
19     hash = "sha256-WSADuhr6p8N0Oh1xIG7yItM6t0EWUiAkzNbdKsSc4WA=";
20   };
22   vendorHash = "sha256-UUD9/5+McR1t5oO4/6TSScT7hhSKM0OpBf94LVQG1Pw=";
24   nativeBuildInputs = [ installShellFiles ];
26   ldflags = [
27     "-s"
28     "-w"
29     "-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=${version}"
30   ];
32   postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
33     installShellCompletion --cmd harbor \
34       --bash <($out/bin/harbor completion bash) \
35       --fish <($out/bin/harbor completion fish) \
36       --zsh <($out/bin/harbor completion zsh)
37   '';
39   passthru.tests.version = testers.testVersion {
40     package = harbor-cli;
41     command = "harbor version";
42   };
44   meta = {
45     homepage = "https://github.com/goharbor/harbor-cli";
46     description = "Command-line tool facilitates seamless interaction with the Harbor container registry";
47     changelog = "https://github.com/goharbor/harbor-cli/releases/tag/v${version}";
48     license = lib.licenses.asl20;
49     maintainers = with lib.maintainers; [ aaronjheng ];
50     mainProgram = "harbor";
51   };