opencode.nix
1 { 2 lib, 3 config, 4 ... 5 }: 6 let 7 tools = { 8 bash = true; 9 # edit = "ask"; 10 write = true; 11 read = true; 12 grep = true; 13 list = true; 14 glob = true; 15 skill = true; 16 webfetch = true; 17 question = true; 18 todowrite = true; 19 }; 20 21 mcp = { 22 devenv = { 23 enabled = true; 24 type = "local"; 25 command = [ 26 "devenv" 27 "mcp" 28 ]; 29 }; 30 31 # likec4 = { 32 # enabled = true; 33 # type = "local"; 34 # command = [ 35 # "likec4" 36 # "mcp" 37 # "${config.git.root}/docs" 38 # ]; 39 # }; 40 41 # supabase = { 42 # enabled = true; 43 # type = "remote"; 44 # url = "http://localhost:54321/mcp?features=docs%2Cdatabase%2Cdebugging%2Cdevelopment"; 45 # }; 46 47 pulumi = { 48 enabled = true; 49 type = "remote"; 50 url = "https://mcp.ai.pulumi.com/mcp"; 51 }; 52 53 # nx = { 54 # enabled = true; 55 # type = "local"; 56 # command = [ 57 # "nx" 58 # "mcp" 59 # ]; 60 # }; 61 }; 62 63 codexMcpServers = lib.mapAttrs ( 64 _: server: 65 if server.type == "remote" then 66 { 67 inherit (server) url; 68 } 69 else 70 { 71 command = builtins.head server.command; 72 args = builtins.tail server.command; 73 } 74 ) mcp; 75 in 76 { 77 # env.OPENCODE_CONFIG = "${config.git.root}/.devenv/state/opencode/opencode.json"; 78 79 files."${config.git.root}/opencode.json".json = { 80 "$schema" = "https://opencode.ai/config.json"; 81 82 inherit tools mcp; 83 }; 84 }