Files
nixpkgs/pkgs/by-name/ya/yara/package.nix
2026-07-14 20:39:33 +00:00

72 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
pkg-config,
protobufc,
withCrypto ? true,
openssl,
enableCuckoo ? true,
jansson,
enableDex ? true,
enableDotNet ? true,
enableMacho ? true,
enableMagic ? true,
file,
enableStatic ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "yara";
version = "4.5.7";
src = fetchFromGitHub {
owner = "VirusTotal";
repo = "yara";
tag = "v${finalAttrs.version}";
hash = "sha256-4PK/GU02mcgMSkFllqGZ7zmswQb8b6bkfEWLoCGHo3E=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
buildInputs = [
protobufc
]
++ lib.optionals withCrypto [ openssl ]
++ lib.optionals enableMagic [ file ]
++ lib.optionals enableCuckoo [ jansson ];
preConfigure = "./bootstrap.sh";
configureFlags = [
(lib.withFeature withCrypto "crypto")
(lib.enableFeature enableCuckoo "cuckoo")
(lib.enableFeature enableDex "dex")
(lib.enableFeature enableDotNet "dotnet")
(lib.enableFeature enableMacho "macho")
(lib.enableFeature enableMagic "magic")
(lib.enableFeature enableStatic "static")
];
doCheck = enableStatic;
# bin/yara contain forbidden references to /build/.
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" $out/bin/yara
'';
meta = {
description = "Tool to perform pattern matching for malware-related tasks";
homepage = "http://Virustotal.github.io/yara/";
changelog = "https://github.com/VirusTotal/yara/releases/tag/v${finalAttrs.version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ fab ];
mainProgram = "yara";
platforms = lib.platforms.all;
};
})