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 dataDir = lib.mkOption {
17 default = "/var/lib/ombi";
18 description = "The directory where Ombi stores its data files.";
22 type = lib.types.port;
24 description = "The port for the Ombi web interface.";
27 openFirewall = lib.mkOption {
28 type = lib.types.bool;
30 description = "Open ports in the firewall for the Ombi web interface.";
36 description = "User account under which Ombi runs.";
39 group = lib.mkOption {
42 description = "Group under which Ombi runs.";
47 config = lib.mkIf cfg.enable {
48 systemd.tmpfiles.rules = [
49 "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
52 systemd.services.ombi = {
54 after = [ "network.target" ];
55 wantedBy = [ "multi-user.target" ];
61 ExecStart = "${pkgs.ombi}/bin/Ombi --storage '${cfg.dataDir}' --host 'http://*:${toString cfg.port}'";
62 Restart = "on-failure";
66 networking.firewall = lib.mkIf cfg.openFirewall {
67 allowedTCPPorts = [ cfg.port ];
70 users.users = lib.mkIf (cfg.user == "ombi") {
78 users.groups = lib.mkIf (cfg.group == "ombi") { ombi = { }; };