2017-03-25 21:18:34 +01: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 09:44:12 +02:00
|
|
|
chown -R jackett:jackett /var/lib/jackett/
|
2017-03-25 21:18:34 +01:00
|
|
|
chmod 0700 /var/lib/jackett/
|
|
|
|
'';
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
User = "jackett";
|
2017-04-22 09:44:12 +02:00
|
|
|
Group = "jackett";
|
2017-03-25 21:18:34 +01:00
|
|
|
PermissionsStartOnly = "true";
|
|
|
|
ExecStart = "${pkgs.jackett}/bin/Jackett";
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.extraUsers.jackett = {
|
2017-04-22 09:44:12 +02:00
|
|
|
uid = config.ids.uids.jackett;
|
2017-03-25 21:18:34 +01:00
|
|
|
home = "/var/lib/jackett";
|
2017-04-22 09:44:12 +02:00
|
|
|
group = "jackett";
|
2017-03-25 21:18:34 +01:00
|
|
|
};
|
2017-04-22 09:44:12 +02:00
|
|
|
users.extraGroups.jackett.gid = config.ids.gids.jackett;
|
2017-03-25 21:18:34 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|