1 { config, pkgs, lib, ... }:
6 cfg = config.services.tautulli;
10 (mkRenamedOptionModule [ "services" "plexpy" ] [ "services" "tautulli" ])
15 enable = mkEnableOption "Tautulli Plex Monitor";
19 default = "/var/lib/plexpy";
20 description = "The directory where Tautulli stores its data files.";
23 configFile = mkOption {
25 default = "/var/lib/plexpy/config.ini";
26 description = "The location of Tautulli's config file.";
32 description = "TCP port where Tautulli listens.";
35 openFirewall = mkOption {
38 description = "Open ports in the firewall for Tautulli.";
44 description = "User account under which Tautulli runs.";
50 description = "Group under which Tautulli runs.";
53 package = mkPackageOption pkgs "tautulli" { };
57 config = mkIf cfg.enable {
58 systemd.tmpfiles.rules = [
59 "d '${cfg.dataDir}' - ${cfg.user} ${cfg.group} - -"
62 systemd.services.tautulli = {
63 description = "Tautulli Plex Monitor";
64 after = [ "network.target" ];
65 wantedBy = [ "multi-user.target" ];
70 GuessMainPID = "false";
71 ExecStart = "${cfg.package}/bin/tautulli --datadir ${cfg.dataDir} --config ${cfg.configFile} --port ${toString cfg.port} --pidfile ${cfg.dataDir}/tautulli.pid --nolaunch";
72 Restart = "on-failure";
76 networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
78 users.users = mkIf (cfg.user == "plexpy") {
79 plexpy = { group = cfg.group; uid = config.ids.uids.plexpy; };