1{
2 lib,
3 buildPythonPackage,
4 cmake,
5 fetchFromGitHub,
6 pytestCheckHook,
7 libxcrypt,
8 pythonOlder,
9 gtest,
10 pybind11,
11 nlohmann_json,
12}:
13
14let
15 pog = fetchFromGitHub {
16 owner = "metthal";
17 repo = "pog";
18 rev = "b09bbf9cea573ee62aab7eccda896e37961d16cd";
19 hash = "sha256-El4WA92t2O/L4wUqH6Xj8w+ANtb6liRwafDhqn8jxjQ=";
20 };
21in
22buildPythonPackage rec {
23 pname = "yaramod";
24 version = "3.23.0";
25 format = "setuptools";
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "avast";
31 repo = pname;
32 rev = "refs/tags/v${version}";
33 hash = "sha256-TB0dnWA+5beyHAoYUjqocmw5uGFgo/h9eKDbuKbmfsw=";
34 };
35
36 postPatch = ''
37 rm -r deps/googletest deps/pog/ deps/pybind11/ deps/json/json.hpp
38 cp -r --no-preserve=all ${pog} deps/pog/
39 cp -r --no-preserve=all ${nlohmann_json.src}/single_include/nlohmann/json.hpp deps/json/
40 cp -r --no-preserve=all ${pybind11.src} deps/pybind11/
41 cp -r --no-preserve=all ${gtest.src} deps/googletest/
42 '';
43
44 dontUseCmakeConfigure = true;
45
46 buildInputs = [ libxcrypt ];
47
48 nativeBuildInputs = [
49 cmake
50 pog
51 gtest
52 ];
53
54 setupPyBuildFlags = [ "--with-unit-tests" ];
55
56 checkInputs = [ pytestCheckHook ];
57
58 pytestFlagsArray = [ "tests/" ];
59
60 pythonImportsCheck = [ "yaramod" ];
61
62 meta = with lib; {
63 description = "Parsing of YARA rules into AST and building new rulesets in C++";
64 homepage = "https://github.com/avast/yaramod";
65 changelog = "https://github.com/avast/yaramod/blob/v${version}/CHANGELOG.md";
66 license = licenses.mit;
67 maintainers = with maintainers; [ msm ];
68 };
69}