2024-12-09 18:07:01 +01:00
|
|
|
# Usage
|
|
|
|
|
|
|
|
## Shell
|
|
|
|
|
|
|
|
A development shell can be started using:
|
|
|
|
```sh
|
|
|
|
nix develop
|
|
|
|
```
|
|
|
|
|
|
|
|
## Building
|
|
|
|
|
|
|
|
To build a Codex you can use:
|
|
|
|
```sh
|
2025-01-09 18:29:14 +01:00
|
|
|
nix build '.?submodules=1#default'
|
2024-12-09 18:07:01 +01:00
|
|
|
```
|
|
|
|
The `?submodules=1` part should eventually not be necessary.
|
|
|
|
For more details see:
|
|
|
|
https://github.com/NixOS/nix/issues/4423
|
|
|
|
|
|
|
|
It can be also done without even cloning the repo:
|
|
|
|
```sh
|
2025-01-09 18:29:14 +01:00
|
|
|
nix build 'git+https://github.com/codex-storage/nim-codex?submodules=1#'
|
2024-12-09 18:07:01 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Running
|
|
|
|
|
|
|
|
```sh
|
2025-01-09 18:29:14 +01:00
|
|
|
nix run 'git+https://github.com/codex-storage/nim-codex?submodules=1#''
|
2024-12-09 18:07:01 +01:00
|
|
|
```
|
2025-01-09 18:29:14 +01:00
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
|
|
|
```sh
|
|
|
|
nix flake check ".?submodules=1#"
|
2025-01-14 09:21:11 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Running Nim-Codex as a service on NixOS
|
|
|
|
|
|
|
|
Include nim-codex flake in your flake inputs:
|
|
|
|
```nix
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
|
|
|
nim-codex-flake.url = "git+https://github.com/codex-storage/nim-codex?submodules=1#";
|
|
|
|
};
|
|
|
|
```
|
|
|
|
|
|
|
|
To configure the service, you can use the following example:
|
|
|
|
```nix
|
|
|
|
services.nim-codex = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
data-dir = "/var/lib/codex-test";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
```
|
|
|
|
The settings attribute set corresponds directly to the layout of the TOML configuration file
|
|
|
|
used by nim-codex. Each option follows the same naming convention as the CLI flags, but
|
|
|
|
with the -- prefix removed. For more details on the TOML file structure and options,
|
|
|
|
refer to the official documentation: [nim-codex configuration file](https://docs.codex.storage/learn/run#configuration-file).
|