1{ buildGoModule, lib, fetchFromGitHub }:
2
3buildGoModule rec {
4 pname = "controller-tools";
5 version = "0.14.0";
6
7 src = fetchFromGitHub {
8 owner = "kubernetes-sigs";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-G0jBQ12cpjfWGhXYppV9dB2n68bExi6ME9QbxXsUWvw=";
12 };
13
14 patches = [ ./version.patch ];
15
16 postPatch = ''
17 # fix wrong go line which go mod tidy complains about
18 # https://github.com/kubernetes-sigs/controller-tools/pull/881
19 substituteInPlace go.mod \
20 --replace-fail "go 1.20" "go 1.21"
21 '';
22
23 vendorHash = "sha256-8XSMg/MII+HlsFuaOC6CK/jYiBXfeRZmLT7sW/ZN3Ts=";
24
25 ldflags = [
26 "-s"
27 "-w"
28 "-X sigs.k8s.io/controller-tools/pkg/version.version=v${version}"
29 ];
30
31 doCheck = false;
32
33 subPackages = [
34 "cmd/controller-gen"
35 "cmd/type-scaffold"
36 "cmd/helpgen"
37 ];
38
39 meta = with lib; {
40 description = "Tools to use with the Kubernetes controller-runtime libraries";
41 homepage = "https://github.com/kubernetes-sigs/controller-tools";
42 changelog = "https://github.com/kubernetes-sigs/controller-tools/releases/tag/v${version}";
43 license = licenses.asl20;
44 maintainers = with maintainers; [ michojel ];
45 };
46}