This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / configs / opencrow.nix
3.4 kB 121 lines
1{ 2 self, 3 config, 4 pkgs, 5 ... 6}: 7let 8 opencrow = self.inputs.opencrow.packages.${pkgs.system}.opencrow; 9 pi = self.inputs.llm-agents.packages.${pkgs.system}.pi; 10in 11{ 12 users.users.bot = { 13 isNormalUser = true; 14 home = "/home/bot"; 15 createHome = true; 16 group = "users"; 17 useDefaultShell = true; 18 openssh.authorizedKeys.keys = [ 19 self.keys.ssh.barnacle.public 20 self.keys.ssh.yubi_pgp.public 21 self.keys.ssh.termux_massulus.public 22 self.keys.ssh.yubi1.public 23 self.keys.ssh.yubi2.public 24 self.keys.ssh.solo2.public 25 self.keys.ssh.ignavia.public 26 self.keys.ssh.phonetpm_massulus.public 27 self.keys.ssh.massulus.public 28 ]; 29 packages = [ 30 opencrow 31 pi 32 pkgs.curl 33 pkgs.jq 34 pkgs.lynx 35 ]; 36 }; 37 38 clan.core.vars.generators.opencrow-matrix = { 39 prompts.matrix-access-token = { 40 description = "Matrix access token for @opencrow:lassul.us"; 41 type = "hidden"; 42 persist = true; 43 }; 44 }; 45 46 clan.core.vars.generators.opencrow-openrouter = { 47 prompts.openrouter-api-key = { 48 description = "OpenRouter API key for opencrow - get from https://openrouter.ai/keys"; 49 type = "hidden"; 50 persist = true; 51 }; 52 }; 53 54 clan.core.vars.generators.opencrow-env = { 55 dependencies = [ 56 "opencrow-matrix" 57 "opencrow-openrouter" 58 ]; 59 files."opencrow.env" = { }; 60 script = '' 61 cat > "$out/opencrow.env" << EOF 62 OPENCROW_MATRIX_ACCESS_TOKEN=$(cat $in/opencrow-matrix/matrix-access-token) 63 OPENROUTER_API_KEY=$(cat $in/opencrow-openrouter/openrouter-api-key) 64 EOF 65 ''; 66 }; 67 68 systemd.services.opencrow = { 69 description = "OpenCrow Matrix Bot"; 70 wantedBy = [ "multi-user.target" ]; 71 after = [ "network-online.target" ]; 72 wants = [ "network-online.target" ]; 73 74 path = [ 75 opencrow 76 pi 77 pkgs.bash 78 pkgs.coreutils 79 pkgs.curl 80 pkgs.jq 81 pkgs.lynx 82 ]; 83 84 environment = { 85 OPENCROW_MATRIX_HOMESERVER = "https://matrix.lassul.us"; 86 OPENCROW_ALLOWED_USERS = "@lassulus:lassul.us"; 87 OPENCROW_MATRIX_USER_ID = "@opencrow:lassul.us"; 88 OPENCROW_MATRIX_DEVICE_ID = "AYBPKDHIDV"; 89 OPENCROW_PI_SESSION_DIR = "/home/bot/opencrow/sessions"; 90 OPENCROW_PI_WORKING_DIR = "/home/bot/opencrow"; 91 OPENCROW_PI_SKILLS = "${opencrow}/share/opencrow/skills/web"; 92 OPENCROW_PI_SKILLS_DIR = "/home/bot/skills"; 93 OPENCROW_PI_PROVIDER = "openrouter"; 94 OPENCROW_PI_MODEL = "anthropic/claude-sonnet-4"; 95 # OPENCROW_HEARTBEAT_INTERVAL = "10m"; 96 OPENCROW_SHOW_TOOL_CALLS = "1"; 97 OPENCROW_SOUL_FILE = "/home/bot/opencrow/SOUL.md"; 98 PI_CODING_AGENT_DIR = "/home/bot/opencrow/pi-agent"; 99 }; 100 101 serviceConfig = { 102 EnvironmentFile = [ 103 config.clan.core.vars.generators.opencrow-env.files."opencrow.env".path 104 config.clan.core.vars.generators.mailserver-bot.files."mail.env".path 105 ]; 106 ExecStart = "${opencrow}/bin/opencrow"; 107 Restart = "on-failure"; 108 RestartSec = 10; 109 User = "bot"; 110 Group = "users"; 111 WorkingDirectory = "/home/bot/opencrow"; 112 }; 113 }; 114 115 # ensure working directory exists 116 systemd.tmpfiles.rules = [ 117 "d /home/bot/opencrow 0750 bot users -" 118 "d /home/bot/opencrow/sessions 0750 bot users -" 119 "d /home/bot/opencrow/pi-agent 0750 bot users -" 120 ]; 121}