# services/shelfarr.nix — Shelfarr: Sonarr/Radarr-style search+acquire for # audiobooks. Not in nixpkgs, so runs as a container like profilarr. # # Only the main app is deployed — the shelfarr-libation companion (Audible # account backup) is skipped, beta and unrelated to indexer-based search. # Ebooks volume also skipped (audiobooks-only use case); mount /ebooks later # if that turns out to be required for the container to start cleanly. # # Runs on the host network rather than the docker bridge: Shelfarr calls # back out to Prowlarr/SABnzbd on localhost, and SABnzbd only binds # 127.0.0.1 on the host (see sabnzbd.nix) — unreachable from a bridged # container. HTTP_PORT tells Thruster (the Rails 8 front proxy baked into # the image) to listen on 5056 directly instead of its 80 default, so it # doesn't collide with nginx's own :80. PORT/TARGET_PORT move the internal # Puma backend off its 3000 default too — with host networking that's no # longer container-isolated, and AdGuard's web UI already owns :3000 on # this host (see adguard.nix). Prowlarr/SABnzbd hookup is scripted in # arr-interconnect.nix via `rails runner` (no public settings API here). { config, lib, ... }: { config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") { systemd.tmpfiles.rules = [ "d /var/lib/shelfarr 0755 root root -" ]; virtualisation.oci-containers.containers.shelfarr = { image = "ghcr.io/pedro-revez-silva/shelfarr:latest"; volumes = [ "/var/lib/shelfarr:/rails/storage" "/mnt/storage/torrents/audiobooks:/audiobooks" "/mnt/storage/torrents/downloads:/downloads" # SABnzbd's real complete_dir (see sabnzbd.nix) — mounted at the # same path SABnzbd itself reports, so Shelfarr's post-processing # step can find and move files without needing the # download_remote_path/download_local_path rewrite settings. "/mnt/storage/usenet/downloads:/mnt/storage/usenet/downloads" ]; extraOptions = [ "--network=host" ]; environment = { TZ = "Europe/London"; SOLID_QUEUE_IN_PUMA = "1"; HTTP_PORT = "5056"; PORT = "5057"; TARGET_PORT = "5057"; # Matches fred:media ownership (2775) on /mnt/storage/torrents/audiobooks PUID = "1000"; PGID = "3000"; CHOWN_ON_START = "auto"; }; }; }; }