Skip to content

Commit

Permalink
rerun: support web_viewer feature
Browse files Browse the repository at this point in the history
When web_viewer is compiled, the wasm webviewer first needs to be built
If this doesn't exist, the build will fail. More information: rerun-io/rerun#6028
The command is taken from https://github.com/rerun-io/rerun/blob/dd025f1384f9944d785d0fb75ca4ca1cd1792f17/pixi.toml#L198C72-L198C187
Note that cargoBuildFeatures reference what buildFeatures is set to in stdenv.mkDerivation,
so that user can easily create an overlay to set cargoBuildFeatures to what he needs
  • Loading branch information
OlivierLDff committed Jan 13, 2025
1 parent fa39fa6 commit 6fdc1da
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkgs/by-name/re/rerun/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,25 @@ rustPlatform.buildRustPackage rec {
cargoBuildFlags = [ "--package rerun-cli" ];
cargoTestFlags = [ "--package rerun-cli" ];
buildNoDefaultFeatures = true;
buildFeatures = [ "native_viewer" ];
buildFeatures = [ "native_viewer" "web_viewer" ];

# When web_viewer is compiled, the wasm webviewer first needs to be built
# If this doesn't exist, the build will fail. More information: https://github.com/rerun-io/rerun/issues/6028
# The command is taken from https://github.com/rerun-io/rerun/blob/dd025f1384f9944d785d0fb75ca4ca1cd1792f17/pixi.toml#L198C72-L198C187
# Note that cargoBuildFeatures reference what buildFeatures is set to in stdenv.mkDerivation,
# so that user can easily create an overlay to set cargoBuildFeatures to what he needs
configurePhase = ''
runHook preConfigure
if [[ " $cargoBuildFeatures " == *" web_viewer "* ]]; then
echo "Building with web_viewer feature..."
cargo run -p re_dev_tools -- build-web-viewer --no-default-features --features analytics,grpc,map_view --release -g
else
echo "web_viewer feature not enabled, skipping web viewer build."
fi
runHook postConfigure
'';

nativeBuildInputs = [
(lib.getBin binaryen) # wasm-opt
Expand Down

0 comments on commit 6fdc1da

Please sign in to comment.