2024-07-04 20:05:46 +02:00
|
|
|
{ pkgs, lib, depot, ... }:
|
2022-09-11 00:49:06 +02:00
|
|
|
let
|
2024-07-04 20:05:46 +02:00
|
|
|
pkgsCross = pkgs.pkgsCross.wasm32-unknown-none;
|
|
|
|
in
|
|
|
|
(pkgsCross.callPackage ./Cargo.nix {
|
|
|
|
defaultCrateOverrides = (depot.tvix.utils.defaultCrateOverridesForPkgs pkgsCross) // {
|
|
|
|
tvixbolt = prev: {
|
|
|
|
src = depot.tvix.utils.filterRustCrateSrc { root = prev.src.origSrc; };
|
|
|
|
};
|
2022-09-11 00:49:06 +02:00
|
|
|
};
|
2024-07-04 20:05:46 +02:00
|
|
|
}).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,css} $out
|
2022-12-06 14:31:09 +01:00
|
|
|
'';
|
2022-09-11 00:49:06 +02:00
|
|
|
|
2024-07-04 20:05:46 +02:00
|
|
|
passthru.serve = pkgs.writeShellScriptBin "tvixbolt-serve" ''
|
|
|
|
${lib.getExe pkgs.simple-http-server} \
|
|
|
|
--index \
|
|
|
|
--nocache \
|
|
|
|
"$@" \
|
|
|
|
${depot.web.tvixbolt}
|
2022-09-11 00:49:06 +02:00
|
|
|
'';
|
2024-07-04 20:05:46 +02:00
|
|
|
})
|