Distro for Linux for WebAssembly
1{
2 run,
3 config,
4 lib,
5
6 clang,
7 lld,
8 sysroot,
9}:
10
11run
12 {
13 name = "basic-init";
14 src = ./.;
15 path = [
16 clang
17 lld
18 ];
19 }
20 ''
21 clang -c -o init.o init.c --target=wasm32-unknown-linux-musl --sysroot=${sysroot} ${lib.optionalString config.debug "-g"} -matomics -mbulk-memory
22 clang -o init init.o --target=wasm32-unknown-linux-musl --sysroot=${sysroot} -Wl,--fatal-warnings,--import-memory,--max-memory=4294967296,--shared-memory,--export-table
23
24 mkdir -p $out/bin
25 cp init $out/bin
26 ''