3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services/misc/tautulli.nix
Pascal Bach 8b3ffebcdc tautulli/plexpy: 1.4.25 -> 2.1.26 (renamed)
PlexPy was renamed to Tautulli.

This renames the module as well as the application accordingly.
Aliases are kept for backwards compatibility.

# Conflicts:
#	nixos/modules/services/misc/tautulli.nix
2019-02-28 19:07:00 +01:00

78 lines
1.9 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.tautulli;
in
{
options = {
services.tautulli = {
enable = mkEnableOption "Tautulli Plex Monitor";
dataDir = mkOption {
type = types.str;
default = "/var/lib/plexpy";
description = "The directory where Tautulli stores its data files.";
};
configFile = mkOption {
type = types.str;
default = "/var/lib/plexpy/config.ini";
description = "The location of Tautulli's config file.";
};
port = mkOption {
type = types.int;
default = 8181;
description = "TCP port where Tautulli listens.";
};
user = mkOption {
type = types.str;
default = "plexpy";
description = "User account under which Tautulli runs.";
};
group = mkOption {
type = types.str;
default = "nogroup";
description = "Group under which Tautulli runs.";
};
package = mkOption {
type = types.package;
default = pkgs.tautulli;
defaultText = "pkgs.tautulli";
description = ''
The Tautulli package to use.
'';
};
};
};
config = mkIf cfg.enable {
systemd.tmpfiles.rules = [
"d '${cfg.dataDir}' - ${cfg.user} ${cfg.group} - -"
];
systemd.services.tautulli = {
description = "Tautulli Plex Monitor";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = cfg.user;
Group = cfg.group;
GuessMainPID = "false";
ExecStart = "${cfg.package}/bin/tautulli --datadir ${cfg.dataDir} --config ${cfg.configFile} --port ${toString cfg.port} --pidfile ${cfg.dataDir}/tautulli.pid --nolaunch";
Restart = "on-failure";
};
};
users.users = mkIf (cfg.user == "plexpy") {
plexpy = { group = cfg.group; uid = config.ids.uids.plexpy; };
};
};
}