nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, rustPlatform
4, fetchFromGitHub
5, llvmPackages
6, libffi
7, libxml2
8, CoreFoundation
9, SystemConfiguration
10, Security
11, withLLVM ? !stdenv.isDarwin
12, withSinglepass ? !(stdenv.isDarwin && stdenv.isx86_64)
13}:
14
15rustPlatform.buildRustPackage rec {
16 pname = "wasmer";
17 version = "4.3.5";
18
19 src = fetchFromGitHub {
20 owner = "wasmerio";
21 repo = pname;
22 rev = "refs/tags/v${version}";
23 hash = "sha256-hEhU3o/SLHWV9zmgCtW+7K/2ev+oGAnrZmlyNtoeSV4=";
24 };
25
26 cargoHash = "sha256-xyR5pnwMGE5K4o7X0Q2JEervSgR5LK1vqpOa3Mm6xkU=";
27
28 nativeBuildInputs = [
29 rustPlatform.bindgenHook
30 ];
31
32 buildInputs = lib.optionals withLLVM [
33 llvmPackages.llvm
34 libffi
35 libxml2
36 ] ++ lib.optionals stdenv.isDarwin [
37 CoreFoundation
38 SystemConfiguration
39 Security
40 ];
41
42 # check references to `compiler_features` in Makefile on update
43 buildFeatures = [
44 "cranelift"
45 "wasmer-artifact-create"
46 "static-artifact-create"
47 "wasmer-artifact-load"
48 "static-artifact-load"
49 ]
50 ++ lib.optional withLLVM "llvm"
51 ++ lib.optional withSinglepass "singlepass";
52
53 cargoBuildFlags = [ "--manifest-path" "lib/cli/Cargo.toml" "--bin" "wasmer" ];
54
55 env.LLVM_SYS_150_PREFIX = lib.optionalString withLLVM llvmPackages.llvm.dev;
56
57 # Tests are failing due to `Cannot allocate memory` and other reasons
58 doCheck = false;
59
60 meta = with lib; {
61 description = "Universal WebAssembly Runtime";
62 mainProgram = "wasmer";
63 longDescription = ''
64 Wasmer is a standalone WebAssembly runtime for running WebAssembly outside
65 of the browser, supporting WASI and Emscripten. Wasmer can be used
66 standalone (via the CLI) and embedded in different languages, running in
67 x86 and ARM devices.
68 '';
69 homepage = "https://wasmer.io/";
70 license = licenses.mit;
71 maintainers = with maintainers; [ Br1ght0ne shamilton nickcao ];
72 };
73}