2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
cmake,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pytestCheckHook,
|
|
|
|
libxcrypt,
|
|
|
|
pythonOlder,
|
|
|
|
gtest,
|
|
|
|
pybind11,
|
|
|
|
nlohmann_json,
|
2023-02-22 10:55:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pog = fetchFromGitHub {
|
|
|
|
owner = "metthal";
|
|
|
|
repo = "pog";
|
|
|
|
rev = "b09bbf9cea573ee62aab7eccda896e37961d16cd";
|
|
|
|
hash = "sha256-El4WA92t2O/L4wUqH6Xj8w+ANtb6liRwafDhqn8jxjQ=";
|
|
|
|
};
|
|
|
|
in
|
2024-06-05 15:53:02 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "yaramod";
|
|
|
|
version = "3.21.0";
|
|
|
|
format = "setuptools";
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "avast";
|
|
|
|
repo = pname;
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-YkMDoFwWPrDhAgDnPpNCU1NlnAPhwYQF/KFaRFn+juQ=";
|
|
|
|
};
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
postPatch = ''
|
|
|
|
rm -r deps/googletest deps/pog/ deps/pybind11/ deps/json/json.hpp
|
|
|
|
cp -r --no-preserve=all ${pog} deps/pog/
|
|
|
|
cp -r --no-preserve=all ${nlohmann_json.src}/single_include/nlohmann/json.hpp deps/json/
|
|
|
|
cp -r --no-preserve=all ${pybind11.src} deps/pybind11/
|
|
|
|
cp -r --no-preserve=all ${gtest.src} deps/googletest/
|
|
|
|
'';
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
dontUseCmakeConfigure = true;
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ libxcrypt ];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pog
|
|
|
|
gtest
|
|
|
|
];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
setupPyBuildFlags = [ "--with-unit-tests" ];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestFlagsArray = [ "tests/" ];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "yaramod" ];
|
2023-02-22 10:55:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Parsing of YARA rules into AST and building new rulesets in C++";
|
|
|
|
homepage = "https://github.com/avast/yaramod";
|
|
|
|
changelog = "https://github.com/avast/yaramod/blob/v${version}/CHANGELOG.md";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ msm ];
|
|
|
|
};
|
|
|
|
}
|