nixpkgs/pkgs/applications/networking/cluster/kubebuilder/default.nix
superherointj 1327c48bb7 kubebuilder: add shell completion, version test
* minor refactor to phases order
2022-09-22 09:17:11 -03:00

68 lines
1.5 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, makeWrapper
, git
, go
, gnumake
, installShellFiles
, testers
, kubebuilder
}:
buildGoModule rec {
pname = "kubebuilder";
version = "3.7.0";
src = fetchFromGitHub {
owner = "kubernetes-sigs";
repo = "kubebuilder";
rev = "v${version}";
sha256 = "sha256-nLjmz9OakBLTBWdYA6czgtJmCuP96abNwLcLZo+yZ48=";
};
vendorSha256 = "sha256-xljLDwubwr6rZ/ZpW9/WithClaMo88ivlBhWFb0iAvo=";
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 = with lib; {
description = "SDK for building Kubernetes APIs using CRDs";
homepage = "https://github.com/kubernetes-sigs/kubebuilder";
license = licenses.asl20;
maintainers = with maintainers; [ cmars ];
};
}