nixpkgs/pkgs/by-name/ku/kubesec/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

56 lines
1.4 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:
buildGoModule rec {
pname = "kubesec";
version = "2.14.1";
src = fetchFromGitHub {
owner = "controlplaneio";
repo = pname;
rev = "v${version}";
sha256 = "sha256-FYYMCouZuG0EqvganPLSrLgaDZ+JowUcYXTnKMJ+6Us=";
};
vendorHash = "sha256-KTmsCbFRHMd1KnBYxwWWuETaTP0G3NYCK/ttgrFy59I=";
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-s"
"-w"
"-X github.com/controlplaneio/kubesec/v${lib.versions.major version}/cmd.version=v${version}"
];
# Tests wants to download the kubernetes schema for use with kubeval
doCheck = false;
postInstall = ''
installShellCompletion --cmd kubesec \
--bash <($out/bin/kubesec completion bash) \
--fish <($out/bin/kubesec completion fish) \
--zsh <($out/bin/kubesec completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/kubesec --help
$out/bin/kubesec version | grep "${version}"
runHook postInstallCheck
'';
meta = with lib; {
description = "Security risk analysis tool for Kubernetes resources";
mainProgram = "kubesec";
homepage = "https://github.com/controlplaneio/kubesec";
changelog = "https://github.com/controlplaneio/kubesec/blob/v${version}/CHANGELOG.md";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ fab jk ];
};
}