diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-04-14 09:45:51 +0300 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-04-14 13:40:57 +0300 |
| commit | 230defc3f58161234f8752e98ecf11725c85860d (patch) | |
| tree | cdeb910a122661bd8da1d245e10fc61d3ba41304 | |
| parent | d37015ed2e03848fa4b7947c6cfa3952c17b97d9 (diff) | |
| download | zkVMs-benchmarks-230defc3f58161234f8752e98ecf11725c85860d.tar zkVMs-benchmarks-230defc3f58161234f8752e98ecf11725c85860d.tar.gz zkVMs-benchmarks-230defc3f58161234f8752e98ecf11725c85860d.zip | |
feat(update-nix-dependencies): Use flake's nix-blockchain-development instead of default
To get the new Nix outPaths for all zkVMs, we used to execute a `nix
run` command, which found the paths from the nix-blockchain-development
repo, default branch on latest commit.
Since that could differ from what repo our flake actually uses, we're
updating the logic.
| -rw-r--r-- | flake.nix | 7 | ||||
| -rw-r--r-- | update-nix-dependencies.nix | 38 |
2 files changed, 27 insertions, 18 deletions
@@ -74,8 +74,11 @@ }) { } guests; in { packages.${system} = hostPackages // guestPackages // { - rust-format-all = callPackage ./rust-format-all.nix { }; - update-nix-dependencies = callPackage ./update-nix-dependencies.nix { }; + rust-format-all = callPackage ./rust-format-all.nix { + }; + update-nix-dependencies = callPackage ./update-nix-dependencies.nix { + zkvms = builtins.map (name: mcl-blockchain.packages.${system}.${name}) zkvms; + }; }; formatter.${system} = pkgs.nixfmt; diff --git a/update-nix-dependencies.nix b/update-nix-dependencies.nix index e3e4275..77b38af 100644 --- a/update-nix-dependencies.nix +++ b/update-nix-dependencies.nix @@ -1,35 +1,41 @@ -{ writeShellApplication, cargo, }: +{ writeShellApplication, cargo, zkvms, }: writeShellApplication { name = "update_nix_dependencies"; runtimeInputs = [ cargo ]; - text = '' - updateCrate() { + text = let + namesAndPaths = builtins.concatStringsSep + " " + (builtins.map + (zkvm: zkvm.pname + "," + zkvm.outPath) + zkvms); + in '' + updatePath() { sed -i "s|/nix/store/[^-]\+-$1-[^/]\+|$2|" Cargo.toml } + updateDep() { + updatePath "$1" "$2" + cargo generate-lockfile + } cd zkvms - for zkvm in * + for i in ${namesAndPaths} do - [ ! -d "$zkvm" ] || [ "$zkvm" == 'result' ] && continue - [ "$zkvm" == 'zkwasm' ] && continue + IFS=',' read -r zkvm path <<< "''${i}" + [ "$zkvm" == 'zkWasm' ] && continue + [ "$zkvm" == 'Nexus-zkVM' ] && zkvm=nexus + 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 wrapper_macro + updatePath "$zkvm" "$path" cd ../guest - cargo generate-lockfile + updateDep "$zkvm" "$path" cd ../host - cargo generate-lockfile + updateDep "$zkvm" "$path" popd done |
