at 24.11-pre 62 lines 1.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildPythonPackage, 6 rustPlatform, 7 cmake, 8 nasm, 9 substituteAll, 10 libiconv, 11}: 12 13buildPythonPackage rec { 14 pname = "kornia-rs"; 15 version = "0.1.2"; 16 pyproject = true; 17 18 src = fetchFromGitHub { 19 owner = "kornia"; 20 repo = "kornia-rs"; 21 rev = "refs/tags/v${version}"; 22 hash = "sha256-7toCMaHzFAzm6gThVLBxKLgQVgFJatdJseDlfdeS8RE="; 23 }; 24 25 nativeBuildInputs = [ 26 rustPlatform.maturinBuildHook 27 rustPlatform.cargoSetupHook 28 cmake # Only for dependencies. 29 nasm # Only for dependencies. 30 ]; 31 32 buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv; 33 34 cargoRoot = "py-kornia"; 35 cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; }; 36 37 # The path dependency doesn't vendor the dependencies correctly, so get kornia-rs from crates instead. 38 patches = [ 39 (substituteAll { 40 src = ./kornia-rs-from-crates.patch; 41 inherit version; 42 }) 43 ]; 44 45 prePatch = '' 46 cp ${./Cargo.lock} py-kornia/Cargo.lock 47 ''; 48 49 maturinBuildFlags = [ 50 "-m" 51 "py-kornia/Cargo.toml" 52 ]; 53 54 dontUseCmakeConfigure = true; # We only want to use CMake to build some Rust dependencies. 55 56 meta = with lib; { 57 homepage = "https://github.com/kornia/kornia-rs"; 58 description = "Python bindings to Low-level Computer Vision library in Rust"; 59 license = licenses.asl20; 60 maintainers = with maintainers; [ chpatrick ]; 61 }; 62}