depot/third_party/nixpkgs/pkgs/by-name/ka/karmor/package.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

57 lines
1.4 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, testers
, karmor
}:
buildGoModule rec {
pname = "karmor";
version = "1.2.2";
src = fetchFromGitHub {
owner = "kubearmor";
repo = "kubearmor-client";
rev = "v${version}";
hash = "sha256-LdUu56y9jRPFOF/Tfo9GZYmOlZIUs7/byWj2yQw7BE4=";
};
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 ];
};
}