blob: a28d708992875ef9dfad9186175b23f2e3e3cae2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{
description = "zkVMs benchmarks";
nixConfig = {
extra-substituters = "https://nix-blockchain-development.cachix.org";
extra-trusted-public-keys = "nix-blockchain-development.cachix.org-1:Ekei3RuW3Se+P/UIo6Q/oAgor/fVhFuuuX5jR8K/cdg=";
};
inputs = {
mcl-blockchain.url = "github:metacraft-labs/nix-blockchain-development?ref=zkvm-packages";
nixpkgs.follows = "mcl-blockchain/nixpkgs";
crane.follows = "mcl-blockchain/crane";
rust-overlay.follows = "mcl-blockchain/rust-overlay";
# flake-utils.follows = "mcl-blockchain/flake-utils";
};
outputs = { self, nixpkgs, mcl-blockchain, crane, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { system = system; overlays = [ mcl-blockchain.overlays.default ]; };
callPackage = pkgs.lib.callPackageWith pkgs;
withZKVMPhases = currentPackage: with currentPackage; {
buildPhase = ''
root_dir="$PWD"
runHook preBuild
cd "$root_dir"
export INPUTS="$PWD/Vertices-010.in"
cargo build --bin ${hostBin} --release
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"/bin
for bin in $(find . -type f -regex ".*release/[^/]*" -executable -print)
do
mv "$bin" "$out"/bin/
done
cat <<EOF > "$out"/bin/${pname}
#!/usr/bin/env sh
${if currentPackage ? preRun then preRun else ""}
"$out"/bin/${hostBin} \$@
EOF
chmod +x "$out"/bin/${pname}
runHook postInstall
'';
doNotPostBuildInstallCargoBinaries = true;
} // currentPackage;
args-zkVM = {
craneLib-default = crane.mkLib pkgs;
inherit withZKVMPhases;
};
in {
packages.${system}.risc0 = callPackage ./zkvms/risc0/default.nix args-zkVM;
};
}
|