refactor(web/tvixbolt): buildRustPackage -> crate2nix

With the recent changes to crate2nix and buildRustCrate in nixpkgs it is
now possible to build tvixbolt via crate2nix like we do for other tvix
crates. We can reuse a lot of the customizations done in //tvix in
tvixbolt to avoid repeating ourselves.

A script for serving tvixbolt locally for testing purposes is also
available now through the .serve attribute of tvixbolt.

This change supersedes https://cl.tvl.fyi/c/depot/+/11821.

Change-Id: I4864df8b75aec73cf5fee2428924ed4cfbb32902
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11952
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Ilan Joselevich 2024-07-04 21:05:46 +03:00
parent 6a7069904e
commit 7ca32d9f0b
9 changed files with 4595 additions and 122 deletions

View file

@ -25,18 +25,6 @@ sure noone is working on this, or has some specific design in mind already.
with a different level of `--strict`, but the toplevel doc-comment suggests
its generic?
### crate2nix for WASM (@kranzes)
Most of Tvix is living inside a `//tvix` cargo workspace, and we use `crate2nix`
as a build system, to get crate-level build granularity (and caching), keeping
compile times somewhat manageable.
Thanks to the recent crate2nix fixes, we can now use it to build WASM.
We should migrate `//web/tvixbolt` from `rustPlatform.buildRustPackage` to
`crate2nix`.
An initial cl/11821 to move it to the `//tvix` workspace got some pushback, we
should see if it's possible to keep it in a separate directory and still refer
to the (cleaned) sources described in `tvix/default.nix`.
## Perf
- String Contexts currently do a lot of indirections (edef)
(NixString -> NixStringInner -> HashSet[element] -> NixContextElement -> String -> data)