1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 rustPlatform,
7 cmake,
8 nasm,
9 libiconv,
10}:
11
12buildPythonPackage rec {
13 pname = "kornia-rs";
14 version = "0.1.2";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "kornia";
19 repo = "kornia-rs";
20 tag = "v${version}";
21 hash = "sha256-7toCMaHzFAzm6gThVLBxKLgQVgFJatdJseDlfdeS8RE=";
22 };
23
24 nativeBuildInputs = [
25 rustPlatform.maturinBuildHook
26 rustPlatform.cargoSetupHook
27 cmake # Only for dependencies.
28 nasm # Only for dependencies.
29 ];
30
31 buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
32
33 cargoRoot = "py-kornia";
34 cargoDeps = rustPlatform.fetchCargoVendor {
35 inherit
36 pname
37 version
38 src
39 cargoRoot
40 ;
41 hash = "sha256-VQtPfTmT9UGM0fIMeZF/1lUqQeyP63naoYZ7UuL6hFg=";
42 };
43
44 maturinBuildFlags = [
45 "-m"
46 "py-kornia/Cargo.toml"
47 ];
48
49 dontUseCmakeConfigure = true; # We only want to use CMake to build some Rust dependencies.
50
51 meta = with lib; {
52 homepage = "https://github.com/kornia/kornia-rs";
53 description = "Python bindings to Low-level Computer Vision library in Rust";
54 license = licenses.asl20;
55 maintainers = with maintainers; [ chpatrick ];
56 };
57}