1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 kustomize,
8 testers,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "kustomize";
13 version = "5.7.1";
14
15 ldflags =
16 let
17 t = "sigs.k8s.io/kustomize/api/provenance";
18 in
19 [
20 "-s"
21 "-X ${t}.version=v${finalAttrs.version}" # add 'v' prefix to match official releases
22 "-X ${t}.gitCommit=${finalAttrs.src.rev}"
23 ];
24
25 src = fetchFromGitHub {
26 owner = "kubernetes-sigs";
27 repo = "kustomize";
28 rev = "kustomize/v${finalAttrs.version}";
29 hash = "sha256-eLj9OQlHZph/rI3om6S5/0sYxjgYloUWag2mS0hEpCE=";
30 };
31
32 # avoid finding test and development commands
33 modRoot = "kustomize";
34 proxyVendor = true;
35 vendorHash = "sha256-OodR5WXEEn4ZlVRTsH2uSmuJuP+6PYRLvTEZCenx4XU=";
36
37 nativeBuildInputs = [ installShellFiles ];
38
39 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
40 installShellCompletion --cmd kustomize \
41 --bash <($out/bin/kustomize completion bash) \
42 --fish <($out/bin/kustomize completion fish) \
43 --zsh <($out/bin/kustomize completion zsh)
44 '';
45
46 passthru.tests = {
47 versionCheck = testers.testVersion {
48 command = "${finalAttrs.meta.mainProgram} version";
49 version = "v${finalAttrs.version}";
50 package = kustomize;
51 };
52 };
53
54 meta = {
55 description = "Customization of kubernetes YAML configurations";
56 mainProgram = "kustomize";
57 longDescription = ''
58 kustomize lets you customize raw, template-free YAML files for
59 multiple purposes, leaving the original YAML untouched and usable
60 as is.
61 '';
62 homepage = "https://github.com/kubernetes-sigs/kustomize";
63 license = lib.licenses.asl20;
64 maintainers = with lib.maintainers; [
65 carlosdagos
66 vdemeester
67 periklis
68 zaninime
69 Chili-Man
70 saschagrunert
71 ];
72 };
73})