1 { config, pkgs, lib, ... }:
2 let cfg = config.services.ombi;
7 enable = lib.mkEnableOption ''
8 Ombi, a web application that automatically gives your shared Plex or
9 Emby users the ability to request content by themselves!
11 Optionally see <https://docs.ombi.app/info/reverse-proxy>
12 on how to set up a reverse proxy
15 package = lib.mkPackageOption pkgs "ombi" { };
17 dataDir = lib.mkOption {
19 default = "/var/lib/ombi";
20 description = "The directory where Ombi stores its data files.";
24 type = lib.types.port;
26 description = "The port for the Ombi web interface.";
29 openFirewall = lib.mkOption {
30 type = lib.types.bool;
32 description = "Open ports in the firewall for the Ombi web interface.";
38 description = "User account under which Ombi runs.";
41 group = lib.mkOption {
44 description = "Group under which Ombi runs.";
49 config = lib.mkIf cfg.enable {
50 systemd.tmpfiles.rules = [
51 "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
54 systemd.services.ombi = {
56 after = [ "network.target" ];
57 wantedBy = [ "multi-user.target" ];
63 ExecStart = "${lib.getExe cfg.package} --storage '${cfg.dataDir}' --host 'http://*:${toString cfg.port}'";
64 Restart = "on-failure";
68 networking.firewall = lib.mkIf cfg.openFirewall {
69 allowedTCPPorts = [ cfg.port ];
72 users.users = lib.mkIf (cfg.user == "ombi") {
80 users.groups = lib.mkIf (cfg.group == "ombi") { ombi = { }; };