lol
1{ lib
2, stdenv
3, buildGoModule
4, fetchFromGitHub
5, installShellFiles
6, nix-update-script
7}:
8
9buildGoModule rec {
10 pname = "cmctl";
11 version = "1.13.2";
12
13 src = fetchFromGitHub {
14 owner = "cert-manager";
15 repo = "cert-manager";
16 rev = "v${version}";
17 hash = "sha256-TfFdHKXbbi0yqvyQjZArY9GbkwjUq1Z00UuNAldyDuc=";
18 };
19
20 sourceRoot = "${src.name}/cmd/ctl";
21
22 vendorHash = "sha256-63XxGvVsIRDpQ0ri6VkjciyD+k7eEMBcg0w8NU8ypYs=";
23
24 ldflags = [
25 "-s"
26 "-w"
27 "-X github.com/cert-manager/cert-manager/cmd/ctl/pkg/build.name=cmctl"
28 "-X github.com/cert-manager/cert-manager/cmd/ctl/pkg/build/commands.registerCompletion=true"
29 "-X github.com/cert-manager/cert-manager/pkg/util.AppVersion=v${version}"
30 "-X github.com/cert-manager/cert-manager/pkg/util.AppGitCommit=${src.rev}"
31 ];
32
33 nativeBuildInputs = [
34 installShellFiles
35 ];
36
37 # Trusted by this computer: no: x509: “cert-manager” certificate is not trusted
38 doCheck = !stdenv.isDarwin;
39
40 postInstall = ''
41 mv $out/bin/ctl $out/bin/cmctl
42 '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
43 installShellCompletion --cmd cmctl \
44 --bash <($out/bin/cmctl completion bash) \
45 --fish <($out/bin/cmctl completion fish) \
46 --zsh <($out/bin/cmctl completion zsh)
47 '';
48
49 passthru.updateScript = nix-update-script { };
50
51 meta = with lib; {
52 description = "A CLI tool for managing cert-manager service on Kubernetes clusters";
53 longDescription = ''
54 cert-manager adds certificates and certificate issuers as resource types
55 in Kubernetes clusters, and simplifies the process of obtaining, renewing
56 and using those certificates.
57
58 It can issue certificates from a variety of supported sources, including
59 Let's Encrypt, HashiCorp Vault, and Venafi as well as private PKI, and it
60 ensures certificates remain valid and up to date, attempting to renew
61 certificates at an appropriate time before expiry.
62 '';
63 downloadPage = "https://github.com/cert-manager/cert-manager";
64 license = licenses.asl20;
65 homepage = "https://cert-manager.io/";
66 maintainers = with maintainers; [ joshvanl ];
67 };
68}