nixpkgs/pkgs/tools/security/tracee/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

130 lines
2.9 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
clang,
pkg-config,
zlib,
elfutils,
libbpf,
nixosTests,
testers,
tracee,
makeWrapper,
}:
buildGoModule rec {
pname = "tracee";
version = "0.20.0";
src = fetchFromGitHub {
owner = "aquasecurity";
repo = pname;
# project has branches and tags of the same name
rev = "refs/tags/v${version}";
hash = "sha256-OnOayDxisvDd802kDKGctaQc5LyoyFfdfvC+2JpRjHY=";
};
vendorHash = "sha256-26sAKTJQ7Rf5KRlu7j5XiZVr6CkAC6fm60Pam7KH0uA=";
patches = [
./use-our-libbpf.patch
# can not vendor dependencies with old pyroscope
# remove once https://github.com/aquasecurity/tracee/pull/3927
# makes it to a release
./update-pyroscope.patch
];
enableParallelBuilding = true;
# needed to build bpf libs
hardeningDisable = [ "stackprotector" ];
nativeBuildInputs = [
pkg-config
clang
];
buildInputs = [
elfutils
libbpf
zlib
];
makeFlags = [
"VERSION=v${version}"
"GO_DEBUG_FLAG=-s -w"
# don't actually need git but the Makefile checks for it
"CMD_GIT=echo"
];
buildPhase = ''
runHook preBuild
mkdir -p ./dist
make $makeFlags ''${enableParallelBuilding:+-j$NIX_BUILD_CORES} bpf all
runHook postBuild
'';
# tests require a separate go module
# integration tests are ran within a nixos vm
# see passthru.tests.integration
doCheck = false;
outputs = [
"out"
"lib"
"share"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $lib/lib/tracee $share/share/tracee
mv ./dist/{tracee,signatures} $out/bin/
mv ./dist/tracee.bpf.o $lib/lib/tracee/
mv ./cmd/tracee-rules/templates $share/share/tracee/
runHook postInstall
'';
passthru.tests = {
integration = nixosTests.tracee;
integration-test-cli = import ./integration-tests.nix { inherit lib tracee makeWrapper; };
version = testers.testVersion {
package = tracee;
version = "v${version}";
command = "tracee version";
};
};
meta = with lib; {
homepage = "https://aquasecurity.github.io/tracee/latest/";
changelog = "https://github.com/aquasecurity/tracee/releases/tag/v${version}";
description = "Linux Runtime Security and Forensics using eBPF";
mainProgram = "tracee";
longDescription = ''
Tracee is a Runtime Security and forensics tool for Linux. It is using
Linux eBPF technology to trace your system and applications at runtime,
and analyze collected events to detect suspicious behavioral patterns. It
is delivered as a Docker image that monitors the OS and detects suspicious
behavior based on a pre-defined set of behavioral patterns.
'';
license = with licenses; [
# general license
asl20
# pkg/ebpf/c/*
gpl2Plus
];
maintainers = with maintainers; [ jk ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
outputsToInstall = [
"out"
"share"
];
};
}