1{
2 lib,
3 buildPythonPackage,
4 rustPlatform,
5 fetchFromGitHub,
6 pytestCheckHook,
7 pkgs,
8}:
9
10buildPythonPackage rec {
11 pname = "yara-x";
12 version = "1.8.1";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "VirusTotal";
17 repo = "yara-x";
18 tag = "v${version}";
19 hash = "sha256-dl2uxMo81K2ZEAfZk2OP0FXTY4lKGmzqZe0QQo/YIsA=";
20 };
21
22 buildAndTestSubdir = "py";
23
24 cargoDeps = rustPlatform.fetchCargoVendor {
25 inherit pname src version;
26 hash = "sha256-+Bva1uch6fd6gl2MH2ss3S6Ea1QkvgVePhdUVUDuIE8=";
27 };
28
29 nativeBuildInputs = [
30 rustPlatform.cargoSetupHook
31 rustPlatform.maturinBuildHook
32 ];
33
34 buildInputs = [ pkgs.yara-x ];
35
36 pythonImportsCheck = [ "yara_x" ];
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 meta = {
41 description = "Official Python library for YARA-X";
42 homepage = "https://github.com/VirusTotal/yara-x/tree/main/py";
43 changelog = "https://github.com/VirusTotal/yara-x/tree/${src.tag}/py";
44 license = lib.licenses.bsd3;
45 maintainers = with lib.maintainers; [ ivyfanchiang ];
46 };
47}