nixpkgs/pkgs/applications/networking/cluster/cmctl/default.nix
joshvanl 2c2366f681 cmctl: fix version encoded inside binary
PR includes the version and git revision as ld build flags to ensure
correct version is output with the `cmctl version` command.

Adds an `update.sh` script which can be used to update the version of
cmctl. Will automatically fetch the latest semvar release of cmctl, and
update hashes accordingly in `default.nix`.

Signed-off-by: joshvanl <me@joshvanl.dev>
2022-09-06 16:59:32 +01:00

54 lines
1.9 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "cmctl";
version = "1.9.1";
src = fetchFromGitHub {
owner = "cert-manager";
repo = "cert-manager";
rev = "4486c01f726f17d2790a8a563ae6bc6e98465505";
sha256 = "1rzm6dn88nc2c8kayg1y9r7gkmbx42s0ph93ji7z56gqqpbqjmk7";
};
vendorSha256 = "sha256-45+tZZAEHaLdTN1NQCueJVTx5x2IanwDl+Y9MELqdBE=";
subPackages = [ "cmd/ctl" ];
ldflags = [
"-s" "-w"
"-X github.com/cert-manager/cert-manager/cmd/ctl/pkg/build.name=cmctl"
"-X github.com/cert-manager/cert-manager/cmd/ctl/pkg/build/commands.registerCompletion=true"
"-X github.com/cert-manager/cert-manager/pkg/util.AppVersion=v${version}"
"-X github.com/cert-manager/cert-manager/pkg/util.AppGitCommit=${src.rev}"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
mv $out/bin/ctl $out/bin/cmctl
installShellCompletion --cmd cmctl \
--bash <($out/bin/cmctl completion bash) \
--fish <($out/bin/cmctl completion fish) \
--zsh <($out/bin/cmctl completion zsh)
'';
meta = with lib; {
description = "A CLI tool for managing cert-manager service on Kubernetes clusters";
longDescription = ''
cert-manager adds certificates and certificate issuers as resource types
in Kubernetes clusters, and simplifies the process of obtaining, renewing
and using those certificates.
It can issue certificates from a variety of supported sources, including
Let's Encrypt, HashiCorp Vault, and Venafi as well as private PKI, and it
ensures certificates remain valid and up to date, attempting to renew
certificates at an appropriate time before expiry.
'';
downloadPage = "https://github.com/cert-manager/cert-manager";
license = licenses.asl20;
homepage = "https://cert-manager.io/";
maintainers = with maintainers; [ joshvanl superherointj ];
};
}