nixpkgs/pkgs/by-name/ka/karmor/package.nix
2024-06-24 13:28:49 +00:00

58 lines
1.4 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, testers
, karmor
}:
buildGoModule rec {
pname = "karmor";
version = "1.2.3";
src = fetchFromGitHub {
owner = "kubearmor";
repo = "kubearmor-client";
rev = "v${version}";
hash = "sha256-XWht+gCR+BHQwLrQqVdCpgKO+VUC6mxvOlpn9hOjrnE=";
};
vendorHash = "sha256-r3Fy4nOjlvyHcvztSfOOE6PmOhhNcVdoIq+ie5jqwkw=";
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-s"
"-w"
"-X=github.com/kubearmor/kubearmor-client/selfupdate.BuildDate=1970-01-01"
"-X=github.com/kubearmor/kubearmor-client/selfupdate.GitSummary=${version}"
];
# integration tests require network access
doCheck = false;
postInstall = ''
mv $out/bin/{kubearmor-client,karmor}
installShellCompletion --cmd karmor \
--bash <($out/bin/karmor completion bash) \
--fish <($out/bin/karmor completion fish) \
--zsh <($out/bin/karmor completion zsh)
'';
passthru.tests = {
version = testers.testVersion {
package = karmor;
command = "karmor version || true";
};
};
meta = with lib; {
description = "Client tool to help manage KubeArmor";
mainProgram = "karmor";
homepage = "https://kubearmor.io";
changelog = "https://github.com/kubearmor/kubearmor-client/releases/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ urandom kashw2 ];
};
}