nixos/lidarr: Add dataDir option

This will bring this module to a state to be consistent with how the
other forks (sonarr & radarr) works.
This commit is contained in:
Elis Hirwing 2019-10-20 21:20:53 +02:00
parent bd42bcd240
commit 9319dd17d8
No known key found for this signature in database
GPG Key ID: D57EFA625C9A925F
1 changed files with 11 additions and 4 deletions

View File

@ -10,6 +10,12 @@ in
services.lidarr = { services.lidarr = {
enable = mkEnableOption "Lidarr"; enable = mkEnableOption "Lidarr";
dataDir = mkOption {
type = types.str;
default = "/var/lib/lidarr/.config/Lidarr";
description = "The directory where Lidarr stores its data files.";
};
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.lidarr; default = pkgs.lidarr;
@ -44,6 +50,10 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.tmpfiles.rules = [
"d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
];
systemd.services.lidarr = { systemd.services.lidarr = {
description = "Lidarr"; description = "Lidarr";
after = [ "network.target" ]; after = [ "network.target" ];
@ -53,11 +63,8 @@ in
Type = "simple"; Type = "simple";
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
ExecStart = "${cfg.package}/bin/Lidarr"; ExecStart = "${cfg.package}/bin/Lidarr -nobrowser -data='${cfg.dataDir}'";
Restart = "on-failure"; Restart = "on-failure";
StateDirectory = "lidarr";
StateDirectoryMode = "0770";
}; };
}; };