diff options
author | Ilan Joselevich <personal@ilanjoselevich.com> | 2024-06-18T18·03+0300 |
---|---|---|
committer | Ilan Joselevich <personal@ilanjoselevich.com> | 2024-07-01T19·25+0000 |
commit | 7f8da5e6a9926170be2fefc1db847166e5631f16 (patch) | |
tree | d1d1593d89eecf8fba80e59d9cedefd559be6a5c /users/kranzes/wasm-hello-world/default.nix | |
parent | 4b2f3c5454a249c6fbd7697a5297c6d4db92ef3e (diff) |
feat(users/kranzes): add wasm-hello-world r/8338
This can be used as a reference for how to build a wasm project with crate2nix. Change-Id: Ib4d0db6bf24d8f1dec4734d5f1e8de19212a54cd Reviewed-on: https://cl.tvl.fyi/c/depot/+/11859 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'users/kranzes/wasm-hello-world/default.nix')
-rw-r--r-- | users/kranzes/wasm-hello-world/default.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/users/kranzes/wasm-hello-world/default.nix b/users/kranzes/wasm-hello-world/default.nix new file mode 100644 index 000000000000..0970f955deff --- /dev/null +++ b/users/kranzes/wasm-hello-world/default.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, ... }: + +(pkgs.pkgsCross.wasm32-unknown-none.callPackage ./Cargo.nix { }).rootCrate.build.overrideAttrs (oldAttrs: { + installPhase = '' + ${lib.getExe pkgs.wasm-bindgen-cli} \ + --target web \ + --out-dir $out \ + --out-name ${oldAttrs.crateName} \ + --no-typescript \ + target/lib/${oldAttrs.crateName}-${oldAttrs.metadata}.wasm + + mv src/*.html $out + ''; +}) + |