Skip to content

Commit

Permalink
update nix revision
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-4 committed Dec 26, 2023
1 parent 613c6c4 commit 4dbda48
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
21 changes: 17 additions & 4 deletions crates/repl_wasm/build-www.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# We use this two-step process because Netlify times out if we try to build the Web REPL there.

# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -euxo pipefail
set -exo pipefail

if ! which wasm-pack
then
Expand All @@ -23,9 +23,22 @@ cd $SCRIPT_RELATIVE_DIR
mkdir -p build
rm -rf build/*

# We want a release build, but with debug info (to get stack traces for Wasm backend panics)
# This configuration is called `--profiling`
wasm-pack build --profiling --target web -- --features console_error_panic_hook
# c++abi is not needed for wasm-pack and causes an error, see #6303 for more info
REMOVE_STR="-C link-arg=-lc++abi"

( # start subshell to limit scope of export RUSTFLAGS
# Check if RUSTFLAGS contains the string to be removed
if [[ $RUSTFLAGS == *"$REMOVE_STR"* ]]; then
# Remove the string
RUSTFLAGS=$(echo "$RUSTFLAGS" | sed "s/$REMOVE_STR//g")

export RUSTFLAGS
fi

# We want a release build, but with debug info (to get stack traces for Wasm backend panics)
# This configuration is called `--profiling`
wasm-pack build --profiling --target web -- --features console_error_panic_hook
)
cp -v pkg/roc_repl_wasm.js build

# To disable optimizations while debugging, do `export REPL_DEBUG=1` before running the script
Expand Down
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Roc flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?rev=676fe5e01b9a41fa14aaa48d87685677664104b1";
nixpkgs.url = "github:nixos/nixpkgs?rev=886c9aee6ca9324e127f9c2c4e6f68c2641c8256";

# rust from nixpkgs has some libc problems, this is patched in the rust-overlay
rust-overlay = {
Expand Down Expand Up @@ -134,7 +134,9 @@
shellHook = ''
export LLVM_SYS_${llvmMajorMinorStr}_PREFIX="${llvmPkgs.llvm.dev}"
${aliases}
'';
'' + pkgs.lib.optionalString (system == "aarch64-darwin") ''
export RUSTFLAGS="-C link-arg=-lc++abi"
''; # lc++abi as workaround for github.com/NixOS/nixpkgs/issues/166205, see also github.com/roc-lang/roc/issues/6303
};

formatter = pkgs.nixpkgs-fmt;
Expand Down

0 comments on commit 4dbda48

Please sign in to comment.