This covers running Flippergotchi unattended (e.g. on a Flipper One or any Linux
box) via systemd, where it should survive reboots, save state cleanly on stop,
and find its config without a -c flag.
pip install . # provides the `flippergotchi` console script
# or, for the CPU AI backend:
pip install '.[ai-cpu]'flippergotchi runs with no -c by looking for a config file in this order and
using the first that exists (otherwise it runs on built-in defaults):
- an explicit
-c/--config PATH $FLIPPERGOTCHI_CONFIG./flippergotchi.toml(current working directory)~/.config/flippergotchi/config.toml/etc/flippergotchi/config.toml
For a service install, drop your config at /etc/flippergotchi/config.toml
(the shipped unit also sets FLIPPERGOTCHI_CONFIG to that path):
sudo install -Dm644 config.example.toml /etc/flippergotchi/config.toml
sudo $EDITOR /etc/flippergotchi/config.tomlAll persistent JSON stores (state, bestiary, inventory, wallet, quests, ledger,
captures, audit log, ...) default under state_dir (~/.flippergotchi).
Override state_dir in the config to relocate all of them together:
state_dir = "/var/lib/flippergotchi"Any per-store *_path still at its default is relocated under state_dir
automatically; explicitly-set *_path values are left where you put them.
systemd + HOME: without
HOMEset,expanduser("~")returns a literal~, which would create./~/.flippergotchiin the service's working directory. Flippergotchi guards against this (falling back to$STATE_DIRECTORYor/var/lib/flippergotchi), but the unit still setsHOMEexplicitly so the default~/.flippergotchiresolves cleanly.
A ready-to-edit unit ships at packaging/flippergotchi.service.
# create the service account (owns the radio + state)
sudo useradd --system --home-dir /var/lib/flippergotchi --shell /usr/sbin/nologin flippergotchi
sudo install -Dm644 packaging/flippergotchi.service /etc/systemd/system/flippergotchi.service
sudo $EDITOR /etc/systemd/system/flippergotchi.service # set User=/HOME=/ExecStart path
sudo systemctl daemon-reload
sudo systemctl enable --now flippergotchi.service
journalctl -u flippergotchi -fKey directives:
Restart=on-failure— auto-recover from a crash.AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW— monitor mode + raw frame capture/injection without running as full root.StateDirectory=flippergotchi— systemd creates/var/lib/flippergotchi(0700, owned byUser=) and exports$STATE_DIRECTORY.Environment=HOME=/var/lib/flippergotchiand an explicitUser=— required so~and state resolution are deterministic (see above).ExecStart=/usr/bin/flippergotchi— the console script; adjust the path to match your install (which flippergotchi).
systemctl stop / shutdown sends SIGTERM. Flippergotchi installs a SIGTERM
(and SIGINT) handler that raises out of the tick loop and flushes all state via
the loop's finally block, so up to ~10 s of progress is no longer lost on every
stop. TimeoutStopSec=20 leaves room for the final save.