Leverage nixpkgs to build wasm packages?

I’ve got this vague idea of building packages already in nixpkgs with emscripten to produce wasm files because nixpkgs already contains lots of packages with their dependencies. Is this a crazy idea? Can wasm be perceived as an architecture just like x86 or aarch64? I wonder if nixpkgs can produce something similar to wapm
I have limited experience with both nixpkgs and emscripten. Any opinions and pointers will be much appreciated.

The manual has a section on emscripten.

For non-web usage there’s also a pkgsCross.wasi32 package set.

this is mind blowing. How come I don’t remember seeing it! Thank you