diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..107273a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# https://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.rs] +indent_size = 4 diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bccf709..733480b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,3 +30,10 @@ jobs: - name: Build and test run: | nix flake check --all-systems --eval-cores 0 -L + + - name: Ensure no changes to generated Wasm + run: | + rm -rf ./wasm + nix build + cp -rL --no-preserve=all ./result ./wasm + git diff --exit-code diff --git a/.gitignore b/.gitignore index 83ea0d2..e3d38cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ -*.wasm -result +result* /target/ *~ /*/tests/*.out -/wasi/target/ \ No newline at end of file +/wasi/target/ diff --git a/flake.lock b/flake.lock index af14f1c..86f6d04 100644 --- a/flake.lock +++ b/flake.lock @@ -38,16 +38,16 @@ }, "flake-schemas": { "locked": { - "lastModified": 1761577921, - "narHash": "sha256-eK3/xbUOrxp9fFlei09XNjqcdiHXxndzrTXp7jFpOk8=", - "rev": "47849c7625e223d36766968cc6dc23ba0e135922", - "revCount": 107, + "lastModified": 1772200446, + "narHash": "sha256-hcUPpu25+VLvQsf961cu4zTeA//Ab35MaMjqSS/Ojqc=", + "rev": "d6a6b7cfa25bea552c197c9e227cd293ff801dbb", + "revCount": 115, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.2.0/019a4a84-544d-7c59-b26d-e334e320c932/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.3.0/019c9f61-e746-760e-a1fe-53f05b10d026/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz" + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.3.0" } }, "git-hooks-nix": { @@ -83,17 +83,16 @@ "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1772218272, - "narHash": "sha256-58OxqvVmSo7y5GuLrt1ogU8tmGvGgtijmaurHPZMSBs=", - "owner": "DeterminateSystems", - "repo": "nix-src", - "rev": "fe3515c2e42b95fb250c22549367285191fb9f5d", - "type": "github" + "lastModified": 1772664055, + "narHash": "sha256-RtKKd4aefzHEzV9sKa8bQdZIY67GJMV0nRS1QZ2E94g=", + "rev": "3a96d5668a8df84c2c8d006a04212c17839b977f", + "revCount": 24783, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix-src/3.17.0/019cbb2e-8d12-7212-a98f-73fd1f2342a2/source.tar.gz" }, "original": { - "owner": "DeterminateSystems", - "repo": "nix-src", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/nix-src/3" } }, "nixpkgs": { diff --git a/flake.nix b/flake.nix index 29586fc..69f4a59 100644 --- a/flake.nix +++ b/flake.nix @@ -3,182 +3,241 @@ inputs = { nixpkgs.follows = "nix/nixpkgs"; - flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz"; - nix.url = "github:DeterminateSystems/nix-src"; + flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/=0.3.0"; + nix.url = "https://flakehub.com/f/DeterminateSystems/nix-src/3"; }; - outputs = { self, ... }@inputs: + outputs = + { self, ... }@inputs: let cargoToml = builtins.fromTOML (builtins.readFile ./nix-wasm-rust/Cargo.toml); - supportedSystems = [ "aarch64-darwin" "x86_64-linux" ]; - forAllSystems = f: inputs.nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import inputs.nixpkgs { inherit system; }; - inherit system; - }); + supportedSystems = [ + "aarch64-darwin" + "x86_64-linux" + ]; + forAllSystems = + f: + inputs.nixpkgs.lib.genAttrs supportedSystems ( + system: + f { + pkgs = import inputs.nixpkgs { inherit system; }; + inherit system; + } + ); in { - packages = forAllSystems ({ pkgs, system }: rec { - default = nix-wasm-plugins; - - nix-wasi-plugins = with pkgs; - let - rustPackages = pkgs.rustPackages_1_89; - rustPlatform = rustPackages.rustPlatform; - rustSysroot = runCommand "rust-sysroot" { } '' - mkdir -p $out/lib/rustlib - cp -r ${rustPackages."rustc-unwrapped"}/lib/rustlib/* $out/lib/rustlib/ - mkdir -p $out/lib/rustlib/src - ln -s ${rustPlatform.rustcSrc} $out/lib/rustlib/src/rust - ''; - rustcWithSysroot = runCommand "rustc-with-sysroot" { } '' - mkdir -p $out/bin - cat > $out/bin/rustc <<'EOF' - #!/bin/sh - exec ${rustPackages.rustc}/bin/rustc --sysroot ${rustSysroot} "$@" - EOF - chmod +x $out/bin/rustc - ''; - wasiCc = pkgs.pkgsCross.wasi32.stdenv.cc; - wasiLibc = pkgs.pkgsCross.wasi32.wasilibc; - wasiLibcDev = wasiLibc.dev; - wasiSysroot = runCommand "wasi-sysroot" { } '' - mkdir -p $out/include $out/lib/wasm32-wasip1 - cp -R ${wasiLibcDev}/include/* $out/include/ - cp -R ${wasiLibc}/lib/* $out/lib/ - cp -R ${wasiLibc}/lib/* $out/lib/wasm32-wasip1/ - ''; - wasiSdk = runCommand "wasi-sdk-compat" { } '' - mkdir -p $out/bin $out/lib/clang/19 $out/share - - ln -s ${wasiCc}/bin/wasm32-unknown-wasi-clang $out/bin/clang - ln -s ${wasiCc}/bin/wasm32-unknown-wasi-clang++ $out/bin/clang++ - ln -s ${wasiCc}/bin/wasm32-unknown-wasi-ar $out/bin/ar - ln -s ${wasiCc}/bin/wasm32-unknown-wasi-ld.lld $out/bin/ld.lld - - ln -s ${wasiCc}/resource-root/include $out/lib/clang/19/include - ln -s ${wasiSysroot} $out/share/wasi-sysroot - ''; - workspaceVendor = rustPlatform.fetchCargoVendor { + lib = { + fib = builtins.wasm { + path = ./wasm/nix_wasm_plugin_fib.wasm; + function = "fib"; + }; + fibWasi = builtins.wasm { + path = ./wasm/nix_wasm_plugin_fib_wasi.wasm; + }; + grep = builtins.wasm { + path = ./wasm/nix_wasm_plugin_grep.wasm; + function = "grep"; + }; + fromINI = builtins.wasm { + path = ./wasm/nix_wasm_plugin_ini.wasm; + function = "fromINI"; + }; + mandelbrot = builtins.wasm { + path = ./wasm/nix_wasm_plugin_mandelbrot.wasm; + function = "mandelbrot"; + }; + quickJs = builtins.wasm { + path = ./wasm/nix_wasm_plugin_quickjs.wasm; + }; + fromYAML = builtins.wasm { + path = ./wasm/nix_wasm_plugin_yaml.wasm; + function = "fromYAML"; + }; + toYAML = builtins.wasm { + path = ./wasm/nix_wasm_plugin_yaml.wasm; + function = "toYAML"; + }; + }; + + packages = forAllSystems ( + { pkgs, system }: + { + default = self.packages.${system}.nix-wasm-plugins; + + nix-wasi-plugins = + with pkgs; + let + rustPackages = pkgs.rustPackages_1_89; + rustPlatform = rustPackages.rustPlatform; + rustSysroot = runCommand "rust-sysroot" { } '' + mkdir -p $out/lib/rustlib + cp -r ${rustPackages."rustc-unwrapped"}/lib/rustlib/* $out/lib/rustlib/ + mkdir -p $out/lib/rustlib/src + ln -s ${rustPlatform.rustcSrc} $out/lib/rustlib/src/rust + ''; + rustcWithSysroot = runCommand "rustc-with-sysroot" { } '' + mkdir -p $out/bin + cat > $out/bin/rustc <<'EOF' + #!/bin/sh + exec ${rustPackages.rustc}/bin/rustc --sysroot ${rustSysroot} "$@" + EOF + chmod +x $out/bin/rustc + ''; + wasiCc = pkgs.pkgsCross.wasi32.stdenv.cc; + wasiLibc = pkgs.pkgsCross.wasi32.wasilibc; + wasiLibcDev = wasiLibc.dev; + wasiSysroot = runCommand "wasi-sysroot" { } '' + mkdir -p $out/include $out/lib/wasm32-wasip1 + cp -R ${wasiLibcDev}/include/* $out/include/ + cp -R ${wasiLibc}/lib/* $out/lib/ + cp -R ${wasiLibc}/lib/* $out/lib/wasm32-wasip1/ + ''; + wasiSdk = runCommand "wasi-sdk-compat" { } '' + mkdir -p $out/bin $out/lib/clang/19 $out/share + + ln -s ${wasiCc}/bin/wasm32-unknown-wasi-clang $out/bin/clang + ln -s ${wasiCc}/bin/wasm32-unknown-wasi-clang++ $out/bin/clang++ + ln -s ${wasiCc}/bin/wasm32-unknown-wasi-ar $out/bin/ar + ln -s ${wasiCc}/bin/wasm32-unknown-wasi-ld.lld $out/bin/ld.lld + + ln -s ${wasiCc}/resource-root/include $out/lib/clang/19/include + ln -s ${wasiSysroot} $out/share/wasi-sysroot + ''; + workspaceVendor = rustPlatform.fetchCargoVendor { + src = self; + hash = "sha256-vkTdv3StxslmBOKy8mFfz5afOiMjBujFd4IU6pkgqGc="; + }; + stdlibVendor = rustPlatform.fetchCargoVendor { + src = rustPlatform.rustcSrc; + cargoRoot = "library"; + hash = "sha256-XD+1wJ7GfnJG4qyulIdZum7VV4rtIoQRM+L0xXUHjXA="; + }; + cargoVendor = runCommand "cargo-vendor-merged" { } '' + mkdir -p $out + cp -R ${workspaceVendor}/* $out/ + mkdir -p $out/.cargo + cp -R ${workspaceVendor}/.cargo/* $out/.cargo/ + chmod -R u+w $out + cp -R ${stdlibVendor}/* $out/ + cp ${workspaceVendor}/Cargo.lock $out/Cargo.lock + cp ${workspaceVendor}/.cargo/config.toml $out/.cargo/config.toml + ''; + in + rustPlatform.buildRustPackage { + pname = "nix-wasi-plugins"; + version = cargoToml.package.version; + + cargoLock.lockFile = ./Cargo.lock; + cargoDeps = cargoVendor; + + # FIXME: filter out the non-wasi plugins from the workspace. src = self; - hash = "sha256-vkTdv3StxslmBOKy8mFfz5afOiMjBujFd4IU6pkgqGc="; + + buildPhase = '' + RUSTFLAGS="-L ${wasiSdk}/share/wasi-sysroot/lib/wasm32-wasip1" \ + cargo build --release -p nix-wasm-plugin-quickjs -p nix-wasm-plugin-fib-wasi \ + --target wasm32-wasip1 -Z build-std=std,panic_abort + ''; + + installPhase = '' + mkdir -p $out + for i in target/wasm32-wasip1/release/*.wasm; do + wasm-opt -O3 --enable-bulk-memory --enable-nontrapping-float-to-int --enable-simd -o "$out/$(basename "$i")" "$i" + done + ''; + + nativeBuildInputs = [ + rustPackages.rustc.llvmPackages.lld + binaryen + llvmPackages.clang + llvmPackages.libclang + ]; + + WASI_SDK = "${wasiSdk}"; + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; + RUSTC = "${rustcWithSysroot}/bin/rustc"; + CC_wasm32_wasip1 = "${wasiSdk}/bin/clang"; + AR_wasm32_wasip1 = "${wasiSdk}/bin/ar"; + CFLAGS_wasm32_wasip1 = "--sysroot=${wasiSdk}/share/wasi-sysroot -isystem ${wasiSdk}/lib/clang/19/include"; + BINDGEN_EXTRA_CLANG_ARGS_wasm32_wasip1 = "-fvisibility=default --sysroot=${wasiSdk}/share/wasi-sysroot -isystem ${wasiSdk}/lib/clang/19/include -resource-dir ${wasiSdk}/lib/clang/19"; + CARGO_TARGET_WASM32_WASIP1_LINKER = "${wasiSdk}/bin/ld.lld"; + RUSTC_BOOTSTRAP = "1"; + doCheck = false; }; - stdlibVendor = rustPlatform.fetchCargoVendor { - src = rustPlatform.rustcSrc; - cargoRoot = "library"; - hash = "sha256-XD+1wJ7GfnJG4qyulIdZum7VV4rtIoQRM+L0xXUHjXA="; + + nix-wasm-plugins = + with pkgs; + rustPlatform.buildRustPackage { + pname = cargoToml.package.name; + version = cargoToml.package.version; + + cargoLock.lockFile = ./Cargo.lock; + + src = self; + + nix_wasi_plugins = self.packages.${system}.nix-wasi-plugins; + + CARGO_BUILD_TARGET = "wasm32-unknown-unknown"; + buildPhase = "cargo build --release --workspace --exclude nix-wasm-plugin-quickjs --exclude nix-wasm-plugin-fib-wasi"; + + checkPhase = '' + for i in nix-wasm-plugin-*/tests/*.nix; do + echo "running test $i..." + base="$(dirname $i)/$(basename $i .nix)" + nix eval --store dummy:// --offline --json --show-trace -I plugins=target/wasm32-unknown-unknown/release -I wasi=$nix_wasi_plugins --impure --eval-cores 0 --file "$i" > "$base.out" + cmp "$base.exp" "$base.out" + done + ''; + + installPhase = '' + mkdir -p $out + for i in target/wasm32-unknown-unknown/release/*.wasm; do + wasm-opt -O3 -o "$out/$(basename "$i")" "$i" + done + if [[ -n $nix_wasi_plugins ]]; then + cp $nix_wasi_plugins/*.wasm $out/ + fi + ''; + + nativeBuildInputs = [ + rustc.llvmPackages.lld + wasm-bindgen-cli + wasm-pack + binaryen + inputs.nix.packages.${system}.nix-cli + ]; + + NIX_CONFIG = "extra-experimental-features = wasm-builtin"; }; - cargoVendor = runCommand "cargo-vendor-merged" { } '' - mkdir -p $out - cp -R ${workspaceVendor}/* $out/ - mkdir -p $out/.cargo - cp -R ${workspaceVendor}/.cargo/* $out/.cargo/ - chmod -R u+w $out - cp -R ${stdlibVendor}/* $out/ - cp ${workspaceVendor}/Cargo.lock $out/Cargo.lock - cp ${workspaceVendor}/.cargo/config.toml $out/.cargo/config.toml - ''; - in rustPlatform.buildRustPackage { - pname = "nix-wasi-plugins"; - version = cargoToml.package.version; - - cargoLock.lockFile = ./Cargo.lock; - cargoDeps = cargoVendor; - - # FIXME: filter out the non-wasi plugins from the workspace. - src = self; - - buildPhase = '' - RUSTFLAGS="-L ${wasiSdk}/share/wasi-sysroot/lib/wasm32-wasip1" \ - cargo build --release -p nix-wasm-plugin-quickjs -p nix-wasm-plugin-fib-wasi \ - --target wasm32-wasip1 -Z build-std=std,panic_abort - ''; - - installPhase = '' - mkdir -p $out - for i in target/wasm32-wasip1/release/*.wasm; do - wasm-opt -O3 --enable-bulk-memory --enable-nontrapping-float-to-int --enable-simd -o "$out/$(basename "$i")" "$i" - done - ''; - - nativeBuildInputs = [ - rustPackages.rustc.llvmPackages.lld - binaryen - llvmPackages.clang - llvmPackages.libclang - ]; - - WASI_SDK = "${wasiSdk}"; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; - RUSTC = "${rustcWithSysroot}/bin/rustc"; - CC_wasm32_wasip1 = "${wasiSdk}/bin/clang"; - AR_wasm32_wasip1 = "${wasiSdk}/bin/ar"; - CFLAGS_wasm32_wasip1 = "--sysroot=${wasiSdk}/share/wasi-sysroot -isystem ${wasiSdk}/lib/clang/19/include"; - BINDGEN_EXTRA_CLANG_ARGS_wasm32_wasip1 = "-fvisibility=default --sysroot=${wasiSdk}/share/wasi-sysroot -isystem ${wasiSdk}/lib/clang/19/include -resource-dir ${wasiSdk}/lib/clang/19"; - CARGO_TARGET_WASM32_WASIP1_LINKER = "${wasiSdk}/bin/ld.lld"; - RUSTC_BOOTSTRAP = "1"; - doCheck = false; - }; - - nix-wasm-plugins = with pkgs; rustPlatform.buildRustPackage { - pname = cargoToml.package.name; - version = cargoToml.package.version; - - cargoLock.lockFile = ./Cargo.lock; - - src = self; - - nix_wasi_plugins = nix-wasi-plugins; - - CARGO_BUILD_TARGET = "wasm32-unknown-unknown"; - buildPhase = "cargo build --release --workspace --exclude nix-wasm-plugin-quickjs --exclude nix-wasm-plugin-fib-wasi"; - - checkPhase = '' - for i in nix-wasm-plugin-*/tests/*.nix; do - echo "running test $i..." - base="$(dirname $i)/$(basename $i .nix)" - nix eval --store dummy:// --offline --json --show-trace -I plugins=target/wasm32-unknown-unknown/release -I wasi=$nix_wasi_plugins --impure --eval-cores 0 --file "$i" > "$base.out" - cmp "$base.exp" "$base.out" - done - ''; - - installPhase = '' - mkdir -p $out - for i in target/wasm32-unknown-unknown/release/*.wasm; do - wasm-opt -O3 -o "$out/$(basename "$i")" "$i" - done - if [[ -n $nix_wasi_plugins ]]; then - cp $nix_wasi_plugins/*.wasm $out/ - fi - ''; - - nativeBuildInputs = [ - rustc.llvmPackages.lld - wasm-bindgen-cli - wasm-pack - binaryen - inputs.nix.packages.${system}.nix-cli - ]; - - NIX_CONFIG = "extra-experimental-features = wasm-builtin"; - }; - nix = inputs.nix.packages.${system}.nix-cli; - }); - - devShells = forAllSystems ({ pkgs, system }: rec { - default = with pkgs; self.packages.${system}.default.overrideAttrs (attrs: { - nix_wasi_plugins = null; - nativeBuildInputs = attrs.nativeBuildInputs ++ [ - wabt - rust-analyzer - rustfmt - clippy - ]; - }); - }); - - checks = forAllSystems ({ pkgs, system }: rec { - build = self.packages.${system}.default; - }); + nix = inputs.nix.packages.${system}.nix-cli; + } + ); + + devShells = forAllSystems ( + { pkgs, system }: + { + default = + with pkgs; + self.packages.${system}.default.overrideAttrs (attrs: { + nix_wasi_plugins = null; + nativeBuildInputs = attrs.nativeBuildInputs ++ [ + wabt + rust-analyzer + rustfmt + clippy + ]; + }); + } + ); + + checks = forAllSystems ( + { pkgs, system }: + { + build = self.packages.${system}.default; + } + ); + + formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style); }; } diff --git a/nix-wasm-plugin-fib/tests/fib.nix b/nix-wasm-plugin-fib/tests/fib.nix index 3292aa3..6d34b38 100644 --- a/nix-wasm-plugin-fib/tests/fib.nix +++ b/nix-wasm-plugin-fib/tests/fib.nix @@ -1 +1,4 @@ -builtins.wasm { path = ; function = "fib"; } 33 +builtins.wasm { + path = ; + function = "fib"; +} 33 diff --git a/nix-wasm-plugin-grep/tests/grep.nix b/nix-wasm-plugin-grep/tests/grep.nix index e9211cf..7f9c24e 100644 --- a/nix-wasm-plugin-grep/tests/grep.nix +++ b/nix-wasm-plugin-grep/tests/grep.nix @@ -1,4 +1,11 @@ let - grep = builtins.wasm { path = ; function = "grep"; }; + grep = builtins.wasm { + path = ; + function = "grep"; + }; in - map builtins.baseNameOf (grep { path = ../..; pattern = "hello 123"; inherit builtins; }) +map builtins.baseNameOf (grep { + path = ../..; + pattern = "hello 123"; + inherit builtins; +}) diff --git a/nix-wasm-plugin-ini/tests/test1.nix b/nix-wasm-plugin-ini/tests/test1.nix index 3508977..b1ab739 100644 --- a/nix-wasm-plugin-ini/tests/test1.nix +++ b/nix-wasm-plugin-ini/tests/test1.nix @@ -1 +1,4 @@ -builtins.wasm { path = ; function = "fromINI"; } (builtins.readFile ./test1.ini) +builtins.wasm { + path = ; + function = "fromINI"; +} (builtins.readFile ./test1.ini) diff --git a/nix-wasm-plugin-mandelbrot/tests/test1.nix b/nix-wasm-plugin-mandelbrot/tests/test1.nix index cb0e703..94491d4 100644 --- a/nix-wasm-plugin-mandelbrot/tests/test1.nix +++ b/nix-wasm-plugin-mandelbrot/tests/test1.nix @@ -1 +1,4 @@ -builtins.wasm { path = ; function = "mandelbrot"; } { width = 160; } +builtins.wasm { + path = ; + function = "mandelbrot"; +} { width = 160; } diff --git a/nix-wasm-plugin-test/tests/call.nix b/nix-wasm-plugin-test/tests/call.nix index 858b2f9..b8a8dba 100644 --- a/nix-wasm-plugin-test/tests/call.nix +++ b/nix-wasm-plugin-test/tests/call.nix @@ -1,7 +1,25 @@ -let - strictMap = builtins.wasm { path = ; function = "strictMap"; }; - range = builtins.wasm { path = ; function = "range"; }; - sum = builtins.wasm { path = ; function = "sum"; }; - double = builtins.wasm { path = ; function = "double"; }; +let + strictMap = builtins.wasm { + path = ; + function = "strictMap"; + }; + range = builtins.wasm { + path = ; + function = "range"; + }; + sum = builtins.wasm { + path = ; + function = "sum"; + }; + double = builtins.wasm { + path = ; + function = "double"; + }; in - sum (strictMap { list = range { start = 0; end = 100000; }; fun = double; }) +sum (strictMap { + list = range { + start = 0; + end = 100000; + }; + fun = double; +}) diff --git a/nix-wasm-plugin-test/tests/lazy.nix b/nix-wasm-plugin-test/tests/lazy.nix index a29a294..ee11367 100644 --- a/nix-wasm-plugin-test/tests/lazy.nix +++ b/nix-wasm-plugin-test/tests/lazy.nix @@ -1,4 +1,15 @@ let - lazyMap = builtins.wasm { path = ; function = "lazyMap"; }; + lazyMap = builtins.wasm { + path = ; + function = "lazyMap"; + }; in - builtins.elemAt (lazyMap { fun = (x: x * 2); list = [1 2 3 (throw "foo")]; }) 2 +builtins.elemAt (lazyMap { + fun = (x: x * 2); + list = [ + 1 + 2 + 3 + (throw "foo") + ]; +}) 2 diff --git a/nix-wasm-plugin-test/tests/pure.nix b/nix-wasm-plugin-test/tests/pure.nix index 3dc3673..8442925 100644 --- a/nix-wasm-plugin-test/tests/pure.nix +++ b/nix-wasm-plugin-test/tests/pure.nix @@ -1,4 +1,11 @@ let - counter = builtins.wasm { path = ; function = "counter"; }; + counter = builtins.wasm { + path = ; + function = "counter"; + }; in - [ (counter "x") (counter "y") (counter "z") ] +[ + (counter "x") + (counter "y") + (counter "z") +] diff --git a/nix-wasm-plugin-yaml/tests/fromYAML.nix b/nix-wasm-plugin-yaml/tests/fromYAML.nix index 98a55f1..d2ae963 100644 --- a/nix-wasm-plugin-yaml/tests/fromYAML.nix +++ b/nix-wasm-plugin-yaml/tests/fromYAML.nix @@ -1 +1,4 @@ -builtins.wasm { path = ; function = "fromYAML"; } (builtins.readFile ./test1.yaml) +builtins.wasm { + path = ; + function = "fromYAML"; +} (builtins.readFile ./test1.yaml) diff --git a/nix-wasm-plugin-yaml/tests/toYAML.nix b/nix-wasm-plugin-yaml/tests/toYAML.nix index 674f3d7..e00d9fe 100644 --- a/nix-wasm-plugin-yaml/tests/toYAML.nix +++ b/nix-wasm-plugin-yaml/tests/toYAML.nix @@ -1,3 +1,11 @@ -builtins.wasm { path = ; function = "toYAML"; } - (builtins.wasm { path = ; function = "fromYAML"; } - (builtins.readFile ./test1.yaml)) +builtins.wasm + { + path = ; + function = "toYAML"; + } + ( + builtins.wasm { + path = ; + function = "fromYAML"; + } (builtins.readFile ./test1.yaml) + ) diff --git a/nix-wasm-plugin-yaml/tests/toYAML2.nix b/nix-wasm-plugin-yaml/tests/toYAML2.nix index b9f8273..9a7fbcc 100644 --- a/nix-wasm-plugin-yaml/tests/toYAML2.nix +++ b/nix-wasm-plugin-yaml/tests/toYAML2.nix @@ -1 +1,13 @@ -builtins.wasm { path = ; function = "toYAML"; } [{foo = 123; bar = null; xyzzy = "bla"; a.b.c = "abc";}] +builtins.wasm + { + path = ; + function = "toYAML"; + } + [ + { + foo = 123; + bar = null; + xyzzy = "bla"; + a.b.c = "abc"; + } + ] diff --git a/wasm/nix_wasm_plugin_fib.wasm b/wasm/nix_wasm_plugin_fib.wasm new file mode 100644 index 0000000..a0f2d9e Binary files /dev/null and b/wasm/nix_wasm_plugin_fib.wasm differ diff --git a/wasm/nix_wasm_plugin_fib_wasi.wasm b/wasm/nix_wasm_plugin_fib_wasi.wasm new file mode 100644 index 0000000..881837b Binary files /dev/null and b/wasm/nix_wasm_plugin_fib_wasi.wasm differ diff --git a/wasm/nix_wasm_plugin_grep.wasm b/wasm/nix_wasm_plugin_grep.wasm new file mode 100644 index 0000000..385cb17 Binary files /dev/null and b/wasm/nix_wasm_plugin_grep.wasm differ diff --git a/wasm/nix_wasm_plugin_ini.wasm b/wasm/nix_wasm_plugin_ini.wasm new file mode 100644 index 0000000..578ea4e Binary files /dev/null and b/wasm/nix_wasm_plugin_ini.wasm differ diff --git a/wasm/nix_wasm_plugin_mandelbrot.wasm b/wasm/nix_wasm_plugin_mandelbrot.wasm new file mode 100644 index 0000000..83f90e2 Binary files /dev/null and b/wasm/nix_wasm_plugin_mandelbrot.wasm differ diff --git a/wasm/nix_wasm_plugin_quickjs.wasm b/wasm/nix_wasm_plugin_quickjs.wasm new file mode 100644 index 0000000..1fc34ec Binary files /dev/null and b/wasm/nix_wasm_plugin_quickjs.wasm differ diff --git a/wasm/nix_wasm_plugin_test.wasm b/wasm/nix_wasm_plugin_test.wasm new file mode 100644 index 0000000..7a20564 Binary files /dev/null and b/wasm/nix_wasm_plugin_test.wasm differ diff --git a/wasm/nix_wasm_plugin_yaml.wasm b/wasm/nix_wasm_plugin_yaml.wasm new file mode 100644 index 0000000..47bd5e3 Binary files /dev/null and b/wasm/nix_wasm_plugin_yaml.wasm differ