1{ lib, stdenv
2, fetchFromGitHub
3, autoreconfHook
4, pcre
5, pkg-config
6, protobufc
7, withCrypto ? true, openssl
8, enableCuckoo ? true, jansson
9, enableDex ? true
10, enableDotNet ? true
11, enableMacho ? true
12, enableMagic ? true, file
13, enableStatic ? false
14}:
15
16stdenv.mkDerivation rec {
17 pname = "yara";
18 version = "4.3.1";
19
20 src = fetchFromGitHub {
21 owner = "VirusTotal";
22 repo = pname;
23 rev = "v${version}";
24 hash = "sha256-Q+Q52W/MhurG3x0CIr0nv31qc4bdaLDk9AGGpMxKOcI=";
25 };
26
27 nativeBuildInputs = [
28 autoreconfHook
29 pkg-config
30 ];
31
32 buildInputs = [
33 pcre
34 protobufc
35 ] ++ lib.optionals withCrypto [
36 openssl
37 ] ++ lib.optionals enableMagic [
38 file
39 ] ++ lib.optionals enableCuckoo [
40 jansson
41 ];
42
43 preConfigure = "./bootstrap.sh";
44
45 configureFlags = [
46 (lib.withFeature withCrypto "crypto")
47 (lib.enableFeature enableCuckoo "cuckoo")
48 (lib.enableFeature enableDex "dex")
49 (lib.enableFeature enableDotNet "dotnet")
50 (lib.enableFeature enableMacho "macho")
51 (lib.enableFeature enableMagic "magic")
52 (lib.enableFeature enableStatic "static")
53 ];
54
55 doCheck = enableStatic;
56
57 meta = with lib; {
58 description = "The pattern matching swiss knife for malware researchers";
59 homepage = "http://Virustotal.github.io/yara/";
60 license = licenses.asl20;
61 maintainers = with maintainers; [ fab ];
62 platforms = platforms.all;
63 };
64}