tmuxPlugins.catppucin: unstable-2024-05-16 -> 2.1.2 (#379030)
[NixPkgs.git] / pkgs / by-name / cl / clusterctl / package.nix
blob199199163add5438cb34119dd9c476a8a711da73
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   installShellFiles,
6   testers,
7   clusterctl,
8 }:
10 buildGoModule rec {
11   pname = "clusterctl";
12   version = "1.9.4";
14   src = fetchFromGitHub {
15     owner = "kubernetes-sigs";
16     repo = "cluster-api";
17     rev = "v${version}";
18     hash = "sha256-XNGSO9czfF+fCMNoF6BIboQeKKvysyF6e7sC7lY+1Ds=";
19   };
21   vendorHash = "sha256-89fq5ANspfHw7aU6b3L7Kdt0Y7oVLpUYxhHmnVdLP/Q=";
23   subPackages = [ "cmd/clusterctl" ];
25   nativeBuildInputs = [ installShellFiles ];
27   ldflags =
28     let
29       t = "sigs.k8s.io/cluster-api/version";
30     in
31     [
32       "-X ${t}.gitMajor=${lib.versions.major version}"
33       "-X ${t}.gitMinor=${lib.versions.minor version}"
34       "-X ${t}.gitVersion=v${version}"
35     ];
37   postInstall = ''
38     # errors attempting to write config to read-only $HOME
39     export HOME=$TMPDIR
41     installShellCompletion --cmd clusterctl \
42       --bash <($out/bin/clusterctl completion bash) \
43       --fish <($out/bin/clusterctl completion fish) \
44       --zsh <($out/bin/clusterctl completion zsh)
45   '';
47   passthru.tests.version = testers.testVersion {
48     package = clusterctl;
49     command = "HOME=$TMPDIR clusterctl version";
50     version = "v${version}";
51   };
53   meta = {
54     changelog = "https://github.com/kubernetes-sigs/cluster-api/releases/tag/${src.rev}";
55     description = "Kubernetes cluster API tool";
56     mainProgram = "clusterctl";
57     homepage = "https://cluster-api.sigs.k8s.io/";
58     license = lib.licenses.asl20;
59     maintainers = with lib.maintainers; [ qjoly ];
60   };