2018-07-20 22:56:59 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
2017-03-25 21:18:34 +01: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 09:44:12 +02:00
|
|
|
chown -R radarr:radarr /var/lib/radarr/
|
2017-03-25 21:18:34 +01:00
|
|
|
chmod 0700 /var/lib/radarr/
|
|
|
|
'';
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
User = "radarr";
|
2017-04-22 09:44:12 +02:00
|
|
|
Group = "radarr";
|
2017-03-25 21:18:34 +01:00
|
|
|
PermissionsStartOnly = "true";
|
|
|
|
ExecStart = "${pkgs.radarr}/bin/Radarr";
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-06-30 01:58:35 +02:00
|
|
|
users.users.radarr = {
|
2017-04-22 09:44:12 +02:00
|
|
|
uid = config.ids.uids.radarr;
|
2017-03-25 21:18:34 +01:00
|
|
|
home = "/var/lib/radarr";
|
2017-04-22 09:44:12 +02:00
|
|
|
group = "radarr";
|
2017-03-25 21:18:34 +01:00
|
|
|
};
|
2018-06-30 01:58:35 +02:00
|
|
|
users.groups.radarr.gid = config.ids.gids.radarr;
|
2017-03-25 21:18:34 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|