Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 = "3.1.1";
18
19 src = fetchFromGitHub {
20 owner = "wasmerio";
21 repo = pname;
22 rev = "refs/tags/v${version}";
23 hash = "sha256-797I3FBBfnAgNfOdMajm3WNkMo3MUXb1347LBggXrLk=";
24 };
25
26 cargoHash = "sha256-zUTwhfRLKUixgj3JXiz2QOuwbFhfget+GcFSRL1QJ3w=";
27
28 nativeBuildInputs = [ rustPlatform.bindgenHook ];
29
30 buildInputs = lib.optionals withLLVM [
31 llvmPackages.llvm
32 libffi
33 libxml2
34 ] ++ lib.optionals stdenv.isDarwin [
35 CoreFoundation
36 SystemConfiguration
37 Security
38 ];
39
40 LLVM_SYS_120_PREFIX = lib.optionalString withLLVM llvmPackages.llvm.dev;
41
42 # check references to `compiler_features` in Makefile on update
43 buildFeatures = checkFeatures ++ [
44 "webc_runner"
45 ];
46
47 checkFeatures = [
48 "cranelift"
49 "wasmer-artifact-create"
50 "static-artifact-create"
51 "wasmer-artifact-load"
52 "static-artifact-load"
53 ]
54 ++ lib.optional withLLVM "llvm"
55 ++ lib.optional withSinglepass "singlepass";
56
57 cargoBuildFlags = [ "--manifest-path" "lib/cli/Cargo.toml" "--bin" "wasmer" ];
58
59 meta = with lib; {
60 description = "The Universal WebAssembly Runtime";
61 longDescription = ''
62 Wasmer is a standalone WebAssembly runtime for running WebAssembly outside
63 of the browser, supporting WASI and Emscripten. Wasmer can be used
64 standalone (via the CLI) and embedded in different languages, running in
65 x86 and ARM devices.
66 '';
67 homepage = "https://wasmer.io/";
68 license = licenses.mit;
69 maintainers = with maintainers; [ Br1ght0ne shamilton ];
70 };
71}