Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion .github/workflows/test-docs-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,52 @@ jobs:
wasm-pack --version
shellcheck --version

test-nix-setup:
name: Test Nix Setup (${{ matrix.os }})
runs-on: ${{ matrix.os }}
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'test-doc-scripts')
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4

- name: Setup Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Test nix develop succeeds
run: |
nix develop

- name: Test Rust installation
run: |
nix develop --command ./website/docs/developers/scripts/setup/install-rust.sh

- name: Test WASM tools installation
run: |
# Source cargo environment first
source ~/.cargo/env
nix develop --command ./website/docs/developers/scripts/setup/install-wasm-tools.sh

- name: Test specialised builds
run: |
nix develop --command ./website/docs/developers/scripts/setup/build-specialized.sh

- name: Test format and lint
run: |
nix develop --command ./website/docs/developers/scripts/setup/format-and-lint.sh

- name: Verify installations
run: |
echo "Verifying installed tools..."
nix develop --command bash -c "rustc --version && cargo --version && node --version && npm --version && protoc --version && sqlite3 --version && wasm-pack --version"


docker-ubuntu:
name: Test Docker Setup Script (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -178,7 +224,8 @@ jobs:
test-update-ocaml-node-script:
name: Test Update OCaml Node Script
runs-on: [macos-latest, ubuntu-latest]

if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'test-doc-scripts')
steps:
- name: Test update-ocaml-node script reproducibility
run: |
# Save the current script to use with the old commit state
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Development tools**: Add shellcheck to the CI
([#1255](https://github.com/o1-labs/openmina/pull/1255))



### Changed

- **CI**: Generalized build jobs to support multiple platforms (Ubuntu 22.04,
Expand Down Expand Up @@ -71,6 +73,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- bump itertools from 0.10.5 to 0.12.0 #1228
([#1228](https://github.com/o1-labs/openmina/pull/1228))

### Other

- Added a `flake.nix` for building the project on nixos/using nix ([#1241](https://github.com/o1-labs/openmina/pull/1241)),
together with **documentation**: instructions for developers,
and test the installation commands in CI.


## [0.16.0] - 2025-04-04

### Added
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

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

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
description = "openmina prerequisites";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
rustup
rust-analyzer
libiconv # Needed for macOS for rustup

openssl
jemalloc
protobuf
libpcap

pkg-config
gcc
gnumake

curl
git
sqlite
nodejs

shellcheck
];

# To use wasm-pack and other executables installed via `cargo install`
shellHook = ''
export PATH=$HOME/.cargo/bin:$PATH
'';

# Fix for tikv-jemalloc-sys compilation error on GNU platforms:
# The GNU version of strerror_r returns char* while POSIX returns int.
# Only set this flag on Linux/GNU systems, not needed on macOS.
CFLAGS = if pkgs.stdenv.isLinux then "-DJEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE" else "";
JEMALLOC_SYS_WITH_CFLAGS = if pkgs.stdenv.isLinux then "-DJEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE" else "";
};
}
);
}
36 changes: 22 additions & 14 deletions website/docs/developers/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import InstallWasmToolsSh from "!!raw-loader!./scripts/setup/install-wasm-tools.
import CloneAndBuildSh from "!!raw-loader!./scripts/setup/clone-and-build.sh";
import BuildSpecializedSh from "!!raw-loader!./scripts/setup/build-specialized.sh";
import FormatAndLintSh from "!!raw-loader!./scripts/setup/format-and-lint.sh";
import NixDevelop from "!!raw-loader!./scripts/setup/nix-develop.sh";

Welcome to OpenMina development! This guide will help you set up your
development environment and build OpenMina from source.
Expand All @@ -39,20 +40,7 @@ development environment and build OpenMina from source.

### Required Tools

#### 1. Rust Toolchain

OpenMina requires both stable and nightly Rust toolchains, plus additional tools
for development:

<CodeBlock language="bash">{InstallRustSh}</CodeBlock>

This installs:

- Rust 1.84 (stable) and nightly toolchains
- Required components: `rustfmt`, `clippy`, `rust-src`
- `taplo-cli`: TOML formatter required for `make format`

#### 2. System Dependencies
#### 1. System Dependencies

<Tabs groupId="operating-systems">
<TabItem value="linux" label="Linux (Ubuntu/Debian)">
Expand All @@ -67,6 +55,19 @@ This installs:
</TabItem>
</Tabs>

#### 2. Rust Toolchain

OpenMina requires both stable and nightly Rust toolchains, plus additional tools
for development:

<CodeBlock language="bash">{InstallRustSh}</CodeBlock>

This installs:

- Rust 1.84 (stable) and nightly toolchains
- Required components: `rustfmt`, `clippy`, `rust-src`
- `taplo-cli`: TOML formatter required for `make format`

#### 3. Additional Development Tools

**Node.js (for documentation and frontend):**
Expand Down Expand Up @@ -103,6 +104,13 @@ This installs:

<CodeBlock language="bash">{InstallWasmToolsSh}</CodeBlock>

#### 5. Using Nix to install dependencies automatically (alternative)

If you're on NixOS or using nix, you can use the nix-flake provided in the repo
to install the dependencies automatically and enter the shell:

<CodeBlock language="bash">{NixDevelop}</CodeBlock>

## Clone and Build OpenMina

### 1. Clone the Repository and Build
Expand Down
5 changes: 1 addition & 4 deletions website/docs/developers/scripts/setup/install-rust.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Install rustup (Rust toolchain installer)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Source cargo environment
source ~/.cargo/env

Expand All @@ -12,7 +9,7 @@ rustup default 1.84
rustup install nightly

# Add required components for Rust 1.84
rustup component add rustfmt clippy --toolchain 1.84
rustup component add rustfmt clippy rust-src --toolchain 1.84

# Add required components for nightly
rustup component add rustfmt clippy rust-src --toolchain nightly
Expand Down
3 changes: 3 additions & 0 deletions website/docs/developers/scripts/setup/install-system-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ sudo apt install -y \
git \
curl \
shellcheck
curl

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
6 changes: 6 additions & 0 deletions website/docs/developers/scripts/setup/nix-develop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This assumes the repository is cloned, and `flake.nix` is present
# Enter nix flake environment
echo "Entering nix develop flake..."
nix develop

# Build your project afterwards using `make` as usual
Loading