forked from mirrors/nixpkgs
Merge pull request #192432 from superherointj/package-kubebuilder-fix-shell-completion
kubebuilder: add shell completion, version test
This commit is contained in:
commit
241f818f0e
|
@ -5,6 +5,9 @@
|
|||
, git
|
||||
, go
|
||||
, gnumake
|
||||
, installShellFiles
|
||||
, testers
|
||||
, kubebuilder
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
|
@ -17,32 +20,47 @@ buildGoModule rec {
|
|||
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=v${version}"
|
||||
"-X main.buildDate=v${version}"
|
||||
"-X main.gitCommit=unknown"
|
||||
"-X main.buildDate=unknown"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
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)
|
||||
'';
|
||||
|
||||
allowGoReference = true;
|
||||
nativeBuildInputs = [ makeWrapper git ];
|
||||
passthru.tests.version = testers.testVersion {
|
||||
command = "${kubebuilder}/bin/kubebuilder version";
|
||||
package = kubebuilder;
|
||||
version = "v${version}";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/kubernetes-sigs/kubebuilder";
|
||||
description = "SDK for building Kubernetes APIs using CRDs";
|
||||
homepage = "https://github.com/kubernetes-sigs/kubebuilder";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ cmars ];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue