Skip to content

Commit 9395a08

Browse files
committed
Add patch to enforce offline mode in forc-node build script for dependency on fuel-core.
1 parent a8c3410 commit 9395a08

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

patches.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,21 @@ in [
154154
};
155155
}
156156

157+
{
158+
condition = m: m.pname == "forc-node";
159+
patch = m: {
160+
# `fuel-core` vendors a build script that shells out to `cargo install`
161+
# for the WASM executor. During a Nix build we have no network, so we
162+
# rewrite the script to force cargo offline mode.
163+
postPatch = (m.postPatch or "") + ''
164+
find . -path '*/fuel-core-*/crates/services/upgradable-executor/build.rs' -print0 | while IFS= read -r -d '\0' f; do
165+
perl -0pi -e 's/let mut args = vec!\[\n/let mut args = vec![\n "--offline".to_owned(),\n/' "$f"
166+
perl -0pi -e 's/cargo.env\("CARGO_PROFILE_RELEASE_DEBUG", "false"\);\n/cargo.env("CARGO_PROFILE_RELEASE_DEBUG", "false");\n cargo.env("CARGO_NET_OFFLINE", "true");\n/' "$f"
167+
done
168+
'';
169+
};
170+
}
171+
157172
# The forc plugins that reside in the Sway repo are in a dedicated
158173
# subdirectory.
159174
{

0 commit comments

Comments
 (0)