Headless Libation on nas: auto-download purchased Audible books #360
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos#360
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Run Libation headless on the nas host to automatically download newly purchased Audible audiobooks to /var/lib/multimedia/audiobooks/Libation/ in an Audiobookshelf-friendly layout.
Decisions (grilled 2026-08-16)
libationcli login-external(exists in v13.3.6: prints an Audible URL, user signs in from any browser, pastes the resulting URL back). No GUI seeding, no sops: Libation rewrites AccountsSettings.json as tokens refresh, so it is seeded-once mutable state, not a deployable secret.<title short> [<id>].Implementation notes (researched, v13.3.6 in nixpkgs release-26.05)
libation(13.3.6) is in the channel the nas host tracks (nixos-26.05); provideslibationcli. No overlay needed.LIBATION_FILES_DIR=/var/lib/libation(Libation only honors the var if the directory already exists). Settings.json, AccountsSettings.json, LibationContext.db all live there.libation, extraGroups [ "jellyfin" ] (audiobooks dir is jellyfin:jellyfin 0775; audiobookshelf reads via jellyfin group).d /var/lib/multimedia/audiobooks/Libation 0775 libation jellyfin(tmpfiles).Books,InProgress,FolderTemplate,FileTemplate,AutoScanfalse (our timer drives it),DownloadEpisodes.<first author>/<if series-><first series>/<-if series><title short>, FileTemplate<title> [<id>]. Invalid templates silently fall back to defaults, so the tag spelling must be exact.libation-sync.service: oneshot, User=libation, HOME=/var/lib/libation, runslibationcli scanthenlibationcli liberate. Generous TimeoutStartSec (first liberate downloads the whole backlog; a wedged download must not hold the box up forever — ~24h cap).libationcli scanexits non-zero ("No accounts"). The sync script must exit 0 cleanly when /var/lib/libation/AccountsSettings.json does not exist yet, so the unit does not sit in a failed/retry loop between first deploy and the one-time login.exit 0WITHOUT resetting the idle clock (same pattern as the pyload-cgroup-unreadable fail-safe). Do NOT usestay_active: a 30-min sync timer that resets the 60-min idle streak on every run would keep the NAS from EVER powering off. With skip-without-reset, an in-flight download still blocks poweroff, a no-op scan does not extend uptime, and after a long download finishes the box powers off at the next check.systemctl show -p ActiveState --value libation-sync.serviceagainst activating|active, notis-active --quiet./var/lib/libationto the impermanence persistence list (tokens + LibationContext.db must survive reboot, else full re-download).sudo -u libation env LIBATION_FILES_DIR=/var/lib/libation HOME=/var/lib/libation libationcli login-external -a <email> -l <locale>over SSH after first deploy (start libation-sync once first so the state dir + Settings.json exist). A small root-only wrapper script for this env/user dance is optional but nice for future ops (set-status, export).Closes-when: purchases appear under /var/lib/multimedia/audiobooks/Libation//… while the box is up, the NAS does not power off during an active sync, and the NAS still powers off after 60 min of real idle despite the periodic sync timer.