Skip to content

Commit

Permalink
Fix build with nix on macos (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
sveitser authored Nov 7, 2024
1 parent 79b53b8 commit d908e3d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 59 deletions.
64 changes: 15 additions & 49 deletions flake.lock

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

19 changes: 9 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@

outputs = { flake-utils, nixpkgs, foundry, rust-overlay, ... }:
let
goVersion = 21; # Change this to update the whole stack
goVersion = 22; # Change this to update the whole stack
overlays = [
(import rust-overlay)
(final: prev: {
(final: prev: rec {
go = prev."go_1_${toString goVersion}";
# Overlaying nodejs here to ensure nodePackages use the desired
# version of nodejs. Arbitrum use nodejs v16 but that's EOL and has
# been removed from nixpkgs, v18 also works.
nodejs = prev.nodejs-18_x;
pnpm = prev.nodePackages.pnpm;
yarn = prev.nodePackages.yarn;
# version of nodejs. Offchainlabs suggests nodejs v18 in the docs.
nodejs = prev.nodejs_18;
yarn = (prev.yarn.override { inherit nodejs; });
pnpm = (prev.pnpm.override { inherit nodejs; });
})
foundry.overlay
];
Expand Down Expand Up @@ -76,9 +75,7 @@
# shell is not able to build one recipe and we haven't managed to
# come up with a dev shell that works for everything on OSX.
#
# nix develop .#wasm -c make build-wasm-libs
#
# After that, the other shell can be used to run `make build`.
# See ./scripts/build-wasm-on-macos-with-nix for how to use it.
#
# With nix the `clang` command is a wrapper that does not understand
# some of the arguments that are passed to it during the build. This
Expand All @@ -93,6 +90,8 @@

llvmPackages_16.clang-unwrapped # provides clang without wrapper
llvmPackages_16.bintools # provides wasm-ld
cmake
wabt # wasm2wat, wat2wasm, etc.

# Docker
docker-compose # provides the `docker-compose` command
Expand Down
11 changes: 11 additions & 0 deletions scripts/build-wasm-on-macos-with-nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail

# Use the default shell to build the brotli library
nix develop -c make .make/cbrotli-lib

# Use the special shell to build the wasm libraries
nix develop .#wasm -c make build-wasm-libs

echo "wasm libs built successfully!"
echo "Use the default shell e. g. 'nix develop' to run other make recipies."

0 comments on commit d908e3d

Please sign in to comment.