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