1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 lib,
5 rustPlatform,
6}:
7
8buildPythonPackage rec {
9 pname = "ua-parser-rs";
10 version = "0.1.2";
11
12 src = fetchFromGitHub {
13 owner = "ua-parser";
14 repo = "uap-rust";
15 tag = "ua-parser-rs-${version}";
16 hash = "sha256-+qAYNGZFOkQyHhzqZZGrxgKHrPTWolO/4KKuppIMSRE=";
17 fetchSubmodules = true;
18 };
19
20 postPatch = ''
21 ln -s ${./Cargo.lock} Cargo.lock
22 '';
23
24 cargoDeps = rustPlatform.importCargoLock {
25 lockFile = ./Cargo.lock;
26 };
27
28 buildAndTestSubdir = "ua-parser-py";
29
30 nativeBuildInputs = [
31 rustPlatform.cargoSetupHook
32 rustPlatform.maturinBuildHook
33 ];
34
35 meta = {
36 description = "Native accelerator for ua-parser";
37 homepage = "https://github.com/ua-parser/uap-rust/tree/main/ua-parser-py";
38 license = lib.licenses.asl20;
39 maintainers = with lib.maintainers; [ dotlambda ];
40 mainProgram = "ua-parser-rs";
41 };
42}