at 23.05-pre 2.7 kB view raw
1{ stdenv 2, lib 3, rustPlatform 4, callPackage 5, fetchFromGitHub 6, buildPythonPackage 7, libiconv 8, libffi 9, libxml2 10, ncurses 11, zlib 12}: 13 14let 15 common = 16 { pname 17 , buildAndTestSubdir 18 , cargoHash 19 , extraNativeBuildInputs ? [ ] 20 , extraBuildInputs ? [ ] 21 }: buildPythonPackage rec { 22 inherit pname; 23 version = "1.1.0"; 24 format = "pyproject"; 25 26 outputs = [ "out" ] ++ lib.optional (pname == "wasmer") "testsout"; 27 28 src = fetchFromGitHub { 29 owner = "wasmerio"; 30 repo = "wasmer-python"; 31 rev = version; 32 hash = "sha256-nOeOhQ1XY+9qmLGURrI5xbgBUgWe5XRpV38f73kKX2s="; 33 }; 34 35 cargoDeps = rustPlatform.fetchCargoTarball { 36 inherit src; 37 name = "${pname}-${version}"; 38 sha256 = cargoHash; 39 }; 40 41 nativeBuildInputs = (with rustPlatform; [ cargoSetupHook maturinBuildHook ]) 42 ++ extraNativeBuildInputs; 43 44 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ] 45 ++ extraBuildInputs; 46 47 inherit buildAndTestSubdir; 48 49 postInstall = lib.optionalString (pname == "wasmer") '' 50 mkdir $testsout 51 cp -R tests $testsout/tests 52 ''; 53 54 # check in passthru.tests.pytest because all packages are required to run the tests 55 doCheck = false; 56 57 passthru.tests = lib.optionalAttrs (pname == "wasmer") { 58 pytest = callPackage ./tests.nix { }; 59 }; 60 61 pythonImportsCheck = [ "${lib.replaceStrings ["-"] ["_"] pname}" ]; 62 63 meta = with lib; { 64 broken = stdenv.isDarwin; 65 description = "Python extension to run WebAssembly binaries"; 66 homepage = "https://github.com/wasmerio/wasmer-python"; 67 license = licenses.mit; 68 platforms = platforms.unix; 69 maintainers = with maintainers; [ SuperSandro2000 ]; 70 }; 71 }; 72in 73rec { 74 wasmer = common { 75 pname = "wasmer"; 76 buildAndTestSubdir = "packages/api"; 77 cargoHash = "sha256-twoog8LjQtoli+TlDipSuB7yLFkXQJha9BqobqgZW3Y="; 78 }; 79 80 wasmer-compiler-cranelift = common { 81 pname = "wasmer-compiler-cranelift"; 82 buildAndTestSubdir = "packages/compiler-cranelift"; 83 cargoHash = "sha256-IqeMOY6emhIC7ekH8kIOZCr3JVkjxUg/lQli+ZZpdq4="; 84 }; 85 86 wasmer-compiler-llvm = common { 87 pname = "wasmer-compiler-llvm"; 88 buildAndTestSubdir = "packages/compiler-llvm"; 89 cargoHash = "sha256-xawbf5gXXV+7I2F2fDSaMvjtFvGDBtqX7wL3c28TSbA="; 90 extraNativeBuildInputs = [ rustPlatform.rust.rustc.llvm ]; 91 extraBuildInputs = [ libffi libxml2.out ncurses zlib ]; 92 }; 93 94 wasmer-compiler-singlepass = common { 95 pname = "wasmer-compiler-singlepass"; 96 buildAndTestSubdir = "packages/compiler-singlepass"; 97 cargoHash = "sha256-4nZHMCNumNhdGPOmHXlJ5POYP7K+VPjwhEUMgzGb/Rk="; 98 }; 99}