forked from WasmEdge/WasmEdge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
61 lines (58 loc) · 1.88 KB
/
flake.nix
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
{
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, rust-overlay, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rust = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
targets = [ "wasm32-wasi" "wasm32-unknown-unknown" ];
};
buildWasmEdgeNoAOT = pkgs.writeShellScriptBin "build-without-aot" ''
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug -DWASMEDGE_BUILD_AOT_RUNTIME=OFF .
cmake --build build
'';
runRustSysTest = pkgs.writeShellScriptBin "run-rust-sys-test" ''
cd bindings/rust/
export WASMEDGE_DIR="$(pwd)/../../"
export WASMEDGE_BUILD_DIR="$(pwd)/../../build"
export LD_LIBRARY_PATH="$(pwd)/../../build/lib/api"
cargo test -p wasmedge-sys --examples -- --nocapture
'';
runRustSysExample = pkgs.writeShellScriptBin "run-rust-sys-example" ''
cd bindings/rust/
export WASMEDGE_DIR="$(pwd)/../../"
export WASMEDGE_BUILD_DIR="$(pwd)/../../build"
export LD_LIBRARY_PATH="$(pwd)/../../build/lib/api"
cargo run -p wasmedge-sys --example $1
'';
in
with pkgs;
{
devShell = mkShell {
buildInputs = [
boost
clang
cmake
gcovr
llvm_10
ninja
openssl
pkg-config
rust
buildWasmEdgeNoAOT
runRustSysTest
runRustSysExample
];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
};
}
);
}