1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 gitUpdater,
5 lib,
6 pytestCheckHook,
7 pyyaml,
8 rustPlatform,
9}:
10
11buildPythonPackage rec {
12 pname = "ua-parser-rs";
13 version = "0.1.3";
14 format = "setuptools";
15
16 src = fetchFromGitHub {
17 owner = "ua-parser";
18 repo = "uap-rust";
19 tag = "ua-parser-rs-${version}";
20 hash = "sha256-Tro3aPjqDN/9c3wBUDDafDpdYXhHEAHeP8NwoU9a4u0=";
21 fetchSubmodules = true;
22 };
23
24 cargoDeps = rustPlatform.fetchCargoVendor {
25 inherit pname version src;
26 hash = "sha256-NZpMW8cFXXpkSP8jMcXMiDyfyIuhR5C0TUzBsJVkOEE=";
27 };
28
29 buildAndTestSubdir = "ua-parser-py";
30
31 nativeBuildInputs = [
32 rustPlatform.cargoSetupHook
33 rustPlatform.maturinBuildHook
34 ];
35
36 nativeCheckInputs = [
37 pytestCheckHook
38 pyyaml
39 ];
40
41 passthru.updateScript = gitUpdater { rev-prefix = "ua-parser-rs-"; };
42
43 meta = {
44 description = "Native accelerator for ua-parser";
45 homepage = "https://github.com/ua-parser/uap-rust/tree/main/ua-parser-py";
46 license = lib.licenses.asl20;
47 maintainers = with lib.maintainers; [ dotlambda ];
48 };
49}