feat: init raven
This commit is contained in:
parent
c749192309
commit
61cabbc0ad
|
|
@ -64,7 +64,6 @@
|
||||||
taskwarrior-tui
|
taskwarrior-tui
|
||||||
# vimwiki-cli
|
# vimwiki-cli
|
||||||
zk
|
zk
|
||||||
unstable.opencode
|
|
||||||
|
|
||||||
(pkgs.writeScriptBin "jq-repl" ''
|
(pkgs.writeScriptBin "jq-repl" ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
../profiles/jacket
|
../profiles/jacket
|
||||||
../profiles/gpodder
|
../profiles/gpodder
|
||||||
../profiles/transmission
|
../profiles/transmission
|
||||||
|
../profiles/raven
|
||||||
#../profiles/postgres_upgrade_script
|
#../profiles/postgres_upgrade_script
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
63
hosts/profiles/raven/default.nix
Normal file
63
hosts/profiles/raven/default.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
{
|
||||||
|
# ===================
|
||||||
|
# Ollama Service
|
||||||
|
# ===================
|
||||||
|
services.ollama = {
|
||||||
|
enable = true;
|
||||||
|
acceleration = null; # CPU only, no GPU
|
||||||
|
host = "127.0.0.1";
|
||||||
|
port = 11434;
|
||||||
|
};
|
||||||
|
|
||||||
|
# ===================
|
||||||
|
# PostgreSQL: Letta Database
|
||||||
|
# ===================
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
ensureDatabases = [ "letta" ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "letta";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# Enable TCP connections (required for Docker)
|
||||||
|
enableTCPIP = true;
|
||||||
|
|
||||||
|
# Allow letta user to connect via TCP with password
|
||||||
|
authentication = lib.mkAfter ''
|
||||||
|
# Letta database - TCP password auth for Docker
|
||||||
|
host letta letta 127.0.0.1/32 scram-sha-256
|
||||||
|
host letta letta ::1/128 scram-sha-256
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Include pgvector extension
|
||||||
|
extraPlugins = ps: [ ps.pgvector ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# ===================
|
||||||
|
# Database Setup Service
|
||||||
|
# ===================
|
||||||
|
# Runs after postgresql to enable pgvector and set password
|
||||||
|
systemd.services.raven-db-setup = {
|
||||||
|
description = "Setup Letta database with pgvector and password";
|
||||||
|
after = [ "postgresql.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
path = [ config.services.postgresql.package ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = "postgres";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
# Enable pgvector extension
|
||||||
|
psql -d letta -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||||
|
|
||||||
|
# Set password for letta user
|
||||||
|
# TODO: Consider using agenix for production
|
||||||
|
psql -c "ALTER USER letta WITH PASSWORD 'letta-dev-password';"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue