1 { config, pkgs, lib, ... }:
6 cfg = config.services.readarr;
11 enable = mkEnableOption "Readarr, a Usenet/BitTorrent ebook downloader";
15 default = "/var/lib/readarr/";
16 description = "The directory where Readarr stores its data files.";
19 package = mkPackageOption pkgs "readarr" { };
21 openFirewall = mkOption {
25 Open ports in the firewall for Readarr
33 User account under which Readarr runs.
41 Group under which Readarr runs.
47 config = mkIf cfg.enable {
48 systemd.tmpfiles.settings."10-readarr".${cfg.dataDir}.d = {
49 inherit (cfg) user group;
53 systemd.services.readarr = {
54 description = "Readarr";
55 after = [ "network.target" ];
56 wantedBy = [ "multi-user.target" ];
62 ExecStart = "${cfg.package}/bin/Readarr -nobrowser -data='${cfg.dataDir}'";
63 Restart = "on-failure";
67 networking.firewall = mkIf cfg.openFirewall {
68 allowedTCPPorts = [ 8787 ];
71 users.users = mkIf (cfg.user == "readarr") {
73 description = "Readarr service";
80 users.groups = mkIf (cfg.group == "readarr") {