about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/wasmer/default.nix
blob: 62c8a2a06b71a3649580486693eea0ce1eae6908 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ lib
, rustPlatform
, fetchFromGitHub
, maturin
, buildPythonPackage
, isPy38
, python
}:
let
  pname = "wasmer";
  version = "1.0.0";

  wheel = rustPlatform.buildRustPackage rec {
    inherit pname version;

    src = fetchFromGitHub {
      owner = "wasmerio";
      repo = "wasmer-python";
      rev = version;
      hash = "sha256-I1GfjLaPYMIHKh2m/5IQepUsJNiVUEJg49wyuuzUYtY=";
    };

    cargoHash = "sha256-txOOia1C4W+nsXuXp4EytEn82CFfSmiOYwRLC4WPImc=";

    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;

  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 ];
  };
}