2018-07-20 21:56:59 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
2017-03-25 20:18:34 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.radarr;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.radarr = {
|
|
|
|
enable = mkEnableOption "Radarr";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.radarr = {
|
|
|
|
description = "Radarr";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
preStart = ''
|
|
|
|
test -d /var/lib/radarr/ || {
|
|
|
|
echo "Creating radarr data directory in /var/lib/radarr/"
|
|
|
|
mkdir -p /var/lib/radarr/
|
|
|
|
}
|
2017-04-22 08:44:12 +01:00
|
|
|
chown -R radarr:radarr /var/lib/radarr/
|
2017-03-25 20:18:34 +00:00
|
|
|
chmod 0700 /var/lib/radarr/
|
|
|
|
'';
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
User = "radarr";
|
2017-04-22 08:44:12 +01:00
|
|
|
Group = "radarr";
|
2017-03-25 20:18:34 +00:00
|
|
|
PermissionsStartOnly = "true";
|
|
|
|
ExecStart = "${pkgs.radarr}/bin/Radarr";
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-06-30 00:58:35 +01:00
|
|
|
users.users.radarr = {
|
2017-04-22 08:44:12 +01:00
|
|
|
uid = config.ids.uids.radarr;
|
2017-03-25 20:18:34 +00:00
|
|
|
home = "/var/lib/radarr";
|
2017-04-22 08:44:12 +01:00
|
|
|
group = "radarr";
|
2017-03-25 20:18:34 +00:00
|
|
|
};
|
2018-06-30 00:58:35 +01:00
|
|
|
users.groups.radarr.gid = config.ids.gids.radarr;
|
2017-03-25 20:18:34 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|