nixpkgs/pkgs/by-name/ku/kubebuilder/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

70 lines
1.6 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, makeWrapper
, git
, go
, gnumake
, installShellFiles
, testers
, kubebuilder
}:
buildGoModule rec {
pname = "kubebuilder";
version = "4.3.0";
src = fetchFromGitHub {
owner = "kubernetes-sigs";
repo = "kubebuilder";
rev = "v${version}";
hash = "sha256-awwUYmzLKz+K6qKN+nNWRAxIM/UFDF1r1cI7heeqrlo=";
};
vendorHash = "sha256-+7vCd9mC5rkC+XKc7hsHMFgT8R6dJfT0XR6PsJM3Xdc=";
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 ];
};
}