blob: f03e5f5a2f7b68974155df1a742e3cb79a075ab4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
SERVICE_NAME="slopbot"
SERVICE_FILE="${SERVICE_NAME}.service"
SYSTEMD_USER_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
SYSTEMD_SERVICE_PATH="${SYSTEMD_USER_DIR}/${SERVICE_FILE}"
NIX=(nix --extra-experimental-features 'nix-command flakes')
if [[ ! -f .zuliprc ]]; then
echo "error: .zuliprc is missing. Copy .zuliprc.example and fill in bot credentials." >&2
exit 1
fi
if [[ ! -f .env ]]; then
cat > .env <<'EOF'
# Required by slop-search.
KAGI_API_KEY=
# Required by SLOPBOT_AGENT_MODEL=parasail/kimi-k26.
PARASAIL_API_KEY=
SLOPBOT_AGENT_MODEL=parasail/kimi-k26
SLOPBOT_WORKERS=4
SLOPBOT_AGENT_WORKERS=1
SLOPBOT_AGENT_TIMEOUT=120
SLOPBOT_AGENT_DEBUG=false
SLOPBOT_HISTORY_LIMIT=20
SLOPBOT_SYSTEM_PROMPT=prompts/system.md
EOF
echo "created .env with slopbot defaults"
echo "edit .env if agent needs provider keys or config before restarting again"
fi
echo "locking local flake inputs..."
"${NIX[@]}" flake lock
echo "running tests..."
./test.sh
echo "building slopbot..."
"${NIX[@]}" build .#slopbot
echo "installing user systemd unit to ${SYSTEMD_SERVICE_PATH}..."
mkdir -p "${SYSTEMD_USER_DIR}"
install -m 0644 "${SERVICE_FILE}" "${SYSTEMD_SERVICE_PATH}"
echo "reloading user systemd..."
systemctl --user daemon-reload
echo "enabling and restarting ${SERVICE_NAME}..."
systemctl --user enable "${SERVICE_NAME}"
systemctl --user restart "${SERVICE_NAME}"
echo "${SERVICE_NAME} status:"
systemctl --user --no-pager --full status "${SERVICE_NAME}"
echo
echo "follow logs with: journalctl --user -u ${SERVICE_NAME} -f"
echo "to keep it running after logout, run once: sudo loginctl enable-linger $USER"
|