feat(users/kranzes): add wasm-hello-world
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
This commit is contained in:
parent
4b2f3c5454
commit
7f8da5e6a9
7 changed files with 1262 additions and 0 deletions
15
users/kranzes/wasm-hello-world/default.nix
Normal file
15
users/kranzes/wasm-hello-world/default.nix
Normal file
|
|
@ -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
|
||||
'';
|
||||
})
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue