tvl-depot/users/kranzes/wasm-hello-world/default.nix
Ilan Joselevich 7f8da5e6a9 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
2024-07-01 19:25:39 +00:00

15 lines
401 B
Nix

{ 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
'';
})