nixpkgs/pkgs/tools/security/kubeclarity/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

62 lines
1.4 KiB
Nix

{ lib
, btrfs-progs
, buildGoModule
, fetchFromGitHub
, lvm2
, pkg-config
, stdenv
}:
buildGoModule rec {
pname = "kubeclarity";
version = "2.23.3";
src = fetchFromGitHub {
owner = "openclarity";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-MC9GeJeVG7ROkpmOW2HD/fWMMnHo43q4Du9MzWTk2cg=";
};
vendorHash = "sha256-JY64fqzNBpo9Jwo8sWsWTVVAO5zzwxwXy0A2bgqJHuU=";
proxyVendor = true;
nativeBuildInputs = [
pkg-config
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
btrfs-progs
lvm2
];
sourceRoot = "${src.name}/cli";
CGO_ENABLED = "0";
ldflags = [
"-s"
"-w"
];
postInstall = ''
mv $out/bin/cli $out/bin/kubeclarity
'';
meta = with lib; {
description = "Kubernetes runtime scanner";
mainProgram = "kubeclarity";
longDescription = ''
KubeClarity is a vulnerabilities scanning and CIS Docker benchmark tool that
allows users to get an accurate and immediate risk assessment of their
kubernetes clusters. Kubei scans all images that are being used in a
Kubernetes cluster, including images of application pods and system pods.
'';
homepage = "https://github.com/openclarity/kubeclarity";
changelog = "https://github.com/openclarity/kubeclarity/releases/tag/v${version}";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ fab ];
};
}