sunken-ship: drop python-telegram-bot from fitness-bot pythonEnvs
bot.py was deleted upstream — neither prod nor shipyard launches a polling bot anymore. server.py only needs python-dotenv + aiohttp. Also refresh the prod section's comment + service description to reflect the Mini-App-only architecture. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3dcbdd408a
commit
cda9c4cf0f
4 changed files with 75 additions and 21 deletions
|
|
@ -94,16 +94,45 @@ sudo dd if=result/iso/nixos-minimal-*.iso of=/dev/sdX status=progress bs=4M
|
||||||
|
|
||||||
## Live-system WiFi (optional, custom ISO only)
|
## Live-system WiFi (optional, custom ISO only)
|
||||||
|
|
||||||
Create `nixos/installer-wifi.nix` (gitignored):
|
The minimal installer ISO runs NetworkManager, so live-system WiFi must be a
|
||||||
|
declarative NetworkManager profile. `networking.wireless` / wpa_supplicant does
|
||||||
|
**not** work here — NixOS asserts you cannot combine `networking.networkmanager`
|
||||||
|
with `networking.wireless.networks`.
|
||||||
|
|
||||||
|
Create `nixos/installer-wifi.nix` (gitignored — it holds the PSK):
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
networking.wireless.enable = true;
|
networking.networkmanager.ensureProfiles.profiles.installer-wifi = {
|
||||||
networking.wireless.networks."YourSSID".psk = "your-password";
|
connection = {
|
||||||
|
id = "installer-wifi";
|
||||||
|
type = "wifi";
|
||||||
|
};
|
||||||
|
wifi = {
|
||||||
|
mode = "infrastructure";
|
||||||
|
ssid = "YourSSID";
|
||||||
|
};
|
||||||
|
wifi-security = {
|
||||||
|
auth-alg = "open";
|
||||||
|
key-mgmt = "wpa-psk";
|
||||||
|
psk = "your-password";
|
||||||
|
};
|
||||||
|
ipv4.method = "auto";
|
||||||
|
ipv6.method = "auto";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Add to flake's installer-iso modules, rebuild ISO on Linux.
|
`flake-modules/installer-iso.nix` auto-includes this file when present (via a
|
||||||
|
`builtins.pathExists` check) — no flake edit needed. Because the file is
|
||||||
|
gitignored, the flake only sees it once it is staged:
|
||||||
|
|
||||||
|
- **`build-installer-iso-on-server.sh`** copies the file to the build host and
|
||||||
|
runs `git add -f` automatically.
|
||||||
|
- For a **direct `nix build`**, run `git add -f nixos/installer-wifi.nix` first
|
||||||
|
(staging is enough — never commit it; it contains the PSK).
|
||||||
|
|
||||||
|
Then rebuild the ISO on Linux.
|
||||||
|
|
||||||
## Installed-system WiFi (optional)
|
## Installed-system WiFi (optional)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
{ inputs, self, ... }: {
|
{ inputs, self, ... }: {
|
||||||
# Custom minimal installer ISO (build with: nix build .#installer-iso).
|
# Custom minimal installer ISO (build with: nix build .#installer-iso).
|
||||||
# Optional: add ./installer-wifi.nix (gitignored) to modules for live WiFi.
|
# nixos/installer-wifi.nix (gitignored) is auto-included when present, to
|
||||||
|
# preconfigure live-system WiFi. See docs/server-installer-usb.md.
|
||||||
flake.nixosConfigurations.installer-iso = inputs.nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations.installer-iso = inputs.nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [ ../nixos/installer-iso.nix ];
|
modules = [ ../nixos/installer-iso.nix ]
|
||||||
|
++ inputs.nixpkgs.lib.optional
|
||||||
|
(builtins.pathExists ../nixos/installer-wifi.nix)
|
||||||
|
../nixos/installer-wifi.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.packages.x86_64-linux.installer-iso =
|
flake.packages.x86_64-linux.installer-iso =
|
||||||
|
|
|
||||||
|
|
@ -149,23 +149,26 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# BigBiggerBiggestBot — Telegram fitness tracker with Mini App.
|
# BigBiggerBiggestBot — Mini App backend (no Telegram polling).
|
||||||
# Code: https://github.com/DannyDannyDanny/bigbiggerbiggestbot cloned at /home/danny/tg_fitness_bot
|
# Code: https://github.com/DannyDannyDanny/bigbiggerbiggestbot cloned at /home/danny/tg_fitness_bot
|
||||||
# Bot token: ~danny/.secrets/bigbiggerbiggestbot
|
# Bot token (used only for validating Telegram WebApp initData HMACs):
|
||||||
|
# ~danny/.secrets/bigbiggerbiggestbot
|
||||||
# Deployment: fitness-bot-pull timer below runs every 15 min, git pulls, restarts service on changes.
|
# Deployment: fitness-bot-pull timer below runs every 15 min, git pulls, restarts service on changes.
|
||||||
#
|
#
|
||||||
# Mini App URL is fronted by Caddy on the vps-relay host at
|
# Mini App URL is fronted by Caddy on the vps-relay host at
|
||||||
# https://bbbot.dannydannydanny.me (VPS → ZeroTier → localhost:8080).
|
# https://bbbot.dannydannydanny.me (VPS → ZeroTier → localhost:8080).
|
||||||
# The bot's start.py honors WEBAPP_URL to skip starting its own
|
# start.py honors WEBAPP_URL to skip starting its own cloudflared
|
||||||
# cloudflared Quick Tunnel when we've got a stable URL from the VPS.
|
# Quick Tunnel when the stable URL from the VPS is already set.
|
||||||
|
#
|
||||||
|
# The slash-command bot (bot.py) was removed in May 2026 — the Mini App
|
||||||
|
# is now the only interface. No python-telegram-bot dependency required.
|
||||||
systemd.services.fitness-bot = let
|
systemd.services.fitness-bot = let
|
||||||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
||||||
python-telegram-bot
|
|
||||||
python-dotenv
|
python-dotenv
|
||||||
aiohttp
|
aiohttp
|
||||||
]);
|
]);
|
||||||
in {
|
in {
|
||||||
description = "BigBiggerBiggestBot Telegram fitness tracker";
|
description = "BigBiggerBiggestBot Mini App backend";
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
wants = [ "network-online.target" ];
|
wants = [ "network-online.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
@ -228,7 +231,6 @@
|
||||||
# beta in shipyard_poc_bot's launcher → test → git push <branch>:main.
|
# beta in shipyard_poc_bot's launcher → test → git push <branch>:main.
|
||||||
systemd.services.fitness-bot-shipyard = let
|
systemd.services.fitness-bot-shipyard = let
|
||||||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
||||||
python-telegram-bot
|
|
||||||
python-dotenv
|
python-dotenv
|
||||||
aiohttp
|
aiohttp
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,17 @@
|
||||||
# host: SSH host (default: sunken-ship)
|
# host: SSH host (default: sunken-ship)
|
||||||
# output_dir: where to save the ISO on your Mac (default: .)
|
# output_dir: where to save the ISO on your Mac (default: .)
|
||||||
# Override SSH key: SSH_KEY=~/.ssh/my_key ./scripts/build-installer-iso-on-server.sh
|
# Override SSH key: SSH_KEY=~/.ssh/my_key ./scripts/build-installer-iso-on-server.sh
|
||||||
|
#
|
||||||
|
# If nixos/installer-wifi.nix exists locally (gitignored), it is copied into
|
||||||
|
# the build and the ISO gets preconfigured live-system WiFi. flake-modules/
|
||||||
|
# installer-iso.nix auto-includes it via a builtins.pathExists check.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
HOST="${1:-sunken-ship}"
|
HOST="${1:-sunken-ship}"
|
||||||
OUT="${2:-.}"
|
OUT="${2:-.}"
|
||||||
|
REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||||
|
|
||||||
# Use sunken-ship key if not set (AGENTS.md)
|
# Default to the sunken-ship SSH key when targeting that host.
|
||||||
if [[ -n "${SSH_KEY:-}" ]]; then
|
if [[ -n "${SSH_KEY:-}" ]]; then
|
||||||
SSH_OPTS=(-i "$SSH_KEY")
|
SSH_OPTS=(-i "$SSH_KEY")
|
||||||
elif [[ "$HOST" == "sunken-ship" ]] && [[ -f ~/.ssh/id_ed25519_sunken_ship ]]; then
|
elif [[ "$HOST" == "sunken-ship" ]] && [[ -f ~/.ssh/id_ed25519_sunken_ship ]]; then
|
||||||
|
|
@ -19,23 +24,37 @@ else
|
||||||
SSH_OPTS=()
|
SSH_OPTS=()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Pushing branch so server can pull..."
|
echo "Pushing main so the server can clone the latest..."
|
||||||
git push origin server-installer-usb 2>/dev/null || true
|
git -C "$REPO_ROOT" push origin main 2>/dev/null || true
|
||||||
|
|
||||||
echo "On $HOST: clone branch, build ISO..."
|
echo "On $HOST: clone main into ~/dotfiles-iso-build..."
|
||||||
ssh "${SSH_OPTS[@]}" "$HOST" 'set -e
|
ssh "${SSH_OPTS[@]}" "$HOST" 'set -e
|
||||||
BUILD_DIR=~/dotfiles-iso-build
|
BUILD_DIR=~/dotfiles-iso-build
|
||||||
rm -rf "$BUILD_DIR"
|
rm -rf "$BUILD_DIR"
|
||||||
git clone --branch server-installer-usb https://github.com/DannyDannyDanny/dotfiles.git "$BUILD_DIR"
|
git clone --branch main https://github.com/DannyDannyDanny/dotfiles.git "$BUILD_DIR"
|
||||||
cd "$BUILD_DIR/nixos"
|
'
|
||||||
|
|
||||||
|
# Optional live-system WiFi: the module is gitignored, so a fresh clone never
|
||||||
|
# has it. Copy it in and stage it (git add -f) so the flake sees it -- a flake
|
||||||
|
# build only includes git-tracked files.
|
||||||
|
if [[ -f "$REPO_ROOT/nixos/installer-wifi.nix" ]]; then
|
||||||
|
echo "Found nixos/installer-wifi.nix - including live-system WiFi in the ISO."
|
||||||
|
scp "${SSH_OPTS[@]}" "$REPO_ROOT/nixos/installer-wifi.nix" \
|
||||||
|
"$HOST:dotfiles-iso-build/nixos/installer-wifi.nix"
|
||||||
|
ssh "${SSH_OPTS[@]}" "$HOST" 'cd ~/dotfiles-iso-build && git add -f nixos/installer-wifi.nix'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "On $HOST: build ISO (flake is at the repo root)..."
|
||||||
|
ssh "${SSH_OPTS[@]}" "$HOST" 'set -e
|
||||||
|
cd ~/dotfiles-iso-build
|
||||||
nix build .#installer-iso
|
nix build .#installer-iso
|
||||||
ls -la result/iso/
|
ls -la result/iso/
|
||||||
'
|
'
|
||||||
|
|
||||||
ISO_NAME=$(ssh "${SSH_OPTS[@]}" "$HOST" 'ls ~/dotfiles-iso-build/nixos/result/iso/*.iso 2>/dev/null | head -1')
|
ISO_NAME=$(ssh "${SSH_OPTS[@]}" "$HOST" 'ls ~/dotfiles-iso-build/result/iso/*.iso 2>/dev/null | head -1')
|
||||||
ISO_NAME=$(basename "$ISO_NAME")
|
ISO_NAME=$(basename "$ISO_NAME")
|
||||||
|
|
||||||
echo "Copying $ISO_NAME to $OUT ..."
|
echo "Copying $ISO_NAME to $OUT ..."
|
||||||
scp "${SSH_OPTS[@]}" "$HOST:~/dotfiles-iso-build/nixos/result/iso/$ISO_NAME" "$OUT/"
|
scp "${SSH_OPTS[@]}" "$HOST:dotfiles-iso-build/result/iso/$ISO_NAME" "$OUT/"
|
||||||
echo "Done. ISO at $OUT/$ISO_NAME"
|
echo "Done. ISO at $OUT/$ISO_NAME"
|
||||||
echo "Write to USB: diskutil unmountDisk diskN && sudo dd if=$OUT/$ISO_NAME of=/dev/rdiskN bs=4m"
|
echo "Write to USB: diskutil unmountDisk diskN && sudo dd if=$OUT/$ISO_NAME of=/dev/rdiskN bs=4m"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue