File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change 11{
2+ lib ,
23 risc0-rust ,
34 rustFromToolchainFile ,
45 craneLib ,
5657crane . buildPackage (
5758 commonArgs
5859 // ( installSourceAndCargo rust-toolchain )
59- // rec {
60+ // {
6061 inherit cargoArtifacts ;
6162
62- postPatch = ''
63- # Replace usages of `Command::new("rustup")` with the correct value
64- # which should be used
65- sed -i '27d;28iPathBuf::from(r"${ risc0-rust } ")' rzup/src/paths.rs
63+ # NOTE: leave ability to change comments without modifying the bash code, avoiding unneeded rebuilds
64+ postPatch = lib . concatStringsSep "\n " [
65+ # Replace references to the normal installations of `rustup` and `risc0`
66+ # As per <https://github.com/risc0/risc0/blob/14b5d588dd01cf4f7ba804d8bb0a61264e6ae2c6/rzup/src/env.rs#L213>,
67+ # used in places like <https://github.com/risc0/risc0/blob/14b5d588dd01cf4f7ba804d8bb0a61264e6ae2c6/rzup/src/components.rs#L139>
68+ /* bash */
69+ ''
70+ RISC0_PATHBUF='PathBuf::from(r#"'"${ risc0-rust } "'"#)'
71+ sed -i \
72+ -e '215s|home_dir.join(".risc0")|'"$RISC0_PATHBUF"'|' \
73+ -e '219s|home_dir.join(".rustup")|'"$RISC0_PATHBUF"'|' \
74+ ./rzup/src/env.rs
75+ ''
76+
6677 # Fix starter template
67- sed -i 's|{{ risc0_build }}|path = "'$out'"|' risc0/cargo-risczero/templates/rust-starter/methods/Cargo-toml
68- sed -i 's|{{ risc0_zkvm }}|path = "'$out'"|' risc0/cargo-risczero/templates/rust-starter/host/Cargo-toml
69- '' ;
78+ /* bash */
79+ ''
80+ sed -i 's|{{ risc0_build }}|path = "'$out'"|' ./risc0/cargo-risczero/templates/rust-starter/methods/Cargo-toml
81+ sed -i 's|{{ risc0_zkvm }}|path = "'$out'"|' ./risc0/cargo-risczero/templates/rust-starter/host/Cargo-toml
82+ ''
83+ ] ;
7084
7185 preBuild = ''
72- export RECURSION_SRC_PATH="${ recursion-zkr } " RUSTFLAGS="$RUSTFLAGS -A dead_code"
86+ export RECURSION_SRC_PATH="${ recursion-zkr } "
87+ export RUSTFLAGS="$RUSTFLAGS -A dead_code"
7388 '' ;
7489
7590 cargoBuildCommand = "cargo build --release -p risc0-zkvm -p risc0-build -p cargo-risczero --features unstable" ;
You can’t perform that action at this time.
0 commit comments