|
17 | 17 | dataDir = lib.mkOption { |
18 | 18 | type = lib.types.str; |
19 | 19 | default = "/var/lib/sonarr/.config/NzbDrone"; |
20 | | - description = "The directory where Sonarr stores its data files."; |
| 20 | + description = '' |
| 21 | + The Sonarr home directory used to store all data. If left as the default value |
| 22 | + this directory will automatically be created before the Sonarr server starts, otherwise |
| 23 | + you are responsible for ensuring the directory exists with appropriate ownership |
| 24 | + and permissions. |
| 25 | + ''; |
21 | 26 | }; |
22 | 27 |
|
23 | 28 | openFirewall = lib.mkOption { |
|
35 | 40 | user = lib.mkOption { |
36 | 41 | type = lib.types.str; |
37 | 42 | default = "sonarr"; |
38 | | - description = "User account under which Sonaar runs."; |
| 43 | + description = '' |
| 44 | + User account under which Sonarr runs."; |
| 45 | +
|
| 46 | + ::: {.note} |
| 47 | + If left as the default value this user will automatically be created |
| 48 | + on system activation, otherwise you are responsible for |
| 49 | + ensuring the user exists before the Sonarr service starts. |
| 50 | + ::: |
| 51 | + ''; |
39 | 52 | }; |
40 | 53 |
|
41 | 54 | group = lib.mkOption { |
42 | 55 | type = lib.types.str; |
43 | 56 | default = "sonarr"; |
44 | | - description = "Group under which Sonaar runs."; |
| 57 | + description = '' |
| 58 | + Group account under which Sonarr runs. |
| 59 | +
|
| 60 | + ::: {.note} |
| 61 | + If left as the default value this group will automatically be created |
| 62 | + on system activation, otherwise you are responsible for |
| 63 | + ensuring the group exists before the Sonarr service starts. |
| 64 | + ::: |
| 65 | + ''; |
45 | 66 | }; |
46 | 67 |
|
47 | 68 | package = lib.mkPackageOption pkgs "sonarr" { }; |
48 | 69 | }; |
49 | 70 | }; |
50 | 71 |
|
51 | 72 | config = lib.mkIf cfg.enable { |
52 | | - systemd.tmpfiles.rules = [ |
53 | | - "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -" |
54 | | - ]; |
55 | | - |
56 | 73 | systemd.services.sonarr = { |
57 | 74 | description = "Sonarr"; |
58 | 75 | after = [ "network.target" ]; |
|
69 | 86 | "-data=${cfg.dataDir}" |
70 | 87 | ]; |
71 | 88 | Restart = "on-failure"; |
| 89 | + } |
| 90 | + // lib.optionalAttrs (cfg.dataDir == "/var/lib/sonarr/.config/NzbDrone") { |
| 91 | + StateDirectory = "sonarr"; |
72 | 92 | }; |
73 | 93 | }; |
74 | 94 |
|
|
0 commit comments