WASIX extensions for Zig ⚡. This module allows you to create programs with Wasmer & WASIX that can run on edge or be sandboxed.
Depend on this library in your project's build.zig.zon
:
.{
.name = "<your-project-name>",
.version = "0.0.0",
.dependencies = .{
.wasix = .{
.url = "https://github.com/nikneym/zig-wasix/archive/<latest-commit-hash>.tar.gz",
.hash = "<commit-hash>",
},
},
}
In your build
function at build.zig
, make sure your build step and source files are aware of zig-wasix
:
const wasix = b.dependency("wasix", .{
.target = target,
.optimize = optimize,
});
exe.addModule("wasix", wasix.module("wasix"));
Now you can build your projects by targeting WASM + WASI and run on Wasmer, as the following:
zig build -Dtarget=wasm32-wasi
wasmer run zig-out/bin/<your-project>.wasm
# You may want to have networking and other stuff be enabled
wasmer run --enable-all --net zig-out/bin/<your-project>.wasm
You can refer to wasix.org for documentation and further API reference.