43cf713417
Change-Id: Ib9881efd6a78ba28e283759e0ed5125fb175b89e Reviewed-on: https://cl.tvl.fyi/c/depot/+/12221 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
32 lines
931 B
Nix
32 lines
931 B
Nix
{ pkgs, lib, depot, ... }:
|
|
let
|
|
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; };
|
|
};
|
|
};
|
|
}).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
|
|
'';
|
|
|
|
passthru.serve = pkgs.writeShellScriptBin "tvixbolt-serve" ''
|
|
${lib.getExe pkgs.simple-http-server} \
|
|
--index \
|
|
--nocache \
|
|
"$@" \
|
|
${depot.web.tvixbolt}
|
|
'';
|
|
|
|
meta.ci.extraSteps.crate2nix-check = depot.tvix.utils.mkCrate2nixCheck ./Cargo.nix;
|
|
})
|