To get started developing on this repository you can leverage Nix. The following sections explain how to obtain a development shell and how to build the project.
You have two options here, you can configure and leverage direnv to automatically drop you in a development shell (recommended) or do it manually.
First, you will have to install direnv, by adding it to your Nix/NixOS configuration or using your package manager. Afterward, run:
touch .envrc
echo "use flake" >> .envrc
direnv allow
Run:
nix develop
Because risc0
projects require a fork of rustc
, we decided to detach the development shell for kairos-prover
from the other crates. To enter a development shell when working with the kairos-prover
/risc0
projects, run:
If you don't use direnv
, you will first need to enter the default development shell, if you didn't before:
nix develop
Afterward (the only command you need when you use direnv
):
nix develop .#risczero
Inside the development shell, you can use cargo
as usual during development.
Code for the whole project tree can be formatted by running nix fmt
from the project's root or anywhere in the tree, but be warned that it will only format code inside the sub-tree.
The nix fmt
command currently formats all the Rust
and Nix
code in the tree. To add support for more languages you'll have to adjust the treefmt
attribute-set in the flake.nix
accordingly. A list of already supported formatters can be found here. Note that any formatting tool can be added trivially, if stuck contact your Nix expert.
You can explore the buildable outputs of this project easily by running:
nix flake show
To build e.g. kairos
you can then run:
nix build .#kairos
To run all the "checks" of this project, like formatting, lint, audit, etc. checks, run:
nix flake check
To run a single check e.g. the format check, run:
nix build .#checks.<system>.treefmt
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.