Simple mini clone of torrra

This commit is contained in:
Alexander
2026-07-02 17:02:49 +02:00
commit 80ebf1cb63
24 changed files with 6424 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
{
pkgs,
lib,
config,
inputs,
...
}:
{
languages.rust.enable = true;
git-hooks.hooks = {
clippy = {
enable = true;
settings.allFeatures = true;
};
treefmt.enable = true;
};
treefmt = {
enable = true;
config.programs = {
nixfmt.enable = true;
rustfmt.enable = true;
};
};
packages = with pkgs; [
git
just
protobuf
buf
grpcurl
# Protobuf generators
protoc-gen-prost-crate
protoc-gen-prost-serde
protoc-gen-tonic
protoc-gen-prost
opencode
];
services.postgres = {
enable = true;
initialDatabases = [
{
name = "toradb";
schema = ./db/schema.sql;
}
];
};
env.PGDATABASE = "toradb";
env.DATABASE_URL = "postgresql://${builtins.getEnv "USER"}@localhost/${config.env.PGDATABASE}?host=${config.env.PGHOST}";
env.TORAD_SOCKET = "${config.env.DEVENV_RUNTIME}/torad.sock";
env.TORAD_PID_FILE = "${config.env.DEVENV_RUNTIME}/torad.pid";
processes.torad = {
exec = ''
cargo run -p torad -- --socket "$TORAD_SOCKET" --pid-file "$TORAD_PID_FILE"
'';
# Waits for postgres's own readiness probe (pg_isready + SELECT 1), not just process start.
after = [ "devenv:processes:postgres" ];
};
outputs = {
tora = config.languages.rust.import ./. { };
};
}