mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-01 02:23:54 +00:00
70 lines
1.6 KiB
Nix
70 lines
1.6 KiB
Nix
{ lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, makeWrapper
|
|
, git
|
|
, go
|
|
, gnumake
|
|
, installShellFiles
|
|
, testers
|
|
, kubebuilder
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "kubebuilder";
|
|
version = "4.3.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "kubernetes-sigs";
|
|
repo = "kubebuilder";
|
|
rev = "v${version}";
|
|
hash = "sha256-IZflevmuYJJyfL6DG8JnRRzV8imVUiH/cmPDqfpYzXM=";
|
|
};
|
|
|
|
vendorHash = "sha256-uoJjJ2wP8O7mLVj3MMe/pmTes3HmgD6v5M63ZhZSj78=";
|
|
|
|
subPackages = ["cmd"];
|
|
|
|
allowGoReference = true;
|
|
|
|
ldflags = [
|
|
"-X main.kubeBuilderVersion=v${version}"
|
|
"-X main.goos=${go.GOOS}"
|
|
"-X main.goarch=${go.GOARCH}"
|
|
"-X main.gitCommit=unknown"
|
|
"-X main.buildDate=unknown"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
git
|
|
installShellFiles
|
|
];
|
|
|
|
postInstall = ''
|
|
mv $out/bin/cmd $out/bin/kubebuilder
|
|
wrapProgram $out/bin/kubebuilder \
|
|
--prefix PATH : ${lib.makeBinPath [ go gnumake ]}
|
|
|
|
installShellCompletion --cmd kubebuilder \
|
|
--bash <($out/bin/kubebuilder completion bash) \
|
|
--fish <($out/bin/kubebuilder completion fish) \
|
|
--zsh <($out/bin/kubebuilder completion zsh)
|
|
'';
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
command = "${kubebuilder}/bin/kubebuilder version";
|
|
package = kubebuilder;
|
|
version = "v${version}";
|
|
};
|
|
|
|
meta = {
|
|
description = "SDK for building Kubernetes APIs using CRDs";
|
|
mainProgram = "kubebuilder";
|
|
homepage = "https://github.com/kubernetes-sigs/kubebuilder";
|
|
changelog = "https://github.com/kubernetes-sigs/kubebuilder/releases/tag/v${version}";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ cmars ];
|
|
};
|
|
}
|