Skip to content

Commit

Permalink
Fix flake for OSX
Browse files Browse the repository at this point in the history
The prover deps are now optional, making this flake usable to build a simulator.
  • Loading branch information
aborg-dev committed Oct 18, 2024
1 parent 01bd0b1 commit bb2eddd
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 2 deletions.
15 changes: 15 additions & 0 deletions book/getting_started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
sudo apt-get install -y xz-utils jq curl git build-essential qemu-system libomp-dev libgmp-dev nlohmann-json3-dev protobuf-compiler uuid-dev libgrpc++-dev libsecp256k1-dev libsodium-dev libpqxx-dev nasm
```

### Nix Flake

Alternatively, you can use [Nix package manager](https://github.com/NixOS/nix) to install all dependencies. First, follow the [guite to install Nix](https://determinate.systems/nix/) on your OS.

Afterwards, use `flake.nix` in `zisk` repository to load the development environment with:
```
nix develop
# You can also use a custom shell:
nix develop -c zsh
```

This will start a new shell with correctly set `PATH` and `LD_LIBRARY_PATH` for dependencies necessary to build the project.
You can exit this shell with Ctrl+D.

### OSX prerequisites
```bash
# Install brew first.
Expand Down
4 changes: 2 additions & 2 deletions book/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ cd zisk

### Compile the PIl2 Stark C++ Library (run only once):
```bash
(cd ../pil2-proofman/pil2-stark && git submodule init && git submodule update && make clean && make -j starks_lib && make -j bctree) && export RUSTFLAGS="-L native=$PWD/../pil2-proofman/pil2-stark/lib"
(cd ../pil2-proofman/pil2-stark && git submodule init && git submodule update && make clean && make -j starks_lib && make -j bctree) && export RUSTFLAGS=$RUSTFLAGS" -L native=$PWD/../pil2-proofman/pil2-stark/lib"
```

### Generate PIL-Helpers Rust Code
Expand Down Expand Up @@ -164,4 +164,4 @@ To generate the proof, the following command needs to be run.
```bash
(cd ../pil2-stark-js && npm i)
node ../pil2-stark-js/src/main_verifier.js -v build/provingKey/zisk/final/final.verkey.json -s build/provingKey/zisk/final/final.starkinfo.json -i build/provingKey/zisk/final/final.verifierinfo.json -o proofs/proofs/final_proof.json -b proofs/publics.json
```
```
64 changes: 64 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
description = "A flake with project build dependencies";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.systems.url = "github:nix-systems/default";
inputs.flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};

outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg:
builtins.elem (nixpkgs.lib.getName pkg) [ "mkl" ];
};
in {
devShells.default = pkgs.mkShell {
packages = [
pkgs.grpc
pkgs.gmp
pkgs.jq
pkgs.libsodium
pkgs.libpqxx
pkgs.libuuid
pkgs.openssl
pkgs.postgresql
pkgs.protobuf
pkgs.secp256k1
pkgs.nlohmann_json
pkgs.nasm
pkgs.libgit2
] ++ (pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.mkl ])
++ (pkgs.lib.optionals pkgs.stdenv.isDarwin
[ pkgs.darwin.apple_sdk.frameworks.Security ]);

RUSTFLAGS = (builtins.map (a: "-L ${a}/lib") [ pkgs.libgit2 ]);
};
});
}

0 comments on commit bb2eddd

Please sign in to comment.