Skip to content

Commit 541717c

Browse files
committed
fix(pkgs/jolt): Make cargo command select the correct binary depending on variable
1 parent 4d0dc3c commit 541717c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/all-packages.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@
201201
inherit corepack-shims;
202202

203203
zkwasm = callPackage ./zkwasm/default.nix args-zkVM;
204-
jolt = callPackage ./jolt/default.nix args-zkVM;
205204
jolt-guest-rust = callPackage ./jolt-guest-rust/default.nix args-zkVM-rust;
205+
jolt = callPackage ./jolt/default.nix (args-zkVM // { inherit jolt-guest-rust; });
206206
zkm = callPackage ./zkm/default.nix args-zkVM;
207207
nexus = callPackage ./nexus/default.nix args-zkVM;
208208
sp1-rust = callPackage ./sp1-rust/default.nix args-zkVM-rust;

packages/jolt/default.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
installSourceAndCargo,
66
pkg-config,
77
openssl,
8+
jolt-guest-rust,
89
...
910
}:
1011
let
@@ -49,5 +50,21 @@ in
4950
sed -i '44,46d' jolt-core/src/host/toolchain.rs
5051
'';
5152

53+
# Different toolchain is used when guest has std features
54+
# https://github.com/a16z/jolt/blob/fa45507aaddb1815bafd54332e4b14173a7f8699/jolt-core/src/host/mod.rs#L132-L134
55+
postInstall = ''
56+
rm $out/bin/cargo
57+
cat <<EOF > $out/bin/cargo
58+
#!/bin/sh
59+
if [ -z "\''${RUSTUP_TOOLCHAIN+x}" ]
60+
then
61+
${jolt-guest-rust}/rust/build/host/stage2/bin/cargo \$@
62+
else
63+
${rust-toolchain}/bin/cargo \$@
64+
fi
65+
EOF
66+
chmod +x $out/bin/cargo
67+
'';
68+
5269
doCheck = false;
5370
})

0 commit comments

Comments
 (0)