1 { config, pkgs, lib, ... }:
3 cfg = config.services.jackett;
9 enable = lib.mkEnableOption "Jackett, API support for your favorite torrent trackers";
13 type = lib.types.port;
15 Port serving the web interface
19 dataDir = lib.mkOption {
21 default = "/var/lib/jackett/.config/Jackett";
22 description = "The directory where Jackett stores its data files.";
25 openFirewall = lib.mkOption {
26 type = lib.types.bool;
28 description = "Open ports in the firewall for the Jackett web interface.";
34 description = "User account under which Jackett runs.";
37 group = lib.mkOption {
40 description = "Group under which Jackett runs.";
43 package = lib.mkPackageOption pkgs "jackett" { };
47 config = lib.mkIf cfg.enable {
48 systemd.tmpfiles.rules = [
49 "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
52 systemd.services.jackett = {
53 description = "Jackett";
54 after = [ "network.target" ];
55 wantedBy = [ "multi-user.target" ];
61 ExecStart = "${cfg.package}/bin/Jackett --NoUpdates --Port ${toString cfg.port} --DataFolder '${cfg.dataDir}'";
62 Restart = "on-failure";
66 networking.firewall = lib.mkIf cfg.openFirewall {
67 allowedTCPPorts = [ cfg.port ];
70 users.users = lib.mkIf (cfg.user == "jackett") {
74 uid = config.ids.uids.jackett;
78 users.groups = lib.mkIf (cfg.group == "jackett") {
79 jackett.gid = config.ids.gids.jackett;