diff --git a/nix/modules/hive-matrix.nix b/nix/modules/hive-matrix.nix index 7e670aa6..fe631815 100644 --- a/nix/modules/hive-matrix.nix +++ b/nix/modules/hive-matrix.nix @@ -126,9 +126,26 @@ let # The flutter web bootstrap loads this from /matrix/native_executor.js # at startup; without it, main.dart.js logs a network-error and # the SPA renders blank (see #643 for the symptom). + # + # `dart compile js` needs `.dart_tool/package_config.json` to + # resolve `package:matrix/...` and the rest of fluffychat's + # `pubspec.lock` deps. buildFlutterApplication's pub-get step + # writes that file to the build CWD (the unpacked source dir), + # not to `$src` (the read-only nix store path). So we must use + # a relative path that walks up from `web/` to the build CWD + # where pub-get's package_config lives — pointing at + # `$src/web/native_executor.dart` walks up to `$src/`, finds + # no `.dart_tool/`, and fails with `Couldn't resolve the + # package 'matrix'` (mara's first build attempt on #685). + # + # nixpkgs's buildFlutterApplication leaves CWD at the source + # root for postInstall (see `pkgs/development/compilers/flutter/ + # build-support/build-flutter-application.nix` — installPhase + # is `cp -r build/web "$out"` with no `cd` first). So `web/...` + # resolves correctly here. ${pkgs.flutter341.dart}/bin/dart compile js \ -o $out/native_executor.js \ - $src/web/native_executor.dart + web/native_executor.dart # #685: install Imaging.{js,wasm} built from the native_imaging # dart package's C source via emscripten (see