2021-04-05 15:23:46 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let cfg = config.services.ombi;
|
|
|
|
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.ombi = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc ''
|
2021-04-05 15:23:46 +00:00
|
|
|
Ombi.
|
2022-09-09 14:08:57 +00:00
|
|
|
Optionally see <https://docs.ombi.app/info/reverse-proxy>
|
2021-04-05 15:23:46 +00:00
|
|
|
on how to set up a reverse proxy
|
2022-09-09 14:08:57 +00:00
|
|
|
'');
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
dataDir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "/var/lib/ombi";
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "The directory where Ombi stores its data files.";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.port;
|
|
|
|
default = 5000;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "The port for the Ombi web interface.";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
openFirewall = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Open ports in the firewall for the Ombi web interface.";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "ombi";
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "User account under which Ombi runs.";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
group = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "ombi";
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Group under which Ombi runs.";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
|
|
|
|
];
|
|
|
|
|
|
|
|
systemd.services.ombi = {
|
|
|
|
description = "Ombi";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
User = cfg.user;
|
|
|
|
Group = cfg.group;
|
|
|
|
ExecStart = "${pkgs.ombi}/bin/Ombi --storage '${cfg.dataDir}' --host 'http://*:${toString cfg.port}'";
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall = mkIf cfg.openFirewall {
|
|
|
|
allowedTCPPorts = [ cfg.port ];
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users = mkIf (cfg.user == "ombi") {
|
|
|
|
ombi = {
|
2021-05-03 20:48:10 +00:00
|
|
|
isSystemUser = true;
|
2021-04-05 15:23:46 +00:00
|
|
|
group = cfg.group;
|
|
|
|
home = cfg.dataDir;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups = mkIf (cfg.group == "ombi") { ombi = { }; };
|
|
|
|
};
|
|
|
|
}
|