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