Unverified Commit 4911c532 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

fluffychat-web: remove reference to rust sysroot (#472031)

parents d089eacc 69965e66
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
@@ -15,13 +15,13 @@
  binaryen,
  writableTmpDirAsHomeHook,
  runCommand,
  removeReferencesTo,
}:

let
  pubSources = fluffychat-web.pubspecLock.dependencySources;

  # wasm-pack doesn't take 'RUST_SRC_PATH' into consideration
  rustcWithLibSrc = buildPackages.rustc.override {
  sysroot = symlinkJoin {
    name = "rustc_unwrapped_with_libsrc";
    paths = [
@@ -32,7 +32,7 @@ let
      ln -s ${rustPlatform.rustLibSrc} $out/lib/rustlib/src/rust/library
    '';
  };
  };
  rustcWithLibSrc = buildPackages.rustc.override { inherit sysroot; };
in

# https://github.com/krille-chan/fluffychat/blob/main/scripts/prepare-web.sh
@@ -80,6 +80,7 @@ stdenv.mkDerivation {
    wasm-bindgen-cli_0_2_100
    binaryen
    writableTmpDirAsHomeHook
    removeReferencesTo
  ];

  buildPhase = ''
@@ -103,6 +104,12 @@ stdenv.mkDerivation {
    runHook postInstall
  '';

  # fix rustc leaking into closure
  # fluffychat-web should not reference build-time dependencies
  preFixup = ''
    find $out -name "*.wasm" -exec remove-references-to -t ${sysroot} {} +
  '';

  env = {
    # Build a pub cache from fluffychat, as dart-vodozemac should be a subset
    # This is required because dart-vodozemac, as a pub, doesn't have a pubspec.lock