Skip to content

Commit

Permalink
Merge pull request #1800 from o1-labs/brian/nixify
Browse files Browse the repository at this point in the history
Add support for building with nix
  • Loading branch information
Geometer1729 authored Sep 17, 2024
2 parents 6ad5405 + cf58f8c commit bedf107
Show file tree
Hide file tree
Showing 11 changed files with 788 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./pin.sh
use flake o1js#default
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ o1js-reference
_build/
src/config/
src/config.mlh
.direnv
.rustup
result
14 changes: 10 additions & 4 deletions README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ npm run build

This command compiles the TypeScript source files, making them ready for use. The compiled OCaml and WebAssembly artifacts are version-controlled to simplify the build process for end users. These artifacts are stored under `src/bindings/compiled` and contain the artifacts needed for both node and web builds. These files only have to be regenerated if there are changes to the OCaml or Rust source files.

## Building with nix

Much like the mina repo, we use the nix registry to conveniently handle git submodules.
You can enter the devshell with `./pin.sh` and `nix develop o1js#default` or by using
direnv with the `.envrc` provided. This devshell provides all the dependencies required for npm scripts including `npm run:update-bindings`.

## Building Bindings

To regenerate the OCaml and WebAssembly artifacts, you can do so within the o1js repo. The [bindings](https://github.com/o1-labs/o1js-bindings) and [Mina](https://github.com/MinaProtocol/mina) repos are both submodules of o1js so you can build them from within the o1js repo.
Expand Down Expand Up @@ -89,8 +95,8 @@ o1js uses these types to ensure that the constants used in the protocol are cons
| main | **Yes** |
| develop | No |

When you start your work on o1js, please create the feature branch off of one of the above base branches.
It's encouraged to submit your work-in-progress as a draft PR to raise visibility!
When you start your work on o1js, please create the feature branch off of one of the above base branches.
It's encouraged to submit your work-in-progress as a draft PR to raise visibility!
When working with submodules and various interconnected parts of the stack, ensure you are on the correct branches that are compatible with each other.

**Default to `main` as the base branch**.
Expand Down Expand Up @@ -202,8 +208,8 @@ docker run --rm --pull=missing -it \

See the [Docker Hub repository](https://hub.docker.com/r/o1labs/mina-local-network) for more information.

Next up, get the Mina blockchain accounts information to be used in your zkApp.
After the local network is up and running, you can use the [Lightnet](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/lib/fetch.ts#L1012) `o1js API namespace` to get the accounts information.
Next up, get the Mina blockchain accounts information to be used in your zkApp.
After the local network is up and running, you can use the [Lightnet](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/lib/fetch.ts#L1012) `o1js API namespace` to get the accounts information.
See the corresponding example in [src/examples/zkapps/hello-world/run-live.ts](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/examples/zkapps/hello-world/run-live.ts).

### Profiling o1js
Expand Down
Loading

0 comments on commit bedf107

Please sign in to comment.