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