2018-09-09 11:10:04 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.lidarr;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.lidarr = {
|
|
|
|
enable = mkEnableOption "Lidarr";
|
2019-06-24 09:53:38 +01:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.lidarr;
|
|
|
|
defaultText = "pkgs.lidarr";
|
|
|
|
description = "The Lidarr package to use";
|
|
|
|
};
|
2018-09-09 11:10:04 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.lidarr = {
|
|
|
|
description = "Lidarr";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
User = "lidarr";
|
|
|
|
Group = "lidarr";
|
2019-06-24 09:53:38 +01:00
|
|
|
ExecStart = "${cfg.package}/bin/Lidarr";
|
2018-09-09 11:10:04 +01:00
|
|
|
Restart = "on-failure";
|
|
|
|
|
2019-02-24 17:36:50 +00:00
|
|
|
StateDirectory = "lidarr";
|
2018-09-09 11:10:04 +01:00
|
|
|
StateDirectoryMode = "0770";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.lidarr = {
|
|
|
|
uid = config.ids.uids.lidarr;
|
|
|
|
home = "/var/lib/lidarr";
|
|
|
|
group = "lidarr";
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.lidarr.gid = config.ids.gids.lidarr;
|
|
|
|
};
|
|
|
|
}
|