From cda8b591a06b498558a713d392084ff1f2a2e6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 4 Jan 2021 10:44:04 +0100 Subject: [PATCH] pythonPackages.wasmer: init at 1.0.0-beta1 --- .../python-modules/wasmer/default.nix | 73 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 75 insertions(+) create mode 100644 pkgs/development/python-modules/wasmer/default.nix diff --git a/pkgs/development/python-modules/wasmer/default.nix b/pkgs/development/python-modules/wasmer/default.nix new file mode 100644 index 00000000000..e8307365574 --- /dev/null +++ b/pkgs/development/python-modules/wasmer/default.nix @@ -0,0 +1,73 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, maturin +, buildPythonPackage +, isPy38 +, python +}: +let + pname = "wasmer"; + version = "1.0.0-beta1"; + + wheel = rustPlatform.buildRustPackage rec { + name = "${pname}-${version}-py${python.version}"; + + src = fetchFromGitHub { + owner = "wasmerio"; + repo = "wasmer-python"; + rev = version; + sha256 = "0302lcfjlw7nz18nf86z6swhhpp1qnpwcsm2fj4avl22rsv0h78j"; + }; + + cargoSha256 = "0d83dniijjq8rc4fcwj6ja5x4hxh187afnqfd8c9fzb8nx909a0v"; + + nativeBuildInputs = [ maturin python ]; + + preBuild = '' + cd packages/api + ''; + + buildPhase = '' + runHook preBuild + maturin build --release --manylinux off --strip + runHook postBuild + ''; + + postBuild = '' + cd ../.. + ''; + + doCheck = false; + + installPhase = '' + runHook preInstall + install -Dm644 -t $out target/wheels/*.whl + runHook postInstall + ''; + }; + +in +buildPythonPackage rec { + inherit pname version; + # we can only support one python version because the cargo hash changes with the python version + disabled = !isPy38; + + format = "wheel"; + src = wheel; + + unpackPhase = '' + mkdir -p dist + cp $src/*.whl dist + ''; + + pythonImportsCheck = [ "wasmer" ]; + + meta = with lib; { + description = "Python extension to run WebAssembly binaries"; + homepage = "https://github.com/wasmerio/wasmer-python"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ SuperSandro2000 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 691da3a66f2..d3e6a0c340d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7910,6 +7910,8 @@ in { wasabi = callPackage ../development/python-modules/wasabi { }; + wasmer = callPackage ../development/python-modules/wasmer { }; + watchdog = callPackage ../development/python-modules/watchdog { }; WazeRouteCalculator = callPackage ../development/python-modules/WazeRouteCalculator { };