diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-03-10 15:28:32 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-04-04 11:03:00 +0300 |
| commit | fe7d70ad78c4660e4e11f8c6bbcfca05fe1099ce (patch) | |
| tree | 63a81a58d54891b61cf8a45db530336c0063be5e | |
| parent | 2cb82e5981490274087e0d144dbc9aa947c91c22 (diff) | |
| download | zkVMs-benchmarks-fe7d70ad78c4660e4e11f8c6bbcfca05fe1099ce.tar zkVMs-benchmarks-fe7d70ad78c4660e4e11f8c6bbcfca05fe1099ce.tar.gz zkVMs-benchmarks-fe7d70ad78c4660e4e11f8c6bbcfca05fe1099ce.zip | |
feat(flake.nix): Add script for updating all zkVM package dependencies
All crates use the zkVM packages (from nix-blockchain-development) as
cargo path dependencies. For each zkVM, they're found in the host, guest
and wrapper crates.
Since there are a lot of places to update, we're introducing a script
which automates this.
| -rw-r--r-- | flake.nix | 1 | ||||
| -rw-r--r-- | update-nix-dependencies.nix | 37 |
2 files changed, 38 insertions, 0 deletions
@@ -75,6 +75,7 @@ in { packages.${system} = hostPackages // guestPackages // { rust-format-all = callPackage ./rust-format-all.nix { }; + update-nix-dependencies = callPackage ./update-nix-dependencies.nix { }; }; formatter.${system} = pkgs.nixfmt; diff --git a/update-nix-dependencies.nix b/update-nix-dependencies.nix new file mode 100644 index 0000000..e3e4275 --- /dev/null +++ b/update-nix-dependencies.nix @@ -0,0 +1,37 @@ +{ writeShellApplication, cargo, }: +writeShellApplication { + name = "update_nix_dependencies"; + + runtimeInputs = [ cargo ]; + + text = '' + updateCrate() { + sed -i "s|/nix/store/[^-]\+-$1-[^/]\+|$2|" Cargo.toml + } + + cd zkvms + for zkvm in * + do + [ ! -d "$zkvm" ] || [ "$zkvm" == 'result' ] && continue + [ "$zkvm" == 'zkwasm' ] && continue + pushd "$zkvm" + newPath="$(nix build github:metacraft-labs/nix-blockchain-development#"$zkvm" --print-out-paths)" + + [ "$zkvm" == 'nexus' ] && zkvm=Nexus + + cd guest + updateCrate "$zkvm" "$newPath" + cd ../host + updateCrate "$zkvm" "$newPath" + cd ../wrapper_macro + updateCrate "$zkvm" "$newPath" + + cd ../guest + cargo generate-lockfile + cd ../host + cargo generate-lockfile + + popd + done + ''; +} |
