2021-06-06 18:31:20 +00:00
|
|
|
{ lib
|
2022-02-04 12:16:47 +00:00
|
|
|
, buildGoModule
|
2021-06-06 18:31:20 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, git
|
2022-02-04 12:16:47 +00:00
|
|
|
, go
|
2021-11-03 07:55:11 +00:00
|
|
|
, gnumake
|
2022-09-22 12:12:48 +00:00
|
|
|
, installShellFiles
|
|
|
|
, testers
|
|
|
|
, kubebuilder
|
2021-06-06 18:31:20 +00:00
|
|
|
}:
|
|
|
|
|
2022-02-04 12:16:47 +00:00
|
|
|
buildGoModule rec {
|
2021-06-06 18:31:20 +00:00
|
|
|
pname = "kubebuilder";
|
2024-10-22 23:21:28 +00:00
|
|
|
version = "4.3.0";
|
2021-06-06 18:31:20 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kubernetes-sigs";
|
|
|
|
repo = "kubebuilder";
|
|
|
|
rev = "v${version}";
|
2024-10-22 23:21:28 +00:00
|
|
|
hash = "sha256-awwUYmzLKz+K6qKN+nNWRAxIM/UFDF1r1cI7heeqrlo=";
|
2021-06-06 18:31:20 +00:00
|
|
|
};
|
2022-09-22 12:12:48 +00:00
|
|
|
|
2024-10-22 23:21:28 +00:00
|
|
|
vendorHash = "sha256-+7vCd9mC5rkC+XKc7hsHMFgT8R6dJfT0XR6PsJM3Xdc=";
|
2021-06-06 18:31:20 +00:00
|
|
|
|
2021-08-06 14:17:00 +00:00
|
|
|
subPackages = ["cmd"];
|
2021-06-06 18:31:20 +00:00
|
|
|
|
2022-09-22 12:12:48 +00:00
|
|
|
allowGoReference = true;
|
|
|
|
|
2021-08-20 07:12:13 +00:00
|
|
|
ldflags = [
|
|
|
|
"-X main.kubeBuilderVersion=v${version}"
|
2022-02-04 12:16:47 +00:00
|
|
|
"-X main.goos=${go.GOOS}"
|
|
|
|
"-X main.goarch=${go.GOARCH}"
|
2022-09-22 12:12:48 +00:00
|
|
|
"-X main.gitCommit=unknown"
|
|
|
|
"-X main.buildDate=unknown"
|
2021-08-20 07:12:13 +00:00
|
|
|
];
|
2021-06-06 18:31:20 +00:00
|
|
|
|
2022-09-22 12:12:48 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
git
|
|
|
|
installShellFiles
|
|
|
|
];
|
2021-06-06 18:31:20 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mv $out/bin/cmd $out/bin/kubebuilder
|
|
|
|
wrapProgram $out/bin/kubebuilder \
|
2022-02-04 12:16:47 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ go gnumake ]}
|
2022-09-22 12:12:48 +00:00
|
|
|
|
|
|
|
installShellCompletion --cmd kubebuilder \
|
|
|
|
--bash <($out/bin/kubebuilder completion bash) \
|
|
|
|
--fish <($out/bin/kubebuilder completion fish) \
|
|
|
|
--zsh <($out/bin/kubebuilder completion zsh)
|
2021-06-06 18:31:20 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-22 12:12:48 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
command = "${kubebuilder}/bin/kubebuilder version";
|
|
|
|
package = kubebuilder;
|
|
|
|
version = "v${version}";
|
|
|
|
};
|
2021-06-06 18:31:20 +00:00
|
|
|
|
2024-04-30 11:13:25 +00:00
|
|
|
meta = {
|
2021-06-06 18:31:20 +00:00
|
|
|
description = "SDK for building Kubernetes APIs using CRDs";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "kubebuilder";
|
2022-09-22 12:12:48 +00:00
|
|
|
homepage = "https://github.com/kubernetes-sigs/kubebuilder";
|
2022-12-10 16:22:17 +00:00
|
|
|
changelog = "https://github.com/kubernetes-sigs/kubebuilder/releases/tag/v${version}";
|
2024-04-30 11:13:25 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = with lib.maintainers; [ cmars ];
|
2021-06-06 18:31:20 +00:00
|
|
|
};
|
|
|
|
}
|