Development Setup
These docs detail getting an environment set up for developing Arminius.
Nix Setup
Arminius is developed using Nix.
If you do not yet have Nix installed, we recommend you install the Lix implementation of Nix.
Important
The Lix installer will ask whether you would like to
Enable flakes? ([Y]es/[n]o):Arminius depends on flakes. We therefore recommend you enable them.
The documentation always assumes that you are inside the nix shell provided with the project
You can enter the nix shell using
nix develop
Tip
To automatically enter the nix shell when entering the project directory, you can install direnv and add an
.envrcto the project directory like so:cp .envrc.example .envrc && direnv allowUnlike
nix developwhich always usesbash,direnvtransparently loads the nix shell environment into your current shell.
Entering the development shell should get you the following message:
Welcome to the Arminius development shell :)
[[[lints and checks]]]
ast-grep scan - Run the repository lint scan.
ast-grep scan --error - Run the CI-equivalent lint scan.
ast-grep test - Run the ast-grep rule fixture tests.
nix fmt - Auto-format all files in the project.
prek - Run pre-commit hooks on currently staged changes
prek --stage pre-push - *Also* slow pre-commit hooks
prek -s main -o HEAD - Run pre-commit hooks on all commits in the current branch
[[general commands]]
menu - prints this menu
Running Background Services
To reset and start NATS, PostgreSQL, and run migrations:
export $(dev-services up | xargs -L 1)
This helper is also available in source form in scripts-dev/dev-services.sh.
Running Arminius
Arminius is designed as a series of microservices. But for development, we support running all services as one monolith:
export ARMINIUS_HOST=127.0.0.1:8080
export ARMINIUS_NAME=127.0.0.1:8080
cargo run --package arminius-server-monolith --features test_login
You can now connect with your Matrix client to http://localhost:8080, and create an account!
With Nuss
To run Arminius with Nuss you should in one shell run Nuss:
export $(dev-services up nuss| xargs -L 1)
export BASE_URL=http://localhost:9000
cargo run --package nuss -- --dev-mode
and in another shell run Arminius:
export $(dev-services up with-nuss| xargs -L 1)
export ARMINIUS_HOST=127.0.0.1:8080
export ARMINIUS_NAME=127.0.0.1:8080
cargo run --package arminius-server-monolith