This repository has no description
0

Configure Feed

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

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