Merge pull request #71461 from etu/lidarr-specify-datadir-option

nixos/lidarr: Add dataDir option
This commit is contained in:
Aaron Andersen 2019-10-22 05:07:49 -04:00 committed by GitHub
commit 43a3d8dc29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,12 @@ in
services.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 {
type = types.package;
default = pkgs.lidarr;
@ -44,6 +50,10 @@ in
};
config = mkIf cfg.enable {
systemd.tmpfiles.rules = [
"d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
];
systemd.services.lidarr = {
description = "Lidarr";
after = [ "network.target" ];
@ -53,11 +63,8 @@ in
Type = "simple";
User = cfg.user;
Group = cfg.group;
ExecStart = "${cfg.package}/bin/Lidarr";
ExecStart = "${cfg.package}/bin/Lidarr -nobrowser -data='${cfg.dataDir}'";
Restart = "on-failure";
StateDirectory = "lidarr";
StateDirectoryMode = "0770";
};
};