nix fmt
This commit is contained in:
parent
27343e49bd
commit
04150f10d4
32 changed files with 475 additions and 404 deletions
|
|
@ -1,61 +1,72 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.nextcloud-claude-bot;
|
||||
|
||||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
||||
fastapi
|
||||
uvicorn
|
||||
httpx
|
||||
]);
|
||||
pythonEnv = pkgs.python3.withPackages (
|
||||
ps: with ps; [
|
||||
fastapi
|
||||
uvicorn
|
||||
httpx
|
||||
]
|
||||
);
|
||||
|
||||
botModule = pkgs.runCommand "nextcloud-claude-bot-module" {} ''
|
||||
botModule = pkgs.runCommand "nextcloud-claude-bot-module" { } ''
|
||||
mkdir -p $out
|
||||
cp ${./bot.py} $out/nextcloud_claude_bot.py
|
||||
'';
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.nextcloud-claude-bot = {
|
||||
enable = mkEnableOption "Nextcloud Talk Claude Bot";
|
||||
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8085;
|
||||
description = "Port for the webhook listener";
|
||||
};
|
||||
|
||||
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "Host to bind to";
|
||||
};
|
||||
|
||||
|
||||
nextcloudUrl = mkOption {
|
||||
type = types.str;
|
||||
example = "https://cloud.example.com";
|
||||
description = "Base URL of your Nextcloud instance";
|
||||
};
|
||||
|
||||
|
||||
botSecretFile = mkOption {
|
||||
type = types.path;
|
||||
description = "Path to file containing the bot secret (shared with Nextcloud)";
|
||||
};
|
||||
|
||||
|
||||
claudePath = mkOption {
|
||||
type = types.path;
|
||||
default = "${pkgs.claude-code}/bin/claude";
|
||||
description = "Path to claude CLI binary";
|
||||
};
|
||||
|
||||
|
||||
allowedUsers = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = [ "harald" "admin" ];
|
||||
default = [ ];
|
||||
example = [
|
||||
"harald"
|
||||
"admin"
|
||||
];
|
||||
description = "Nextcloud usernames allowed to talk to the bot (empty = all)";
|
||||
};
|
||||
|
||||
|
||||
contextMessages = mkOption {
|
||||
type = types.int;
|
||||
default = 6;
|
||||
|
|
@ -67,7 +78,7 @@ in {
|
|||
default = 120;
|
||||
description = "Timeout in seconds for Claude CLI";
|
||||
};
|
||||
|
||||
|
||||
systemPrompt = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
|
|
@ -75,13 +86,13 @@ in {
|
|||
description = "Optional system prompt for Claude";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.nextcloud-claude-bot = {
|
||||
description = "Nextcloud Talk Claude Bot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
|
||||
environment = {
|
||||
HOME = "/var/lib/nextcloud-claude-bot";
|
||||
BOT_HOST = cfg.host;
|
||||
|
|
@ -133,8 +144,8 @@ in {
|
|||
home = "/var/lib/nextcloud-claude-bot";
|
||||
};
|
||||
|
||||
users.groups.claude-bot = {};
|
||||
|
||||
users.groups.claude-bot = { };
|
||||
|
||||
# Nginx reverse proxy config (optional, if you want external access)
|
||||
# services.nginx.virtualHosts."cloud.example.com".locations."/claude-bot/" = {
|
||||
# proxyPass = "http://${cfg.host}:${toString cfg.port}/";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue