1 { config, pkgs, lib, ... }:
3 cfg = config.services.readarr;
8 enable = lib.mkEnableOption "Readarr, a Usenet/BitTorrent ebook downloader";
10 dataDir = lib.mkOption {
12 default = "/var/lib/readarr/";
13 description = "The directory where Readarr stores its data files.";
16 package = lib.mkPackageOption pkgs "readarr" { };
18 openFirewall = lib.mkOption {
19 type = lib.types.bool;
22 Open ports in the firewall for Readarr
30 User account under which Readarr runs.
34 group = lib.mkOption {
38 Group under which Readarr runs.
44 config = lib.mkIf cfg.enable {
45 systemd.tmpfiles.settings."10-readarr".${cfg.dataDir}.d = {
46 inherit (cfg) user group;
50 systemd.services.readarr = {
51 description = "Readarr";
52 after = [ "network.target" ];
53 wantedBy = [ "multi-user.target" ];
59 ExecStart = "${cfg.package}/bin/Readarr -nobrowser -data='${cfg.dataDir}'";
60 Restart = "on-failure";
64 networking.firewall = lib.mkIf cfg.openFirewall {
65 allowedTCPPorts = [ 8787 ];
68 users.users = lib.mkIf (cfg.user == "readarr") {
70 description = "Readarr service";
77 users.groups = lib.mkIf (cfg.group == "readarr") {