Skip to content

Commit

Permalink
Merge pull request #5 from cspr-rad/add-readme
Browse files Browse the repository at this point in the history
add README.md
  • Loading branch information
marijanp authored Jan 17, 2024
2 parents 470bcc2 + ce0fcc0 commit 3500f12
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Kairos

## Development

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.

### Development Shell

You have two options here, you can configure and leverage [direnv](https://direnv.net/) to automatically drop you in a development shell (recommended) or do it manually.

#### Automatic Development Shell using `direnv`

First, you will have to install direnv, by adding it to your Nix/NixOS configuration or using your package manager.
Afterward, run:

```sh
touch .envrc
echo "use flake" >> .envrc
direnv allow
```

#### Manual Development Shell

Run:

```sh
nix develop
```

#### Risc0 Development Shell

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:

```sh
nix develop
```

Afterward (the only command you need when you use `direnv`):

```
nix develop .#risczero
```

### Inside a Development Shell

Inside the development shell, you can use `cargo` as usual during development.

### Formatting

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](https://numtide.github.io/treefmt/formatters/). Note that any formatting tool can be added trivially, if stuck contact your Nix expert.

### Build

You can explore the buildable outputs of this project easily by running:

```sh
nix flake show
```

To build e.g. `kairos` you can then run:

```sh
nix build .#kairos
```

### Check

To run all the "checks" of this project, like formatting, lint, audit, etc. checks, run:

```sh
nix flake check
```

To run a single check e.g. the format check, run:

```sh
nix build .#checks.<system>.treefmt
```

0 comments on commit 3500f12

Please sign in to comment.